search for: ssall

Displaying 1 result from an estimated 1 matches for "ssall".

Did you mean: shall
2003 Jul 30
2
Comparing two regression slopes
...ery 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) SSprod <-sum(lm1$model[,2]^2) * sum(lm2$model[,2]^2) F.val <-(as.numeric(coefficients(lm1)[2]) - as.numeric(coefficients(lm2) [2]))^2/((SSall/SSprod)*sigma) p.val <-1-pf(F.val, 1, (lm1$df.residual + lm2$df.residual-4)) cat("\n\nTest...