Learn R Programming

ConSpline (version 1.2)

ConSpline-package: Partial Linear Least-squares Regression with Constrained Splines

Description

Given a continuous response y and a continuous predictor x, and a design matrix Z of parametrically-modeled covariates, the model y=f(x)+Zb+e is fit using least-squares cone projection. The function f is smooth and has one of eight user-defined shapes: increasing, decreasing, convex, concave, or combinations of monotonicity and convexity. Quadratic splines are used for increasing and decreasing, while cubic splines are used for the other six shapes.

Arguments

Details

Package: ConSpline
Type: Package
Version: 1.1
Date: 2015-08-27
License: GPL-2 | GPL-3

The function conspline fits the partial linear model. Given a response variable y, a continuous predictor x, and a design matrix Z of parametrically modeled covariates, this function solves a least-squares regression assuming that y=f(x)+Zb+e, where f is a smooth function with a user-defined shape. The shape is assigned with the argument type, where 1=increasing, 2=decreasing, 3=convex, 4=concave, 5=increasing and convex, 6=decreasing and convex, 7=increasing and concave, 8= decreasing and concave.

References

Meyer, M.C. (2008) Shape-Restricted Regression Splines, Annals of Applied Statistics, 2(3),1013-1033.

Examples

Run this code
# NOT RUN {
data(WhiteSpruce)
plot(WhiteSpruce$Diameter,WhiteSpruce$Height)
ans=conspline(WhiteSpruce$Height,WhiteSpruce$Diameter,7)
lines(sort(WhiteSpruce$Diameter),ans$muhat[order(WhiteSpruce$Diameter)])
# }

Run the code above in your browser using DataLab