mtable function and adjusted R-squared


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.



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")
r <- pscl::pR2(mylogit) # look for 'McFadden'

1 Like


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

Thank you!

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)

#> 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) 
#> 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.