[R] Variance of multiple non-contiguous time periods?

Jim Lemon jim at bitwrit.com.au
Tue Nov 4 10:11:22 CET 2014


On Mon, 3 Nov 2014 12:45:03 PM CJ Davies wrote:
> ...
> On 30/10/14 21:33, Jim Lemon wrote:
> If I understand, you mean to calculate deviations for each individual
> 'chunk' of each transition & then aggregate the results? This is what
> I'd been thinking about, but is there a sensible manner within R to
> achieve this, or is it something for which it would be easier to
> preprocess the data in an external tool? Is there some way to subset 
the
> data such that I can work over just contiguous 'chunks'?
> 
Exactly. If there is some combination of existing variables that can be 
combined to make a set of unique values for each "chunk", you can 
calculate the deviations within each "chunk", then average the squared 
deviations for each type of "chunk", weighting by the duration of the 
"chunks" so that you don't bias the pooled variance toward the longer 
"chunks".

Jim



More information about the R-help mailing list