# [R] how to test whether two slopes are sign. different?

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jul 21 08:33:42 CEST 2003

```On Sun, 20 Jul 2003, Herzog, Mark wrote:

> Or better yet skip the whole "significantly" different all together, and
> figure out if a model with 2 slopes explains the data "better" than a
> model with 1------ AIC's!

That's not what AIC is designed to do: it is about `prediction' not
`explanation', as you will discover from the primary sources (if not from
some of the secondary ones).

In this specific case there are is the question of whether the error
variances are the same to take into account, which makes it tricky to fit
a single model (especially with lsfit).

>
> Mark
>
> 	-----Original Message-----
> 	From: Brett Magill [mailto:bmagill at earthlink.net]
> 	Sent: Sun 7/20/2003 7:12 PM
> 	To: Gijsbert Stoet; r-help at stat.math.ethz.ch
> 	Cc:
> 	Subject: Re: [R] how to test whether two slopes are sign. different?
>
>
>
> 	Not really r-specific:
>
> 	Z = (b1 - b2) / SQRT ( SEb1^2 + SEb2^2)
>
> 	-------Original Message-------
> 	From: Gijsbert Stoet <stoet at volition.wustl.edu>
> 	Sent: 07/20/03 09:51 PM
> 	To: r-help at stat.math.ethz.ch
> 	Subject: [R] how to test whether two slopes are sign. different?
>
> 	>
> 	> Hi,
>
> 	  suppose I do want to test whether the slopes (e.g. determined with
> 	lsfit) of two different population are significantly different, how do
> 	I test this (in R). Say for example, I found out what the slope
> 	between age and number of books read per year is for two different
> 	populations of subjects (e.g. 25 man and 25 woman), say using
> 	lsfit. How can I tell whether the slopes are different in R. (And how
> 	would I do it for regression coefficients?)
>
> 	Thanks a lot for your help.
>
> 	______________________________________________
> 	R-help at stat.math.ethz.ch mailing list
> 	https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 	>
>
> 	______________________________________________
> 	R-help at stat.math.ethz.ch mailing list
> 	https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>

--
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

```