This function gives the generalised R-squared of Nagelkerke (1991) for a GAMLSS model.
a GAMLSS object
which definition of R squared. Can be the "Cox Snell" or the Nagelkerke, "Cragg Uhler" or "both".
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(fitted) 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 with
Rsq() produces a single value if type="Cox Snell" or "Cragg Uhler" and a list if type="both".
The null model is fitted using the function gamlssML() which can create warning messages
Mikis Stasinopoulos email@example.com
Nagelkerke, N. J. (1991). A note on a general definition of the coefficient of determination. Biometrika, 78(3), 691-692.
Rigby, R. A., Stasinopoulos, D. M., Heller, G. Z., and De Bastiani, F. (2019) Distributions for modeling location, scale, and shape: Using GAMLSS in R, Chapman and Hall/CRC. An older version can be found in https://www.gamlss.com/.
Stasinopoulos D. M. Rigby R.A. (2007) Generalized additive models for location scale and shape (GAMLSS) in R. Journal of Statistical Software, Vol. 23, Issue 7, Dec 2007, https://www.jstatsoft.org/v23/i07/.
Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017) Flexible Regression and Smoothing: Using GAMLSS in R, Chapman and Hall/CRC.
(see also https://www.gamlss.com/).
1 2 3 4
Loading required package: splines Loading required package: gamlss.data Attaching package: 'gamlss.data' The following object is masked from 'package:datasets': sleep Loading required package: gamlss.dist Loading required package: MASS Loading required package: nlme Loading required package: parallel ********** GAMLSS Version 5.1-3 ********** For more on GAMLSS look at http://www.gamlss.org/ Type gamlssNews() to see new features/changes/bug fixes. GAMLSS-RS iteration 1: Global Deviance = 492.7119 GAMLSS-RS iteration 2: Global Deviance = 492.6375 GAMLSS-RS iteration 3: Global Deviance = 492.6373  0.8095829 $CoxSnell  0.8095829 $CraggUhler  0.8095856
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.