run_vet: Simulate the Vanderbilt Expertise Test

Description Usage Arguments Value Examples

View source: R/run_vet.R

Description

run_vet gets the probability of choosing the target image for all trials on the VET

Usage

1
run_vet(vet, dst, model, par)

Arguments

vet

The preprocessed VET test list made with make_vet_list

dst

A distance matrix or list of distance matrices. Each element (i,j) is the distance between image i and j. The name of row i and column j correspond to the name of image i and name of image j, respectively.

model

A function that returns the probability of choosing the target probe. Its first argument is a 3 element vector containing the summed distances for a given probe and all study items. Its second argument is a named vector of parameters used to convert the distance into a probabilty of picking the target. See the example below for further explanation.

par

A data frame of parameter values

Value

A data frame where row i correspond to the predicted probability of choosing the target on trial i.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#make a list of parameters
par_list = make_parameter_list(num_subjects=10,par_names=c('c','beta'),
                               lower=c(0,0),upper=c(1,1))

# set the model function
model = function(d,pars) {
    c = pars$c
    beta = pars$beta
    p = sapply(d, function(d) exp(-c*d) / (exp(-c*d) + beta))
    p = p[1] / sum(p) #probability of picking target
}

#run the simulation
response_lists = run_vet(vet_list, dst, model, par_list)

#get the correlation matrix
get_corr_matrix(response_lists)

jeff324/vetnet documentation built on May 26, 2019, 12:31 p.m.