countRSquare | R Documentation |
Produces the count pseudo r-squared measure for models with a binary outcome.
countRSquare(
fit,
digits = 3,
suppressWarnings = TRUE,
plotit = FALSE,
jitter = FALSE,
pch = 1,
...
)
fit |
The fitted model object for which to determine pseudo r-squared.
|
digits |
The number of digits in the outputted values. |
suppressWarnings |
If |
plotit |
If |
jitter |
If |
pch |
Passed to |
... |
Additional arguments. |
The count pseudo r-squared is simply the number of correctly predicted observations divided the total number of observations.
This version is appropriate for models with a binary outcome.
The adjusted value deducts the count of the most frequent outcome from both the numerator and the denominator.
It is recommended that the model is fit on data in long
format. That is, that the weight
option not be used in
the model.
The function makes no provisions for NA
values.
It is recommended that NA
values be removed before
the determination of the model.
A list including a description of the submitted model, a data frame with the pseudo r-squared results, and a confusion matrix of the results.
Salvatore Mangiafico, mangiafico@njaes.rutgers.edu
https://stats.oarc.ucla.edu/other/mult-pkg/faq/general/faq-what-are-pseudo-r-squareds/, https://rcompanion.org/handbook/H_08.html, https://rcompanion.org/rcompanion/e_06.html
nagelkerke
,
efronRSquared
,
accuracy
data(AndersonBias)
### Covert data to long format
Long = AndersonBias[rep(row.names(AndersonBias), AndersonBias$Count),
c("Result", "County", "Gender")]
rownames(Long) = seq(1:nrow(Long))
str(Long)
### Fit model and determine count r-square
model = glm(Result ~ County + Gender + County:Gender,
data = Long,
family = binomial())
countRSquare(model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.