In the following dataset, I had just trained a generalized linear model with gamma-distributed residuals, refer the following code:
library(MASS)
df <- read.csv('test.csv')
model <- glm(formula = y ~ method * site + year + 0,
family=Gamma(link = "log"), data = df)
And by executing the above code, I am getting something like this:
> summary(model)
Coefficients:
Estimate Std. Error t value Pr(>|t|)
methodM0 3.89533 0.13670 28.496 < 2e-16 ***
methodM1 5.63965 0.20940 26.933 < 2e-16 ***
methodM2 -55.854107 73.982453 -0.755 0.450
methodM3 -55.731730 73.986509 -0.753 0.451
siteS1 -0.002872 0.098226 -0.029 0.977
siteS2 0.060892 0.107795 0.565 0.572
siteS3 -0.016239 0.102258 -0.159 0.874
year 0.030813 0.036743 0.839 0.402
methodM1:siteS1 -0.030616 0.144592 -0.212 0.832
methodM2:siteS1 -0.030632 0.144663 -0.212 0.832
methodM3:siteS1 0.064179 0.145593 0.441 0.659
methodM1:siteS2 -0.146505 0.152012 -0.964 0.335
methodM2:siteS2 -0.039610 0.148024 -0.268 0.789
methodM3:siteS2 -0.202881 0.150406 -1.349 0.178
methodM1:siteS3 NA NA NA NA
methodM2:siteS3 0.081617 0.144040 0.567 0.571
methodM3:siteS3 -0.064155 0.147771 -0.434 0.664
I know that the table is the outcome of made-up numbers, but the main query is that I have an interaction between method M1 and site S3 that give NA. But I want to set up the GLM to remove that interaction after training, or assign those NA values in the model to 0?