library("gamlss2")
air <- subset(airquality, !is.na(Ozone))
air <- air[order(air$Temp), ]
## Fit a distribution where both location (mu) and scale (sigma)
## depend nonlinearly on Temp via local regression
f <- Ozone ~ lo(~Temp+Wind, span=0.5, degree=2) | lo(Temp, span=0.7)
## estimate model
m <- gamlss2(f, data = air, family = GA)
## model summary
summary(m)
## visualize estimated effects
plot(m)LOESS Smoothers for GAMLSS
Description
Constructs a local polynomial regression fitting (LOESS) model term for use with gamlss2. The neighborhood size and polynomial degree can be supplied by the user. Neighborhood parameter tuning can be performed automatically using various information criteria during backfitting.
Usage
lo(formula, ...)
Arguments
formula
|
A formula specifying the predictors to be included in the local polynomial regression (e.g., |
…
|
Further arguments passed directly to the underlying |
Details
The term is fitted using loess within backfitting. Effective degrees of freedom (edf) for information criteria are taken from the fitted object’s trace.hat. The fitted smooth is centered by subtracting its mean to ensure identifiability.
Value
The constructor lo() returns an object of classes “special” and “lo” containing the covariate matrix, formula definitions, and control arguments required for fitting and prediction.
After estimation with gamlss2, the corresponding fitted special term contains the following main components:
-
model: the underlying fittedloessobject. -
fitted.values: centered fitted contribution of the term. -
edf: effective degrees of freedom, taken fromtrace.hat. -
shift: the mean value used to center the fitted smooth. -
term: character vector of variable names involved in the smooth. -
formula: the internal updated formula matching the working response.
References
Cleveland WS, Grosse E, Shyu WM (1992). “Local Regression Models”. In Chambers JM, Hastie TJ (eds.), Statistical Models in S, chapter 8, 309–376. Wadsworth & Brooks/Cole, Pacific Grove, CA. doi:10.1201/9780203738535-8
See Also
gamlss2, special_terms, loess