Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion R/rwi.stats.running.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ rwi.stats.running <- function(rwi, ids=NULL, period=c("max", "common"),
stop("'window.length' is smaller than 'min.corr.overlap'")
}
}
tmp <- normalize1(rwi, n, prewhiten)
rwi.mean<-round(mean(unlist(rwi),na.rm=T))
if(rwi.mean==0){rwi<-rwi+100} #this is a check whether your dataset has been detrended using difference=T, thus having a grand mean of 0. If so, it needs to be transposed by an arbitrary positive number, otherwise normalize1() messes up the dataset and can divide a series by a slightly negative value.
tmp <- normalize1(rwi, n, prewhiten)
if(!all(tmp$idx.good)) {
warning("after prewhitening, 'rwi' contains column(s) without at least four observations",
call.=FALSE)
Expand Down
Loading