Skip to content

Commit

Permalink
Merge pull request #10 from andrjohns/array-syntax
Browse files Browse the repository at this point in the history
 Update array syntax for future rstan compatibility
  • Loading branch information
demsarjure authored Sep 26, 2023
2 parents 965cfb7 + 1011c11 commit dc35a0b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Imports:
ggplot2 (>= 3.3.2),
metRology (>= 0.9.28.1),
reshape (>= 0.8.8),
rstan (>= 2.21.2),
rstan (>= 2.26.0),
rstantools (>= 2.1.1),
mcmcse (>= 1.4.1),
stats (>= 4.0.0),
Expand All @@ -35,8 +35,8 @@ Suggests:
rmarkdown (>= 2.5.0),
knitr (>= 1.30.0)
LinkingTo:
StanHeaders (>= 2.21.0.6),
rstan (>= 2.21.0),
StanHeaders (>= 2.26.0),
rstan (>= 2.26.0),
BH (>= 1.72.0.3),
Rcpp (>= 1.0.5),
RcppEigen (>= 0.3.3.7.0),
Expand Down
16 changes: 8 additions & 8 deletions inst/stan/color.stan
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
data {
int<lower=0> n; // number of data entries
// rgb
real<lower=0,upper=255> r[n];
real<lower=0,upper=255> g[n];
real<lower=0,upper=255> b[n];
array[n] real<lower=0,upper=255> r;
array[n] real<lower=0,upper=255> g;
array[n] real<lower=0,upper=255> b;
// hsv
real<lower=0,upper=2*pi()> h[n];
real<lower=0,upper=1> s[n];
real<lower=0,upper=1> v[n];
array[n] real<lower=0,upper=2*pi()> h;
array[n] real<lower=0,upper=1> s;
array[n] real<lower=0,upper=1> v;

// priors
int<lower=0> p_ids[12];
real p_values[24];
array[12] int<lower=0> p_ids;
array[24] real p_values;
}

parameters {
Expand Down
6 changes: 3 additions & 3 deletions inst/stan/linear.stan
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ data {
int<lower=0> m; // number of subjects
vector[n] x; // sequence/time
vector[n] y; // response
int<lower=0> s[n]; // subject ids
array[n] int<lower=0> s; // subject ids

// priors
int<lower=0> p_ids[6];
real p_values[12];
array[6] int<lower=0> p_ids;
array[12] real p_values;
}

parameters {
Expand Down
6 changes: 3 additions & 3 deletions inst/stan/reaction_time.stan
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ data {
int<lower=0> n; // total number of measurements
int<lower=0> m; // number of subjects
vector<lower=0>[n] t; // reaction times
int<lower=0> s[n]; // subject ids
array[n] int<lower=0> s; // subject ids

// priors
int p_ids[6];
real p_values[12];
array[6] int p_ids;
array[12] real p_values;
}

parameters {
Expand Down
8 changes: 4 additions & 4 deletions inst/stan/success_rate.stan
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
data {
int<lower=0> n; // total number of measurements
int<lower=0> m; // number of subjects
int<lower=0,upper=1> r[n]; // results - success or fail
int<lower=0> s[n]; // subject ids
array[n] int<lower=0,upper=1> r; // results - success or fail
array[n] int<lower=0> s; // subject ids

// priors
int<lower=0> p_ids[2];
real<lower=0> p_values[4];
array[2] int<lower=0> p_ids;
array[4] real<lower=0> p_values;
}

parameters {
Expand Down
6 changes: 3 additions & 3 deletions inst/stan/ttest.stan
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
data {
int<lower=0> n; // number of samples
real y[n];
array[n] real y;

// priors
int<lower=0> p_ids[3];
real p_values[6];
array[3] int<lower=0> p_ids;
array[6] real p_values;
}

parameters {
Expand Down

0 comments on commit dc35a0b

Please sign in to comment.