ModelSummary and Stargazer fail when RQ s.e. calculation fails
stargazer(m_demo_int_qr)
Error in base::backsolve(r, x, k = k, upper.tri = upper.tri, transpose = transpose, :
singular matrix in 'backsolve'. First zero in diagonal [13]
modelsummary(m_demo_int_qr)
Error: `modelsummary could not extract the required information from a model of class
"rq". The package tried a sequence of 2 helper functions to extract estimates:
parameters::parameters(model)
broom::tidy(model)
To draw a table, one of these commands must return a `data.frame` with a column
named "term". The `modelsummary` website explains how to summarize unsupported
models or add support for new models yourself:
https://modelsummary.com/articles/modelsummary.html
These errors messages were generated during extraction:
`parameters::parameters(model)` did not return a valid data.frame.
`broom::tidy(model)` did not return a valid data.frame.
If you bootstrap the s.e., you need a way to combine the results to a table.
Assume a list of model coefs gotten via commands like:
summary(m_demo_int_qr, se = "boot")$coef
And then use the code above to produce a latex table. Sample usage:
model_list <- list(
Model1 = summary(m_demo_int_qr, se = "boot")$coef,
Model2 = summary(m_demo_int_qr, se = "boot")$coef
)
# Pass coefficient names (optional)
coef_names <- c(
"(Intercept)" = "Intercept",
"women" = "Women",
"race_labAsian" = "Asian",
"race_labBlack" = "Black",
"race_labHispanic" = "Hispanic",
"race_labOther" = "Other Race",
"educ_labCollege" = "College Education",
"educ_labPostgrad" = "Postgraduate Education",
"educ_labSome college" = "Some College Education",
"agegroup_lab25-34" = "Age 25-34",
"agegroup_lab35-49" = "Age 35-49",
"agegroup_lab50-64" = "Age 50-64",
"agegroup_lab65+" = "Age 65+"
)
# Generate the LaTeX table
latex_output <- generate_latex_table(model_list, coef_names)