# Logistic Regression in Stan

Hi everyone!
I am attempting to code a logistic regression model on Stan.
I have 6 θs from θ1 to θ6. By right, the mean of θ1 is supposed to be 0.1, θ2 is supposed to be 0.2, θ3 is supposed to be 0.3, θ4 is supposed to be 0.4, θ5 is supposed to be 0.5, θ6 is supposed to be 0.6. However, all the means of my θs are 0, so not sure what is wrong.

This is my data:
N <- 1000
X <- rbinom(N,1,0.5)
p <- 6
theta1_0_star <- 0
theta1_star <- c(0.1,0.2,0.3,0.4,0.5,0.6)
C_numbers <- rnorm(N*p,mean=0,sd=1)
C <- matrix(data = C_numbers, nrow = N, ncol = p)

And this is my stan code:

``````data {
int<lower=0> N;
int<lower=0> p;
int X[N];
real theta1_0_star;
vector[p] theta1_star;
matrix[N,p] C;

}

parameters {
real theta1_0;
vector[p] theta1;
}

model {
theta1_0 ~ normal(theta1_0_star,sqrt(800));
theta1 ~ normal(theta1_star,sqrt(50));
target += bernoulli_logit_glm_lpmf(X|C,theta1_0,theta1);

}
``````

I appreciate the help and apologise for any inconvenience caused!

You’ve generated the data, `X`, in R using a formula with no dependence on your predictors, so the subsequent inference on the influence of these predictors will yield zeros.

Hi Mike,

Thanks for your reply! I see, alright thanks! Will figure how to generate X.