From l.r.schouten at amc.uva.nl Mon Feb 8 12:25:31 2016 From: l.r.schouten at amc.uva.nl (L.R.A. Schouten) Date: Mon, 8 Feb 2016 11:25:31 +0000 Subject: [Mediation-information] (no subject) Message-ID: <2A83A0CC0AA54F438EA9D441E777D0083A6732FE@MS-APP-804B.amc.intra> Dear Angel, I read your question on http://lists.r-forge.r-project.org/ about the error: Error in if (xhat == 0) out <- 1 else { : missing value where TRUE/FALSE needed I get the same error when using I got the same error using the code: med.fit<-glm(formula = cluster_two~Tertile_age, data=cluster, family=binomial) out.fit<-glm(formula = death ~cluster_two+Tertile_age, data=cluster, family=binomial) Did you figure out what causes the error. Thank you in advance! Laura Laura Schouten MD | Phd candidate Pediatric Intensive Care | Department of intensive care & Laboratory of Experimental Intensive Care and Anesthesiology (LEICA) | Room G3-227 Emma Children's Hospital | Academic Medical Center | Meibergdreef 9, 1105 AZ Amsterdam | E: l.r.schouten at amc.nl | T: 020 5666342 | m:+31641149755 ________________________________ AMC Disclaimer : https://www.amc.nl/disclaimer ________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: From dtingley at gov.harvard.edu Thu Feb 11 15:53:46 2016 From: dtingley at gov.harvard.edu (dustin tingley) Date: Thu, 11 Feb 2016 09:53:46 -0500 Subject: [Mediation-information] (no subject) In-Reply-To: <2A83A0CC0AA54F438EA9D441E777D0083A6732FE@MS-APP-804B.amc.intra> References: <2A83A0CC0AA54F438EA9D441E777D0083A6732FE@MS-APP-804B.amc.intra> Message-ID: *THIS WAS THE RESPONSE TO ANGEL* Hi Angel, You have to change the mediator into number like 0 and 1. --------------------------------------------------------------------------- library("mediation") library("sandwich") set.seed(2014) load("~/Desktop/kentaro.rda") kentaro$estudic.new <- 0 kentaro$estudic.new[kentaro$estudic == "Menos que primarios"] <- 1 kentaro$estudic <- kentaro$estudic.new med.fit <- glm(estudic ~ edad_c + sexo + regalf + deprinf, family="binomial" ,data=kentaro) out.fit <- glm(benvii ~ edad_c + sexo + regalf + deprinf + estudic, family="binomial" ,data=kentaro) med.out <- mediate(med.fit, out.fit, treat = "deprinf", mediator = "estudic", robustSE = TRUE, sims = 100, control.value = "no", treat.value = "s\xed") summary(med.out) --------------------------------------------------------------------------- Best, Kentaro Dustin Tingley Professor of Government Government Department Harvard University Webpage Director of Graduate Studies, Government Department Faculty Director, Vice Provost on Advances in Learning (VPAL) Research Team Director, Program on Experience Based Learning in the Social Sciences Faculty Founder and Director, ABLConnect , the Active and Activity Based Learning Connection Director, Undergraduate Research Scholars , Institute of Quantitative Social Science -Contribute to the Research Resource Reservoir On Mon, Feb 8, 2016 at 6:25 AM, L.R.A. Schouten wrote: > Dear Angel, > > I read your question on http://lists.r-forge.r-project.org/ about the error: Error in if (xhat == 0) out <- 1 else { : missing value where TRUE/FALSE needed I get the same error when using > > > > I got the same error using the code: > > med.fit<-glm(formula = cluster_two~Tertile_age, data=cluster, > family=binomial) > > out.fit<-glm(formula = death ~cluster_two+Tertile_age, data=cluster, > family=binomial) > > > > Did you figure out what causes the error. > > Thank you in advance! > > > > Laura > > > > Laura Schouten MD | Phd candidate Pediatric Intensive Care | Department of > intensive care & Laboratory of Experimental Intensive Care and > Anesthesiology (LEICA) | Room G3-227 Emma Children's Hospital | Academic > Medical Center | Meibergdreef 9, 1105 AZ Amsterdam | E: > l.r.schouten at amc.nl | T: 020 5666342 | m:+31641149755 > > > > ------------------------------ > > AMC Disclaimer : https://www.amc.nl/disclaimer > ------------------------------ > > > _______________________________________________ > Mediation-information mailing list > Mediation-information at lists.r-forge.r-project.org > > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/mediation-information > -------------- next part -------------- An HTML attachment was scrubbed... URL: