Learn R Programming

gamlss (version 4.2-4)

lo: Specify a loess fit in a GAMLSS formula

Description

Allows the user to specify a loess fit in a GAMLSS model. This function is similar to the lo function in the gam implementation of package gam see Chambers and Hastie (1991).

Usage

lo(formula, control = lo.control(...), ...)
lo.control(span = 0.75, enp.target = NULL, 
          degree = 2, parametric = FALSE, drop.square = FALSE, 
          normalize = TRUE, family = c("gaussian", "symmetric"), 
          method = c("loess", "model.frame"), 
          surface = c("interpolate", "direct"), 
          statistics = c("approximate", "exact"), 
          trace.hat = c("exact", "approximate"), 
          cell = 0.2, iterations = 4, ...)

Arguments

formula
a formula specifying the explanatory variables
control
a control to be passed to the loess function
...
extra arguments
span
the number of observations in a neighbourhood. This is the smoothing parameter for a loess fit.
enp.target
an alternative way to specify span, as the approximate equivalent number degrees of freedom to be used. See also the help file of the R

Value

  • a loess object is returned.

item

  • degree
  • parametric
  • drop.square
  • normalize
  • family
  • method
  • surface
  • statistics
  • trace.hat
  • cell
  • iterations

code

loess.control

Warning

In this version the first argument is a formula NOT a list as in the previous one

Details

Note that lo itself does no smoothing; it simply sets things up for the function gamlss.lo() which is used by the backfitting function gamlss.add().

References

Chambers, J. M. and Hastie, T. J. (1991). Statistical Models in S, Chapman and Hall, London.

Rigby, R. A. and Stasinopoulos D. M. (2005). Generalized additive models for location, scale and shape,(with discussion), Appl. Statist., 54, part 3, pp 507-554.

Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use the GAMLSS package in R. Accompanying documentation in the current GAMLSS help files, (see also http://www.gamlss.org/).

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, http://www.jstatsoft.org/v23/i07.

See Also

cs, random,

Examples

Run this code
data(aids)
attach(aids)
# fitting a loess curve with span=0.4 plus the a quarterly  effect 
aids1<-gamlss(y~lo(~x,span=0.4)+qrt,data=aids,family=PO) # 
plot(x,y)
lines(x,fitted(aids1))
rm(aids1)
detach(aids)

Run the code above in your browser using DataLab