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

CJ Davies cjohndavies at gmail.com
Mon Nov 3 13:45:03 CET 2014


On 30/10/14 21:33, Jim Lemon wrote:
> On Fri, 31 Oct 2014 07:19:01 AM Jim Lemon wrote:
>> On Wed, 29 Oct 2014 05:12:19 PM CJ Davies wrote:
>>> I am trying to show that the red line ('yaw') in the upper of the two
>>> plots here;
>>>
>>> http://i.imgur.com/N4Xxb4f.png
>>>
>>> varies more within the pink sections ('transition 1') than in the 
> light
>>> blue sections ('real').
>>>
>>> I tried to use var.test() however this runs into a problem because
>>> although the red line doesn't vary much *within* any particular 
> light
>>> blue section, it does vary a lot *between* light blue sections.
>>>
>>> For example, in the light blue section around t=90 the red line
>> doesn't
>>
>>> move much & likewise in the light blue section around t=160 the
>> red line
>>
>>> doesn't move much. But between these two sections the red line
>> has moved
>>
>>> substantially.
>>>
>>> So if I simply subset the data according to pink/light blue & then 
> put
>>> those resultant subsets into var.test(), the answer does not show
>> the
>>
>>> relationship that I want it to.
>>>
>>> Can anybody shed some light on a sensible method of solving 
> this?
>> Hi CJ,
>> If your dataset has the transition type coded for each observation:
>>
>> rotation	transition
>> 90		blue
>> 90		blue
>> 115		pink
>> -10		pink
>> 30		green
>> ...
>>
>> you could aggregate all the observations within each transition type
>> and test that.
>>
>> Jim
>>
> Oops,
> What I meant was aggregate all the _deviations_ within each transition 
> type.
>
> Jim
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
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'?

Regards,
CJ Davies



More information about the R-help mailing list