Displaying 1 result from an estimated 1 matches for "twoslope".
Did you mean:
trollope
2003 Jul 30
2
Comparing two regression slopes
...ferent. I'm a bit concerned,
because when I test it on simulated data with different sample sizes and
variances, the function seems to be extremely sensitive both of these. I am
wondering if I've missed something in my function? I'd be very grateful for
any tips.
Thanks!
Martin
TwoSlope <-function(lm1, lm2) {
## lm1 and lm2 are two linear models on independent data sets
coef1 <-summary(lm1)$coef
coef2 <-summary(lm2)$coef
sigma <-(sum(lm1$residuals^2)+sum(lm2$residuals^2))/(lm1$df.residual +
lm2$df.residual-4)
SSall <-sum(lm1$model[,2]^2) + sum(lm2$model[,2]^2)
S...