# Log transformation in GLM and model fit

For a negative binomial GLM, are we allowed to write the log transformation in the following way?

library(MASS)
nb.fit <- glm.nb(y~log(X1)+log(X2)+X3+X4+log(X5),maxit=1000, data=df)
chisq.p.value <- pchisq(deviance(nb.fit ), df.residual(nb.fit), lower = F)
chisq.p.value


Here X3 and X4 have pretty low values compared to X1, X2, and X5. Y is a count response with extremely high variance with no zero responses. How can I check that my model fits the data well?

Since chisq.p.value = 0.22078 (p> 0.05), can we say our model fits the data well?

Your initial question is ambiguous. I think you are asking if using the log within the model formula replicates the link function. If so, the answer is no. The link function (which in this case is the log) is a transformation of the predicted mean, not of your covariates. Although written in a different context, it may be helpful to read my answer to: Difference between logit and probit models. You might also be asking if it is allowed to use transformations, or logarithmic transformations specifically, of predictor variables. If so, the answer is yes, there is no problem with using logs of X's. Regarding their interpretations, you may want to read: Interpretation of log transformed predictor and/or response. Lastly, if you are asking if R allows you to use the log() function within the formula argument to a standard model function, the answer is also yes (after all, you just did it and it worked).