[Mediation-information] (no subject)
dustin tingley
dtingley at gov.harvard.edu
Thu Feb 11 15:53:46 CET 2016
*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 <http://scholar.harvard.edu/dtingley>
Director of Graduate Studies, Government Department
Faculty Director, Vice Provost on Advances in Learning (VPAL) Research Team
<http://vpal.harvard.edu/research>
Director, Program on Experience Based Learning in the Social Sciences
<http://projects.iq.harvard.edu/peblss/>
Faculty Founder and Director, ABLConnect <http://ablconnect.harvard.edu/>,
the Active and Activity Based Learning Connection
Director, Undergraduate Research Scholars <http://urs.iq.harvard.edu/>,
Institute of Quantitative Social Science
-Contribute to the Research Resource Reservoir
<http://urs.iq.harvard.edu/pages/research-resources>
On Mon, Feb 8, 2016 at 6:25 AM, L.R.A. Schouten <l.r.schouten at amc.uva.nl>
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: <http://lists.r-forge.r-project.org/pipermail/mediation-information/attachments/20160211/c096b0f3/attachment.html>
More information about the Mediation-information
mailing list