I have this linear model in r:
a<-lm(NA. ~ PC +SPCI,data=DSET)
Now, what I want to run is a linear model with the inverse of SPCI, which is (1/SCPCI).
I guessed that the sintaxis was : a<-lm(NA. ~ PC +(1/SPCI),data=DSET)
.
But it doesn`t make sense for that code because (1/SPCI) is completely ignored , it's just adding 0.
So, What should I do to run the inverse of a predictor in a linear model in R.
I think you need to to use the notation of I
in your formula. See ?formula
for details.
From help of formula
:
the function I() can be used to bracket those portions of a model formula where the operators are used in their arithmetic sense. For example, in the formula y ~ a + I(b+c), the term b+c is to be interpreted as the sum of b and c
a<-lm(NA. ~ PC + I(1/SPCI), data=DSET)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With