^ character in R lm ()
Running regression in R:
fit = lm(y ~ x + log(x) + z + log(z) + (z-1)^2, data=data)
I get ridiculously high R ^ 2 values. I replaced (z-1) ^ 2 with a variable I named q, which is defined as (z-1) ^ 2, and I got a much smaller R ^ 2 value.
It's clear to me now that ^ does not act as an exponent in lm (), but what does it do? I looked here http://faculty.chicagobooth.edu/richard.hahn/teaching/FormulaNotation.pdf but I didn't get it.
+3
source to share