# Why p-values are inconsistent when applying model on subsetted data versus using interaction terms

I have the following negative binomial GLM, where "group" is either Control or Experimental and "count" shows the number of times patient came to hospital.

model.negbin <- glm.nb(count ~ group + age + weight + donor_status,
data = count_data[count_data\$gender == "male", ])


when I run the model subsetting the data only for males, I get the following model summary

Coefficients:
Estimate Std. Error z value             Pr(>|z|)
(Intercept)        1.1876325  0.0760771  15.611 < 0.0000000000000002 ***
groupB            -0.0055944  0.0289652  -0.193                0.847
age                0.0108259  0.0012675   8.541 < 0.0000000000000002 ***
weight             0.0019068  0.0002832   6.734     0.00000000001650 ***
donor_statusnaive -0.5045864  0.0702436  -7.183     0.00000000000068 ***


Next, I run the following model including the gender (not subsetting the data for males) but using interaction with group and setting male as base level.

    count_data$$gender = relevel(count_data$$gender, ref = "male")
model.negbin.gender_group <- glm.nb(count ~ gender*group + age + weight + donor_status,
data = count_data)


I get the following model summary:

Coefficients:
Estimate Std. Error z value             Pr(>|z|)
(Intercept)          1.1389188  0.0636926  17.881 < 0.0000000000000002 ***
genderfemale        -0.1129884  0.0353376  -3.197              0.00139 **
groupB              -0.0053305  0.0291059  -0.183              0.85469
age                  0.0119945  0.0010366  11.571 < 0.0000000000000002 ***
weight               0.0019362  0.0002298   8.426 < 0.0000000000000002 ***
donor_statusnaive   -0.5030604  0.0540750  -9.303 < 0.0000000000000002 ***
genderfemale:groupB -0.0703297  0.0501223  -1.403              0.16057


From my point of view the pvalue associated with group coefficient in above table (0.85469) must be the same pvalue as obtained in the previous model summary table (0.847). But there are not the same and my question is why they differ from running the model on subsetted data versus running on full data but using interaction term?

For the coefficients and standard errors (and $$p$$-values) to be identical you would need to have interactions between geneder and all the other variables, and also have separate values of the overdispersion parameter by gender
Your interaction model has a separate group coefficient for male and female but has the same coefficients across gender for age, weight, donor_status, and the overdispersion parameter