# Test for equality of coefficients from 2 different samples

I have a model that I fit on two different samples (each representing a region in a country, with different sample sizes):

region 1: P = a1 + a2*H

region 2: P = b1 + b2*H


which is simply:

region 1: R1 <- lm(P ~ H)

region 2: R2 <- lm(P ~ H)


To test for equality of coefficient estimates, a Wald test would be appropriate. However, the standard Wald test, waldtest(), can only be carried out for models applied to the same data set.

How can I get around this and test for equality of coefficients when I have 2 different samples?

thanks, Diana

You can do it by creating one combined dataset with variables P, H, and a new variable "region" that is a factor with levels "R1" and "R2", say. Then consider two models

mod1 <- lm(P ~ H * region, data = combineddata)

mod2 <- lm(P ~ H, data = combineddata)


The first model has 4 parameters, comprising separate slopes and intercepts, and the second fits the same slope and intercept to both regions. Then

anova(mod1,mod2)


will do a test comparing the two models.