[R] Splitting a Vector

Ben Ward benjamin.ward at bathspa.org
Thu Jan 6 14:09:07 CET 2011


Hi all,

I read in a text book, that you can examine a variable that is colinear 
with others, and giving different ANOVA output and explanatory power 
when ordered differently in the model forula, by modelling that 
explanatory variable, against the others colinear with it. Then, using 
that information to split the vector (explanatory variable) in question, 
into two new vectors, one should correspond to the fitted values and one 
the residuals of the (I think you could call it nested) model. One 
vector therefore should be aligned with the subspacespace defined by the 
other variables colinear with it, and the other will be residual, and so 
orthogonal to the subspace of the colinear variables. Then by including 
these two variables in the origional model - the one that showed the 
order dependency, you can see how much explanatory power the othogonal 
part of the order dependent variable has, at different orders, and in 
principle it shouldn't change, but the vector made from the part 
co-aligned with the co-variates, will change as the order changes - it's 
explanatory power should decreace in ANOVA is it moves away from being 
the first explanatory variable in the model.

Obviously finding the fitted model values and residual required to split 
the vector in two is a simple lm() with the right variables. But how 
would I create two new vectors from this and append them to my 
dataframe? Is there a package or function specially designed with this 
sort of task in mind?

Thanks,
Ben Ward.



More information about the R-help mailing list