Skip to content

Commit

Permalink
window of 1500
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig committed Mar 27, 2013
1 parent 5b0efc3 commit 51cc8e0
Show file tree
Hide file tree
Showing 4 changed files with 4,032 additions and 4,030 deletions.
4 changes: 2 additions & 2 deletions inst/examples/beer.Rmd
Expand Up @@ -28,7 +28,7 @@ timeseries <- matrix(X@.Data, ncol=M)
w <- sapply(data.frame(timeseries), function(x) any(x < threshold))
# extract that subset by id
W <- timeseries[,w]
sample <- 500 # sample length
sample <- 1500 # sample length
dev <- sapply(as.data.frame(W), which.min)
drop <- which(dev - sample < 1)
if(length(drop) > 0){
Expand Down Expand Up @@ -66,7 +66,7 @@ dat <- melt(data.frame(Variance=var, Autocorrelation=acor))
To compare against the expected distribution of these statistics, we create another set of simulations without conditioning on having experienced a chance transition, on which we perform the identical analysis.

``` {r simdatf_null}
null <- timeseries[1000:1501,]
null <- timeseries[1000:2501,]
null <- as.data.frame(cbind(time = 1:dim(null)[1], null))
ndf <- melt(null, id="time")
names(ndf) = c("time", "reps", "value")
Expand Down
8 changes: 4 additions & 4 deletions inst/examples/beer.md
Expand Up @@ -46,7 +46,7 @@ timeseries <- matrix(X@.Data, ncol=M)
w <- sapply(data.frame(timeseries), function(x) any(x < threshold))
# extract that subset by id
W <- timeseries[,w]
sample <- 500 # sample length
sample <- 1500 # sample length
dev <- sapply(as.data.frame(W), which.min)
drop <- which(dev - sample < 1)
if(length(drop) > 0){
Expand All @@ -72,7 +72,7 @@ zoom <- df
ggplot(subset(zoom, reps %in% levels(zoom$reps)[1:9])) + geom_line(aes(time, value)) + facet_wrap(~reps, scales="free")
```

![plot of chunk example-trajectories](http://farm9.staticflickr.com/8516/8592953281_bb7ec80511_o.png)
![plot of chunk example-trajectories](http://farm9.staticflickr.com/8369/8593100341_4e2af5fec3_o.png)


Compute model-based warning signals on all each of these.
Expand All @@ -92,7 +92,7 @@ To compare against the expected distribution of these statistics, we create anot


```r
null <- timeseries[1000:1501,]
null <- timeseries[1000:2501,]
null <- as.data.frame(cbind(time = 1:dim(null)[1], null))
ndf <- melt(null, id="time")
names(ndf) = c("time", "reps", "value")
Expand All @@ -111,7 +111,7 @@ ggplot(dat) + geom_histogram(aes(value, y=..density..), binwidth=0.3, alpha=.5)
geom_density(data=nulldat, aes(value), adjust=2) + xlab("Kendall's tau") + theme_bw()
```

![plot of chunk fig](http://farm9.staticflickr.com/8518/8592953433_2e184d3044_o.png)
![plot of chunk fig](http://farm9.staticflickr.com/8108/8593100533_533e2d0c46_o.png)



Expand Down
50 changes: 26 additions & 24 deletions inst/examples/beer_dat.csv
@@ -1,25 +1,27 @@
"","variable","value"
"1","Variance",0.435792828685259
"2","Variance",0.509800796812749
"3","Variance",0.0161593625498008
"4","Variance",0.141800796812749
"5","Variance",-0.468239043824701
"6","Variance",-0.0520478087649402
"7","Variance",0.956207171314741
"8","Variance",0.0816892430278885
"9","Variance",0.173737051792829
"10","Variance",0.941290836653387
"11","Variance",-0.327426294820717
"12","Variance",0.406342629482072
"13","Autocorrelation",0.0609083665338645
"14","Autocorrelation",0.389641434262948
"15","Autocorrelation",-0.143203187250996
"16","Autocorrelation",-0.0640318725099602
"17","Autocorrelation",-0.403474103585657
"18","Autocorrelation",-0.076207171314741
"19","Autocorrelation",0.648637450199203
"20","Autocorrelation",-0.230533864541833
"21","Autocorrelation",-0.107059760956175
"22","Autocorrelation",0.207394422310757
"23","Autocorrelation",-0.145880478087649
"24","Autocorrelation",0.538231075697211
"1","Variance",-0.209310252996005
"2","Variance",0.645493120284066
"3","Variance",0.157986684420772
"4","Variance",-0.737260541500222
"5","Variance",-0.447833111407013
"6","Variance",-0.817232134931203
"7","Variance",0.238093209054594
"8","Variance",-0.709791389258766
"9","Variance",0.615680426098535
"10","Variance",0.337430980914336
"11","Variance",-0.153015534842432
"12","Variance",0.83688948069241
"13","Variance",-0.61149045716822
"14","Autocorrelation",-0.140282290279627
"15","Autocorrelation",0.571103417665335
"16","Autocorrelation",0.2305867731913
"17","Autocorrelation",-0.579675099866844
"18","Autocorrelation",-0.428012427873946
"19","Autocorrelation",-0.19937505548158
"20","Autocorrelation",0.230494451841988
"21","Autocorrelation",-0.492623169107856
"22","Autocorrelation",0.27037017310253
"23","Autocorrelation",0.172885929871283
"24","Autocorrelation",-0.0338854860186418
"25","Autocorrelation",0.582636484687084
"26","Autocorrelation",-0.484349755881048

0 comments on commit 51cc8e0

Please sign in to comment.