sr.regression {SpatialNP} | R Documentation |
This function fits linear models to data using spatial signs or ranks.
sr.regression(formula, data=NULL, score = c("sign", "rank"), ae = TRUE, eps = 1e-06, na.action = na.fail)
formula |
a symbolic description of the model to be fit |
data |
an optional matrix or a data frame |
score |
a character string indicating which transformation of the observations should be used |
ae |
logical. Should the result be affine equivariant? |
eps |
tolerance for convergence |
na.action |
a function which indicates what should happen when the data contain 'NA's. Default is to fail. |
See formula
or lm
for more
details on specifying formulas.
The found matrix of coefficients β for a model
Y=X β^T+E
is the one that solves
X^T S(E(β))
where E(β) is the matrix of residuals corresponding to the choice of β and S(E(β) is the matrix of the chosen scores (signs or ranks) of those residuals.
The coefficient estimates found based on ranks (score = "rank"
)
are always for the model with the intercept term included and the
intercept is computed separately. To emphasize this when rank based
coefficients are computed without the intercept term there is a row of
NA
values in the result.
A matrix of estimated coefficients.
Jaakko Nevalainen, jaakko.nevalainen@uta.fi
A<-matrix(c(1,2,-3,4,3,-2,-1,0,4),ncol=3) X<-matrix(rt(150,1),ncol=3) Y<-X%*%t(A)+runif(150,-1,1) sr.regression(Y~X,data.frame(Y=Y,X=X),score="sign") sr.regression(Y~X,data.frame(Y=Y,X=X),score="rank")