[R] How to test the statistical significance of the difference of two univariate Linear Regression betas?

peter dalgaard pdalgd at gmail.com
Wed Mar 14 17:49:02 CET 2012


On Mar 14, 2012, at 16:21 , Michael wrote:

> How to test the statistical significance of the difference of two
> univariate Linear Regression betas?
> 
> Hi all,
> 
> There are two samples of data: D1 and D2.
> 
> On data D1 we do a univariate Linear Regression and get the coefficient
> beta1.
> 
> On data D2 we do a univariate Linear Regression and get the coefficient
> beta2.
> 
> How do I test the statistical significance of (beta1-beta2)?
> 
> Could you please recommend packages/commands in R for doing this?

Well, the large-sample test would be to calculate the se of the difference as 

  se <- sqrt(se1^2+se2^2)

and then Z <- (beta1-beta2)/se; 2*pnorm(-abs(Z)).

For small samples you might consider joining the two data sets and test for an interaction between your predictor and an indicator for D1 or D2. Other options are possible, if you know a bit of theory.

> 
> Thanks a lot!
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list