Skip to content

Commit

Permalink
Merge pull request #201 from drbenvincent/dev
Browse files Browse the repository at this point in the history
beta-delta fixes
  • Loading branch information
drbenvincent authored Aug 19, 2017
2 parents bf133f1 + 9e5815a commit 46f737f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
% Generate initial values of the root nodes
nExperimentFiles = obj.data.getNExperimentFiles();
for chain = 1:nchains
initialParams(chain).beta = unifrnd(0, 1, [nExperimentFiles-1,1]);
initialParams(chain).delta = normrnd(1, 0.5, [nExperimentFiles-1,1]);
initialParams(chain).groupW = rand;
initialParams(chain).groupALPHAmu = rand*100;
initialParams(chain).groupALPHAsigma = rand*100;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
% Generate initial values of the root nodes
nExperimentFiles = obj.data.getNExperimentFiles();
for chain = 1:nchains
initialParams(chain).beta = abs(normrnd(0.84, 2, [nExperimentFiles,1]));
initialParams(chain).beta = unifrnd(0, 1, [nExperimentFiles,1]);
initialParams(chain).delta = normrnd(1, 0.5, [nExperimentFiles,1]);
initialParams(chain).epsilon = 0.1 + rand([nExperimentFiles,1])/10;
initialParams(chain).alpha = abs(normrnd(0.01,10,[nExperimentFiles,1]));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,17 @@ model{
# DISCOUNT FUNCTION PARAMETERS =================================================
# RANDOM (BY PARTICIPANT) FACTORS; HYPER-PRIORS = NO

# delta is slope
group_delta_MEAN <- 0.9995
group_delta_PRECISION <- 1/(0.0009^2)

# beta is intercept
group_beta_MEAN <- 0.84
group_beta_PRECISION <- 1/(0.11^2)

for (p in 1:nRealExperimentFiles){

# get some instability if we use the reparameterisation, so we'll avoid this for the moment
#delta_offset[p] ~ dnorm(0,1)
#delta[p] <- group_delta_MEAN + delta_offset[p] * group_delta_PRECISION
delta[p] ~ dnorm(group_delta_MEAN, group_delta_PRECISION)

# using reparameterisation to avoid funnel of hell
beta_offset[p] ~ dnorm(0,1)
beta[p] <- group_beta_MEAN + beta_offset[p] * group_beta_PRECISION
#beta[p] ~ dnorm(group_beta_MEAN, group_beta_PRECISION)
beta[p] ~ dnorm(group_beta_MEAN, group_beta_PRECISION) T(0,1)
}

# MODEL-SPECIFIC: CALCULATION OF PRESENT SUBJECTIVE VALUES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ model{

# estimates of mean/sd of beta and delta were taken from Franck, C. T., Koffarnus, M. N., House, L. L., & Bickel, W. K. (2014). Accurate characterization of delay discounting: A multiple model approach using approximate bayesian model selection and a unified discounting measure. Journal of the Experimental Analysis of Behavior, 103(1), 218–233.

# delta is slope
delta_MEAN <- 0.9995
delta_PRECISION <- 1/(0.0009^2)

# beta is intercept
beta_MEAN <- 0.84
beta_PRECISION <- 1/(0.11^2)

for (p in 1:nRealExperimentFiles){
delta[p] ~ dnorm(delta_MEAN, delta_PRECISION)
beta[p] ~ dnorm(beta_MEAN, beta_PRECISION) T(0,)
beta[p] ~ dnorm(beta_MEAN, beta_PRECISION) T(0,1)
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ model{

# estimates of mean/sd of beta and delta were taken from Franck, C. T., Koffarnus, M. N., House, L. L., & Bickel, W. K. (2014). Accurate characterization of delay discounting: A multiple model approach using approximate bayesian model selection and a unified discounting measure. Journal of the Experimental Analysis of Behavior, 103(1), 218–233.

# delta is slope
delta_MEAN <- 0.9995
delta_PRECISION <- 1/(0.0009^2)

# beta is intercept
beta_MEAN <- 0.84
beta_PRECISION <- 1/(0.11^2)

for (p in 1:nRealExperimentFiles){
delta[p] ~ dnorm(delta_MEAN, delta_PRECISION)
beta[p] ~ dnorm(beta_MEAN, beta_PRECISION) T(0,)
beta[p] ~ dnorm(beta_MEAN, beta_PRECISION) T(0,1)
}

# MODEL-SPECIFIC: CALCULATION OF PRESENT SUBJECTIVE VALUES
Expand All @@ -26,8 +29,8 @@ for (t in 1:length(ID)) {

# RESPONSE ERROR PARAMETERS ====================================================

epsilon_alpha <- 1.1
epsilon_beta <- 10.9
epsilon_alpha <- 1+0.1
epsilon_beta <- 1+9.9

for (p in 1:nRealExperimentFiles){
epsilon[p] ~ dbeta(epsilon_alpha , epsilon_beta ) T(,0.5)
Expand Down

0 comments on commit 46f737f

Please sign in to comment.