Many multivariate simple linear regressions coefficients {Rfast} | R Documentation |
Many multivariate simple linear regressions coefficients
Description
Many multivariate simple linear regressions coefficients.
Usage
mvbetas(y, x, pvalue = FALSE)
Arguments
y |
A matrix with the data, where rows denotes the observations and the columns contain the dependent variables. |
x |
A numerical vector with one continuous independent variable only. |
pvalue |
If you want a hypothesis test that each slope (beta coefficient) is equal to zero set this equal to TRUE. It will also produce all the correlations between y and x. |
Details
It is a function somehow opposite to the allbetas
. Instead of having one y and many xs we have many ys and one x.
Value
A matrix with the constant (alpha) and the slope (beta) for each simple linear regression. If the p-value is set to TRUE, the correlation of each y with the x is calculated along with the relevant p-value.
Author(s)
Michail Tsagris
R implementation and documentation: Michail Tsagris <mtsagris@uoc.gr> and Manos Papadakis <papadakm95@gmail.com>.
See Also
Examples
y <- matrnorm(100, 100)
x <- rnorm(100)
a <- mvbetas(y, x, pvalue = FALSE)
b <- matrix(nrow = 100, ncol = 2)
z <- cbind(1, x)
a <- mvbetas(y, x)
b[2, ] <- coef( lm.fit( z, y[, 1] ) )
b[2, ] <- coef( lm.fit( z, y[, 2] ) )
x <- NULL