Define own noninformative prior in stan In the simple case of normally distributed data with unknown mean and variance, Jeffrey's prior is given by $$p(\mu, \sigma^2)=\frac{1}{\sigma^2}.$$ 
How can I define such a prior in the Stan language, i.e. how do I need to change the model statement below to obtain the desired result? (The model statement now is for the prior $p(\mu, \sigma^2)\propto 1.$
data {
 int<lower=0> n; // obs in group x
 real x[n];
}
parameters {
 real muX;
 real<lower=0> sigmaSquared;
 real postPred;
}
transformed parameters
{
 real<lower=0> sigmaX;
 sigmaX <- sqrt(sigmaSquared);
}
model {
 x ~ normal(muX, sigmaX);
 postPred ~ normal(muX, sigmaX);
}

 A: You can define a proper or improper prior in the Stan language using the increment_log_prob() function, which will add its input to the accumulated log-posterior value that is used in the Metropolis step to decide whether to accept or reject a proposal for the parameters.
In your example, the model block would need to include the new line

increment_log_block(-log(sigmaSquared));

However, some people (e.g. Jaynes) argue that the Jeffreys prior is only appropriate for scale parameters, in which case you could reparameterize your model in terms of the standard deviation (sigmaX) rather than the variance (sigmaSquared). Also, what I assume is your attempt to draw from the posterior predictive distribution of x should be in a generated quantities block. Putting all three pieces together, it would look like:

data {
  int<lower=0> n; // obs in group x
  real x[n];
}
parameters {
  real muX;
  real<lower=0> sigmaX;
}
model {
  x ~ normal(muX, sigmaX);
  increment_log_prob(-log(sigmaX));
}
generated quantities {
  real postPred;
  postPred <- normal_rng(muX, sigmaX);
}

