[R] Matrix algebra in R to compute coefficients of a linear regression.

2012-02-18 Thread John Sorkin
I am trying to use matrix algebra to get the beta coefficients from a simple bivariate linear regression, y=f(x). The coefficients should be computable using the following matrix algebra: t(X)Y / t(x)X I have pasted the code I wrote below. I clearly odes not work both because it returns a

Re: [R] Matrix algebra in R to compute coefficients of a linear regression.

2012-02-18 Thread Mark Leeds
Hi John: I don't understand what you're doing ( not saying that it's wrong. I just don't follow it ). Below is code for computing the coefficients using the matrix way I follow. Others may understand what you're doing and be able to fix it so I wouldn't just use below immediately. xprimex -

Re: [R] Matrix algebra in R to compute coefficients of a linear regression.

2012-02-18 Thread John Sorkin
Mark Thank you! John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please

Re: [R] Matrix algebra in R to compute coefficients of a linear regression.

2012-02-18 Thread Berend Hasselman
On 18-02-2012, at 14:36, John Sorkin wrote: I am trying to use matrix algebra to get the beta coefficients from a simple bivariate linear regression, y=f(x). The coefficients should be computable using the following matrix algebra: t(X)Y / t(x)X I have pasted the code I wrote below. I

Re: [R] Matrix algebra in R to compute coefficients of a linear regression.

2012-02-18 Thread John Sorkin
Thank you, John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call

Re: [R] Matrix algebra in R to compute coefficients of a linear regression.

2012-02-18 Thread Frank Harrell
The Wilcoxon test is not related to the difference in medians but rather to the Hodges-Lehmann estimator, which is the median of all possible differences of observations between sample 1 and sample 2. So what's needed is a confidence interval for this estimate, obtainable from inverting the