GAIC and Generalised (Pseudo) R-squared for GAMLSS Models
Description
Functions to compute the GAIC and the generalised R-squared of Nagelkerke (1991) for GAMLSS models.
Usage
## Information criteria.
GAIC(object, ...,
k = 2, corrected = FALSE)
## R-squared.
Rsq(object, ...,
type = c("Cox Snell", "Cragg Uhler", "both", "simple"),
newdata = NULL)
Arguments
object
A fitted model object
…
Optionally more fitted model objects.
k
Numeric, the penalty to be used. The default k = 2 corresponds to the classical AIC.
corrected
Logical, whether the corrected AIC should be used? Note that it applies only when k = 2.
type
Which definition of R squared. Can be the “Cox Snell” or the Nagelkerke, “Cragg Uhler” or “both”, or “simple”, which computes the R-squared based on the median. In this case also newdata may be supplied.
newdata
Only for type = “simple”, the R-squared can be evaluated using newdata.
Details
The Rsq() function uses the definition for R-squared:
where \(L(0)\) is the null model (only a constant is fitted to all parameters) and \(L(\hat{\theta})\) is the current fitted model. This definition sometimes is referred to as the Cox & Snell R-squared. The Nagelkerke /Cragg & Uhler’s definition divides the above by
\(1 - L(0)^{2/n}\)
Note that GAIC() function is fully represented by the AIC and BIC functions. We only included GAIC() because of the previous package so users who relied on this function would still have the option.
Value
Numeric vector or data frame, depending on the number of fitted model objects.
References
Nagelkerke NJD (1991). “A Note on a General Definition of the Coefficient of Determination.” Biometrika, 78(3), 691–692. doi:10.1093/biomet/78.3.691
See Also
gamlss2
Examples
library("gamlss2")## load the aids data setdata("aids", package ="gamlss.data")## estimate negative binomial count modelsb1 <-gamlss2(y ~ x + qrt, data = aids, family = NBI)
GAMLSS-RS iteration 1: Global Deviance = 492.7033 eps = 0.148555
GAMLSS-RS iteration 2: Global Deviance = 492.6374 eps = 0.000133
GAMLSS-RS iteration 3: Global Deviance = 492.6373 eps = 0.000000
b2 <-gamlss2(y ~s(x) +s(qrt, bs ="re"), data = aids, family = NBI)
GAMLSS-RS iteration 1: Global Deviance = 408.2411 eps = 0.294515
GAMLSS-RS iteration 2: Global Deviance = 379.8718 eps = 0.069491
GAMLSS-RS iteration 3: Global Deviance = 375.4344 eps = 0.011681
GAMLSS-RS iteration 4: Global Deviance = 374.4315 eps = 0.002671
GAMLSS-RS iteration 5: Global Deviance = 374.1784 eps = 0.000676
GAMLSS-RS iteration 6: Global Deviance = 374.1352 eps = 0.000115
GAMLSS-RS iteration 7: Global Deviance = 374.1317 eps = 0.000009