I continue to encounter issues in my courses where some Windows computers crash RStudio when running models like that included below. The problems do not arise on Mac or Linux, or PyStan on Windows. They seem to be limited to Windows 10, but having Windows 10 is not sufficient. Machines with 16 GB of RAM (and no other processes starving the system of memory) still crash. One possible commonality is Windows 10 Enterprise?
I have two system specs for machines that were causing problems if that might help.
Any thoughts?
data {
int<lower=1> N; // Number of observations
int<lower=1> N_location; // Number of location groups
int<lower=1, upper=N_location> location[N]; // Location group assignments
int<lower=1> N_method; // Number of method groups
int<lower=1, upper=N_method> method[N]; // Method group assignments
vector[N] x; // Covariates
int y[N]; // Binary variates
}
parameters {
real mu_alpha; // Location intercepts population mean
real<lower=0> sigma_alpha; // Location intercepts population standard deviation
vector[N_location] alpha_location_tilde; // Non-centered location intercepts
real mu_beta; // Location slopes population mean
real<lower=0> sigma_beta; // Location slopes population standard deviation
vector[N_location] beta_location_tilde; // Non-centered location slopes
}
transformed parameters {
// Recentered intercepts for each location group
vector[N_location] alpha_location = mu_alpha + sigma_alpha * alpha_location_tilde;
// Recentered slopes for each location group
vector[N_location] beta_location = mu_beta + sigma_beta * beta_location_tilde;
}
model {
mu_alpha ~ normal(0, 0.5); // Prior model
sigma_alpha ~ normal(0, 2); // Prior model
alpha_location_tilde ~ normal(0, 1); // Non-centered hierarchical model
mu_beta ~ normal(0, 0.5); // Prior model
sigma_beta ~ normal(0, 2); // Prior model
beta_location_tilde ~ normal(0, 1); // Non-centered hierarchical model
// Observational model
y ~ bernoulli_logit(beta_location[location] .* x + alpha_location[location]);
}