Title: | Robust Regression Functions |
---|---|
Description: | Linear regression functions using Huber and bisquare psi functions. Optimal weights are calculated using IRLS algorithm. |
Authors: | Ian M. Johnson <[email protected]> |
Maintainer: | Ian M. Johnson <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1-11 |
Built: | 2024-12-07 06:43:05 UTC |
Source: | CRAN |
Predict y vector from X design matrix and b vector
fit_rcpp(X,b)
fit_rcpp(X,b)
X |
Design matrix |
b |
Estimates of beta |
Ian M. Johnson
j <- rep(1, 5) x1 <- rnorm(5) x2 <- rnorm(5, 10, 20) X = as.matrix(data.frame(j, x1, x2)) b <- 1:3 fit_rcpp(X, b)
j <- rep(1, 5) x1 <- rnorm(5) x2 <- rnorm(5, 10, 20) X = as.matrix(data.frame(j, x1, x2)) b <- 1:3 fit_rcpp(X, b)
Rcpp fast implementation of median absolute deviation (MAD)
mad_rcpp(r,scale_factor = 1.4826)
mad_rcpp(r,scale_factor = 1.4826)
r |
A numeric vector |
scale_factor |
Scale factor |
Ian M. Johnson
mad(1:100)
mad(1:100)
Rcpp fast implementation of median
median_rcpp(x)
median_rcpp(x)
x |
A numeric vector containing the values whose median is to be computed. |
Ian M. Johnson
median_rcpp(1:100)
median_rcpp(1:100)
Rcpp fast implementation of Tukey's Bisquare psi function
psiBS_rcpp(r,c)
psiBS_rcpp(r,c)
r |
A numeric vector |
c |
Tuning constant |
Ian M. Johnson
## Not run: psiBS_rcpp(r,c) ## End(Not run)
## Not run: psiBS_rcpp(r,c) ## End(Not run)
Rcpp fast implementation of Huber's Psi Function
psiHuber_rcpp(r,c)
psiHuber_rcpp(r,c)
r |
A numeric vector |
c |
Tuning constant |
Ian M. Johnson
## Not run: psiHuber_rcpp(r,c) ## End(Not run)
## Not run: psiHuber_rcpp(r,c) ## End(Not run)
Using iteratively reweighted least squares (IRLS), the function calculates the optimal weights to perform m-estimator or bounded influence regression. Returns robust beta estimates, mean squared error (MSE) and prints robust ANOVA table.
robustRegBS(formula,data,tune=4.685,m=TRUE,max.it=1000,tol=1e-5,anova.table=FALSE)
robustRegBS(formula,data,tune=4.685,m=TRUE,max.it=1000,tol=1e-5,anova.table=FALSE)
formula |
Model |
data |
A data frame containing the variables in the model. |
tune |
Tuning Constant. Default value of 4.685 is 95% asymptotically efficient against outliers |
m |
If |
max.it |
Maximum number of iterations to achieve convergence in IRLS algorithm |
tol |
Tolerance level in determining convergence |
anova.table |
If |
M-estimates of beta should be used when evaluating least squares estimates of beta and diagnostics show outliers. Least squares estimates of beta should be used as starting points to achieve convergence.
Bounded influence estimates of beta should be used when evaluating least squares estimates of beta and diagnostics show large values of the "Hat Matrix" diagonals and outliers.
Original package written in 2006
Ian M. Johnson
Tukey,
Birch, Robust F-Test, 1983
robustRegH()
data(stackloss) robustRegBS(stack.loss~Air.Flow+Water.Temp,data=stackloss) #If X matrix contained large values of H matrix (high influence points) robustRegBS(stack.loss~Air.Flow+Water.Temp,data=stackloss,m=FALSE)
data(stackloss) robustRegBS(stack.loss~Air.Flow+Water.Temp,data=stackloss) #If X matrix contained large values of H matrix (high influence points) robustRegBS(stack.loss~Air.Flow+Water.Temp,data=stackloss,m=FALSE)
Using iteratively reweighted least squares (IRLS), the function calculates the optimal weights to perform m-estimator or bounded influence regression. Returns robust beta estimates, mean squared error (MSE) and prints robust ANOVA table
robustRegH(formula,data,tune=1.345,m=TRUE,max.it=1000,tol=1e-5,anova.table=FALSE)
robustRegH(formula,data,tune=1.345,m=TRUE,max.it=1000,tol=1e-5,anova.table=FALSE)
formula |
Model |
data |
A data frame containing the variables in the model. |
tune |
Tuning Constant. Default value of 1.345 is 95% asymptotically efficient against outliers |
m |
If |
max.it |
Maximum number of iterations to achieve convergence in IRLS algorithm |
tol |
Tolerance level in determining convergence |
anova.table |
If |
M-estimates of beta should be used when evaluating least squares estimates of beta and diagnostics show outliers. Least squares estimates of beta are used as starting points to achieve convergence.
Bounded influence estimates of beta should be used when evaluating least squares estimates of beta and diagnostics show large values of the "Hat Matrix" diagonals and outliers.
Original package written in 2006
Ian M. Johnson
P. J. Huber (1981) Robust Statistics. Wiley.
Birch (1983) Robust F-Test
robustRegBS()
data(stackloss) robustRegH(stack.loss~Air.Flow+Water.Temp,data=stackloss) #If X matrix contained large values of H matrix (high influence points) robustRegH(stack.loss~Air.Flow+Water.Temp,data=stackloss,m=FALSE)
data(stackloss) robustRegH(stack.loss~Air.Flow+Water.Temp,data=stackloss) #If X matrix contained large values of H matrix (high influence points) robustRegH(stack.loss~Air.Flow+Water.Temp,data=stackloss,m=FALSE)