Hi everyone,
I am trying to figure out a way to program the calculation of the z test comparing regression coefficients across separate subgroups outlined in:
Paternoster, R., Brame, R., Mazerolle, P., & Piquero, A. (1998). Using the correct statistical test for the equality of regression coefficients. Criminology, 36(4), 859-866.
The equation is attached. All it requires is the b and SE from each model.
z = (b from model 1) - (b from model 2)/(sqrt(SE of b from model 1 squared) + (SE of b from model 2 squared))
For example, if I wanted to compare whether the relationship between mpg and price (controlling for headroom) was the same for foreign and domestic cars*, I would run the following two models:
sysuse auto
regress price mpg headroom if foreign==0
regress price mpg headroom if foreign==1
In model 1, _b[mpg] = -374.1 and _se[mpg] = 91.6.
In model 2, _b[mpg] = -252.3 and _se[mpg] = 69.6.
Manually calculating the z test would be simple, but I'm curious about how to automate the process. I suspect that using -estimates store- is required, but I haven't managed to make it work (I don't have much programming experience).
Thanks!
Owen Gallupe
*I realise this is best done through a multiplicative interaction term. My goal is to compare the two approaches (the multiplicative approach and the subgroup correlations approach).
I am trying to figure out a way to program the calculation of the z test comparing regression coefficients across separate subgroups outlined in:
Paternoster, R., Brame, R., Mazerolle, P., & Piquero, A. (1998). Using the correct statistical test for the equality of regression coefficients. Criminology, 36(4), 859-866.
The equation is attached. All it requires is the b and SE from each model.
z = (b from model 1) - (b from model 2)/(sqrt(SE of b from model 1 squared) + (SE of b from model 2 squared))
For example, if I wanted to compare whether the relationship between mpg and price (controlling for headroom) was the same for foreign and domestic cars*, I would run the following two models:
sysuse auto
regress price mpg headroom if foreign==0
regress price mpg headroom if foreign==1
In model 1, _b[mpg] = -374.1 and _se[mpg] = 91.6.
In model 2, _b[mpg] = -252.3 and _se[mpg] = 69.6.
Manually calculating the z test would be simple, but I'm curious about how to automate the process. I suspect that using -estimates store- is required, but I haven't managed to make it work (I don't have much programming experience).
Thanks!
Owen Gallupe
*I realise this is best done through a multiplicative interaction term. My goal is to compare the two approaches (the multiplicative approach and the subgroup correlations approach).
Comment