[R] Covariance between two dichotomous variables

Heather Kettrey heather.h.kettrey at vanderbilt.edu
Wed Sep 3 06:29:33 CEST 2014


I am trying to test a mediation hypothesis using coefficients from logistic
regression analyses (x, m, and y are all dichotomous). I am running a test
of significance using MacKinnon and Dwyer's adaptation of Sobel's test
(i.e., correcting for different scales of coefficients in cases of a
dichotomous outcome).

In order to make this correction I need to compute the covariance between x
and m. I have searched various R packages and the R-help page archive and
cannot find a way to do this in R.

Does anyone know how to compute the covariance between two dichotomous
variables in R? It seems like there should be a very simple answer to this
question, but I cannot find it.

Thanks in advance!


Heather Hensman Kettrey
PhD Candidate
Department of Sociology
Vanderbilt University

	[[alternative HTML version deleted]]

More information about the R-help mailing list