# deviance: Smooth Model Deviance In npreg: Nonparametric Regression via Smoothing Splines

 deviance 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 `gsm` function, "sm" output by the `sm` function, or "ss" output by the `ss` function `...` 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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.4135/9781526421036885885")}

`ss`, `sm`, `gsm`

`fitted.values` and `residuals`

### 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
}
``````

npreg documentation built on May 29, 2024, 4:17 a.m.