Reread ?lm and note that the lhs can be a matrix. I believe this is
exactly what you want.
-- Bert
On Sun, Jan 29, 2012 at 2:05 PM, Martin Batholdy
wrote:
> Hi,
>
>
> I would like to fit lm-models to a matrix with 'samples' of a dependent
> variable (each row represents one sample of the depend
If it's a simple one variable OLS regression and you only need
regression coefficients, you'll probably get best performance by
hard-coding the closed form solutions. apply() might help a little
(since it's a very good loop) but ultimately you'll be best served by
deciding exactly what you want and
Hi,
I would like to fit lm-models to a matrix with 'samples' of a dependent
variable (each row represents one sample of the dependent variable).
The independent variable is a vector that stays the same:
y <- c(1:10)
x <- matrix(rnorm(5*10,0,1), 5, 10)
now I would like to avoid looping over
3 matches
Mail list logo