sprms(formula, data, a, eta, fun = "Hampel", probp1 = 0.95, hampelp2 = 0.975,
hampelp3 = 0.999, center = "median", scale = "qn", print = FALSE,
numit = 100, prec = 0.01)
"Hampel"
(preferred), "Huber"
or "Fair"
.fun="Hampel"
.fun="Hampel"
."mean"
or "median"
."sd"
or "qn"
or alternatively "no"
for no scaling.FALSE
. If TRUE
the variables included in each component are reported.Functions summary
, predict
and plot
are available. Also the generic functions coefficients
, fitted.values
and residuals
can be used to extract the corresponding elements from the sprm object.
w=wy*wt
.scores=Xs%*%R
.a
is the number of components in the model. Note that it is not possible to simply reduce the number of weighting vectors to obtain a model with a smaller number of components. Each model has to be estimated separately due to its dependence on robust case weights.
Serneels, S., Croux, C., Filzmoser, P., Van Espen, P.J. (2005). Partial Robust M-Regression. Chemometrics and Intelligent Laboratory Systems, 79, 55-64.
sprmsCV
, plot.sprm
, biplot.sprm
, predict.sprm
, prms
set.seed(50235)
U1 <- c(rep(3,20), rep(4,30))
U2 <- rep(3.5,50)
X1 <- replicate(5, U1+rnorm(50))
X2 <- replicate(20, U2+rnorm(50))
X <- cbind(X1,X2)
beta <- c(rep(1, 5), rep(0,20))
e <- c(rnorm(45,0,1.5),rnorm(5,-20,1))
y <- X%*%beta + e
d <- as.data.frame(X)
d$y <- y
mod <- sprms(y~., data=d, a=1, eta=0.5, fun="Hampel")
sprmfit <- predict(mod)
plot(y,sprmfit, main="SPRM")
abline(0,1)
Run the code above in your browser using DataLab