Advertisement
Guest User

Untitled

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