lmr | R Documentation |
Function lmr
fits a multiple linear regression model (MLR) using function lm
.
Row observations can eventually be weighted.
lmr(Xr, Yr, Xu, Yu = NULL, weights = NULL)
Xr |
A |
Yr |
A |
Xu |
A |
Yu |
A |
weights |
A vector of length |
A list of outputs (see examples), such as:
y |
Responses for the test data. |
fit |
Predictions for the test data. |
r |
Residuals for the test data. |
fm |
Output of function |
n <- 10
p <- 6
set.seed(1)
X <- matrix(rnorm(n * p, mean = 10), ncol = p, byrow = TRUE)
y1 <- 100 * rnorm(n)
y2 <- 100 * rnorm(n)
Y <- cbind(y1, y2)
set.seed(NULL)
Xr <- X[1:8, ] ; Yr <- Y[1:8, ]
Xu <- X[9:10, ] ; Yu <- Y[9:10, ]
fm <- lmr(Xr, Yr, Xu, Yu)
names(fm)
fm$y
fm$fit
fm$r
names(fm$fm)
coef(fm$fm)
mse(fm, nam = "y1")
mse(fm, nam = "y2")
mse(fm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.