mtable function and adjusted R-squared

Hi!

I am using the memisc package with mtable to format two multiple regression outputs into one table. I can not seem to find a way to call the Adjusted squared. It seems the package only prints squared. Is this accurate? If not, how can I get the output to generate Adjusted R-squared?

spretty.table <- mtable( "Model 1"= Model_1, "Model 2" = Model_2,
summary.stats=c("R-squared", "F","p","N"))

spretty.table %>% pander (justify = 'center')

write_html(spretty.table, "Models_1_2.html")


I have tried substituting "R-squared" with "Adj. R-squared" "Adjusted R-squared" and so on and so forth and it seems only to have a call for R-squared.

Thoughts?

Cheers,
M

I believe adjusted R^2 is not universally defined for regression other than linear, so perhaps that is why memisc does not calculate it. In logistic regression, one measure of adjusted R^2 is McFadden R^2, which you can get for example as follows:

df <- data.frame(UCBAdmissions)
mylogit <- glm(Admit ~ ., data = df, family = "binomial")
library(pscl)
r <- pscl::pR2(mylogit) # look for 'McFadden'
r
r[4]

1 Like

Interesting.

I am running linear at this point but appreciate the insight for logistic regression.

Thank you!
M

If you are doing linear regression, use the summary command without running a package to get adjusted R^2:

df <- data.frame(mtcars)
model <- lm(mpg ~ ., data = df)
summary(model)

library(memisc)
#> Loading required package: lattice
#> Loading required package: MASS
#> 
#> Attaching package: 'memisc'
#> The following objects are masked from 'package:stats':
#> 
#>     contr.sum, contr.treatment, contrasts
#> The following object is masked from 'package:base':
#> 
#>     as.array
fit <- lm(mpg ~ wt, mtcars)
out <- mtable("model" = fit) 
out$model$sumstat[3]
#> adj.r.squared 
#>     0.7445939

Created on 2023-01-23 with reprex v2.0.2

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.