Hi all,
I’m trying to plot my posterior predictive for psychometric functions of 14 separate conditions. The code below only generates the posterior predictive for the aggregate of all conditions. How would I change my code below to plot the posterior predictive for each of the 14 conditions separately?
Thanks much!
James
This is currently what the posterior predictive looks like:
n_samps <-100
xx <- seq(min(dat.2$norm), max(dat.2$norm), length.out=500)
psi <- matrix(NA, n_samps, length(xx))
i <- 0
for (sn in sample(x=length(fit.samples$lp__), size=n_samps, replace = TRUE)) {
i<- i + 1
midpoint <- with(fit.samples, mum[sn] + fA[sn] + sA[sn] + fsA[sn,cn])
width <- with(fit.samples, mean(muw))
psi[i,] <- chance_performance + (1 - chance_performance) *
inv.logit((xx-midpoint)/width);
}
eap_midpoint <- with(fit.samples, mean(midpoint))
eap_width <- with(fit.samples, mean(width))
eap_psi <- chance_performance + (1 - chance_performance) *
inv.logit((xx-eap_midpoint)/eap_width);
colvec <- grey(pmax(pmin(rnorm(n_samps, mean=.7, sd=.08), 1), 0))
matplot(xx, t(psi), type='l', lty=1, col=colvec, xlab="Intensity", ylab="Psi")
lines(xx, eap_psi, lwd=2)