Learn R Programming

pgam (version 0.3.3)

pgam.parser: Read the model formula and split it into the parametric and nonparametric partitions

Description

Read the model formula and split it into two new ones concerning the parametric and nonparametric partitions of the predictor.

Usage

pgam.parser(formula, parent.level=1)

Arguments

formula
object representing the model formula. Rstandard for GLM models
parent.level
an environment to be used as the parent of the environment created

Value

  • List containing the information needed for model fitting.

Details

This function extracts all the information in the model formula. Most important, split the model into two parts regarding the parametric nature of the model. A model can be specified as following: $$Y~f\left(sf_{r}\right)+V1+V2+V3+g\left(V4,df_{4}\right)+g\left(V5,df_{5}\right)$$ where $sf_{r}$ is a seasonal factor with period $r$ and $df_{i}$ is the degree of freedom of the smoother of the i-th covariate. Actually, two new formulae will be created: $$~sf_{1}+\dots+sf_{r}+V1+V2+V3$$ and $$~V4+V5$$ These two formulae will be used to build the necessary datasets for model estimation. Dummy variables reproducing the seasonal factors will be created also.

Models without explanatory variables must be specified as in the following formula $$Y~NULL$$

See Also

pgam, f, g

Examples

Run this code
library(pgam)
data(aihrio)
attach(aihrio)
form <- ITRESP5~f(WEEK)+HOLIDAYS+offset(rain)+PM+g(tmpmax,7)+g(wet,3)

Run the code above in your browser using DataLab