data {
int<lower=0> Nx; //number of xvals
int<lower=0> Ny; //number of yvals
vector[Ny] y_vals; //y values
matrix[Nx, Ny] surface; //surface
}
parameters{
//Peak 1
real<lower=8, upper=35> peak1_Ft[Nx];
real<lower=0, upper=20> peak1_At[Nx];
real<lower=5, upper=100> peak1_Bt[Nx];
real<lower=.8, upper=5> peak1_sig2Ft;
real<lower=0> peak1_sig2At;
real<lower=0> peak1_sig2Bt;
//Peak 2
real<lower=0, upper=1> peak2_Ft[Nx];
real<lower=0> peak2_At[Nx];
real<lower=0, upper=2> peak2_Bt[Nx];
real<lower=0, upper= 1> peak2_sig2Ft;
real<lower=0> peak2_sig2At;
real<lower=0> peak2_sig2Bt;
//Peak 3
real<lower=1, upper=3> peak3_Ft[Nx];
real<lower=0> peak3_At[Nx];
real<lower=1, upper=10> peak3_Bt[Nx];
real<lower=0, upper= 1> peak3_sig2Ft;
real<lower=0> peak3_sig2At;
real<lower=0> peak3_sig2Bt;
//Baseline
real<lower=0> baseline_At[Nx];
real<lower=0, upper=1> baseline_Rt[Nx];
real baseline_Ot[Nx];
real<lower=0> baseline_sig2At;
real<lower=0> baseline_sig2Rt;
real<lower=0> baseline_sig2Ot;
//Observation Noise
real<lower=0, upper=10> sig2obs;
}
model {
//Model variables
matrix[Nx, Ny] mu; //Holds the mean
//Gamma parameters
real peak1_k;
real peak1_theta;
real peak2_k;
real peak2_theta;
real peak3_k;
real peak3_theta;
//Priors
peak1_Ft[1] ~ normal(20,5);
peak2_Ft[1] ~ normal(.1,.5);
peak2_Bt[1] ~ normal(.1,.05);
peak3_Ft[1] ~ normal(1,2);
peak3_Bt[1] ~ normal(2,.5);
baseline_Ot[1] ~ normal(-25,5);
baseline_Rt[1] ~ normal(.01,.001);
baseline_At[1] ~ normal(50,10);
sig2obs ~ cauchy(0,.5);
for (x in 1:Nx){
if(x>1)
{
//Create Random Walk
peak1_Ft[x] ~ normal(peak1_Ft[x-1], peak1_sig2Ft);
peak1_At[x] ~ normal(peak1_At[x-1], peak1_sig2At);
peak1_Bt[x] ~ normal(peak1_Bt[x-1], peak1_sig2Bt);
peak2_Ft[x] ~ normal(peak2_Ft[x-1], peak2_sig2Ft);
peak2_At[x] ~ normal(peak2_At[x-1], peak2_sig2At);
peak2_Bt[x] ~ normal(peak2_Bt[x-1], peak2_sig2Bt);
peak3_Ft[x] ~ normal(peak3_Ft[x-1], peak3_sig2Ft);
peak3_At[x] ~ normal(peak3_At[x-1], peak3_sig2At);
peak3_Bt[x] ~ normal(peak3_Bt[x-1], peak3_sig2Bt);
baseline_At[x] ~ normal(baseline_At[x-1], baseline_sig2At);
baseline_Rt[x] ~ normal(baseline_Rt[x-1], baseline_sig2Rt);
baseline_Ot[x] ~ normal(baseline_Ot[x-1], baseline_sig2Ot);
}
//Compute Gamma Terms
peak2_k=(sqrt(peak2_Ft[x]^2*(4*peak2_Bt[x]+peak2_Ft[x]^2))+2*peak2_Bt[x]+peak2_Ft[x]^2)/(2*peak2_Bt[x]);
peak2_theta=(sqrt(peak2_Ft[x]^2*(4*peak2_Bt[x]+peak2_Ft[x]^2))-peak2_Ft[x]^2)/(2*peak2_Ft[x]);
peak3_k=(sqrt(peak3_Ft[x]^2*(4*peak3_Bt[x]+peak3_Ft[x]^2))+2*peak3_Bt[x]+peak3_Ft[x]^2)/(2*peak3_Bt[x]);
peak3_theta=(sqrt(peak3_Ft[x]^2*(4*peak3_Bt[x]+peak3_Ft[x]^2))-peak3_Ft[x]^2)/(2*peak3_Ft[x]);
peak1_k=(sqrt(peak1_Ft[x]^2*(4*peak1_Bt[x]+peak1_Ft[x]^2))+2*peak1_Bt[x]+peak1_Ft[x]^2)/(2*peak1_Bt[x]);
peak1_theta=(sqrt(peak1_Ft[x]^2*(4*peak1_Bt[x]+peak1_Ft[x]^2))-peak1_Ft[x]^2)/(2*peak1_Ft[x]);
for (y in 1:Ny){
//Add baseline
mu[x,y] = baseline_At[x]*(1-baseline_Rt[x])^y_vals[y]+baseline_Ot[x];
//Add Peak 1
mu[x,y] = mu[x,y] + peak1_At[x]/(exp(1-peak1_k)*((peak1_k-1)*peak1_theta)^(peak1_k-1))*y_vals[y]^(peak1_k-1)*exp(-y_vals[y]/peak1_theta);
//Add Peak 2
mu[x,y] = mu[x,y] + peak2_At[x]/(exp(1-peak2_k)*((peak2_k-1)*peak2_theta)^(peak2_k-1))*y_vals[y]^(peak2_k-1)*exp(-y_vals[y]/peak2_theta);
//Add Peak 3
mu[x,y] = mu[x,y] + peak3_At[x]/(exp(1-peak3_k)*((peak3_k-1)*peak3_theta)^(peak3_k-1))*y_vals[y]^(peak3_k-1)*exp(-y_vals[y]/peak3_theta);
}
}
to_vector(surface) ~ normal(to_vector(mu), sig2obs);
}
If you can't rescale the data, make these
peak_Ft_raw[1] ~ normal(0, 1);
peak_Ft[1] = 20 + 5 * peak_Ft_raw;
There's also a time-series example in the manual that suggests
replacing something like
> for (x in 1:Nx){
> if(x>1)
> {
> //Create Random Walk
> peak1_Ft[x] ~ normal(peak1_Ft[x-1], peak1_sig2Ft);
with
peak1_Ft[2:Nx] ~ normal(peak1_Ft[1:(Nx - 1)], peak1_sig2Ft);
this should provide a substantial speedup.
I didn't understand the rest of the model, but if there are
any shared terms in all those computations, saving them and
reusing is a big gain.
I'd strongly recommend writing that cut-and-paste formula in
the following as a function to avoid errors (assuming these really
are all the same formula---that's one of the reasons to use
a function---to highlight the repetition):
That would work the same way, by breaking down the normal
foo[t] ~ normal(g(foo[t-1]), sigma);
as
foo_raw[t] ~ normal(0, 1);
foo[t] = g(foo[t - 1]) + sigma * foo_raw[t];
where g is any kind of function you want.
parameters {
real foo_raw;
real sigma;
}
real foo[N]//Is foo a transformed parameter?
//Does this go in the model of transformed parameters?
foo_raw ~ normal(0,1);
sigma ~ cauchy(0, .5);
foo[1] = 20 + sigma*foo_raw;
foo[2:N]=foo[1:N-1] + sigma*foo_raw;> Since foo_raw is always ~normal(0,1) is it necessary to have T versions of it?
Yes---it's characterizing the movement of the elements
of the time series on the unit scale. It might be helpful
for you to try it and see the difference. It won't be a time
series model.
for t in (2:Nt){
foo_raw[t] ~ normal(0,1);
foo[t] = foo[t-1] + sigma*foo_raw[t];
}
foo_raw ~ normal(0,1);
for t in (2:Nt){
foo[t] = foo[t-1] + sigma*foo_raw;
}> If so, to constrain the bounds of foo (upper=a, lower=b), must I now constrain foo_raw to constrain foo indirectly?
Are you sure you really want to do that? Where do the bounds
come from in the generative process you're envisioning here?
If you do need those bounds, you'd need Jacobian adjustments.
Exception thrown at line 215: normal_log: Location parameter[2236] is -nan, but must be finite!
If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.functions {
//Compute the k parameter
real get_k(real Ft, real Bt){
return (sqrt(Ft^2*(4*Bt+Ft^2))+2*Bt+Ft^2)/(2*Bt);
}
//Compute the theta parameter
real get_theta(real Ft, real Bt){
return (sqrt(Ft^2*(4*Bt+Ft^2))-Ft^2)/(2*Ft);
}
//Compute the fixed term in the gamma function
real get_gamma_term(real At, real k, real theta){
return At/(exp(1-k)*((k-1)*theta)^(k-1));
}
//Compute the gamma function
real gamma(real gamma_term, real k, real theta, real freq){
return gamma_term*freq^(k-1)*exp(-freq/theta);
}
}
data {
int<lower=0> Nt; //number of times
int<lower=0> Nf; //number of frequencies
vector[Nf] yvals; //y values
matrix[Nt, Nf] data_matrix; //spectrogram
}
parameters{
//Peak 1 Oscillation
vector[Nt] peak1_Ft_raw;
vector[Nt] peak1_At_raw;
vector[Nt] peak1_Bt_raw;
real<lower=0> peak1_sig2Ft;
real<lower=0> peak1_sig2At;
real<lower=0> peak1_sig2Bt;
//Peak 1 Oscillation
vector[Nt] peak2_Ft_raw;
vector[Nt] peak2_At_raw;
vector[Nt] peak2_Bt_raw;
real<lower=0> peak2_sig2Ft;
real<lower=0> peak2_sig2At;
real<lower=0> peak2_sig2Bt;
//Peak 3
vector[Nt] peak3_Ft_raw;
vector[Nt] peak3_At_raw;
vector[Nt] peak3_Bt_raw;
real<lower=0> peak3_sig2Ft;
real<lower=0> peak3_sig2At;
real<lower=0> peak3_sig2Bt;
//Background
vector[Nt] baseline_At_raw;
vector[Nt] baseline_Rt_raw;
vector[Nt] baseline_Ot_raw;
real<lower=0> baseline_sig2At;
real<lower=0> baseline_sig2Rt;
real<lower=0> baseline_sig2Ot;
//Observation Noise
real<lower=0> sig2obs;
}
transformed parameters{
vector[Nt] peak1_Ft;
vector[Nt] peak1_At;
vector[Nt] peak1_Bt;
vector[Nt] peak2_Ft;
vector[Nt] peak2_At;
vector[Nt] peak2_Bt;
vector[Nt] peak3_Ft;
vector[Nt] peak3_At;
vector[Nt] peak3_Bt;
vector[Nt] baseline_At;
vector[Nt] baseline_Rt;
vector[Nt] baseline_Ot;
//Peak 1 Priors
peak1_Ft[1] =.1 + peak1_Ft_raw[1]*peak1_sig2Ft;
peak1_At[1] = 5 + peak1_At_raw[1]*peak1_sig2At;
peak1_Bt[1] = 1 + peak1_Bt_raw[1]*peak1_sig2Bt;
//Peak 1 Priors
peak2_Ft[1] = 1 + peak2_Ft_raw[1]*peak2_sig2Ft;
peak2_At[1] = 5 + peak2_At_raw[1]*peak2_sig2At;
peak2_Bt[1] = 1 + peak2_Bt_raw[1]*peak2_sig2Bt;
//Peak 3 Priors
peak3_Ft[1] = 20 + peak3_Ft_raw[1]*peak3_sig2Ft;
peak3_At[1] = 5 + peak3_At_raw[1]*peak3_sig2At;
peak3_Bt[1] = 1 + peak3_Bt_raw[1]*peak3_sig2Bt;
//Baseline Priors
baseline_At[1] = 50 + baseline_At_raw[1]*baseline_sig2At;
baseline_Rt[1] = .01 + baseline_Rt_raw[1]*baseline_sig2Rt;
baseline_Ot[1] = -25 + baseline_Ot_raw[1]*baseline_sig2Ot;
for (x in 2:Nt){
//Transformed Random Walks
peak1_Ft[x] = peak1_Ft[x-1] + peak1_Ft_raw[x]*peak1_sig2Ft;
peak1_At[x] = peak1_At[x-1] + peak1_At_raw[x]*peak1_sig2At;
peak1_Bt[x] = peak1_Bt[x-1] + peak1_Bt_raw[x]*peak1_sig2Bt;
peak2_Ft[x] = peak2_Ft[x-1] + peak2_Ft_raw[x]*peak2_sig2Ft;
peak2_At[x] = peak2_At[x-1] + peak2_At_raw[x]*peak2_sig2At;
peak2_Bt[x] = peak2_Bt[x-1] + peak2_Bt_raw[x]*peak2_sig2Bt;
peak3_Ft[x] = peak3_Ft[x-1] + peak3_Ft_raw[x]*peak3_sig2Ft;
peak3_At[x] = peak3_At[x-1] + peak3_At_raw[x]*peak3_sig2At;
peak3_Bt[x] = peak3_Bt[x-1] + peak3_Bt_raw[x]*peak3_sig2Bt;
baseline_At[x] = baseline_At[x-1] + baseline_At_raw[x]*baseline_sig2At;
baseline_Rt[x] = baseline_Rt[x-1] + baseline_Rt_raw[x]*baseline_sig2Rt;
baseline_Ot[x] = baseline_Ot[x-1] + baseline_Ot_raw[x]*baseline_sig2Ot;
}
}
model {
//Model variables
matrix[Nt, Nf] mu; //Holds the mean
//Gamma parameters
real peak1_k;
real peak1_theta;
real peak2_k;
real peak2_theta;
real peak3_k;
real peak3_theta;
real peak1_gamma;
real peak2_gamma;
real peak3_gamma;
//Keep estimated parameters on the same scale
peak1_Ft_raw ~ normal(0,1);
peak1_At_raw ~ normal(0,1);
peak1_Bt_raw ~ normal(0,1);
peak2_Ft_raw ~ normal(0,1);
peak2_At_raw ~ normal(0,1);
peak2_Bt_raw ~ normal(0,1);
peak3_Ft_raw ~ normal(0,1);
peak3_At_raw ~ normal(0,1);
peak3_Bt_raw ~ normal(0,1);
baseline_Ot_raw ~ normal(0,1);
baseline_Rt_raw ~ normal(0,1);
baseline_At_raw ~ normal(0,1);
for (x in 1:Nt){
//Compute Gamma Terms
peak1_k=get_k(peak1_Ft[x], peak1_Bt[x]);
peak1_theta=get_theta(peak1_Ft[x], peak1_Bt[x]);
peak1_gamma=get_gamma_term(peak1_At[x], peak1_k, peak1_theta);
peak2_k=get_k(peak2_Ft[x], peak2_Bt[x]);
peak2_theta=get_theta(peak2_Ft[x], peak2_Bt[x]);
peak2_gamma=get_gamma_term(peak2_At[x], peak2_k, peak2_theta);
peak3_k=get_k(peak3_Ft[x], peak3_Bt[x]);
peak3_theta=get_theta(peak3_Ft[x], peak3_Bt[x]);
peak3_gamma=get_gamma_term(peak3_At[x], peak3_k, peak3_theta);
for (y in 1:Nf){
//Add Background
mu[x,y] = (baseline_At[x])*(1-baseline_Rt[x])^yvals[y]+baseline_Ot[x];
//Add Peak 3
mu[x,y] = mu[x,y] + gamma(peak1_gamma, peak1_k, peak1_theta, yvals[y]);
//Add peak1 Oscillation
mu[x,y] = mu[x,y] + gamma(peak2_gamma, peak2_k, peak2_theta, yvals[y]);
//Add peak2 Oscillation
mu[x,y] = mu[x,y] + gamma(peak3_gamma, peak3_k, peak3_theta, yvals[y]);
}
}
to_vector(data_matrix) ~ normal(to_vector(mu), sig2obs);
}to_vector(data_matrix) ~ normal(to_vector(mu), sig2obs);functions {
...
}
data {
...
}
parameters{
//Background
vector[Nx] baseline_At_raw;
vector[Nx] baseline_Rt_raw;
vector[Nx] baseline_Ot_raw;
real<lower=0> baseline_sig2At;
real<lower=0> baseline_sig2Rt;
real<lower=0> baseline_sig2Ot;
//Observation Noise
real<lower=0> sig2obs;
}
transformed parameters{
vector[Nx] baseline_At;
vector[Nx] baseline_Rt;
vector[Nx] baseline_Ot;
//Baseline Priors
baseline_At[1] = 50 + baseline_At_raw[1]*baseline_sig2At;
baseline_Rt[1] = .01 + baseline_Rt_raw[1]*baseline_sig2Rt;
baseline_Ot[1] = -25 + baseline_Ot_raw[1]*baseline_sig2Ot;
for (x in 2:Nx){
baseline_At[x] = baseline_At[x-1] + baseline_At_raw[x]*baseline_sig2At;
baseline_Rt[x] = baseline_Rt[x-1] + baseline_Rt_raw[x]*baseline_sig2Rt;
baseline_Ot[x] = baseline_Ot[x-1] + baseline_Ot_raw[x]*baseline_sig2Ot;
}
}
model {
//Model variables
matrix[Nx, Ny] mu; //Holds the mean
//Set up priors for the sigmas
sig2obs ~ cauchy(0,.5);
bg_sig2At ~ cauchy(0, 1);
bg_sig2Rt ~ cauchy(0,.01);
bg_sig2Ot ~ cauchy(0, 1);
//Keep estimated parameters on the same scale
bg_Ot_raw[1:Nx] ~ normal(0,1);
bg_Rt_raw[1:Nx] ~ normal(0,1);
bg_At_raw[1:NX] ~ normal(0,1);
for (x in 1:Nx){
for (y in 1:Ny){
//Add Background
mu[x,y] = (baseline_At[x])*(1-baseline_Rt[x])^yvals[y]+baseline_Ot[x];
}
}
to_vector(data_matrix) ~ normal(to_vector(mu), sig2obs);
}
baseline_At[x] = baseline_At[x-1] + baseline_At_raw[x]*baseline_sig2At;
baseline_At[2:Nx] = baseline_At[1:(Nx-1)] + baseline_At_raw[2:Nx]*baseline_sig2At;
output-8.csv: Error evaluating the log probability at the initial value.
output-8.csv: Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
output-8.csv: Exception thrown at line 70: normal_log: Location parameter[3] is nan, but must be finite!
output-8.csv: If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
output-8.csv: but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
output-8.csv: Rejecting initial value:
output-8.csv: Error evaluating the log probability at the initial value.
output-8.csv: Initialization between (-2, 2) failed after 100 attempts.
output-8.csv: Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model.
to_vector(data_matrix) ~ normal(to_vector(mu), sig2obs);
> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.
> To post to this group, send email to stan-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/5jGpRYU0q1A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.
output-8.csv: Error evaluating the log probability at the initial value.
output-8.csv: Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
output-8.csv: Exception thrown at line 70: normal_log: Location parameter[1] is -nan, but must be finite!
output-8.csv: If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
output-8.csv: but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
output-8.csv: Rejecting initial value:
output-8.csv: Error evaluating the log probability at the initial value.
output-8.csv: Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
output-8.csv: Exception thrown at line 70: normal_log: Location parameter[2] is -nan, but must be finite!
output-8.csv: If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
output-8.csv: but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
output-8.csv: Rejecting initial value:
output-8.csv: Error evaluating the log probability at the initial value.
output-8.csv: Informational Message: The current Metropolis proposal is about to be rejected because of the following issue:
output-8.csv: Exception thrown at line 70: normal_log: Location parameter[3] is nan, but must be finite!
output-8.csv: If this warning occurs sporadically, such as for highly constrained variable types like covariance matrices, then the sampler is fine,
output-8.csv: but if this warning occurs often then your model may be either severely ill-conditioned or misspecified.
//Baseline Priors
bg_At[1] = 50 + bg_At_raw[1]*bg_sig2At;
bg_Rt[1] = .01 + bg_Rt_raw[1]*bg_sig2Rt;
bg_Ot[1] = -25 + bg_Ot_raw[1]*bg_sig2Ot;
//Transformed Random Walk
for (t in 2:Nt)
{
bg_At[t] = bg_At[t-1] + bg_At_raw[t]*bg_sig2At;
bg_Rt[t] = bg_Rt[t-1] + bg_Rt_raw[t]*bg_sig2Rt;
bg_Ot[t] = bg_Ot[t-1] + bg_Ot_raw[t]*bg_sig2Ot;
}
//Baseline Priors
bg_At[1] = 50 + bg_At_raw[1]*bg_sig2At;
bg_Rt[1] = .01 + bg_Rt_raw[1]*bg_sig2Rt;
bg_Ot[1] = -25 + bg_Ot_raw[1]*bg_sig2Ot;
//Transformed Random Walk
bg_At[2:Nt] = bg_At[1:(Nt-1)] + bg_At_raw[2:Nt]*bg_sig2At;
bg_Rt[2:Nt] = bg_Rt[1:(Nt-1)] + bg_Rt_raw[2:Nt]*bg_sig2At;
bg_Ot[2:Nt] = bg_Ot[1:(Nt-1)] + bg_Ot_raw[2:Nt]*bg_sig2At;bg_At, bg_Rt, and bg_Ot quickly go to NaN. Are these programmatically identical?> To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.> To post to this group, send email to stan-...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
--
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/5jGpRYU0q1A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+...@googlegroups.com.
To post to this group, send email to stan-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.
- what version of CmdStan do you have?
- can you post the output the error messages for both runs with the same seed? You didn't post your data, so it's a program that I really can't run. My guess is that the behavior is seed dependent, which would indicate problems with how you're computing mu. For example, what's freqs?
My guess: your problem is with line 76. (But this is just a guess.)
--
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to stan-users+unsubscribe@googlegroups.com.
Thanks for sending all the files over. It took a direct comparison to actually find the problem.
And for future reference, it really helps to send Stan programs with data. Just in case it's useful to anyone else, I debugged this by:1. Running both programs without changing anything. Verifying the behavior.2. Inspecting both programs for consistency.3. Reducing the number of iterations. I wanted to make sure the problem occurred with the Stan program.4. Copying over the working code into the non working code and comparing results. This verifies that everything was the same.5. Changing one of the three assignments. It's always easier for me to reason about one change over multiple changes.6. Verifying failure with one change.7. Digging through the logic for the one change. If I didn't spot it, I would have modified the program to print.I couldn't have done any of that with the trickle of changing programs strewn across multiple emails. I was only able to help once you actually sent programs and data over. As an exercise, try going back through your this thread and only use the info you provided to debug. Hopefully you'll see why I kept asking you to send full programs. If everything was attached at the very beginning, we would have been able to find this much sooner.And try using print to debug. It's useful.
There's also a time-series example in the manual that suggests
replacing something like
> for (x in 1:Nx){
> if(x>1)
> {
> //Create Random Walk
> peak1_Ft[x] ~ normal(peak1_Ft[x-1], peak1_sig2Ft);
with
peak1_Ft[2:Nx] ~ normal(peak1_Ft[1:(Nx - 1)], peak1_sig2Ft);
this should provide a substantial speedup.