---------- Forwarded message ---------- From: thanoon younis <thanoon.youni...@gmail.com> Date: Thursday, June 5, 2014 Subject: error in R program To: Charles Determan Jr <deter...@umn.edu>
many thanks to you Dr. Charles Really i have a problem with simulation data in xi and now i have this erro r "Error in mvrnorm(1, c(0, 0, 0), phi1, tol = 1e-06, empirical = FALSE, : incompatible arguments" Regards On 5 June 2014 16:45, Charles Determan Jr <deter...@umn.edu> wrote: Hello again Thanoon, Once again, you should send these request not to me but to the r-help list. You are far more likely to get help from the greater R community than just me. Furthermore, it is not entirely clear where your error is. It is courteous to provide only the code that is run up to the error and commenting the location. I see you have a loop and all the more important to isolate where the error is taking place and commenting it out. My recommendations: 1. Set both t and i = 1 and try to run your loop code manually to locate the specific function providing the error. 2. Check your data inputs for the function. The error tells you that some data is missing or infinite. Perhaps a slight error in your data generation? 3. See if you can address the specific instance before running the full loops, it may be multiple instances or just one. I hope this provides some guidance, Charles On Thu, Jun 5, 2014 at 3:10 AM, thanoon younis <thanoon.youni...@gmail.com> wrote: Dear Dr. Charles i need your help to correct the winbugs code below to estimate parameters of SEM by using bayesian inference for two group. I have this error"Error in eigen(Sigma, symmetric = TRUE, EISPACK = EISPACK) : infinite or missing values in 'x'. many thanks in advance R-CODE library(MASS) #Load the MASS package library(R2WinBUGS) #Load the R2WinBUGS package library(boa) #Load the boa package library(coda) #Load the coda package N1<-200;N2=100; P1<-10;P2<-10 phi1<-matrix(NA,nrow=4,ncol=4) #The covariance matrix of xi1 Ro1<-matrix(NA,nrow=4,ncol=4) yo1<-matrix(data=NA,nrow=200,ncol=10) phi2<-matrix(NA,nrow=4,ncol=4) #The covariance matrix of xi2 Ro2<-matrix(NA,nrow=4,ncol=4) yo2<-matrix(data=NA,nrow=200,ncol=10) #Matrices save the Bayesian Estimates and Standard Errors Eu1<-matrix(data=NA,nrow=100,ncol=10) SEu<-matrix(data=NA,nrow=100,ncol=10) Elam1<-matrix(data=NA,nrow=100,ncol=6) SElam1<-matrix(data=NA,nrow=100,ncol=6) Egam1<-matrix(data=NA,nrow=100,ncol=4) SEgam1<-matrix(data=NA,nrow=100,ncol=4) Ephx1<-matrix(data=NA,nrow=100,ncol=4) SEphx1<-matrix(data=NA,nrow=100,ncol=4) Eb1<-numeric(100); SEb<-numeric(100) Esgd1<-numeric(100); SEsgd<-numeric(100) Eu2<-matrix(data=NA,nrow=100,ncol=10) SEu2<-matrix(data=NA,nrow=100,ncol=10) Elam2<-matrix(data=NA,nrow=100,ncol=6) SElam2<-matrix(data=NA,nrow=100,ncol=6) Egam2<-matrix(data=NA,nrow=100,ncol=3) SEgam2<-matrix(data=NA,nrow=100,ncol=3) Ephx2<-matrix(data=NA,nrow=100,ncol=3) SEphx2<-matrix(data=NA,nrow=100,ncol=3) Eb2<-numeric(100); SEb2<-numeric(100) Esgd2<-numeric(100); SEsgd2<-numeric(100) #Arrays save the HPD intervals mu.y1=array(NA, c(100,10,2)) lam1=array(NA, c(100,6,2)) gam1=array(NA, c(100,4,2)) sgd1=array(NA, c(100,2)) phx1=array(NA, c(100,4,2)) mu.y2=array(NA, c(100,10,2)) lam2=array(NA, c(100,6,2)) gam2=array(NA, c(100,3,2)) sgd2=array(NA, c(100,2)) phx2=array(NA, c(100,3,2)) DIC=numeric(100) #DIC values #Parameters to be estimated parameters<-c ("mu.y1","lam1","gam1","phi1","psi1","psd1","sgd1","phx1","mu.y2","lam2","gam2","phi2","psi2","psd2","sgd2","phx2") #Initial values for the MCMC in WinBUGS init1<-list(uby1=rep(0.0,10),lam1=rep(0.0,10), gam1=c(1.0,1.0,1.0 -- Dr. Charles Determan, PhD Integrated Biosciences [[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.