getPred {hbmem} | R Documentation |
getPred is a helper function that takes a block and its indexes, and returns the predicted value from that block for each trial. It is the same thing as taking $(XtX)^(-1) Xty$ where X is the design matrix for 1 (mu),sub, item, and lag; y is the vector of effect estimates, block.
getPred(block,sub,item,lag,I,J,R)
block |
Block of parameter values starting with the grand mean, followed by participant effects, and finially item effects. |
sub |
Vector of subject index, starting at zero. |
item |
Vector of item index, starting at zero. |
lag |
Vector of lag index, zero-centered. |
I |
Number of subjects. |
J |
Number of items. |
R |
Total number of trials. |
Returns predicted means for each trial.
Michael S. Pratte
hbmem
library(hbmem) sim=uvsdSim() I=length(levels(as.factor(sim@subj))) J=length(levels(as.factor(sim@item))) RN=sum(sim@cond==0) block=c(sim@muN,sim@alphaN,sim@betaN) means=getPred(block,sim@subj[sim@cond==0], sim@item[sim@cond==0],sim@lag[sim@cond==0],I,J,RN) multi=sim@resp[sim@cond==0] plot(multi~means,ylab="Response to New Item",xlab="Mean of New-Item Distribution")