Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(dplyr)
- library(broom)
- iris.regressao <- iris %>%
- group_by(Species) %>%
- do(regressao =
- lm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width, data=.))
- tidy(iris.regressao, regressao)
- # A tibble: 12 x 6
- # Groups: Species [3]
- Species term estimate std.error statistic p.value
- <fctr> <chr> <dbl> <dbl> <dbl> <dbl>
- 1 setosa (Intercept) 2.3518898 0.39286751 5.9864707 3.034183e-07
- 2 setosa Sepal.Width 0.6548350 0.09244742 7.0833236 6.834434e-09
- 3 setosa Petal.Length 0.2375602 0.20801921 1.1420107 2.593594e-01
- 4 setosa Petal.Width 0.2521257 0.34686362 0.7268727 4.709870e-01
- 5 versicolor (Intercept) 1.8955395 0.50705524 3.7383295 5.112246e-04
- 6 versicolor Sepal.Width 0.3868576 0.20454490 1.8913091 6.488965e-02
- 7 versicolor Petal.Length 0.9083370 0.16543248 5.4906811 1.666695e-06
- 8 versicolor Petal.Width -0.6792238 0.43538206 -1.5600639 1.255990e-01
- 9 virginica (Intercept) 0.6998830 0.53360089 1.3116227 1.961563e-01
- 10 virginica Sepal.Width 0.3303370 0.17432873 1.8949086 6.439972e-02
- 11 virginica Petal.Length 0.9455356 0.09072204 10.4223360 1.074269e-13
- 12 virginica Petal.Width -0.1697527 0.19807243 -0.8570233 3.958750e-01
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement