The function fit_PB()
fits a P-spline univariate smoother [Eilers and Marx (1996)] to y
against the x
with prior weights weights
.
fit_PB(x, y, weights, data, xmin, xmax, nseg = 20,
lambda = 10, order = 2, degree = 3, max.df = 20,
ylim, plot = TRUE, col.ribbon = "pink")
A object Psplines
is produced with methods print()
, coef()
deviance()
, fitted()
, predict()
and resid().
the explanatory variable
the response
possible prior weights (set to one by default)
the data frame where x
, y
and weights
are coming from
the x
minimum if different from min(x)
the x
maximum if different from max(x)
the number of knots
the smotthing parameter
the ordr of the difference
the degree of the piewise polynonmial
the maximum allowed degress of freedom
the ylim
in the plot
whether to plot the results
the color in the se of the fitted values
Mikis Stasinopoulos
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., Stasinopoulos, D. M., Heller, G. Z., and De Bastiani, F. (2019) Distributions for modeling location, scale, and shape: Using GAMLSS in R, Chapman and Hall/CRC. tools:::Rd_expr_doi("10.1201/9780429298547").
Stasinopoulos D. M., Rigby R.A., Heller G., Voudouris V., and De Bastiani F., (2017) Flexible Regression and Smoothing: Using GAMLSS in R, Chapman and Hall/CRC. tools:::Rd_expr_doi("10.1201/b21973")
Stasinopoulos, M.D., Kneib, T., Klein, N., Mayr, A. and Heller, G.Z., (2024). Generalized Additive Models for Location, Scale and Shape: A Distributional Regression Approach, with Applications (Vol. 56). Cambridge University Press.
(see also https://www.gamlss.com/).
ACE
data(abdom)
m1 <- fit_PB(x,y, data=abdom)
Run the code above in your browser using DataLab