std::vector<double, std::allocator<double> > write_array(std::vector<double, std::allocator<double> >, bool, bool, unsigned int, unsigned int)

takes a vector of unconstrained parameters, flags for include_tparams and include_gqs, as well as integers for id and seed and returns a vector of constrained parameters

Rcpp::List write_list(std::vector<double, std::allocator<double> >, bool, bool, unsigned int, unsigned int)

takes a vector of unconstrained parameters, flags for include_tparams and include_gqs, as well as integers for id and seed and returns a list of constrained parameters with the appropriate dimensions

// This Stan block defines a Binomial model, by Sean van der Merwe, UFS
data {
  int<lower=1> n;   			        // number of observations
  int<lower=1> N;                // Binomial upper limit
  int<lower=0, upper=N> y[n];       // observations
}
parameters {
  real<lower=0, upper=1> p;                 
}
model {
  y ~ binomial(N, p);       
}

// This Stan block defines a ChiSquare model, by Sean van der Merwe, UFS
data {
  int<lower=1> n;   			        // number of observations
  real<lower=0> y[n];       // observations
}
// The parameters of the model
parameters {
  real<lower=0> m;                 
}
model {
  y ~ chi_square(m);       
}

// This Stan block defines a Exponential model, by Sean van der Merwe, UFS
data {
  int<lower=1> n;   			        // number of observations
  real<lower=0> y[n];       // observations
}
// The parameters of the model
parameters {
  real<lower=0> l;                 
}
model {
  y ~ exponential(l);       
}

// This Stan block defines an F model, by Sean van der Merwe, UFS
functions{
	real f_lpdf(real x, real d1, real d2){
//	  return(beta_lpdf(d1*x/d2/(d1*x/d2 + 1) | d1/2, d2/2));
      return (	0.5 * (-d1 * log(d1 * x + d2) -
						d2 * log(d1 * x + d2) + d1 * log(x) + d1 * log(d1) +
						d2 * log(d2) - 2 * log(x)) - lbeta(d1/2, d2/2)			);
	}
}
data {
  int<lower=1> n;   			        // number of observations
  real<lower=0> y[n];       // observations
}
// The parameters of the model
parameters {
  real<lower=0> d1;                 
  real<lower=0> d2;                 
}
model {
  for (i in 1:n) {
    y[i] ~ f(d1, d2);
  }       // Stan doesn't have an F distribution
  d1 ~ exponential(0.1);
  d2 ~ exponential(0.1);
}