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 han

Re: [R] Applying a function

2011-12-23 Thread Steinar Veka
First, it may be a good idea to use 1 for “yes” and 0 for “no” in the motherrecovery column. Then if you name your table e.g tab1, you may try something like this.. sum(tab1[,2]==1*tab1[,4])/sum(tab1[,2]==1) 2011/12/23 Joanie Van De Walle > > Hi, > > I need help writing a function