Description Usage Arguments Value Author(s) References Examples
Returns an object of class "plaqr"
and "rq"
that represents a quantile regression fit. A nonlinear term z is transformed using bs(z)
before fitting the model. The formula of the model (as it appears in R
) becomes y~ x1 + x2 + bs(z1) + bs(z2)
where bs(z1)
is a B-spline.
1 2 3 |
formula |
a formula object, with the response on the left of a |
nonlinVars |
a one-sided formula object, with a |
tau |
the quantile to be estimated, this is a number strictly between 0 and 1 (for now). |
data |
a data.frame in which to interpret the variables named in the formula, or in the subset and the weights argument. If this is missing, then the variables in the formula should be on the search list. This may also be a single number to handle some special cases – see below for details. |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
weights |
vector of observation weights; if supplied, the algorithm fits to minimize the sum of the weights multiplied into the absolute residuals. The length of weights must be the same as the number of observations. The weights must be nonnegative and it is strongly recommended that they be strictly positive, since zero weights are ambiguous. |
na.action |
a function to filter missing data.
This is applied to the model.frame after any subset argument has been used.
The default (with |
model |
if TRUE then the model frame is returned. This is essential if one wants to call summary subsequently. |
method |
the algorithmic method used to compute the fit. There are several
options: The default method is the modified version of the
Barrodale and Roberts algorithm for l1-regression,
used by |
contrasts |
a list giving contrasts for some or all of the factors
default = |
splinesettings |
a list of length equal to the number of nonlinear effects containing arguments to pass to the |
... |
additional arguments for the fitting routines
(see the |
Returns the following:
coefficients |
Coefficients from the fitted model |
x |
optionally the model matrix, if |
y |
optionally the response, if |
residuals |
the residuals from the fit. |
dual |
the vector dual variables from the fit. |
fitted.values |
fitted values from the fit. |
formula |
the formula that was used in the |
rho |
the value of the objective function at the solution. |
model |
optionally the model frame, if |
linear |
the linear terms used in the model fit. |
nonlinear |
the nonlinear terms used in the model fit. |
z |
the values of the nonlinear terms. |
Adam Maidman
Hastie, T. J. (1992) Generalized additive models. Chapter 7 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.
Koenker, R. W. (2005). Quantile Regression, Cambridge U. Press.
Sherwood, B. and Wang, L. (2016). Partially linear additive quantile regression in ultra-high dimension. The Annals of Statistics 44, 288-317.
Maidman, A., Wang, L. (2017). New Semiparametric Method for Predicting High-Cost Patients. Preprint.
1 2 3 4 5 6 7 8 9 10 11 12 | data(simData)
ss <- vector("list", 2)
ss[[2]]$degree <- 5
ss[[2]]$Boundary.knots <- c(-1, 1)
plaqr(y~., nonlinVars=~z1+z2, data=simData)
#same as plaqr(formula= y~x1+x2+x3, nonlinVars=~z1+z2, data=simData)
plaqr(y~0, nonlinVars=~z1+z2, data=simData, splinesettings=ss) #no linear terms in the model
plaqr(y~., data=simData) #all linear terms
|
Loading required package: quantreg
Loading required package: SparseM
Attaching package: 'SparseM'
The following object is masked from 'package:base':
backsolve
Loading required package: splines
Call:
plaqr(formula = y ~ ., nonlinVars = ~z1 + z2, data = simData)
Coefficients:
(Intercept) x1 x2 x3 bs(z1)1 bs(z1)2
-5.655792 3.502119 1.734125 1.919248 19.309354 -17.410101
bs(z1)3 bs(z2)1 bs(z2)2 bs(z2)3
2.152656 7.806139 1.278381 8.891872
Degrees of freedom: 100 total; 90 residual
Call:
plaqr(formula = y ~ 0, nonlinVars = ~z1 + z2, data = simData,
splinesettings = ss)
Coefficients:
(Intercept)
-3.7242930
bs(z1)1
23.0419424
bs(z1)2
-18.9673497
bs(z1)3
2.8660628
bs(z2, degree = 5, Boundary.knots = c(-1, 1))1
-0.2675056
bs(z2, degree = 5, Boundary.knots = c(-1, 1))2
14.0909702
bs(z2, degree = 5, Boundary.knots = c(-1, 1))3
-9.4923466
bs(z2, degree = 5, Boundary.knots = c(-1, 1))4
9.8296028
bs(z2, degree = 5, Boundary.knots = c(-1, 1))5
8.2595997
Degrees of freedom: 100 total; 91 residual
Call:
plaqr(formula = y ~ ., data = simData)
Coefficients:
(Intercept) x1 x2 x3 z1 z2
4.741973 4.218701 1.719575 1.731902 -10.309600 3.800588
Degrees of freedom: 100 total; 94 residual
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.