Here is a quick example:

c1 <- cor(iris[,-5])
s1 <- sqrt(diag(var(iris[,-5])))

betas <- diag( s1 ) %*% c1 %*% diag( 1/s1 )

# now compare:

coef( lm( Sepal.Length ~ Sepal.Width, data=iris ) )[2]
betas[1,2]


But if you cannot work that out on your own, then you really should review 
linear algebra and linear model theory.

Also when dealing with us "absent minded professor" types (I now have adjunct 
status at 2 universities, can I rationalize being twice as absent minded now?) 
it is best to include some context in your post (quote some of the previous 
conversation) to help us remember which of many discussions we have been part 
of recently you are asking about.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of ashz
> Sent: Thursday, August 19, 2010 3:02 AM
> To: r-help@r-project.org
> Subject: Re: [R] Linear regression equation and coefficient matrix
> 
> 
> Dear Greg,
> 
> Thanks for the tip. As I am new in R can you please provide me a script
> how
> do to so. It will help my learning process.
> 
> Thanks,
> Asher
> --
> View this message in context: http://r.789695.n4.nabble.com/Linear-
> regression-equation-and-coefficient-matrix-tp2329804p2330867.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to