Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deprecated syntax for future rstan compatibility #17

Open
wants to merge 1 commit into
base: bmstdr
Choose a base branch
from
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
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Imports:
methods,
spTimer,
ggplot2,
rstan,
rstan (>= 2.26.0),
spBayes,
CARBayes,
CARBayesST,
Expand Down Expand Up @@ -65,8 +65,8 @@ LinkingTo:
BH (>= 1.66.0),
Rcpp (>= 0.12.0),
RcppEigen (>= 0.3.3.3.0),
rstan (>= 2.18.1),
StanHeaders (>= 2.18.0),
rstan (>= 2.26.0),
StanHeaders (>= 2.26.0),
RcppParallel
VignetteBuilder: knitr
SystemRequirements: GNU make
Expand Down
16 changes: 8 additions & 8 deletions inst/stan/gp_marginal.stan
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ int<lower=0> p;
int<lower=0> ntmiss;
int<lower=0> ntobs;
int <lower=0, upper=1> missing;
int data_miss_idx[ntmiss];
int data_obs_idx[ntobs];
real yobs[ntobs];
array[ntmiss] int data_miss_idx;
array[ntobs] int data_obs_idx;
array[ntobs] real yobs;
matrix[nT, p] X;
real<lower=0> sigma2_prior[2];
real<lower=0> tau2_prior[2];
array[2] real<lower=0> sigma2_prior;
array[2] real<lower=0> tau2_prior;
int<lower=0> phidist;
real <lower=0> prior_phi_param[2];
array[2] real <lower=0> prior_phi_param;
matrix[sn, sn] dist; // to hold sn by sn distance matrix
int <lower=0> verbose;
}
Expand All @@ -38,15 +38,15 @@ parameters {
real<lower=0> phi;
real<lower=0> sigma_sq;
real<lower=0> tau_sq;
real z_miss[missing ? ntmiss : 0]; // Only define z_miss if there is missing data
array[missing ? ntmiss : 0] real z_miss; // Only define z_miss if there is missing data
}


model {
vector[nT] xbmodel;
matrix[tn, sn] mus;
matrix[tn, sn] dats;
real z1[nT];
array[nT] real z1;
matrix [sn, sn] L;
matrix [sn, sn] Sigma;
real u;
Expand Down
26 changes: 13 additions & 13 deletions inst/stan/ind_gpp_marginal.stan
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ int<lower=0> p;
int<lower = 0, upper = 1> missing; // Is there any missing observation?
int<lower=0> ntmiss;
int<lower=0> ntobs;
int data_miss_idx[ntmiss];
int data_obs_idx[ntobs];
int time[n]; // gives the time t for a data row
array[ntmiss] int data_miss_idx;
array[ntobs] int data_obs_idx;
array[n] int time; // gives the time t for a data row
int nots; // How many observed times
int ots[nots]; // Observed times
int nts[nots]; // Number of observations in time ots
int start_row[nots]; // Starting row minus 1 for the observations at t th time
int fin_row[nots]; // Finish row for the observations at t th time
array[nots] int ots; // Observed times
array[nots] int nts; // Number of observations in time ots
array[nots] int start_row; // Starting row minus 1 for the observations at t th time
array[nots] int fin_row; // Finish row for the observations at t th time
// blank line
int n_misst; // Number of time points without any observations
// int misst[n_misst]; // Which times have missing observations
// Do not need this here.
matrix[n, m2] Cdist; // to hold n by m2 distance matrix
matrix[m2, m2] dmat; // to hold m2 by m2 distance matrix
real yobs[ntobs];
array[ntobs] real yobs;
matrix[n, p] X;
real<lower=0> sigma2_prior[2];
real<lower=0> tau2_prior[2];
array[2] real<lower=0> sigma2_prior;
array[2] real<lower=0> tau2_prior;
int<lower=0> phidist;
real <lower=0> prior_phi_param[2];
array[2] real <lower=0> prior_phi_param;
}

transformed data {
Expand All @@ -53,14 +53,14 @@ parameters {
vector[p] beta;
real<lower=0> phi;
real<lower=0> sigma_sq;
real z_miss[missing ? ntmiss : 0]; // Only define z_miss if there is missing data
array[missing ? ntmiss : 0] real z_miss; // Only define z_miss if there is missing data
// vector[include_alpha ? N : 0] alpha;
real<lower=0> tau_sq;
}

transformed parameters {
vector[n] xbmodel;
real bigS[sumnt2];
array[sumnt2] real bigS;
{
matrix [m2, m2] Sigma;
matrix [m2, m2] Swinv;
Expand Down
2 changes: 1 addition & 1 deletion inst/stan/normal.stan
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
data {
int<lower=0> n; // number of sites
real y[n];
array[n] real y;
real mu; // for the prior
real mprior; // for the prior
real aprior; // for the prior
Expand Down