The function penReg() can be used to fit a P-spline.
It can be used as demonstration of how the penalised B-splines can be fitted to one explanatory variable.
For more that one explanatory variables use the function pb() in gamlss.
The function penRegQ() is similar to the function penReg() but it estimates the "random effect" sigmas using the Q-function (marginal likelihood). The Q-function estimation takes longer but it has the advantage that standard errors are provided for log σ_e and log σ_b, where the sigmas are the standard errors for the response and the random effects respectively.
The function pbq() is a smoother within GAMLSS and should give identical results to the additive function pb(). The function gamlss.pbq is not for use.
the lambda starting value if the local methods are used
inter
the no of break points (knots) in the x-axis
order
the required difference in the vector of coefficients
degree
the degree of the piecewise polynomial
plot
whether to plot the data and the fitted function
method
The method used in the (local) performance iterations. Available methods are "ML", "ML-1", "EM", "GAIC" and "GCV"
k
the penalty used in "GAIC" and "GCV"
optim.proc
which function to be use to optimise the Q-function, options are c("nlminb", "optim")
optim.control
options for the optimisation procedures
control
arguments for the fitting function. It takes one two: i) order the order of the B-spline and plot whether to plot the data and fit.
xeval
this is use for prediction
...
for extra arguments
Value
Returns a fitted object of class penReg. The object contains 1) the fitted
coefficients 2) the fitted.values 3) the response variable y,
4) the label of the response variable ylabel
5) the explanatory variable x, 6) the lebel of the explanatory variable
7) the smoothing parameter lambda, 8) the effective degrees of freedom df,
9) the estimete for sigma sigma,
10) the residual sum of squares rss, 11) the Akaike information criterion aic,
12) the Bayesian information criterion sbc and 13) the deviance
Eilers, P. H. C. and Marx, B. D. (1996). Flexible smoothing with
B-splines and penalties (with comments and rejoinder). Statist. Sci,
11, 89-121.
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. (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.