In order to create a presentation, I use R Markdown. I'd like to print a linear regression (lm) or mixed-effects model (lmer) summary on a slide. However, it does not fit neatly on the slide and I searched the web for a method that allows me to scale the summary, but I couldn't find anything useful. Of course, I could delve deeply into the LaTeX configuration of my Markdown document. However, I was wondering whether there is a quick solution e.g., using a certain package, function or set up the relevant chunk differently?
I use stargazer to create the regresssion tables, there you can change the font size with font.size, the column spacing withcolumn.sep.width and/or print the regressions on one row with single.row = TRUE.
Related
I am learning different statistical models and how to compute them using R.
I want to display the summary of a large multinomial logistic regression model in RMarkdown so that I am able to generate a PDF file.
However, only one page with the regression results is visible in the generated PDF file. The other results are simply cut off.
This is what I get:
I have tried the following code to output the summary of my model:
```{r, results = 'asis'}
texreg(model_pchoice)
```
I expect to generate a nice PDF File with an appealing table (spanning several pages if necessary). How could I proceed?
I would like to save the results of a Bayesian estimation function (e.g. brm) to file (e.g. in Latex format), for sharing results and preparing publications. It appears that existing packages (e.g. xtable, stargazer) are designed with non-Bayesian statistics in mind and cannot handle these model objects. Are there any existing packages or available code to handle this task (before I begin to recreate the wheel)? I have found tools for making tables from models estimated using JAGS/BUGS here but brm uses stan to estimate models.
If you call launch_shinystan on the object and go to the Estimate tab, there is a link to Generate LaTeX table that gives you a bunch of options to check on the left and it outputs the syntax on the right.
For posterity's sake, for basic tables one may also access specific parts of the model by for example:
summary(model)$fixed
where model is a stanfit object, and pass that to xtable or another function to output latex tables.
I want to replicate in texreg the functionality contained in stargazer via the arguments omit and omit.labels (see here). Unfortunately, I cannot use the stargazer package as it does not support the model I am using and is not extensible. Since texreg is easily extensible I can get it to work with my models. I can also easily omit some output from texreg with the omit.coef argument. What I can't seem to figure out is how to insert labels for the omitted coefficients. Does this exist in texreg? Does anyone have experience trying to write this functionality into an extract function? Alternatively, has anyone figured out how to extend stargazer to work with a custom model?
Context: I am writing a presentation in knitr and need to convert the output of some estimators into latex which will then get converted to pdf for my beamer presentation. The output has a bunch of covariates and thus is too long to display nicely in beamer. I want to truncate the output by omitting some covariates and inserting in their place a line indicating whether these covariates have been included in the model or not, e.g. collapse the variables "County Population", "County Income", etc. into a line that reads "County controls" and then have "Yes" or "No" to indicate whether these controls were included in the estimate or not. Ideally, someone could help me figure out a way to do this in texreg. If not, I would be open to other packages/approaches, e.g. xtable.
A possible option is the github version of huxtable. (I am the author.) This has a huxreg function which creates a table from a bunch of regressions, much like texreg: it'll work for anything that has a broom::tidy method defined for it. You can then edit the table much like a normal data frame, just rbind in the rows you want.
You'll need to install using devtools::install_github, if you want to try this route.
I am using pander to print regression output. However, it is automatically (incorrectly) labeling the tables. I have tried to use setcaption to override this habit, but it simply puts the caption to the right of the automated table number.
Any thoughts?
I have been performing the hurdle regression (from: library(pscl), using the command summary(hurdle(y~x))) for my supervisor and now I am trying to make the hurdle regression summary output into a latex table. However for some reason none of the usual tricks work - xtable(), regtex(), latextable() all refuses to convert the summary table into a latex output. I even tried stargazer() but of course the answer was no. Is there anyway I can convert the hurdle regression summary table into a latex output? I am not comfortable with LaTex and making one from the scratch would be really painful!
EDIT: What is remarkable about this problem is that stargazer and texreg both (the latter is more reasonable to me cause it gives both parts of the model) give output on the console but throw an error in knitr documents.