[R-sig-ME] help with ordinal MCMCglmm
Jarrod Hadfield
j.hadfield at ed.ac.uk
Sat Jan 29 15:57:05 CET 2011
Hi Achaz,
I think the code below does what you want.
CP <- cbind(-Inf, 0, mod1$CP, Inf) # Obtain posteior cutpoints
Sol <-mod1$Sol # Obtain posterior fixed effects (I think there are two?)
VCV<-rowSums(mod1$VCV) # Total variance
prob.with<-mcmc(matrix(NA, 1000,15))
prob.without<-mcmc(matrix(NA, 1000,15))
for (i in 1:15) {
prob.with[,i] <- pnorm(CP[, i + 1] - Sol[,1], 0, sqrt(VCV + 1)) -
pnorm(CP[, i] -Sol[,1], 0, sqrt(VCV + 1))
prob.without[,i] <- pnorm(CP[, i + 1] - Sol[,2], 0, sqrt(VCV + 1)) -
pnorm(CP[, i] -Sol[,2], 0, sqrt(VCV + 1))
}
Cheers,
Jarrod
Quoting Achaz von Hardenberg <achaz.hardenberg at gmail.com>:
> dear all,
> I would like to ask your help on the following model:
> I have data for the size of zooplankon in lakes with (Y) and without
> (N) introduced fish. there are 15 size classes with 1 the smallest
> and 15 the largest. Number of zooplankton samples in each class are
> as follows (cumulated over all lakes):
>
>> Ctable
>
> N Y
> 1 7901 24174
> 2 2869 2331
> 3 964 737
> 4 1573 621
> 5 1857 584
> 6 2073 777
> 7 2078 548
> 8 919 171
> 9 485 28
> 10 239 3
> 11 64 0
> 13 30 0
> 14 3 0
> 15 1 0
>
> To test the hypothesis that fish eat the biggest zooplanktons,
> as I have repeated measures in different lakes, I thought to model
> this data as follows,:
>
> prior=list(R=list(V=1, fix=1), G=list(G1=list(V=1, nu=0)))
> mod1<-MCMCglmm(CLASS~Fish-1,
> random=~lago,family="ordinal",data=dimensioni.dat, prior=prior)
>
> where CLASS is the size class and "Fish" the variable indicating if
> the lake has or not introduced fish.
>
> The model seems to run fine, but I have trouble in obtaining the
> expected probabilities for each size category in lakes with and
> without introduced fish... Anybody can help me out?
>
> your help would be greatly appreciated!
>
> cheers,
> Achaz von Hardenberg
> Gran Paradiso National PArk. Italy
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>
--
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