[R-sig-ME] MCMCglmm predict function output and interpretation

Jarrod Hadfield j.hadfield at ed.ac.uk
Mon Jul 28 09:52:03 CEST 2014


Hi Justine,

The first 634 predictions are for B vs A, and the second 634 are for C  
vs A. If you want the predicted probabilities of falling in category  
A, B or C you'll have to do it by hand I'm afraid.

Cheers,

Jarrod



Quoting Justine Smith <jsmith5 at ucsc.edu> on Sun, 27 Jul 2014 09:54:13 -0700:

> Dear all,
>
> I have constructed a multinomial mixed model using the package MCMCglmm
> that has three potential values of the response variable (let's call them
> A, B, and C). Although the model is running smoothly, I am unclear of how
> to interpret the output of the predict function. I would like to
> cross-validate the model, so I need to know the model prediction for each
> data point (A, B, or C). I have 634 data points and 1268 rows in the output
> of the predict function, which makes me think there is both a probability B
> is more likely than A and a probability that C is more likely than A, but
> because they are all in one column and don't have an index, I don't know
> what point each row corresponds to.
>
> Here is my model:
>
> mt<-MCMCglmm(pcl2~-1+trait + trait:ngtr1 + trait:bin1 + trait:night1,
>
> random = ~ us(1+night1):lID,
>
> rcov=~us(trait):units,
>
> prior = list(
>
> R = list(V=IJ,fix=1),
>
> G = list(
>
> G1 = list(V = diag(2),n = 0.002))),
>
> burnin = 30000,
>
> nitt = 200000,
>
> family = "categorical",
>
> data = killsdf,
>
> verbose=FALSE,
>
> DIC=TRUE,
>
> pr=TRUE,
>
> thin=200)
>
> And the basic predict function:
>
> m.pred<-predict(mt,type="response",interval="prediction")
>
> My output from "predict" looks like this (again, n = 634):
>
>          fit                lwr                upr
> 1 0.07529940 0.0009159809 0.2450521
> 2 0.26639933 0.0006481384 0.8171763
> 3 0.08842384 0.0011288143 0.2682600
> 4 0.28736411 0.0001511912 0.8286539
> 5 0.11389115 0.0013791012 0.3841322
> 6 0.21789723 0.0058586078 0.5767750
>> 1268 0.24447799 5.553336e-03 0.6738022
>
> I apologize if this is clearly discussed in the Course Notes or other
> documents, but I just cannot seem to find it. I would be very grateful to
> anyone who can provide insight on how to interpret the predict function
> output.
>
> Many thanks,
> Justine
>
> 	[[alternative HTML version deleted]]
>
>



-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



More information about the R-sig-mixed-models mailing list