diff --git a/NAMESPACE b/NAMESPACE index 67add6a04..08f6bcc15 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -170,12 +170,14 @@ S3method(model_performance,censReg) S3method(model_performance,clm) S3method(model_performance,clm2) S3method(model_performance,coxph) +S3method(model_performance,coxph_weightit) S3method(model_performance,default) S3method(model_performance,felm) S3method(model_performance,fixest) S3method(model_performance,fixest_multi) S3method(model_performance,flexsurvreg) S3method(model_performance,glm) +S3method(model_performance,glm_weightit) S3method(model_performance,glmmTMB) S3method(model_performance,glmmadmb) S3method(model_performance,glmx) @@ -197,9 +199,11 @@ S3method(model_performance,mixor) S3method(model_performance,mlogit) S3method(model_performance,model_fit) S3method(model_performance,multinom) +S3method(model_performance,multinom_weightit) S3method(model_performance,negbinirr) S3method(model_performance,negbinmfx) S3method(model_performance,nestedLogit) +S3method(model_performance,ordinal_weightit) S3method(model_performance,plm) S3method(model_performance,poissonirr) S3method(model_performance,poissonmfx) diff --git a/R/model_performance.lm.R b/R/model_performance.lm.R index c797b396f..0199b4ce4 100644 --- a/R/model_performance.lm.R +++ b/R/model_performance.lm.R @@ -3,10 +3,10 @@ #' Compute indices of model performance for regression models. #' #' @param model A model. -#' @param metrics Can be `"all"`, `"common"` or a character vector of -#' metrics to be computed (one or more of `"AIC"`, `"AICc"`, `"BIC"`, `"R2"`, -#' `"R2_adj"`, `"RMSE"`, `"SIGMA"`, `"LOGLOSS"`, `"PCP"`, `"SCORE"`). -#' `"common"` will compute AIC, BIC, R2 and RMSE. +#' @param metrics Can be `"all"`, `"common"` or a character vector of metrics to +#' be computed (one or more of `"AIC"`, `"AICc"`, `"BIC"`, `"R2"`, `"R2_adj"`, +#' `"RMSE"`, `"SIGMA"`, `"LOGLOSS"`, `"PCP"`, `"SCORE"`). `"common"` will +#' compute AIC, BIC, R2 and RMSE. #' @param verbose Toggle off warnings. #' @param ... Arguments passed to or from other methods. #' @@ -209,6 +209,18 @@ model_performance.lm_robust <- model_performance.lm #' @export model_performance.multinom <- model_performance.lm +#' @export +model_performance.multinom_weightit <- model_performance.lm + +#' @export +model_performance.ordinal_weightit <- model_performance.lm + +#' @export +model_performance.coxph_weightit <- model_performance.lm + +#' @export +model_performance.glm_weightit <- model_performance.lm + #' @export model_performance.plm <- model_performance.lm diff --git a/R/r2_coxsnell.R b/R/r2_coxsnell.R index 3db7197b7..36df504ec 100644 --- a/R/r2_coxsnell.R +++ b/R/r2_coxsnell.R @@ -8,12 +8,12 @@ #' @param ... Currently not used. #' #' @details -#' This index was proposed by *Cox and Snell (1989, pp. 208-9)* and, -#' apparently independently, by *Magee (1990)*; but had been suggested -#' earlier for binary response models by *Maddala (1983)*. However, this -#' index achieves a maximum of less than 1 for discrete models (i.e. models -#' whose likelihood is a product of probabilities) which have a maximum of 1, -#' instead of densities, which can become infinite *(Nagelkerke, 1991)*. +#' This index was proposed by *Cox and Snell (1989, pp. 208-9)* and, apparently +#' independently, by *Magee (1990)*; but had been suggested earlier for binary +#' response models by *Maddala (1983)*. However, this index achieves a maximum +#' of less than 1 for discrete models (i.e. models whose likelihood is a product +#' of probabilities) which have a maximum of 1, instead of densities, which can +#' become infinite *(Nagelkerke, 1991)*. #' #' @return A named vector with the R2 value. #' @@ -24,12 +24,12 @@ #' @references #' - Cox, D. R., Snell, E. J. (1989). Analysis of binary data (Vol. 32). #' Monographs on Statistics and Applied Probability. -#' - Magee, L. (1990). R 2 measures based on Wald and likelihood ratio -#' joint significance tests. The American Statistician, 44(3), 250-253. +#' - Magee, L. (1990). R 2 measures based on Wald and likelihood ratio joint +#' significance tests. The American Statistician, 44(3), 250-253. #' - Maddala, G. S. (1986). Limited-dependent and qualitative variables in #' econometrics (No. 3). Cambridge university press. -#' - Nagelkerke, N. J. (1991). A note on a general definition of the -#' coefficient of determination. Biometrika, 78(3), 691-692. +#' - Nagelkerke, N. J. (1991). A note on a general definition of the coefficient +#' of determination. Biometrika, 78(3), 691-692. #' #' @export r2_coxsnell <- function(model, ...) { diff --git a/man/check_dag.Rd b/man/check_dag.Rd index 266a62ec7..c33444f60 100644 --- a/man/check_dag.Rd +++ b/man/check_dag.Rd @@ -129,7 +129,7 @@ adjustments or over-adjustment. } \examples{ -\dontshow{if (require("ggdag", quietly = TRUE) && require("dagitty", quietly = TRUE) && require("see", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} +\dontshow{if (require("ggdag", quietly = TRUE) && require("dagitty", quietly = TRUE) && require("see", quietly = TRUE) && packageVersion("see") > "0.8.5") (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # no adjustment needed check_dag( y ~ x + b, diff --git a/man/model_performance.lm.Rd b/man/model_performance.lm.Rd index 208d9b1c4..11a820fff 100644 --- a/man/model_performance.lm.Rd +++ b/man/model_performance.lm.Rd @@ -9,10 +9,10 @@ \arguments{ \item{model}{A model.} -\item{metrics}{Can be \code{"all"}, \code{"common"} or a character vector of -metrics to be computed (one or more of \code{"AIC"}, \code{"AICc"}, \code{"BIC"}, \code{"R2"}, -\code{"R2_adj"}, \code{"RMSE"}, \code{"SIGMA"}, \code{"LOGLOSS"}, \code{"PCP"}, \code{"SCORE"}). -\code{"common"} will compute AIC, BIC, R2 and RMSE.} +\item{metrics}{Can be \code{"all"}, \code{"common"} or a character vector of metrics to +be computed (one or more of \code{"AIC"}, \code{"AICc"}, \code{"BIC"}, \code{"R2"}, \code{"R2_adj"}, +\code{"RMSE"}, \code{"SIGMA"}, \code{"LOGLOSS"}, \code{"PCP"}, \code{"SCORE"}). \code{"common"} will +compute AIC, BIC, R2 and RMSE.} \item{verbose}{Toggle off warnings.} diff --git a/man/r2_coxsnell.Rd b/man/r2_coxsnell.Rd index 2d53cb628..55dfaac1a 100644 --- a/man/r2_coxsnell.Rd +++ b/man/r2_coxsnell.Rd @@ -18,12 +18,12 @@ A named vector with the R2 value. Calculates the pseudo-R2 value based on the proposal from \emph{Cox & Snell (1989)}. } \details{ -This index was proposed by \emph{Cox and Snell (1989, pp. 208-9)} and, -apparently independently, by \emph{Magee (1990)}; but had been suggested -earlier for binary response models by \emph{Maddala (1983)}. However, this -index achieves a maximum of less than 1 for discrete models (i.e. models -whose likelihood is a product of probabilities) which have a maximum of 1, -instead of densities, which can become infinite \emph{(Nagelkerke, 1991)}. +This index was proposed by \emph{Cox and Snell (1989, pp. 208-9)} and, apparently +independently, by \emph{Magee (1990)}; but had been suggested earlier for binary +response models by \emph{Maddala (1983)}. However, this index achieves a maximum +of less than 1 for discrete models (i.e. models whose likelihood is a product +of probabilities) which have a maximum of 1, instead of densities, which can +become infinite \emph{(Nagelkerke, 1991)}. } \examples{ model <- glm(vs ~ wt + mpg, data = mtcars, family = "binomial") @@ -34,11 +34,11 @@ r2_coxsnell(model) \itemize{ \item Cox, D. R., Snell, E. J. (1989). Analysis of binary data (Vol. 32). Monographs on Statistics and Applied Probability. -\item Magee, L. (1990). R 2 measures based on Wald and likelihood ratio -joint significance tests. The American Statistician, 44(3), 250-253. +\item Magee, L. (1990). R 2 measures based on Wald and likelihood ratio joint +significance tests. The American Statistician, 44(3), 250-253. \item Maddala, G. S. (1986). Limited-dependent and qualitative variables in econometrics (No. 3). Cambridge university press. -\item Nagelkerke, N. J. (1991). A note on a general definition of the -coefficient of determination. Biometrika, 78(3), 691-692. +\item Nagelkerke, N. J. (1991). A note on a general definition of the coefficient +of determination. Biometrika, 78(3), 691-692. } }