"qpCItest"(X, i=1, j=2, Q=c(), exact.test=TRUE, use=c("complete.obs", "em"), tol=0.01, R.code.only=FALSE)
"qpCItest"(X, i=1, j=2, Q=c(), exact.test=TRUE, use=c("complete.obs", "em"), tol=0.01, R.code.only=FALSE)
"qpCItest"(X, i=1, j=2, Q=c(), I=NULL, long.dim.are.variables=TRUE, exact.test=TRUE, use=c("complete.obs", "em"), tol=0.01, R.code.only=FALSE)
"qpCItest"(X, i=1, j=2, Q=c(), I=NULL, long.dim.are.variables=TRUE, exact.test=TRUE, use=c("complete.obs", "em"), tol=0.01, R.code.only=FALSE)
"qpCItest"(X, i=1, j=2, Q=c(), R.code.only=FALSE)
ExpressionSet
object, a qtl::cross
object,
a data frame, a matrix or an SsdMatrix-class
object. In the latter case,
the input matrix should correspond to a sample covariance matrix of data on which we
want to test for conditional independence. The function qpCov()
can be used to estimate such matrices.X
to test.X
to test.X
forming the conditioning set.X
that are discrete. See details
below regarding this argument.FALSE
an asymptotic likelihood ratio test of
conditional independence test is employed with mixed (i.e., continuous and discrete)
data; if TRUE
(default) then an exact likelihood ratio test of conditional
independence with mixed data is employed. See details below regarding this argument."complete.obs"
(default)
or "em"
.use="em"
."htest"
containing the following components:
I=NULL
, the t-statistic for
zero partial regression coefficient; when I!=NULL
, the value Lambda
of
the likelihood ratio if exact.test=TRUE
and -n log Lambda
otherwise.I=NULL
, the degrees of freedom
for the t-statistic (n-q-2
); when I!=NULL
, the degrees of freedom for
-n log Lambda
of a chi-square distribution under the null hypothesis if
exact.test=FALSE
and the (a, b)
parameters of a beta distribution under
the null if exact.test=TRUE
.I=NULL
), the estimated partial
regression coefficient. In case of mixed continuous and discrete data with I!=NULL
,
the estimated partial eta-squared: the fraction of variance from i
or j
explained by the other tested variable after excluding the variance explained by the
variables in Q
. If one of the tested variables i
or j
is discrete,
then the partial eta-squared is calculated on the tested continuous variable. If both,
i
and j
are continuous, then the partial eta-squared is calculated on
variable i
.i, j
and Q
are continuous and I=NULL
, this function
performs a conditional independence test using a t-test for zero partial regression coefficient
(Lauritzen, 1996, pg. 150). Note that the size of possible Q
sets should be in
the range 1 to min(p,n-3)
, where p
is the number of variables and n
the number of observations. The computational cost increases linearly with
the number of variables in Q
.When variables in i, j
and Q
are continuous and discrete (mixed data),
indicated with the I
argument when X
is a matrix, then mixed graphical
model theory (Lauritzen and Wermuth, 1989) is employed and, concretely, it is assumed
that data come from an homogeneous conditional Gaussian distribution. By default, with
exact.test=TRUE
, an exact likelihood ratio test for conditional independence is
performed (Lauritzen, 1996, pg. 192-194; Tur, Roverato and Castelo, 2014), otherwise an
asymptotic one is used.
In this setting further restrictions to the maximum value of q
apply, concretely,
it cannot be smaller than p
plus the number of levels of the discrete variables
involved in the marginal distributions employed by the algorithm.
Lauritzen, S.L. Graphical models. Oxford University Press, 1996.
Lauritzen, S.L and Wermuth, N. Graphical Models for associations between variables, some of which are qualitative and some quantitative. Ann. Stat., 17(1):31-57, 1989.
Tur, I., Roverato, A. and Castelo, R. Mapping eQTL networks with mixed graphical models. Submitted, http://arxiv.org/abs/1402.4547, 2014.
qpCov
qpNrr
qpEdgeNrr
require(mvtnorm)
nObs <- 100 ## number of observations to simulate
## the following adjacency matrix describes an undirected graph
## where vertex 3 is conditionally independent of 4 given 1 AND 2
A <- matrix(c(FALSE, TRUE, TRUE, TRUE,
TRUE, FALSE, TRUE, TRUE,
TRUE, TRUE, FALSE, FALSE,
TRUE, TRUE, FALSE, FALSE), nrow=4, ncol=4, byrow=TRUE)
Sigma <- qpG2Sigma(A, rho=0.5)
X <- rmvnorm(nObs, sigma=as.matrix(Sigma))
qpCItest(X, i=3, j=4, Q=1, long.dim.are.variables=FALSE)
qpCItest(X, i=3, j=4, Q=c(1,2), long.dim.are.variables=FALSE)
Run the code above in your browser using DataLab