Title: | Smooth-Rough Partitioning of the Regression Coefficients |
Version: | 1.2.0 |
Description: | Performs the change-point detection in regression coefficients of linear model by partitioning the regression coefficients into two classes of smoothness. The change-point and the regression coefficients are jointly estimated. |
Depends: | R (≥ 3.4.0) |
License: | GPL-2 | GPL-3 [expanded from: GPL] |
LazyData: | true |
Imports: | fda, mgcv |
Encoding: | UTF-8 |
NeedsCompilation: | no |
RoxygenNote: | 6.1.0 |
Packaged: | 2019-04-18 16:10:47 UTC; maengh |
Author: | Hyeyoung Maeng [aut, cre], Piotr Fryzlewicz [aut] |
Maintainer: | Hyeyoung Maeng <h.maeng@lse.ac.uk> |
Repository: | CRAN |
Date/Publication: | 2019-04-24 08:40:03 UTC |
srp: Detecting the change-point of smoothness in linear regression coefficients
Description
The srp package performs the change-point detection in regression coefficients of a linear model by partitioning the regression coefficients into two classes of smoothness. To start with, see the function srp.c
.
Author(s)
Hyeyoung Maeng, h.maeng@lse.ac.uk
References
"Regularised forecasting via smooth-rough partitioning of the regression coefficients", H. Maeng and P. Fryzlewicz (2018), preprint.
See Also
The natural cubic spline interpolation
Description
This function performs the natural cubic spline interpolation of a design matrix.
Usage
ncs(x)
Arguments
x |
The design matrix. |
Details
Usually only called by srp.c
and srp.l
.
Value
cf0 |
The coefficient matrix for B-splines obtained by natural cubic spline interpolation of |
Author(s)
Hyeyoung Maeng, h.maeng@lse.ac.uk
See Also
Examples
x <- matrix(rnorm(100), ncol=10)
ncs(x)$cf0
The Smooth-Rough Partition model prediction
Description
This function performs the predictions from the results of Smooth-Rough Partition fitting.
Usage
## S3 method for class 'srp.c'
predict(object, x, ...)
Arguments
object |
An object of class either 'srp.c', returned by |
x |
A new matrix you wish to fit Smooth-Rough Partition model. The dimension of row is the number of covariates. |
... |
Further parameters that can be passed to |
Details
The Smooth-Rough Partition model is described in "Regularised forecasting via smooth-rough partitioning of the regression coefficients", H. Maeng and P. Fryzlewicz (2018), preprint.
Value
yhat |
The vector of predicted values. |
Author(s)
Hyeyoung Maeng, h.maeng@lse.ac.uk
See Also
The Smooth-Rough Partition model prediction
Description
This function performs the predictions from the results of Smooth-Rough Partition fitting.
Usage
## S3 method for class 'srp.l'
predict(object, x, ...)
Arguments
object |
An object of class 'srp.l', returned by |
x |
A new matrix you wish to fit Smooth-Rough Partition model. The dimension of row is the number of covariates. |
... |
Further parameters that can be passed to |
Details
The Smooth-Rough Partition model is described in "Regularised forecasting via smooth-rough partitioning of the regression coefficients", H. Maeng and P. Fryzlewicz (2018), preprint.
Value
yhat |
The vector of predicted values. |
Author(s)
Hyeyoung Maeng, h.maeng@lse.ac.uk
See Also
Optimisation of the Smooth-Rough Partition model
Description
This function performs the optimisation of the number of unconstrained regression parameters in Smooth-Rough Partition model by minimising SIC criterion and gives the change-point of smoothness in regression parameters.
Usage
sic.c(x.basis = x.basis, B.basis = B.basis, x = x, y = y,
cf0 = cf0, maxq = maxq, fixedq = F, L = L, inisp = inisp)
Arguments
x.basis |
The b-spline basis defined for interpolated x in |
B.basis |
The b-spline basis defined for constrained regression coefficient. |
x |
The design matrix used in |
y |
The response variable used in |
cf0 |
The coefficient matrix obtained by natural cubic spline interpolation of x in |
maxq |
The maximum number of unconstrained parameters if |
fixedq |
If TRUE, |
L |
The dimension of b-spline expansion for constrained parameters used in |
inisp |
The initial value for the optimisation of tuning parameters in |
Details
Usually only called by srp.c
.
Value
The following components are obtained only when fixedq
is FALSE:
qhat |
The optimal number of unconstrained parameters. |
sicq |
The vector of Schwarz criterion with length |
The following components are obtained only when fixedq
is TRUE:
muhat |
The estimator of constant parameter. |
bhat |
The vector of evaluated constrained functional regression coefficient. |
ahat |
The vector of unconstrained regression coefficient estimators. |
etahat |
The vector containing both |
yhat |
The vector of estimated response variable. |
sp |
The vector of two tuning parameters estimated by minimising generalised cross validation (GCV). |
L |
The number of b-spline bases used for constrained regression parameters. |
Author(s)
Hyeyoung Maeng, h.maeng@lse.ac.uk
See Also
Examples
library(fda)
x <- matrix(rnorm(10000), ncol=100)
y <- matrix(rnorm(100), ncol=1)
p <- dim(x)[1] + 1
t <- seq(0, 1, length.out=dim(x)[1])*(dim(x)[1])
x.basis <- as.fd(splinefun(t, x[, 1], method="natural"))$basis
B.basis <- create.bspline.basis(rangeval=c(0, dim(x)[1]), norder=4, nbasis=35)
result <- sic.c(x.basis=x.basis, B.basis=B.basis, x=x, y=y, cf0=ncs(x)$cf0, maxq=10, L=35, inisp=1)
plot(result$sicq, type="b")
Optimisation of the (simpler) Smooth-Rough Partition model
Description
This function performs the optimisation of the number of unconstrained regression parameters in (simpler) Smooth-Rough Partition model by minimising SIC criterion and gives the change-point in regression parameters.
Usage
sic.l(x.basis = x.basis, M.basis = M.basis, x = x, y = y,
cf0 = cf0, maxq = maxq, fixedq = F)
Arguments
x.basis |
The b-spline basis defined for interpolated x in |
M.basis |
The monomial basis defined for constrained regression coefficient. |
x |
The design matrix used in |
y |
The response variable used in |
cf0 |
The coefficient matrix obtained by natural cubic spline interpolation of x in |
maxq |
The maximum number of unconstrained parameters if |
fixedq |
If TRUE, |
Details
Usually only called by srp.l
.
Value
The following components are obtained only when fixedq
is FALSE:
qhat |
The optimal number of unconstrained parameters. |
sicq |
The vector of Schwarz criterion with length |
The following components are obtained only when fixedq
is TRUE:
muhat |
The estimator of constant parameter. |
bhat |
The vector of evaluated constrained functional regression coefficient. |
ahat |
The vector of unconstrained regression coefficient estimators. |
etahat |
The vector containing both |
yhat |
The vector of estimated response variable. |
Author(s)
Hyeyoung Maeng, h.maeng@lse.ac.uk
See Also
Examples
library(fda)
x <- matrix(rnorm(10000), ncol=100)
y <- matrix(rnorm(100), ncol=1)
p <- dim(x)[1] + 1
t <- seq(0, 1, length.out=dim(x)[1])*(dim(x)[1])
x.basis <- as.fd(splinefun(t, x[, 1], method="natural"))$basis
M.basis <- create.monomial.basis(rangeval=c(0, dim(x)[1]), nbasis=2)
result <- sic.l(x.basis=x.basis, M.basis=M.basis, x=x, y=y, cf0=ncs(x)$cf0, maxq=10)
plot(result$sicq, type="b")
The Smooth-Rough Partition model fitting
Description
This function performs the Smooth-Rough Partition linear regression with the input matrix.
Usage
srp.c(x, y, maxq = max(30, ceiling(0.1 * dim(x)[1])), L = 35,
norder = 4, inisp = 1, plot = T)
Arguments
x |
A matrix you wish to fit Smooth-Rough Partition model. The dimension of row is the number of variables which are pre-ordered in terms of their importance in prediction. |
y |
A vector you wish to use as a response variable in case of regressing |
maxq |
An integer specifying the maximum number of unconstrained parameters which the model can have. The default is max(30, ceiling(0.1*dim(x)[1])). |
L |
An integer specifying the dimension of b-spline expansion for the constrained (smoothed) parameters. The default is 35. |
norder |
An integer specifying the order of b-splines. The default of 4 performs cubic splines. |
inisp |
An initial value for optimising the tuning parameters and the default is 1. |
plot |
If true, it gives the plot of estimated regression coefficients. |
Details
The estimation procedure of Smooth-Rough Partition model is described in "Regularised forecasting via smooth-rough partitioning of the regression coefficients", H. Maeng and P. Fryzlewicz (2018), preprint.
Value
muhat |
The estimator of constant parameter. |
bhat |
The vector of evaluated constrained functional regression coefficient. |
ahat |
The vector of unconstrained regression coefficient estimators. |
etahat |
The vector containing both |
yhat |
The vector of estimated response variable. |
SIC |
The vector of Schwarz criterion with length |
qhat |
The optimal number of unconstrained parameters selected in the model. |
sp |
The vector of two tuning parameters estimated by minimising generalised cross validation (GCV). |
L |
The number of bases used for constrained regression parameters. |
norder |
The order of b-splines specified. |
Author(s)
Hyeyoung Maeng, h.maeng@lse.ac.uk
See Also
Examples
x <- matrix(rnorm(10000), ncol=100)
srp.c(x)
The (simpler) Smooth-Rough Partition linear regression model fitting
Description
This function performs same as srp.c
except that constrained functional coefficient is estimated as a linear function.
Usage
srp.l(x, y, maxq = max(30, ceiling(0.1 * dim(x)[1])), plot = T)
Arguments
x |
A matrix you wish to fit Smooth-Rough Partition model. The dimension of row is the number of variables which are pre-ordered in terms of their importance in prediction. |
y |
A vector you wish to use as a response variable in case of regressing |
maxq |
An integer specifying the maximum number of unconstrained parameters which the model can have. The default is max(30, ceiling(0.1*dim(x)[1])). |
plot |
If true, it gives the plot of estimated regression coefficients. |
Details
The estimation procedure of Smooth-Rough Partition model is described in "Regularised forecasting via smooth-rough partitioning of the regression coefficients", H. Maeng and P. Fryzlewicz (2018), preprint.
Value
muhat |
The estimator of constant parameter. |
bhat |
The vector of evaluated constrained (linear) functional regression coefficient. |
ahat |
The vector of unconstrained regression coefficient estimators. |
etahat |
The vector containing both |
yhat |
The vector of estimated response variable. |
SIC |
The vector of Schwarz criterion with length |
qhat |
The optimal number of unconstrained parameters selected in the model. |
Author(s)
Hyeyoung Maeng, h.maeng@lse.ac.uk
See Also
Examples
x <- matrix(rnorm(10000), ncol=100)
srp.l(x)
A dataset containing true regression coefficients for simulation
Description
True regression coefficients used for simulations in "Regularised forecasting via smooth-rough partitioning of the regression coefficients", H. Maeng and P. Fryzlewicz (2018), preprint.
Usage
data(truebeta)
Format
A matrix with 356 rows and 4 variables:
- Case 1
true regression coefficients for case 1
- Case 2
true regression coefficients for case 2
- Case 3
true regression coefficients for case 3
- Case 4
true regression coefficients for case 4