[R] Other ways to lm() regression? (non-loop?)

2011-12-26 Thread iliketurtles
Hi, I'm quite new to R (1 month full time use so far). I have to run loop regressions VERY often in my work, so I would appreciate some new methodology that I'm not considering. #-

Re: [R] Other ways to lm() regression? (non-loop?)

2011-12-26 Thread Steinar Veka
You can get the ols coefficients with basic matrix operations as well ( https://files.nyu.edu/mrg217/public/ols_matrix.pdf) and by that avoid one of the loops. I do not know how efficient this is but I have attached an example you can paste bellow your code. Here, one x-array is used as a right

Re: [R] Other ways to lm() regression? (non-loop?)

2011-12-26 Thread Gerrit Eichner
Hello, iliketurtles (?), for whatever strange reasons you want to regress all y-columns on all x-columns, maybe reg - apply( x, 2, function( xx) lm( y ~ xx)) do.call( cbind, lapply( reg, coef)) does what you want. (To understand what the code above does, check the documentation for lm(): If

Re: [R] Other ways to lm() regression? (non-loop?)

2011-12-26 Thread Bert Gunter
Dear anonymous: 1. You may be more likely to get useful tips on this list if you sign with your real name. It's friendlier. 2. If you are using R 14 hours/day. get and read a good R book. The CRAN site or Amazon lists many; choose one or more that suits your needs. 3. Read the R Help files

Re: [R] Other ways to lm() regression? (non-loop?)

2011-12-26 Thread iliketurtles
Thanks for the advice everyone. All very helpful. @Bert Added my information to signature, thanks. - Isaac Research Assistant Quantitative Finance Faculty, UTS -- View this message in context: http://r.789695.n4.nabble.com/Other-ways-to-lm-regression-non-loop-tp4234487p4235654.html