Page 1 of 1

confidence interval or a prediction interval for a curve

Posted: Tue Aug 18, 2015 3:18 pm
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 3860 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

Re: confidence interval or a prediction interval for a curve

Posted: Thu Aug 20, 2015 2:57 pm
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.