This RStan model was originally used in a publication from 2016 and I am trying to implement it in Pystan. I have done my best to update the code with respect to Stan’s current documentation, but I would like some feedback because I continue to get this error:

Exception: variable does not exist; processing stage=data initialization; variable name=f; base type=int (in ‘unknown file name’ at line 3)

```
data {
int<lower=0> N; // Number of dates in the set
int<lower=0> f[N]; // Number of failed components in a set
int<lower=0> s[N]; // Number of non-failed components in a set
real<lower=0> t[N]; // Time inspected
int<lower=2> p; // Number of covariates (intercept included)
row_vector[p] X[N]; // Matrix [N,p] of covariates (intercept included)
vector[p] a0; // Mean vector g-prior for alpha
vector[p] b0; // Mean vector g-prior for beta
cov_matrix[p] V1; // Covariate matrix g-prior for alpha
cov_matrix[p] V2; // Covariate matrix g-prior for beta
}
parameters {
vector[p] alpha; // parameter vector alpha
vector[p] beta; // parameter vector beta
}
model {
alpha ~ multi_normal(a0, V1); // gaussian-prior for alpha
beta ~ multi_normal(b0, V2); // gaussian-prior for beta
for (i in 1:N) {
// log-likelihood (for right and left censored data)
target += s[i]*weibull_lccdf(t[i] | exp(X[i]*alpha), exp(X[i]*beta));
target += f[i]*log(weibull_cdf(t[i], exp(X[i]*alpha), exp(X[i]*beta)));
}
}
generated quantities {
vector[N] eta; // scale parameter for each observation
for (i in 1:N) {
eta[i] = exp(X[i]*beta);
}
}
```

Here is my data. I originally had ndarrays of int32 for f and s, but I converted them to lists to avoid compatibility issues with C++. inspected_times is a list of times as floats, D is a list of deaths as ints, C is a list of censored as ints, cov_X is my feature (covariate) matrix

```
data = {
'N' : len(inspected_times), # Number of dates in the set
'f[N]' : D, # Number of failed components in a set
's[N]' : C, # Number of non-failed components in a set
't[N]' : inspected_times, # Time inspected
'p' : len(cov_X[0]), # Number of covariates (calendar, causes, intercept included)
'X' : cov_X, # [N,p] of covariates (calendar, cause, Sintercept)
'a0' : 0, # Mean vector g-prior for alpha
'b0' : 0, # Mean vector g-prior for beta
'V1' : len(inspected_times)*invert_matrix(cov_X.T@cov_X), # Cov. matrix g-prior for alpha
'V2' : len(inspected_times)*invert_matrix(cov_X.T@cov_X), # Cov. matrix g-prior for beta
}
```