pb | R Documentation |
Both pb
and pbs
are adaptations of function pb
and ps
from the gamlss
package, respectively, to specify penalized B-spline.
pb(x, df = NULL, lambda = NULL, control = pb.control(...), ...)
pb.control(inter = 20, degree = 3, order = 2, quantiles = FALSE, ...)
pbs(x, df = 3, lambda = NULL, ps.intervals = 20, degree = 3, order = 3)
x |
the univariate predictor. |
df |
the desidered equivalent number of degrees of freedom (trace of the smoother matrix minus two for the constant and linear fit. |
lambda |
the smoothing parameter. |
control |
setting the control parameters |
ps.intervals |
the number of break points in the x-axis. |
inter |
the number of break points (knots) in the x-axis. |
degree |
the degree of the piecewise polynomials. |
order |
the required difference in the vector of coefficients. |
quantiles |
if |
... |
for extra arguments. |
Basically, pb
is a reduced-functionality version of the original one specified in gamlss
with no performance iteration methods (i.e. by method
specification) implemented. The only method implemented minimizes the GAIC by internal optim
calls.
The function returns the vector x, which includes several attached attributes.
While x is directly used in building the model matrix, its attributes are crucial
for the backfitting procedure implemented by additive.fit()
Marco Enea, based on the original versions of the corresponding functions contained in the gamlss
package by Mikis Stasinopoulos and Bob Rigby.
#NOT RUN
#Example 1. The Dale's model
data(ulcer)
m1 <- pblm(fo1=cbind(pain,medication)~1, fo12=~I(operation=="vh"), RC.fo=~Col,
data=ulcer, weights=freq, contrasts=list(Col="contr.SAS"))
summary(m1)
# Example 2. An artificial data set:
set.seed(1234)
da <- expand.grid("Y1"=1:3,"Y2"=1:3,"fat1"=0:9,"fat2"=0:1)
da$x1 <- seq(-5,5,l=180)
da$x2 <- rnorm(180)
da$Freq <- sample(5:30,180,replace=TRUE)
m1 <- pblm(fo1=cbind(Y1,Y2) ~ pbs(x1) + fat2,
fo2=~pb(x1) + x2,
fo12=~pb(x1) + x2, data=da, weights=Freq)
plot(m1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.