Thanks for turning my half-baked suggestion into something that would actually work Cliff :)
Michael On 14 September 2010 12:27, Clifford Long <gnolff...@gmail.com> wrote: > If you'll allow me to throw in two cents ... > > Like Michael said, the dummy variable route is the way to go, but I believe > that the coefficients on the dummy variables test for equal intercepts. For > equality of slopes, do we need the interaction between the dummy variable > and the explanatory variable whose slope (coefficient) is of interest? I'll > add some detail below. > > > For only two groups, we could use a single 2-level dummy variable D > D = 0 is the reference level (group) > D = 1 is the other level (group) > > > Equality of intercepts > > y = b0 + b1*x + b2*D > > If D = 0, then y = b0 + b1*x > If D = 1, then y = b0 + b1*x + b2 ...... group like terms: y = (b0 + b2) > + b1*x > > If coefficient b2 = 0, then we might fail to reject the null hypothesis that > the intercepts are equal > If coefficient b2 <> 0, then we would reject the null hypothesis that the > intercepts are equal > > > Equality of slopes model > > y = b0 + b1*x + b2*D + b3*x*D > > (we added the interaction between x and D) > > > If D = 0, then y = b0 + b1*x > If D = 1, then y = b0 + b1*x + b2 + b3*x ...... group like terms: y = (b0 > + b2) + (b1 + b3)*x > > If coefficient b3 = 0, then we might fail to reject the null hypothesis that > the slopes are equal > If coefficient b3 <> 0, then we would reject the null hypothesis that > the slopes are equal > > > For a model with three groups, assuming that lm / glm / etc. would really do > this for you, the explicit dummy variable coding might look like: > > D1 D2 > group 1 0 0 (reference level ... can usually choose) > group 2 1 0 > group 3 0 1 > > I believe that this is called a sigma-restricted model (??), as opposed to > an overparameterized model where three groups would have three dummy > variables. > You can probably find this info in most books on basic regression. This > might be overly simplistic, and I'll happily stand corrected if I've made > any mistakes. > > Otherwise, I hope that this helps. > > Cliff ______________________________________________ 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.