I have a data that has 3 variables that depend one of the other, like a hierarchy, so supposing that the data look like this:
H0 H1 H2 t y x
a a1 a1a 5 2 1
a a1 a1b 5 4 2
a a2 a2a 8 3 3
b b1 b1a 22 7 88
c a1 c1a 2 2 2
...
As it can be seen, there is a hierarchy: H0->H1->H2. And there maybe the same H1 for two different H0. I want to make a linear model for x depending on the other variables:
model <- lm(log(x) ~ H0 + H1 + H2 + t + y)
This has worked, but if I change it with H0*H1 + H2 + t + y
I get an not enough memory error. And if I do H0 + H1 + H0:H1 + H2 + t + y
I get the same error with the same estimated needed size (that I assume is correct).
I have seen also that there is also nesting /
and conditioning |
(docs), and I am not really sure which is the best for my case. I have found here that
|
isn't used bylm
at all
which I am afraid to agree, but no conter arguments. And there are also as is I(...)
and also ^
, and I really want some more explanations about these approaches.
More: supposing that I have another variable q, that I do not use in the model shall I use -q
in lm
?
The - operator removes the specified terms, so that (a+b+c)^2 - a:b is identical to a + b + c + b:c + a:c.
It could also be used to delete the intercept term.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다