Plotting uncertainty incorrectly resulting a weird graph

50 views Asked by At

I am trying to plot a model output and two confidence intervals but I am getting some weird graphs and I do not understand what I have done wrong.

enter image description here

My code :

#plotting model with uncertainity
#need to create Confidence intervals
model4.pred2<-predict(model4,newdata=data,interval="confidence",level=0.95) # predict from the model, using your data frame

plot(data$mum.age, model4pred, xlab = 'Mum Age (yrs)', ylab = 'Model 4 Predicted mass values (g)', main = 'Predicted values of Model 4 vs Mother Age', xlim = c(0,12), pch=16, col="orange", cex=1)
matplot(data$mum.age,model4.pred2, type='l',lty=c(1,2,2),col='black')

I thought I would get a graph with three lines the main model output and then the confidence intervals.

see code in previous section

0

There are 0 answers