Fits a penalized spline to the supplied data.
heavyPS(x, y, family = Student(df = 4), nseg = 20, deg = 3, ord = 2,
lambda = 1, method = c("GCV", "none"), ngrid = 200, control)
vectors giving the coordinates of the points in the scatter plot. Missing values are deleted.
a description of the error distribution to be used in the model. By default the Student-t distribution with 4 degrees of freedom is considered.
number of segments used to divide the domain, this information is required to construct the sequence of knots. Default value is 20.
the degree of the spline transformation. Must be a nonnegative integer. The default value is 3. The polynomial degree should be a small integer, usually 0, 1, 2, or 3. Larger values are rarely useful.
the order of the roughness penalty. Default value is 2.
specifies the smoothing parameter for the fit. It is fixed if method="none"
.
If method="GCV"
then weighted generalized cross validation is used to choose an "optimal"
smoothing parameter. The default value is 1.
the method for choosing the smoothing parameter lambda
. If method="none"
,
then lambda
is 'fixed'. If method="GCV"
(the default) then the smoothing parameter is chosen
automatically using the weighted generalized cross validation criterion.
number of elements in the grid used to compute the smoother. Only required to plot the fitted P-spline.
a list of control values for the estimation algorithm to replace
the default values returned by the function heavy.control
.
an object of class heavyPS
representing the fitted model. Generic
functions print
and summary
, show the results of the fit.
The following components must be included in a legitimate heavyPS
object.
a list containing an image of the heavyPS
call that produced the object.
a list containing the B-spline basis matrix, the triangular factor of the penalty matrix and a numeric vector of knot positions with non-decreasing values.
one of "GCV" or "none", depending on the fitting criterion used.
the heavy.family
object used in the fitting process.
final estimate of the coefficients vector.
final scale estimate of the random error.
estimated smoothing parameter for the model (if requested).
fitted model predictions of expected value for each datum.
the residuals for the fitted model.
the penalized log-likelihood at convergence.
the effective number of parameters.
the minimized smoothing parameter selection score (weighted GCV).
the penalty term at convergence.
the number of iterations used in the iterative algorithm.
estimated weights corresponding to the assumed heavy-tailed distribution.
squared of scaled residuals.
grid of x-values used to fit the P-spline.
estimated curve on the x-grid, required to plot the fitted P-spline.
estimated shape parameters, only available if requested.
Eilers, P.H.C., and Marx, B.D. (1996). Flexible smoothing using B-splines and penalties (with discussion). Statistical Science 11, 89-121.
Osorio, F. (2016). Influence diagnostics for robust P-splines using scale mixture of normal distributions. Annals of the Institute of Statistical Mathematics 68, 589-619.
# NOT RUN {
data(life)
x <- life$income
y <- life$life
fit <- heavyPS(x, y, family = Student(df = 5), method = "GCV")
summary(fit)
par(pty = "s")
plot(x, y, xlab = "Per Capita Income", ylab = "Life Expectancy")
lines(fit$xgrid, fit$ygrid)
# }
Run the code above in your browser using DataLab