Question

I want to adjust a function like this:

fit4 = lm(mut ~ ent + score + wt + I(ent^2) + I(score^2) +I(wt^2))

when I summary(fit4) I get:

Coefficients:                 
                          Estimate   Std. Error t value Pr(>|t|)   
(Intercept)              -1.779381   0.086256 -20.629   <2e-16   
ent                       2.724036   0.072543  37.550   <2e-16   
score                     0.473230   0.009450  50.077   <2e-16   
wt                       -0.464216   0.031141 -14.907   <2e-16
I(ent^2)                 -0.473427   0.018814 -25.164   <2e-16
I(score^2)                0.030187   0.004851   6.222    5e-10
I(wt^2)                   0.043386   0.004609   9.413   <2e-16
---

Now I would like to obtain the same, but doing the root square error of the above function: sqrt(ent + score + wt + I(ent^2) + I(score^2) +I(wt^2)), but when I simply add "sqrt()", the summary returns something like:

                    Estimate 
(Intercept)          1.066025                                                                                                                    
I(sqrt(ent + score + wt + I(ent^2) + I(score^2) + I(wt^2))) -0.24028    

(and same for Std.Error, t-value, etc.)

How can I add "root squared" or "log" and still obtain the values for each element of the function?

Was it helpful?

Solution

You have to apply the function to all of them induvidually. So

fit4 = lm(mut ~ log(ent) + log(score) + log(wt) + 
                log(I(ent^2)) + log(I(score^2)) +log(I(wt^2)))

will do the desired

Reason:

log(ent + score + wt + I(ent^2) + I(score^2) +I(wt^2))

is interpreted as a single regressor. So to r it is like lm(mut~x) where x=log(...) instead of

x=log(ent) + ... + log(I(wt^2))

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top