betareg
default residuals are heavy, which may cause an error to allocate vector due to its high size. This can be solved by changing the type
of residuals in the summary
call as explained here.
However, when presenting regression tables with stargazer
, the type of residuals can't be explicitly set.
Is there any way to make (large) betareg
objects work in stargazer
?
The potential solutions that I can think of, but don't know how to implement, are:
- Indicating the residual
type
in the originalbetareg
call (type = "pearson"
(or any other type) doesn't work). - Explicitly indicating the argument that
stargazer
should include when callingsummary
on thebetareg
object. - Any other?
Example:
set.seed(1)
df <- data.frame(y=runif(100000), x=runif(100000))
library(betareg)
beta <- betareg(y ~ x, data=df)
library(stargazer)
stargazer(beta)
# Error: cannot allocate vector of size 74.5 Gb
The way I finally solved this issue was by modifying the
stargazer
function. Particularly, in.stargazer.wrap
, which code you can find here, I added the following code:inside
.add.model
, i.e. just after these lines of code:Note that you need to create a new
stargazer
function with the new.stargazer.wrap
. I just called itstargazer2
: