Can someone explain why I am getting the following error: in the r code
below?

Error in solve.default(diag(2) + ((1/currvar) * (XX1 %*% t(XX1)))) :
  system is computationally singular: reciprocal condition number = 0
In addition: There were 50 or more warnings (use warnings() to see the first
50)

The R code is part of a bigger program.





            ##sample from full conditional distribution of Si
            #Prob(Si = 1)
            for (j in 1:N)
            {

            numerat =
currphi1*exp((-1/(2*currvar))*t(Y1-(t(XX1)%*%currbeta1))%*%(Y1-(t(XX1)%*%currbeta1)))
            denomin =
currphi2*exp((-1/(2*currvar))*t(Y2-(t(XX2)%*%currbeta2))%*%(Y2-(t(XX2)%*%currbeta2)))
            sum=denomin + numerat
            ProbSi = numerat/sum
            arunofSi[j]=rbinom(1,1,ProbSi)  #Generate 50 Bernoulli rvs and
assign them to arunofSi array

            }

            N0=sum(arunofSi==0)    #We check the number of zeros in the
arrays
            N1= sum(arunofSi==1)   #We check the number of ones in the array
                                   #The N0 and N1 values are the number of
subjects in groups 0 and 1.
                                   #This is fed into the Dirichlet function
below to create the currphi's




Jim

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to