Learn R Programming

hbmem (version 0.2)

uvsdSim: Function uvsdSim

Description

Simulates data from a hierarchical UVSD model.

Usage

uvsdSim(NN = 2, NS = 1, I = 30, J = 200, K = 6, muN = c(-0.5, 
    -0.2), s2aN = 0.2, s2bN = 0.2, muS = 0.5, s2aS = 0.2, s2bS = 0.2, 
    muS2 = log(1), s2aS2 = 0, s2bS2 = 0,lagEffect = -0.001,crit = matrix(rep(c(-1.5,-0.5, 0, 0.5, 1.5), each = I), ncol = (K - 1)))

Arguments

NN
Number of conditions for new words.
NS
Number of conditions for studied words.
I
Number of participants.
J
Number of items.
K
Number of response options.
muN
Mean of new-item distribution. If NN is greater than 1, then muN must be a vector of length NN.
s2aN
Variance of participant effects on mean of new-item distribution.
s2bN
Variance of item effects on mean of new-item distribution.
muS
Mean of studied-item distribution. If NS is greater than 1, then muS must be a vector of length NS.
s2aS
Variance of participant effects on mean of studied-item distribution.
s2bS
Variance of item effects on mean of studied-item distribution.
lagEffect
Magnitude of linear lag effect on both studied-item distribution and log(sigma2).
muS2
Mean variance of studied-item distribution, sigma2
s2aS2
Variance of participant effects sigma2.
s2bS2
Variance of item effects on sigma2.
crit
Matrix of criteria (not including -Inf or Inf). Columns correspond to criteria, rows correspond to participants.

Value

  • The function returns an internally defined "uvsdSim" structure.

References

See Pratte, Rouder, & Morey (2009)

See Also

hbmem

Examples

Run this code
library(hbmem)
#Data from hiererchial model
sim=uvsdSim() 
slotNames(sim) 
table(sim@resp,sim@Scond,sim@cond)

#Usefull to make data.frame for passing to model-fitting functions
dat=as.data.frame(cbind(sim@subj,sim@item,sim@cond,sim@Scond,sim@lag,sim@resp))
colnames(dat)=c("sub","item","cond","Scond","lag","resp")

table(dat$resp,dat$Scond,dat$cond)

Run the code above in your browser using DataLab