"qpAllCItests"(X, I=NULL, Q=NULL, pairup.i=NULL, pairup.j=NULL, long.dim.are.variables=TRUE, exact.test=TRUE, use=c("complete.obs", "em"), tol=0.01, return.type=c("p.value", "statn", "all"), verbose=TRUE, R.code.only=FALSE, clusterSize=1, estimateTime=FALSE, nAdj2estimateTime=10)
X
that are discrete.
See details below regarding this argument.X
forming the conditioning set.pairup.j
pairup.i
TRUE
it is assumed
that when data are in a data frame or in a matrix, the longer dimension
is the one defining the random variables (default); if FALSE
, then
random variables are assumed to be at the columns of the data frame or matrix.FALSE
an asymptotic conditional independence
test is employed with mixed (i.e., continuous and discrete) data;
if TRUE
(default) then an exact conditional independence test with
mixed data is employed. See details below regarding this argument."complete.obs"
(default)
or "em"
.use="em"
."p.value"
indicates that a list containing a matrix of p-values from all performed conditional
independence (CI) tests will be returned. If return.type="statn"
then a list
containing the matrix of the statistics and the sample sizes on each CI test, will be
returned. If return.type="all"
then all previous matrices of values will be
returned within a list.FALSE
then the faster C implementation is used
(default); if TRUE
then only R code is executed.snow
and rlecuyer
.TRUE
then the time for carrying out the
calculations with the given parameters is estimated by calculating for a
limited number of adjacencies, specified by nAdj2estimateTime
, and
extrapolating the elapsed time; if FALSE
(default) calculations are
performed normally till they finish.estimateTime=TRUE
). By default this has a
default value of 10 adjacencies and larger values should provide more
accurate estimates. This might be relevant when using a cluster facility.p.value
, statistic
and n
corresponding to a dspMatrix-class
symmetric matrix of p-values for the null
hypothesis of coindtional independence with the diagonal set to NA
values,
an analogous matrix of the statistics of each test and of the sample sizes, respectively.
These returned values, however, depend on the setting of argument return.type
which,
by default, enables only returning the matrix of p-values.
If arguments pairup.i
and pairup.j
are employed, those cells outside
the constrained pairs will get also a NA
value.Note, however, that when estimateTime=TRUE
, then instead of the matrix
of estimated non-rejection rates, a vector specifying the estimated number of
days, hours, minutes and seconds for completion of the calculations is returned.
I
is set different to NULL
then mixed graphical model theory
is employed and, concretely, it is assumed that the data comes from an homogeneous
conditional Gaussian distribution. By default, with exact.test=TRUE
, an
exact test for conditional independence is employed, otherwise an asymptotic one
will be used. Full details on these features can be found in Tur, Roverato and Castelo (2014).
Tur, I., Roverato, A. and Castelo, R. Mapping eQTL networks with mixed graphical models. Submitted, http://arxiv.org/abs/1402.4547, 2014.
qpCItest
library(mvtnorm)
nVar <- 50 ## number of variables
maxCon <- 3 ## maximum connectivity per variable
nObs <- 30 ## number of observations to simulate
set.seed(123)
A <- qpRndGraph(p=nVar, d=maxCon)
Sigma <- qpG2Sigma(A, rho=0.5)
X <- rmvnorm(nObs, sigma=as.matrix(Sigma))
alltests <- qpAllCItests(X, verbose=FALSE)
## distribution of p-values for the present edges
summary(alltests$p.value[upper.tri(alltests$p.value) & A])
## distribution of p-values for the missing edges
summary(alltests$p.value[upper.tri(alltests$p.value) & !A])
Run the code above in your browser using DataLab