0
$\begingroup$

I have

fit.all <-lm(Sepal.Length ~ .,iris)
summary(fit.all)->fit.all.summary
print(fit.all.summary$coefficients)

Output What are the coefficients ordered by?

$\endgroup$
2
  • $\begingroup$ Could you share the output of your last command line? $\endgroup$
    – Miss.Alpha
    Commented Oct 15, 2022 at 21:54
  • $\begingroup$ This is a generic question. I re-wrote with the iris data set to illustrate. $\endgroup$
    – Kirsten
    Commented Oct 15, 2022 at 22:34

1 Answer 1

1
$\begingroup$

They are simply in the exact order that you passed the data.frame to lm().

data(iris)
iris <- iris[, c(5,4,3,2,1)] #change column order

fit.all <-lm(Sepal.Length ~ .,iris)
summary(fit.all)->fit.all.summary
print(fit.all.summary$coefficients)

Output:

                    Estimate Std. Error   t value     Pr(>|t|)
(Intercept)        2.1712663 0.27979415  7.760227 1.429502e-12
Speciesversicolor -0.7235620 0.24016894 -3.012721 3.059634e-03
Speciesvirginica  -1.0234978 0.33372630 -3.066878 2.584344e-03
Petal.Width       -0.3151552 0.15119575 -2.084418 3.888826e-02
Petal.Length       0.8292439 0.06852765 12.100867 1.073592e-23
Sepal.Width        0.4958889 0.08606992  5.761466 4.867516e-08
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.