deviance {npreg} | R Documentation |
Smooth Model Deviance
Description
Returns the deviance from a fit smoothing spline (fit by ss
), smooth model (fit by sm
), or generalized smooth model (fit by gsm
).
Usage
## S3 method for class 'gsm'
deviance(object, ...)
## S3 method for class 'sm'
deviance(object, ...)
## S3 method for class 'ss'
deviance(object, ...)
Arguments
object |
an object of class "gsm" output by the |
... |
other arugments (currently ignored) |
Details
For ss
and sm
objects, the deviance is caculated assuming iid Gaussian errors.
For gsm
objects, the deviance is calculated by summing the squared deviance residuals, which are calculated using family(object)$dev.resid
Value
Deviance of the model object
.
Author(s)
Nathaniel E. Helwig <helwig@umn.edu>
References
Chambers, J. M. and Hastie, T. J. (1992) Statistical Models in S. Wadsworth & Brooks/Cole.
Helwig, N. E. (2020). Multiple and Generalized Nonparametric Regression. In P. Atkinson, S. Delamont, A. Cernat, J. W. Sakshaug, & R. A. Williams (Eds.), SAGE Research Methods Foundations. doi:10.4135/9781526421036885885
See Also
Examples
## for 'ss' and 'sm' objects, this function is defined as
function(object, ...){
sum(weighted.residuals(object)^2, na.rm = TRUE)
}
## for 'gsm' objects, this function is defined as
function(object, ...){
object$deviance
}