fit_PB: P-spline smoother

View source: R/fit_PB.R

fit_PBR Documentation

P-spline smoother

Description

The function fit_PB() fits a P-spline univariate smoother [Eilers and Marx (1996)] to y against the x with prior weights weights.

Usage

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")

Arguments

x

the explanatory variable

y

the response

weights

possible prior weights (set to one by default)

data

the data frame where x, y and weights are coming from

xmin

the x minimum if different from min(x)

xmax

the x maximum if different from max(x)

nseg

the number of knots

lambda

the smotthing parameter

order

the ordr of the difference

degree

the degree of the piewise polynonmial

max.df

the maximum allowed degress of freedom

ylim

the ylim in the plot

plot

whether to plot the results

col.ribbon

the color in the se of the fitted values

Value

A object Psplines is produced with methods print(), coef() deviance(), fitted(), predict() and resid().

Note

The functionfit_PB() is an engine for getting the maximal correlation between two continuous variables. It can be also used on its own as a smoother.

Author(s)

Mikis Stasinopoulos

References

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. \Sexpr[results=rd]{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. \Sexpr[results=rd]{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/).

See Also

ACE

Examples

data(abdom)
m1 <- fit_PB(x,y, data=abdom)

gamlss.ggplots documentation built on May 29, 2024, 1:34 a.m.