Learn R Programming

MNM (version 0.95-0)

mv.l1lm: Linear Regression Based on Identity, Spatial Sign or Spatial Rank Scores

Description

This function fits a multivariate linear regression model based on identity, spatial sign or spatial rank scores. Both inner and outer standardization are possible.

Usage

mv.l1lm(formula, scores = "identity", stand = "outer", 
        maxiter = 1000, eps = 1e-06, eps.S = 1e-06, 
        x = TRUE, y = TRUE, data, subset, na.action)

Arguments

Value

  • mv.l1ml returns an object of 'class' mvl1lm. The functions summary is the best choice to view the results. The generic accessor functions coefficients, fitted, residuals and vcov extract various useful features of the value returned by mv.l1ml. An object of class mv.l1ml is a list wich contains different information depending on the scores and standardization used. To see its content use the function str.

code

cbind

Details

The theory behind this function is described in detail in Chapter 13 of the MNM book. For regular multivariate L2-regression the function lm might be more efficient and offers more methods. Note however that the results given by lm and mv.l1lm may differ slightly due to different divisors of the covariance matrix. The algorithms for the sign and rank scores are still in an early phase and therefore any feedback is very welcome. For example if p+1 residuals are 0, then the algorithms may not return correct values. Note also that the computations for rank scores might be slow. Rank regression does not provide an estimate for the intercept parameter is not considered a parameter, a Hodges-Lehmann estimator of the residuals is then an estimate when an interecept term is in the formula. For the one sample case however the function cannot be used for rank scores. We recommend that the regression function should not be used for the one or two sample case. There are distinct functions designed for that purpose. Note furthermore that in the two sample case the covariance matrix returned from the regression function differs slightly from the one returned by the function mv.2sample.est since there matrix A is computed in a different way. In general it is recommended to use the data argument and specify there the data frame that contains the variables and matrices. For having a matrix Y in a data frame for example the following methods work:
{ MyData <- data.frame(I(Y),...) or } { MyData <- data.frame(...) MyData$Y <- Y }

References

Oja, H. (2010), Multivariate Nonparametric Methods with R, Springer.

See Also

lm, mv.1sample.est, mv.1sample.test, mv.2sample.est, mv.Csample.test

Examples

Run this code
# creating simple data

X <- cbind(rep(1,100),rmvnorm(100,c(0,0,0)) )
B <- matrix(c(4,1,1,0.5,-3,2,2,2),ncol=4, byrow=TRUE)
Y <- X %*% t(B)+ rmvnorm(100,c(0,0), diag(0.2,2))
DAT <- data.frame(x1=X[,2],x2=X[,3], x3=X[,4], Y=I(Y))

# true B
t(B)

# example using identity scores
test1 <- mv.l1lm(Y ~ x1 + x2 + x3, data=DAT)

print(test1)
summary(test1)
coef(test1)
vcov(test1)
head(fitted(test1))
head(residuals(test1))

# example using outer sign scores
test2 <- mv.l1lm(Y ~ x1 + x2 + x3, scores= "s", data=DAT)

print(test2)
summary(test2)
coef(test2)
vcov(test2)
head(fitted(test2))
head(residuals(test2))

# example using inner sign scores
test3 <- mv.l1lm(Y ~ x1 + x2 + x3, scores= "s", stand="i", 
data=DAT)

print(test3)
summary(test3)
coef(test3)
vcov(test3)
head(fitted(test3))
head(residuals(test3))

# example using outer rank scores
test4 <- mv.l1lm(Y ~ x1 + x2 + x3, scores= "r", stand="o", 
data=DAT)

print(test4)
summary(test4)
coef(test4)
vcov(test4)
head(fitted(test4))
head(residuals(test4))

# example using inner rank scores
test5 <- mv.l1lm(Y ~ x1 + x2 + x3, scores= "r", stand="i", 
data=DAT)

print(test5)
summary(test5)
coef(test5)
vcov(test5)
head(fitted(test5))
head(residuals(test5))

# prediction

newData <- data.frame(x1=c(1,-2),x2=c(0.5,0.7), x3=c(-1,-1))
newData
predict(test1,newData)
predict(test2,newData)
predict(test3,newData)
predict(test4,newData)
predict(test5,newData)

Run the code above in your browser using DataLab