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
Function lo() defines a special model term for gamlss2. It acts as a wrapper wrapper around the standard loess function integrated cleanly into the iterative backfitting architecture of the location, scale, and shape loops.
Estimation is based on localized weighted least squares. For a given neighborhood configuration, the local polynomial parameters are updated at every backfitting step using the adjusted working targets z and weights w.
The effective degrees of freedom (edf) for the smooth term are extracted analytically using the trace.hat value returned by the local regression engine.
To ensure global model identifiability across the additive channels of the distributional parameters, the estimated contribution is centered by subtracting its mean before being passed back to the outer fitting algorithm.
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, W. S., Grosse, E. and Shyu, W. M. (1992). “Local regression models.” Chapter 8 of Statistical Models in S, eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.
See Also
gamlss2, special_terms, loess