Help me to fitting the Bayesian Generalized Method of Moment the Stan coding is following

//Simple Bayesian Generalized Method of Moments Model

//Essentially this model is the Bayesian analog to a Frequentist GEE model with

//an indepdent working correlation matrix

//

//the data consists of N 2-person families, thus we do not have independent observations

//however, GEE can be used to conduct valid inference on the mean parameters even given

//the fact that our working correlation matrix (I) is incorrect.

data {

int<lower=0> N; // number of 2-person families

real Y[N*2]; // response, ordered by family*

real X1[N2]; // 1 covariate

real N2;

}

parameters {

real beta0; //intercept

real beta1; //covariate effect

real<lower=0> phi; //variance

}

model {

real yhat[2];

real sigmak[2];

real sk[2];

vector[4] Fk;

matrix[4,3] D;

matrix[4,4] V;

matrix[3,N] utemp;

vector[3] u;

vector[3] U;

matrix[3,3] u2temp = rep_matrix(0, 3, 3);

matrix[3,3] Sigma;

//priors:

beta0~normal(0,100000);

beta1~normal(0,100000);

phi~uniform(0,100000);

for(i in 1:N){

yhat[1]= (beta0+beta1*X1[2*i-1]);

yhat[2]= (beta0+beta1*X1[2*i]);

sigmak[1]=phi;

sigmak[2]=phi;

sk[1]=(Y[2*i-1]-yhat[1])^2;*

sk[2]=(Y[2i]-yhat[2])^2;

Fk[1]=Y[2*i-1]-yhat[1];*

Fk[2]=Y[2i]-yhat[2];

Fk[3]=sk[1]-sigmak[1];

Fk[4]=sk[2]-sigmak[2];

D[1,1]=1.0; D[2,1]=1.0; D[3,1]=0.0; D[4,1]=0.0;

D[1,2]=X1[2*i-1]; D[2,2]=X1[2*i]; D[3,2]=0.0; D[4,2]=0.0;

D[1,3]=0.0; D[2,3]=0.0; D[3,3]=1.0; D[4,3]=1.0;

V[1,1]=phi; V[2,1]=0.0; V[3,1]=0.0; V[4,1]=0.0;

V[1,2]=0.0; V[2,2]=phi; V[3,2]=0.0; V[4,2]=0.0;

V[1,3]=0.0; V[2,3]=0.0; V[3,3]=2*phi^2; V[4,3]=0.0;*

V[1,4]=0.0; V[2,4]=0.0; V[3,4]=0; V[4,4]=2phi^2;

//u constains the 3 estimating functions for beta0, beta1, and phi

u= Dā*inverse(V)*Fk;*

utemp[1:3,i]=u;

u2temp = u2temp + uuā;

}

//U is the sample mean of the N uās

//U is asymptotically normal with mean 0 and variance consistently estimating by Sigma

//Bayesian GMM works by applying a normal likelihood to U, and then uses MCMC to estimate //the posterior of all parameters

U[1]=mean(utemp[1,]); U[2]=mean(utemp[2,]); U[3]=mean(utemp[3,]);

Sigma= 1/N2^2 * u2temp - 1/N2 * U*Uā;

//pseudolikelihood for GMM (Yin 2009 Bayes GMM paper doesnt use normalizing constant):

//However, model will not fit with or without the normalizing constantā¦

//target+= -3.0/2.0*log(2*3.14159265359)-0.5*log_determinant(Sigma)-0.5*Uā*inverse(Sigma)*U;*

target += -0.5Uā*inverse(Sigma)*U;

library(rstan)

load(āGEE1data1.RDataā)

data=list(Y=simdata$Y,X1=simdata$X1,N=length(table(simdata$famID)),N2=100.0)

fit = stan(file = āstan_GEE1_ind.stanā,data = data, cores = 1, chains = 1, iter = 10)

Result is following

SAMPLING FOR MODEL āstan_GEE1_indā NOW (CHAIN 1).

Rejecting initial value:

Log probability evaluates to log(0), i.e. negative infinity.

Stan canāt start sampling from this initial value.

Rejecting initial value:

Log probability evaluates to log(0), i.e. negative infinity.

Stan canāt start sampling from this initial value.

Rejecting initial value:

Log probability evaluates to log(0), i.e. negative infinity.

Stan canāt start sampling from this initial value.

Rejecting initial value:

Initialization between (-2, 2) failed after 100 attempts.

Try specifying initial values, reducing ranges of constrained values, or reparameterizing the model.

[1] āError in sampler$call_sampler(args_list[[i]]) : Initialization failed.ā

[2] āIn addition: Warning message:ā

[3] āIn readLines(file, warn = TRUE) :ā

[4] " incomplete final line found on āC:\Users\Muhammad Zada\Desktop\New folder\stan_GEE1_ind.stanā"

[1] "error occurred during calling the sampler; sampling not done"

please help meā¦