Skip to content

Commit

Permalink
version 1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
morenococo authored and gaborcsardi committed Dec 3, 2014
1 parent ba47cfc commit 874bb9f
Show file tree
Hide file tree
Showing 14 changed files with 528 additions and 337 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: crqa
Type: Package
Title: Cross-Recurrence Quantification Analysis for Categorical and
Continuous Time-Series
Version: 1.0.4
Version: 1.0.5
Date: 2014-12-03
Author: Moreno I. Coco and Rick Dale
Maintainer: Moreno I. Coco <[email protected]>
Expand All @@ -14,12 +14,12 @@ Description:
at the diagonal recurrent points, as well as more
in-depth measures of the whole cross-recurrence plot,
e.g., recurrence rate.
Depends: R (>= 3.0.0), Matrix, tseriesChaos, fields
Depends: R (>= 3.0.0), Matrix, tseriesChaos, fields, pracma
License: GPL (>= 2)
Collate: 'CTcrqa.R' 'calcphi.R' 'checkts.R' 'crqa.R' 'drpdfromts.R'
'optimizeParam.R' 'runcrqa.R' 'simts.R' 'spdiags.R' 'takephi.R'
'theiler.R' 'tt.R' 'wincrqa.R' 'windowdrp.R'
Packaged: 2014-03-17 11:30:57 UTC; root
Packaged: 2014-12-05 16:02:34 UTC; root
NeedsCompilation: yes
Repository: CRAN
Date/Publication: 2014-03-17 12:54:38
Date/Publication: 2014-12-05 17:20:22
26 changes: 13 additions & 13 deletions MD5
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
6d5a3c039a49659684234ddbfca30662 *DESCRIPTION
1cee7a78a67f9d3c8cd68e9ffc4ade52 *NAMESPACE
6ad732bc193dc083039fc23147070c10 *DESCRIPTION
68d8282a548c134580427587d2cf0dd2 *NAMESPACE
28ae7e1d4c946f1c5b80da067e9d2586 *R/CTcrqa.R
fd4d3e5903396c9dd00c5d77bb712d2c *R/calcphi.R
b51bdcb8367be865d0aa541d9a4b3649 *R/checkts.R
341931e900fd6808faac508992e58472 *R/crqa.R
0c18c004eda963abd2e0271cc4251b8a *R/checkts.R
15db939b0e514af9d138a38d58c2d495 *R/crqa.R
df7954f7b92ca063bb3bd4fff8f61d2d *R/drpdfromts.R
fc7bb8a825747019e0e789157d3eb4b3 *R/optimizeParam.R
dcf5e486656a61ad8de9f92095ff67f2 *R/runcrqa.R
5a3ee97ef5058600237d2a04406b0759 *R/optimizeParam.R
03e91b59adb0dd7aa1c13ea99940c28b *R/runcrqa.R
0264d4c328a7a32ec30714b4a3e16dc8 *R/simts.R
ef263b24aca130d3cc80288cd67e1fd4 *R/spdiags.R
47cac4ad60709f2d3a8f9d1b24008fe5 *R/takephi.R
825a40d05a0320a77654ab2475cd6076 *R/theiler.R
5a30c10c022e3bbaa9b9cd235645703d *R/tt.R
3d42f84b035d186565120616e33b9f34 *R/wincrqa.R
02f938031565a9c9fd8295fc161e544b *R/wincrqa.R
54d09d840eb3679de8de57fb308a0b84 *R/windowdrp.R
da138fa547a6838629fe7d5b93ba8e90 *data/crqa.RData
9b27c14007b4dfde4894a7a64c1f654d *man/CTcrqa.Rd
5fe54e1726d6996050405a62fdf76285 *man/RDts1.Rd
955a46841cd8af86d1bf7a68537e9d51 *man/RDts2.Rd
96fbb17a2ce0be88599768b0dcea5bc9 *man/calcphi.Rd
5c81c273eaf557d35872ea0919edd910 *man/checkts.Rd
493407e8564b6313bd0d8c4528c10cc5 *man/checkts.Rd
98ae19fd1be11988f8bfe5f49d9c67fb *man/crqa-package.Rd
99f7ac521d1511f667ac9e2d3c3b0456 *man/crqa.Rd
73a17ec5140ba1134be7ce1f30d3ae3d *man/crqa.Rd
212ae1a69c55e5fa7968d72a095be035 *man/drpdfromts.Rd
ef2141e99f7f3f2cff924104b4f7fc8e *man/leftmov.Rd
27dbde773468780efc5ad7ea06d1cf44 *man/optimizeParam.Rd
dcc10177c107b376e5eca66be1bad609 *man/optimizeParam.Rd
6548ea97f5c7480527001f75262cba19 *man/rightmov.Rd
068ea7765083d3e35a109cd2cd53cc6d *man/runcrqa.Rd
5afa5d71e31f041413a679f86cc72a71 *man/runcrqa.Rd
a02045e8733e9ba46c6d094654cfdb68 *man/simts.Rd
47cbd9f5cd8e35b18bbaf1039e858951 *man/spdiags.Rd
a7bbf18e5f6062c94babf3dc8f9c9e1e *man/theiler.Rd
8522ac7eb9dc1e0be3e0066802519f10 *man/tt.Rd
9bac65f30a31c37768464f8e3b01da37 *man/wincrqa.Rd
fafc650cd83a882a5004670ad0598a27 *man/tt.Rd
c03845b1bf61a761d159f45f18d51fed *man/wincrqa.Rd
29dcbbff24f2496573bed92ddffe3810 *man/windowdrp.Rd
a9de526d2dd2130a3b2c4eae51b6c365 *src/jspd.f
6 changes: 3 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export(CTcrqa,
windowdrp)

import(tseriesChaos,
fields)
fields,
pracma)

importFrom(Matrix,Matrix)
importFrom(Matrix,t)
importFrom("Matrix", diag, t, Matrix, sparseMatrix, rBind)
54 changes: 41 additions & 13 deletions R/checkts.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
## arguments: ts1, ts2, the two time-series,
## datatype: (numerical, categorical)
##
## pad: whether the two series of to be chopped or padded

checkts <- function(ts1, ts2, datatype, thrshd){
.packageName <- 'crqa'

checkts <- function(ts1, ts2, datatype, thrshd, pad){

## take as input the two sequences and normalize them by a pre-defined
## threshold constant.

ln1 = length(ts1)
ln2 = length(ts2)

mxl = max(c(ln1, ln2))

if (datatype == "numeric"){ ## just make sure that the vec are numeric
ts1 = as.numeric(as.matrix( ts1) )
Expand All @@ -28,17 +30,41 @@ checkts <- function(ts1, ts2, datatype, thrshd){
}

if ( ln1 != ln2 ){ ## timeseries can differ in length
df = abs(ln1 - ln2)
dfs = abs(ln1 - ln2)

## TODO if length of time-series is different there is a threshold
## find optimal solution to accepted threshold

if (df <= thrshd){ ## threshold to adjust | remove pair

if (ln2 > ln1){ ts2 = ts2[1:(length(ts2)-df)] } ## remove final time-points to series of equal length
if (ln1 > ln2){ ts1 = ts1[1:(length(ts1)-df)] }

}
if (dfs <= thrshd){ ## threshold to adjust | remove pair

## remove final time-points to series of equal length

if (pad == TRUE){
if (datatype == "numeric"){
## we pad with the mean value

if (ln2 > ln1){ ts1 = c(ts1, rep(mean(c(ts1,ts2), na.rm = TRUE), dfs)) }
if (ln1 > ln2){ ts2 = c(ts2, rep(mean(c(ts1,ts2), na.rm = TRUE), dfs)) }

}

if (datatype == "categorical"){
## we pad with a constant that it is not used
## for recoding

if (ln2 > ln1){ ts1 = c(ts1, rep(mxl + 1, dfs)) }
if (ln1 > ln2){ ts2 = c(ts2, rep(mxl + 1, dfs)) }

}


} else {
## we just chop off the series
if (ln2 > ln1){ ts2 = ts2[1:(length(ts2)-dfs)] }
if (ln1 > ln2){ ts1 = ts1[1:(length(ts1)-dfs)] }
}

}
}

if ( length(ts1) == length(ts2) ){
Expand All @@ -47,7 +73,7 @@ checkts <- function(ts1, ts2, datatype, thrshd){

} else {

return (list(df, FALSE) )## how many units are the sequences differing.
return (list(dfs, FALSE) )## how many units are the sequences differing.

}

Expand All @@ -65,8 +91,10 @@ numerify <- function( ts1, ts2 ){
ids = seq(1, length(objects), 1)

for ( o in 1:length(objects) ){
nwts1[which(ts1 == objects[o])] = ids[o]
nwts2 [which(ts2 == objects[o])] = ids[o]
indts1 = which(ts1 == objects[o])
if (length(indts1) > 0) nwts1[indts1] = ids[o]
indts2 = which(ts2 == objects[o])
if (length(indts2) > 0) nwts2[indts2] = ids[o]
}

return( list( nwts1, nwts2 ) )
Expand Down
Loading

0 comments on commit 874bb9f

Please sign in to comment.