Title: | Robust Marginal Integration Procedures |
---|---|
Description: | Three robust marginal integration procedures for additive models based on local polynomial kernel smoothers. As a preliminary estimator of the multivariate function for the marginal integration procedure, a first approach uses local constant M-estimators, a second one uses local polynomials of order 1 over all the components of covariates, and the third one uses M-estimators based on local polynomials but only in the direction of interest. For this last approach, estimators of the derivatives of the additive functions can be obtained. All three procedures can compute predictions for points outside the training set if desired. See Boente and Martinez (2017) <doi:10.1007/s11749-016-0508-0> for details. |
Authors: | Alejandra Martinez [aut, cre], Matias Salibian-Barrera [aut] |
Maintainer: | Alejandra Martinez <[email protected]> |
License: | GPL (>=3.0) |
Version: | 2.0.3 |
Built: | 2025-02-24 06:03:37 UTC |
Source: | https://github.com/alemermartinez/rmargint |
Robust marginal integration estimators for additive models.
Alejandra Martinez, Matias Salibian-Barrera
Maintainer: Alejandra Martinez <[email protected]>
Boente G. and Martinez A. (2017). Marginal integration M-estimators for additive models. TEST, 26, 231-260.
margint
This function returns the deviance of the fitted additive model using one of the three
classical or robust marginal integration estimators, as computed with margint.cl
or
margint.rob
.
## S3 method for class 'margint' deviance(object, ...)
## S3 method for class 'margint' deviance(object, ...)
object |
an object of class |
... |
additional other arguments. Currently ignored. |
A real number.
Alejandra Mercedes Martinez [email protected]
margint
This function returns the fitted values given the covariates of the original sample under an additive model using a classical or robust marginal integration procedure estimator computed with margint.cl
or margint.rob
.
## S3 method for class 'margint' fitted.values(object, ...)
## S3 method for class 'margint' fitted.values(object, ...)
object |
an object of class |
... |
additional other arguments. Currently ignored. |
A vector of fitted values.
Alejandra Mercedes Martinez [email protected]
Description of the additive model formula extracted from an object of class margint
.
## S3 method for class 'margint' formula(x, ...)
## S3 method for class 'margint' formula(x, ...)
x |
an object of class |
... |
additional other arguments. Currently ignored. |
A model formula.
Alejandra Mercedes Martinez [email protected]
This function evaluates an Epanechnikov kernel
k.epan(x)
k.epan(x)
x |
a vector of real numbers |
This function evaluates an Epanechnikov kernel.
A vector of the same length as x
where each entry is
0.75 * (1 - x^2)
if x < 1
and 0 otherwise.
Matias Salibian-Barrera, [email protected], Alejandra Martinez
x <- seq(-2, 2, length=10) k.epan(x)
x <- seq(-2, 2, length=10) k.epan(x)
This function evaluates a kernel of order 10. A kernel of order 10.
kernel10(x)
kernel10(x)
x |
A vector of real numbers. |
This function evaluates a kernel of order 10. A kernel L is a kernel of order 10 if it integrates 1, the integrals of u^j L(u) are 0 for 1 <= j < 10 (j integer) and the integral of u^10 L(u) is different from 0.
A vector of the same length as x
where each entry is 0.75 * ( 1 - x^2 ) * ( 315/128 - 105/32 * x^2 + 63/64 * x^4 - 3/32 * x^6 - 1/384 * x^8 )
and 0 otherwise.
Alejandra Martinez, [email protected], Matias Salibian-Barrera
x <- seq(-2,2,length=10) kernel10(x)
x <- seq(-2,2,length=10) kernel10(x)
This function evaluates a kernel of order 4.
kernel4(x)
kernel4(x)
x |
A vector of real numbers. |
This function evaluates a kernel of order 4. A kernel L is a kernel of order 4 if it integrates 1, the integrals of u^j L(u) are 0 for 1 <= j < 4 (j integer) and the integral of u^4 L(u) is different from 0.
A vector of the same length as x
where each entry is ( 15/32 ) * ( 1 - x^2 ) * ( 3 - 7 * x^2 )
if abs(x) < 1
and 0 otherwise.
Alejandra Martinez, [email protected], Matias Salibian-Barrera
x <- seq(-2,2,length=10) kernel4(x)
x <- seq(-2,2,length=10) kernel4(x)
This function evaluates a kernel of order 6.
kernel6(x)
kernel6(x)
x |
A vector of real numbers. |
This function evaluates a kernel of order 6. A kernel L is a kernel of order 6 if it integrates 1, the integrals of u^j L(u) are 0 for 1 <= j < 6 (j integer) and the integral of u^6 L(u) is different from 0.
A vector of the same length as x
where each entry is ( 105/256 ) * ( 1 - x^2 ) * ( 5 - 30 * x^2 + 33 * x^4 )
if abs(x) < 1
and 0 otherwise.
Alejandra Martinez, [email protected], Matias Salibian-Barrera
x <- seq(-2,2,length=10) kernel6(x)
x <- seq(-2,2,length=10) kernel6(x)
This function evaluates a kernel of order 8.
kernel8(x)
kernel8(x)
x |
A vector of real numbers. |
This function evaluates a kernel of order 8. A kernel L is a kernel of order 8 if it integrates 1, the integrals of u^j L(u) are 0 for 1 <= j < 8 (j integer) and the integral of u^8 L(u) is different from 0.
A vector of the same length as x
where each entry is ( 315/4096 ) * ( 1 - x^2 ) * ( 35 - 385 * x^2 + 1001 * x^4 - 715 * x^6 )
and 0 otherwise.
Alejandra Martinez, [email protected], Matias Salibian-Barrera
x <- seq(-2,2,length=10) kernel8(x)
x <- seq(-2,2,length=10) kernel8(x)
This function computes the standard marginal integration procedures for additive models.
margint.cl( formula, data, subset, point = NULL, windows, epsilon = 1e-06, prob = NULL, type = "0", degree = NULL, qderivate = FALSE, orderkernel = 2, Qmeasure = NULL )
margint.cl( formula, data, subset, point = NULL, windows, epsilon = 1e-06, prob = NULL, type = "0", degree = NULL, qderivate = FALSE, orderkernel = 2, Qmeasure = NULL )
formula |
an object of class |
data |
an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
point |
a matrix of points where predictions will be computed and returned. |
windows |
a vector or a squared matrix of bandwidths for the smoothing estimation procedure. |
epsilon |
convergence criterion. |
prob |
a vector of probabilities of observing each response (n). Defaults to |
type |
three different type of estimators can be selected: type |
degree |
degree of the local polynomial smoother in the direction of interest when using the estimator of type |
qderivate |
if TRUE, it calculates |
orderkernel |
order of the kernel used in the nuisance directions when using the estimator of type |
Qmeasure |
a matrix of points where the integration procedure ocurrs. Defaults to |
This function computes three types of classical marginal integration procedures for additive models, that is, considering a squared loss function.
A list with the following components:
mu |
Estimate for the intercept. |
g.matrix |
Matrix of estimated additive components (n by p). |
prediction |
Matrix of estimated additive components for the points listed in the argument point. |
mul |
A vector of size p showing in each component the estimated intercept that considers only that direction of interest when using the type |
g.derivative |
Matrix of estimated derivatives of the additive components (only when qderivate is |
prediction.derivate |
Matrix of estimated derivatives of the additive components for the points listed in the argument point (only when qderivate is |
Xp |
Matrix of explanatory variables. |
yp |
Vector of responses. |
formula |
Model formula |
Alejandra Martinez, [email protected], Matias Salibian-Barrera
Chen R., Hardle W., Linton O.B. and Severance-Lossin E. (1996). Nonparametric estimation of additive separable regression models. Physica-Verlag HD, Switzerland. Linton O. and Nielsen J. (1995). A kernel method of estimating structured nonparametric regression based on marginal integration. Biometrika, 82(1), 93-101. Severance-Lossin E. and Sperlich S. (1999). Estimation of derivatives for additive separable models. Statistics, 33(3), 241-265. Tjostheim D. and Auestad B. (1994). Nonparametric identification of nonlinear time series: Selecting significant lags. Journal of the American Statistical Association, 89(428), 1410-1430.
function.g1 <- function(x1) 24*(x1-1/2)^2-2 function.g2 <- function(x2) 2*pi*sin(pi*x2)-4 n <- 150 x1 <- runif(n) x2 <- runif(n) X <- cbind(x1, x2) eps <- rnorm(n,0,sd=0.15) regresion <- function.g1(x1) + function.g2(x2) y <- regresion + eps bandw <- matrix(0.25,2,2) set.seed(8090) nQ <- 80 Qmeasure <- matrix(runif(nQ*2), nQ, 2) fit.cl <- margint.cl(y ~ X, windows=bandw, type='alpha', degree=1, Qmeasure=Qmeasure)
function.g1 <- function(x1) 24*(x1-1/2)^2-2 function.g2 <- function(x2) 2*pi*sin(pi*x2)-4 n <- 150 x1 <- runif(n) x2 <- runif(n) X <- cbind(x1, x2) eps <- rnorm(n,0,sd=0.15) regresion <- function.g1(x1) + function.g2(x2) y <- regresion + eps bandw <- matrix(0.25,2,2) set.seed(8090) nQ <- 80 Qmeasure <- matrix(runif(nQ*2), nQ, 2) fit.cl <- margint.cl(y ~ X, windows=bandw, type='alpha', degree=1, Qmeasure=Qmeasure)
This function computes robust marginal integration procedures for additive models.
margint.rob( formula, data, subset, point = NULL, windows, prob = NULL, sigma.hat = NULL, win.sigma = NULL, epsilon = 1e-06, type = "0", degree = NULL, typePhi = "Huber", k.h = 1.345, k.t = 4.685, max.it = 20, qderivate = FALSE, orderkernel = 2, Qmeasure = NULL )
margint.rob( formula, data, subset, point = NULL, windows, prob = NULL, sigma.hat = NULL, win.sigma = NULL, epsilon = 1e-06, type = "0", degree = NULL, typePhi = "Huber", k.h = 1.345, k.t = 4.685, max.it = 20, qderivate = FALSE, orderkernel = 2, Qmeasure = NULL )
formula |
an object of class |
data |
an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
point |
a matrix of points where predictions will be computed and returned. |
windows |
a vector or a squared matrix of bandwidths for the smoothing estimation procedure. |
prob |
a vector of probabilities of observing each response (n). Defaults to |
sigma.hat |
estimate of the residual standard error. If |
win.sigma |
a vector of bandwidths for estimating sigma.hat. If |
epsilon |
convergence criterion. |
type |
three different type of estimators can be selected: type |
degree |
degree of the local polynomial smoother in the direction of interest when using the estimator of type |
typePhi |
one of either |
k.h |
tuning constant for a Huber-type loss function. Defaults to |
k.t |
tuning constant for a Tukey-type loss function. Defaults to |
max.it |
maximum number of iterations for the algorithm. |
qderivate |
if TRUE, it calculates |
orderkernel |
order of the kernel used in the nuisance directions when using the estimator of type |
Qmeasure |
a matrix of points where the integration procedure ocurrs. Defaults to |
This function computes three types of robust marginal integration procedures for additive models.
A list with the following components:
mu |
Estimate for the intercept. |
g.matrix |
Matrix of estimated additive components (n by p). |
sigma.hat |
Estimate of the residual standard error. |
prediction |
Matrix of estimated additive components for the points listed in the argument point. |
mul |
A vector of size p showing in each component the estimated intercept that considers only that direction of interest when using the type |
g.derivative |
Matrix of estimated derivatives of the additive components (only when qderivate is |
prediction.derivate |
Matrix of estimated derivatives of the additive components for the points listed in the argument point (only when qderivate is |
Xp |
Matrix of explanatory variables. |
yp |
Vector of responses. |
formula |
Model formula |
Alejandra Martinez, [email protected], Matias Salibian-Barrera
Boente G. and Martinez A. (2017). Marginal integration M-estimators for additive models. TEST, 26(2), 231-260. https://doi.org/10.1007/s11749-016-0508-0
function.g1 <- function(x1) 24*(x1-1/2)^2-2 function.g2 <- function(x2) 2*pi*sin(pi*x2)-4 set.seed(140) n <- 150 x1 <- runif(n) x2 <- runif(n) X <- cbind(x1, x2) eps <- rnorm(n,0,sd=0.15) regresion <- function.g1(x1) + function.g2(x2) y <- regresion + eps bandw <- matrix(0.25,2,2) set.seed(8090) nQ <- 80 Qmeasure <- matrix(runif(nQ*2), nQ, 2) fit.rob <- margint.rob(y ~ X, windows=bandw, type='alpha', degree=1, Qmeasure=Qmeasure)
function.g1 <- function(x1) 24*(x1-1/2)^2-2 function.g2 <- function(x2) 2*pi*sin(pi*x2)-4 set.seed(140) n <- 150 x1 <- runif(n) x2 <- runif(n) X <- cbind(x1, x2) eps <- rnorm(n,0,sd=0.15) regresion <- function.g1(x1) + function.g2(x2) y <- regresion + eps bandw <- matrix(0.25,2,2) set.seed(8090) nQ <- 80 Qmeasure <- matrix(runif(nQ*2), nQ, 2) fit.rob <- margint.rob(y ~ X, windows=bandw, type='alpha', degree=1, Qmeasure=Qmeasure)
This function calculates the Euclidean norm of a vector.
my.norm.2(x)
my.norm.2(x)
x |
A real vector. |
The Euclidean norm of the input vector.
Matias Salibian-Barrera, [email protected], Alejandra Martinez
x <- seq(-2, 2, length=10) my.norm.2(x)
x <- seq(-2, 2, length=10) my.norm.2(x)
margint
Plot method for class margint
.
## S3 method for class 'margint' plot(x, derivative = FALSE, which = 1:np, ask = FALSE, ...)
## S3 method for class 'margint' plot(x, derivative = FALSE, which = 1:np, ask = FALSE, ...)
x |
an object of class |
derivative |
if TRUE, it plots the q-th derivatives. Defaults to FALSE. |
which |
vector of indices of explanatory variables for which partial residuals plots will be generated. Defaults to all available explanatory variables. |
ask |
logical value. If |
... |
additional other arguments. |
Alejandra Mercedes Martinez [email protected]
function.g1 <- function(x1) 24*(x1-1/2)^2-2 function.g2 <- function(x2) 2*pi*sin(pi*x2)-4 set.seed(140) n <- 150 x1 <- runif(n) x2 <- runif(n) X <- cbind(x1, x2) eps <- rnorm(n,0,sd=0.15) regresion <- function.g1(x1) + function.g2(x2) y <- regresion + eps bandw <- matrix(0.25,2,2) set.seed(8090) nQ <- 80 Qmeasure <- matrix(runif(nQ*2), nQ, 2) fit.rob <- margint.rob(y ~ X, windows=bandw, type='alpha', degree=1, Qmeasure=Qmeasure) plot(fit.rob, which=1)
function.g1 <- function(x1) 24*(x1-1/2)^2-2 function.g2 <- function(x2) 2*pi*sin(pi*x2)-4 set.seed(140) n <- 150 x1 <- runif(n) x2 <- runif(n) X <- cbind(x1, x2) eps <- rnorm(n,0,sd=0.15) regresion <- function.g1(x1) + function.g2(x2) y <- regresion + eps bandw <- matrix(0.25,2,2) set.seed(8090) nQ <- 80 Qmeasure <- matrix(runif(nQ*2), nQ, 2) fit.rob <- margint.rob(y ~ X, windows=bandw, type='alpha', degree=1, Qmeasure=Qmeasure) plot(fit.rob, which=1)
margint
This function returns the fitted values given the covariates of the original sample under an additive model using a classical or robust marginal integration procedure estimator computed with margint.cl
or margint.rob
.
## S3 method for class 'margint' predict(object, ...)
## S3 method for class 'margint' predict(object, ...)
object |
an object of class |
... |
additional other arguments. Currently ignored. |
A vector of fitted values.
Alejandra Mercedes Martinez [email protected]
The default print method for a margint
object.
## S3 method for class 'margint' print(x, ...)
## S3 method for class 'margint' print(x, ...)
x |
an object of class |
... |
additional other arguments. Currently ignored. |
A real number.
Alejandra Mercedes Martinez [email protected]
This function evaluates the first derivative of Huber's loss function.
psi.huber(r, k = 1.345)
psi.huber(r, k = 1.345)
r |
A vector of real numbers. |
k |
A positive tuning constant. |
This function evaluates the first derivative of Huber's loss function.
A vector of the same length as r
.
Matias Salibian-Barrera, [email protected], Alejandra Martinez
x <- seq(-2, 2, length=10) psi.huber(r=x, k = 1.5)
x <- seq(-2, 2, length=10) psi.huber(r=x, k = 1.5)
This function evaluates the first derivative of Tukey's bi-square loss function.
psi.tukey(r, k = 4.685)
psi.tukey(r, k = 4.685)
r |
A vector of real numbers |
k |
A positive tuning constant. |
This function evaluates the first derivative of Tukey's bi-square loss function.
A vector of the same length as r
.
Matias Salibian-Barrera, [email protected], Alejandra Martinez
x <- seq(-2, 2, length=10) psi.tukey(r=x, k = 1.5)
x <- seq(-2, 2, length=10) psi.tukey(r=x, k = 1.5)
margint
This function returns the residuals of the fitted additive model using one of the three
classical or robust marginal integration estimators, as computed with margint.cl
or
margint.rob
.
## S3 method for class 'margint' residuals(object, ...)
## S3 method for class 'margint' residuals(object, ...)
object |
an object of class |
... |
additional other arguments. Currently ignored. |
A vector of residuals.
Alejandra Mercedes Martinez [email protected]
Summary method for class margint
.
## S3 method for class 'margint' summary(object, ...)
## S3 method for class 'margint' summary(object, ...)
object |
an object of class |
... |
additional other arguments. |
This function returns the estimation of the intercept and also the five-number summary and the mean of the residuals for both classical and robust estimators. For the robust estimator it also returns the estimate of the residual standard error.
Alejandra Mercedes Martinez [email protected]