On 14.09.2012 09:41, agent dunham wrote:
Dear community, I've check it while working, but just to reassure myself. Let's say we have 2 models: model1 <- lm(vdep ~ log(v1) + v2 + v3 + I(v4^2) , data = mydata) model2 <- lm(vdep ~ log(v1) + v2 + v3 + v4^2, data = mydata) So in model1 you really square v4; and in model2, v4*^2 *doesn't do anything, does it? Model2 could be rewritten: model2b <- lm(vdep ~ log(v1) + v2 + v3 + v4, data = mydata) and nothing changes, doesn't it? This "I" caret is essential with powering or when including transformations as I(1/(v2+v3)) but not with log transformation, isn't it?. Is there any other transformation where I muss use also this "I", as is caret?
You need it whenever you are using operators with a special meaning in formulas such as "+", "-", "*", "/", "|", "^", ":" etc.
v4^2 means: Take the variables v4 and all their two-way interactions. Since v4 is singular, there are no two-way interactiosn available and it is not changed.
Best, Uwe Ligges
Thanks in advance, u...@host.com -- View this message in context: http://r.789695.n4.nabble.com/when-to-use-I-as-is-caret-tp4643113.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@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.
______________________________________________ R-help@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.