confidence interval or a prediction interval for a curve

Welcome to the forum for R2MLwiN users. Feel free to post your question about R2MLwiN here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to R2MLwiN: Running MLwiN from within R >> http://www.bris.ac.uk/cmm/software/r2mlwin/
Post Reply
adeldaoud
Posts: 63
Joined: Sat Aug 15, 2015 4:00 pm

confidence interval or a prediction interval for a curve

Post by adeldaoud »

Hi

I am modelling various growth-models with R2mlwin. Specifically this mode:

(Economic.poly4 <- runMLwiN(Economic ~ 1 + Years + Years2 + Years3 + Years4 + Page_length + (1 + Years | journal) + (1 | Article_ID), estoptions = list(EstM = 0, debugmode = T, resi.store=T, x64=F, optimat=T), data = df.eo.sorted))

Years2,3,4 are polynomials of the degree specified by the numbers.


Questions:
(1) I would like to produce some predictions with a confidence interval or a prediction interval. Is this possible with R2mlwin?

(2) I can make some predicitons using the predCurves function as in predCurves(Economic.poly4, xname=c("Years")), but get a strange looking figure. See attached picture. The shape of the curve is expected but not the lines above it. Any ideas about what is going on?
Rplot10.png
Rplot10.png (3.44 KiB) Viewed 1958 times
(3) I would like to know the exact mathematical/statistical structure of how the confidence interval is calculated generally (or in R2mlwin) when having a polynomial (which is essentially a form of interaction).

Many thanks in advance
Adel

ChrisCharlton
Posts: 1193
Joined: Mon Oct 19, 2009 10:34 am

Re: confidence interval or a prediction interval for a curve

Post by ChrisCharlton »

(1) There are some plots that have this at the end of the user guide chapter 5 (see http://www.bris.ac.uk/cmm/media/r2mlwin/UserGuide05.R). Is this the kind of thing that you are after? Alternatively if you fit the model with MCMC then you can create chains of the predictions and take the credible intervals from these.

(2) I think that this may be because of there being several page lengths for each year. The predCurves example has the following syntax:

Code: Select all

predCurves(mymodel, xname = "gcseav", group = "genderfemale")
so I would suggest that you put in your page length variable as the group (assuming these are categories), which should give you a line for each length.

Post Reply