etab | R Documentation |
This function produces a data frame with model summaries. The organization of the table resembles final format used in publications.
etab( model, digits = 4, hc = FALSE, hc.type = c("hc3", "hc0", "hc1", "hc2", "hc4") )
model |
an output of |
digits |
integer, the number of significant digitis to use |
hc |
boolean, if |
hc.type |
a string with the method to compute the standard errors (see |
library(magrittr) set.seed(77) data = tibble::data_frame( n = 300, x1 = rnorm(n,3,1), x2 = rexp(n), cat1 = sample(c(0,1), n, replace=TRUE), cat2 = sample(letters[1:4], n, replace=TRUE), y = -10*x1*cat1 + 10*x2*(3*(cat2=='a') -3*(cat2=='b') +1*(cat2=='c') -1*(cat2=='d')) + rnorm(n,0,10), y.bin = ifelse(y < mean(y), 0, 1), y.mul = 1+ifelse( - x1 - x2 + rnorm(n,sd=10) < 0, 0, ifelse( - 2*x2 + rnorm(n,sd=10) < 0, 1, 2)), ) formula1 = y ~ x1 formula2 = y ~ x1 + x2 formula3 = y ~ x1*cat1 + x2*cat2 formula4bin = y.bin ~ x1+x2*cat2 formula5mul = y.mul ~ x1 + x2 model.g1 = lm(formula1, data) model.g2 = lm(formula2, data) model.g3 = lm(formula3, data) model.bin = glm(formula4bin, data=data, family='binomial') model.mul = nnet::multinom(formula5mul, data) model.mul %>% tidye %>% etab list(model.g1,model.g3) %>% tidye %>% etab list(model.g1,model.g2, model.g3) %>% tidye %>% etab list(model.mul, model.g3) %>% tidye %>% etab model.g3%>% tidye%>% etab model.mul %>% etab list(model.g1,model.g3) %>% etab list(model.g1,model.g2, model.g3) %>% etab list(model.mul, model.g3) %>% etab model.g3%>% etab
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.