Displaying 1 result from an estimated 1 matches for "pred_model_1".
Did you mean:
pred_model_2
2005 Aug 16
1
predict nbinomial glm
...K. Steinmann (working with R 2.0.0)
Code:
library(MASS)
a <- rnbinom(200, 1, 0.5)
b <- (1:200)
c <- (30:229)
d <- rep(c("q", "r", "s", "t"), rep(50,4))
data_frame <- data.frame(a,b,c,d)
model_1 = glm.nb(a ~ b + d , data = data_frame)
pred_model_1 = predict(model_1, newdata = data_frame, type = "response", se.fit
= FALSE, dispersion = NULL, terms = NULL)
subset_of_dataframe = subset(data_frame, (b > 80 & c < 190 ))
model_2 = glm.nb(a ~ b + d , data = subset_of_dataframe)
pred_model_2 = predict(model_2, newdata = subse...