Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions R/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
hBayesDM*.tar.gz
hBayesDM.Rcheck/
docs/
!inst/include/stan_meta_header.hpp
5 changes: 5 additions & 0 deletions R/configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /bin/sh

# Generated by rstantools. Do not edit by hand.

"${R_HOME}/bin/Rscript" -e "rstantools::rstan_config()"
5 changes: 5 additions & 0 deletions R/configure.win
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#! /bin/sh

# Generated by rstantools. Do not edit by hand.

"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "rstantools::rstan_config()"
7 changes: 0 additions & 7 deletions R/inst/include/meta_header.hpp

This file was deleted.

1 change: 1 addition & 0 deletions R/inst/include/stan_meta_header.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Insert all #include<foo.hpp> statements here
File renamed without changes.
22 changes: 0 additions & 22 deletions R/src/Makevars

This file was deleted.

22 changes: 0 additions & 22 deletions R/src/Makevars.win

This file was deleted.

48 changes: 0 additions & 48 deletions R/tools/make_cc.R

This file was deleted.

16 changes: 8 additions & 8 deletions commons/stan_files/alt_delta.stan
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include /pre/license.stan
#include /include/license.stan

data {
int<lower=1> N;
int<lower=1> T;
int<lower=1, upper=T> Tsubj[N];
int<lower=-1, upper=2> choice[N, T];
real outcome[N, T]; // no lower and upper bounds
real bluePunish[N, T];
real orangePunish[N, T];
array[N] int<lower=1, upper=T> Tsubj;
array[N, T] int<lower=-1, upper=2> choice;
array[N, T] real outcome; // no lower and upper bounds
array[N, T] real bluePunish;
array[N, T] real orangePunish;
}
transformed data {
real initV_ev; // initial values for EV
Expand Down Expand Up @@ -88,10 +88,10 @@ generated quantities {
real<lower=0, upper=10> mu_gamma;

// For log likelihood calculation
real log_lik[N];
array[N] real log_lik;

// For posterior predictive check
real y_pred[N, T];
array[N, T] real y_pred;

// Set all posterior predictions to 0 (avoids NULL values)
for (i in 1:N) {
Expand Down
16 changes: 8 additions & 8 deletions commons/stan_files/alt_gamma.stan
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include /pre/license.stan
#include /include/license.stan

data {
int<lower=1> N;
int<lower=1> T;
int<lower=1, upper=T> Tsubj[N];
int<lower=1, upper=2> choice[N, T];
real outcome[N, T]; // no lower and upper bounds
real bluePunish[N, T];
real orangePunish[N, T];
array[N] int<lower=1, upper=T> Tsubj;
array[N, T] int<lower=1, upper=2> choice;
array[N, T] real outcome; // no lower and upper bounds
array[N, T] real bluePunish;
array[N, T] real orangePunish;
}
transformed data {
vector[2] initV_ev; // initial values for EV
Expand Down Expand Up @@ -89,10 +89,10 @@ generated quantities {
real<lower=0, upper=10> mu_gamma;

// For log likelihood calculation
real log_lik[N];
array[N] real log_lik;

// For posterior predictive check
real y_pred[N, T];
array[N, T] real y_pred;

// Set all posterior predictions to 0 (avoids NULL values)
for (i in 1:N) {
Expand Down
12 changes: 6 additions & 6 deletions commons/stan_files/bandit2arm_delta.stan
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include /pre/license.stan
#include /include/license.stan

data {
int<lower=1> N;
int<lower=1> T;
int<lower=1, upper=T> Tsubj[N];
int<lower=-1, upper=2> choice[N, T];
real outcome[N, T]; // no lower and upper bounds
array[N] int<lower=1, upper=T> Tsubj;
array[N, T] int<lower=-1, upper=2> choice;
array[N, T] real outcome; // no lower and upper bounds
}
transformed data {
vector[2] initV; // initial values for EV
Expand Down Expand Up @@ -65,10 +65,10 @@ generated quantities {
real<lower=0, upper=5> mu_tau;

// For log likelihood calculation
real log_lik[N];
array[N] real log_lik;

// For posterior predictive check
real y_pred[N, T];
array[N, T] real y_pred;

// Set all posterior predictions to 0 (avoids NULL values)
for (i in 1:N) {
Expand Down
12 changes: 6 additions & 6 deletions commons/stan_files/bandit4arm2_kalman_filter.stan
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include /pre/license.stan
#include /include/license.stan

data {
int<lower=1> N;
int<lower=1> T;
int<lower=1, upper=T> Tsubj[N];
int<lower=1,upper=4> choice[N,T];
real<lower=1,upper=100> outcome[N,T];
array[N] int<lower=1, upper=T> Tsubj;
array[N,T] int<lower=1,upper=4> choice;
array[N,T] real<lower=1,upper=100> outcome;
}

transformed data {
Expand Down Expand Up @@ -104,8 +104,8 @@ generated quantities {
real<lower=0,upper=100> mu_mu0;
real<lower=0,upper=15> mu_s0;
real<lower=0,upper=15> mu_sD;
real log_lik[N];
real y_pred[N,T];
array[N] real log_lik;
array[N,T] real y_pred;

for (i in 1:N) {
for (t in 1:T) {
Expand Down
14 changes: 7 additions & 7 deletions commons/stan_files/bandit4arm_2par_lapse.stan
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include /pre/license.stan
#include /include/license.stan

// Seymour et al 2012 J neuro model, w/o C (chioce perseveration) but with xi (lapse rate)
// w/o reward sensitivity and punishment sensitivity
Expand All @@ -7,10 +7,10 @@
data {
int<lower=1> N;
int<lower=1> T;
int<lower=1, upper=T> Tsubj[N];
real rew[N, T];
real los[N, T];
int choice[N, T];
array[N] int<lower=1, upper=T> Tsubj;
array[N, T] real rew;
array[N, T] real los;
array[N, T] int choice;
}

transformed data {
Expand Down Expand Up @@ -104,10 +104,10 @@ generated quantities {
real<lower=0, upper=1> mu_xi;

// For log likelihood calculation
real log_lik[N];
array[N] real log_lik;

// For posterior predictive check
real y_pred[N, T];
array[N, T] real y_pred;

// Set all posterior predictions to 0 (avoids NULL values)
for (i in 1:N) {
Expand Down
14 changes: 7 additions & 7 deletions commons/stan_files/bandit4arm_4par.stan
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include /pre/license.stan
#include /include/license.stan

// Seymour et al 2012 J neuro model, w/o C (chioce perseveration)
data {
int<lower=1> N;
int<lower=1> T;
int<lower=1, upper=T> Tsubj[N];
real rew[N, T];
real los[N, T];
int choice[N, T];
array[N] int<lower=1, upper=T> Tsubj;
array[N, T] real rew;
array[N, T] real los;
array[N, T] int choice;
}

transformed data {
Expand Down Expand Up @@ -106,10 +106,10 @@ generated quantities {
real<lower=0, upper=30> mu_P;

// For log likelihood calculation
real log_lik[N];
array[N] real log_lik;

// For posterior predictive check
real y_pred[N, T];
array[N, T] real y_pred;

// Set all posterior predictions to 0 (avoids NULL values)
for (i in 1:N) {
Expand Down
14 changes: 7 additions & 7 deletions commons/stan_files/bandit4arm_lapse.stan
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include /pre/license.stan
#include /include/license.stan

// Seymour et al 2012 J neuro model, w/o C (chioce perseveration) but with xi (lapse rate)
data {
int<lower=1> N;
int<lower=1> T;
int<lower=1, upper=T> Tsubj[N];
real rew[N, T];
real los[N, T];
int choice[N, T];
array[N] int<lower=1, upper=T> Tsubj;
array[N, T] real rew;
array[N, T] real los;
array[N, T] int choice;
}

transformed data {
Expand Down Expand Up @@ -111,10 +111,10 @@ generated quantities {
real<lower=0, upper=1> mu_xi;

// For log likelihood calculation
real log_lik[N];
array[N] real log_lik;

// For posterior predictive check
real y_pred[N, T];
array[N, T] real y_pred;

// Set all posterior predictions to 0 (avoids NULL values)
for (i in 1:N) {
Expand Down
14 changes: 7 additions & 7 deletions commons/stan_files/bandit4arm_lapse_decay.stan
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include /pre/license.stan
#include /include/license.stan

// Seymour et al 2012 J neuro model, w/o C (chioce perseveration) but with xi (lapse rate). Added decay rate (Niv et al., 2015, J. Neuro)
// Aylward et al., 2018, PsyArXiv
data {
int<lower=1> N;
int<lower=1> T;
int<lower=1, upper=T> Tsubj[N];
real rew[N, T];
real los[N, T];
int choice[N, T];
array[N] int<lower=1, upper=T> Tsubj;
array[N, T] real rew;
array[N, T] real los;
array[N, T] int choice;
}

transformed data {
Expand Down Expand Up @@ -123,10 +123,10 @@ generated quantities {
real<lower=0, upper=1> mu_d;

// For log likelihood calculation
real log_lik[N];
array[N] real log_lik;

// For posterior predictive check
real y_pred[N, T];
array[N, T] real y_pred;

// Set all posterior predictions to 0 (avoids NULL values)
for (i in 1:N) {
Expand Down
Loading