fit_lcm fit latent cause model to conditioning data

fit_lcm(data, model, opts, parameter_range, estimation_method)

Arguments

data

long format data containing the following variables (Order and name is exactly the same as following):

   ID  Subject ID

   CR  Conditioned Response

   US  Unconditioned Stimulus

   CS  Conditioned Stimului or Context. If using multiple CS, set variables name as CS1,CS2,CS3...

   If you want to use LCM-RW, you have to add time variable(stimulus onset, unit is sec) before US.
model

1 = latent cause model, 2 = latent cause modulated RW model

opts

(optional)options used in inference

<For LCM>

a hyperparameter of beta prior(default = 1)

b hyperparameter of beta prior(default = 1)

c_alpha concentration parameter for Chinese restaurant process prior(default = 1)

stickiness stickiness parameer for Chinese restaurant process prior(default = 0)

K maximum number of latent causes(default = 10)

<For LCM-RW>

a hyperparameter of beta prior(default = 1)

b hyperparameter of beta prior(default = 1)

c_alpha concentration parameter for Chinese restaurant process prior(default = 1)

stickiness stickiness parameer for Chinese restaurant process prior(default = 0)

K maximum number of latent causes(default = 10)

c_alpha concentration parameter for Chinese restaurant process prior(default = 0.1)

g temporal scaling parameter(default = 1)

psi [N x 1]binary vector specifying when protein synthesis inhibitor is injected(default = 0)

eta learning rate(default = 0.2)

maxIter maximum number of iterations between each trial(default = 3)

w0 initial weight value(default = 0)

sr US variance(default = 0.4)

sx stimulus variance(default = 1)

theta response threshold(default = 0.3)

lambda response gain(default = 0.005)

K maximum number of latent causes(default = 15)

nst If you don't want to use  a nonlinear sigmoidal transformation, you set nst = 0.(default = 0)
parameter_range

(optional) range of parameter(a_L, a_U, e_L, e_U)

estimation_method

(optional) 0 = optim, 1 = post mean(only latent cause model), 2 = optimize(lcm)

Value

return the fit, parameters and plc_vcr. fit is fitting results. parameters is parameters estmated including post_mean_alpha(posterior mean alpha) and logBFlog(Bayes factor for the alpha>=0 model relative to the alpha=0 model). plc_vcr is matrix of latent cause posterior and V & CR predicted.

Examples

# results <- fit_lcm(data, model, opts, parameter_range, estimation_method)