New to R and fairly new to statistics - appreciate any input.

In short, I'm trying to develop a predictive regression model but after fitting the model on training data, the output for my testing data shows far less variance than expected.

Below are images of the output as well as the code. My sense is that I need to some run multiple simulations for each patient - but I'm not entirely sure that is the answer. Any help on the code or the approach would be appreciated.

Thank you!


summary(bin_model <- glm(BVAS ~ Days + ANCA, data = training, family = "poisson"))
summary(zero_infl <- zeroinfl(BVAS ~ Days + ANCA, data = training))  

vuong(bin_model, zero_infl) # zero-inflated wins out

testing$BVAS_hat <- predict(zero_infl, newdata = testing)

ggplot(testing, aes(x=Days)) +
  geom_point(aes(y=BVAS_hat), alpha = 0.5, position = position_jitter(h=0.02), color = "red") + 
  geom_point(aes(y=BVAS), alpha = 0.5, position = position_jitter(h=0.02), color = "blue") + 
  labs(x="Days", y="BVAS")

Blue = actual testing data Red = output

enter image description here


Your training data - just as any other data - is a mixture of signal and noise. In modeling, we try to capture the signal, since the noise is by definition not predictable, except in a probabilistic sense.

predict.zeroinfl() by default predicts the expected response, i.e., the signal. Since the noise is mainly variation, stripping this out means that the signal is far less variable.

You may be interested in a , i.e., intervals that contain future observations with a prespecified probability. These of course (need to) account for noise. You can use predict.zeroinfl(..., type="prob") for this, which should give you predicted probabilities for various possible outcomes.

| cite | improve this answer | |
  • $\begingroup$ Thanks Stephan, I'm getting a "could not find function" error for predict.zeroinfl(), however, I can add the argument type="prob" to the regular predict function as shown in the code above - are the two equivalent? When I input type="prob" I get a vector of length 16 - I'm assuming these are the various probabilities, but what outcome are they related to? For example, if I have c(0.1, 0.25, 0.17) - I am currently interpreting this as a 10% probablility of outcome1, 25% for outcome2, and a 17% for outcome 3 - but I'm a bit lost on what the value of the outcomes - thanks! $\endgroup$ – wingsoficarus116 Jan 31 '19 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.