hi I've been using this code to set a reference level for uni and multivariate analysis rmix$interviewmethodcode<-relevel(mix$interviewmethodcode,ref="SAQ") summary(rma.1<-rma(yi,vi,mods=~interviewmethodcode,data=rmix,method="SJ",knha=F,weighted=F,intercept=T)) giving this output: Model Results: estimate se zval pval ci.lb ci.ub intrcpt 0.1437 0.0176 8.1485 <.0001 0.1091 0.1783 *** interviewmethodcodeACASI 0.0022 0.0412 0.0545 0.9566 -0.0784 0.0829 interviewmethodcodeFTFI -0.0926 0.0656 -1.4112 0.1582 -0.2213 0.0360 However, when i use the same code with a different variable (below) I get the error message - "Error in qr.solve(wX, diag(k)) : singular matrix 'a' in solve". rmix$continent<-relevel(mix$continent,ref="North America") summary(rma.1<-rma(yi,vi,mods=~continent,data=rmix,method="SJ",knha=F,weighted=F,intercept=T)) Can anyone help to see where the problem is? thanks Branwen hi I've been using this code to set a reference level for uni and multivariate analysis rmix$interviewmethodcode<-relevel(mix$interviewmethodcode,ref="SAQ") summary(rma.1<-rma(yi,vi,mods=~interviewmethodcode,data=rmix,method="SJ",knha=F,weighted=F,intercept=T)) giving this output: Model Results: estimate se zval pval ci.lb ci.ub intrcpt 0.1437 0.0176 8.1485 <.0001 0.1091 0.1783 *** interviewmethodcodeACASI 0.0022 0.0412 0.0545 0.9566 -0.0784 0.0829 interviewmethodcodeFTFI -0.0926 0.0656 -1.4112 0.1582 -0.2213 0.0360 However, when i use the same code with a different variable (below) I get the error message - "Error in qr.solve(wX, diag(k)) : singular matrix 'a' in solve". rmix$continent<-relevel(mix$continent,ref="North America") summary(rma.1<-rma(yi,vi,mods=~continent,data=rmix,method="SJ",knha=F,weighted=F,intercept=T)) Can anyone help to see where the problem is? thanks Branwen -- View this message in context: http://r.789695.n4.nabble.com/metafor-matrix-error-tp4667653.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]
Dear Branwen, This means that your design matrix is not of full rank (in a more recent version of the metafor package, the error message is a bit more informative; i.e., please upgrade). Since "continent" is a factor, this should imply that one of the levels never actually occurs, leading to a column of 0s in the design matrix, which then causes the problem with the matrix inversion. Best, Wolfgang -- Wolfgang Viechtbauer, Ph.D., Statistician Department of Psychiatry and Psychology School for Mental Health and Neuroscience Faculty of Health, Medicine, and Life Sciences Maastricht University, P.O. Box 616 (VIJV1) 6200 MD Maastricht, The Netherlands +31 (43) 388-4170 | http://www.wvbauer.com> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] > On Behalf Of Branwen Owen > Sent: Tuesday, May 21, 2013 23:12 > To: r-help at r-project.org > Subject: [R] metafor matrix error > > hi > I've been using this code to set a reference level for uni and > multivariate analysis > rmix$interviewmethodcode<- > relevel(mix$interviewmethodcode,ref="SAQ") > summary(rma.1<- > rma(yi,vi,mods=~interviewmethodcode,data=rmix,method="SJ",knha=F,weighted> F,intercept=T)) > giving this output: > Model Results: > estimate se zval pval ci.lb > ci.ub > intrcpt 0.1437 0.0176 8.1485 <.0001 > 0.1091 0.1783 *** > interviewmethodcodeACASI 0.0022 0.0412 0.0545 0.9566 - > 0.0784 0.0829 > interviewmethodcodeFTFI -0.0926 0.0656 -1.4112 0.1582 - > 0.2213 0.0360 > > However, when i use the same code with a different variable (below) I get > the error message - "Error in qr.solve(wX, diag(k)) : singular matrix 'a' > in solve". > rmix$continent<-relevel(mix$continent,ref="North America") > summary(rma.1<- > rma(yi,vi,mods=~continent,data=rmix,method="SJ",knha=F,weighted=F,intercep > t=T)) > > Can anyone help to see where the problem is? > thanks > Branwen > > -- > View this message in context: http://r.789695.n4.nabble.com/metafor- > matrix-error-tp4667653.html > Sent from the R help mailing list archive at Nabble.com. > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.