qpCItest {qpgraph} | R Documentation |
Performs a conditional independence test between two variables given a conditioning set.
## S4 method for signature 'ExpressionSet': qpCItest(data, N, i=1, j=2, Q=c(), long.dim.are.variables=TRUE, R.code.only=FALSE) ## S4 method for signature 'data.frame': qpCItest(data, N, i=1, j=2, Q=c(), long.dim.are.variables=TRUE, R.code.only=FALSE) ## S4 method for signature 'matrix': qpCItest(data, N, i=1, j=2, Q=c(), long.dim.are.variables=TRUE, R.code.only=FALSE)
data |
data set where the test should be performed. It can be either an
ExpressionSet object, a data frame, or a matrix. If it is a matrix
and the matrix is squared then this function assumes the matrix is the
sample covariance matrix of the data and the sample size parameter
N should be provided. |
N |
number of observations in the data set. Only necessary when the
sample covariance matrix is provided through the data parameter. |
i |
index or name of one of the two variables. |
j |
index or name of the other variable. |
Q |
indexes or names of the variables forming the conditioning set. |
long.dim.are.variables |
logical; if 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. |
R.code.only |
logical; if FALSE then the faster C implementation is used (default); if TRUE then only R code is executed. |
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
.
A list with two members, the t-statistic value and the p-value on rejecting the null hypothesis of independence.
R. Castelo and A. Roverato
Castelo, R. and Roverato, A. A robust procedure for Gaussian graphical model search from microarray data with p larger than n, J. Mach. Learn. Res., 7:2621-2650, 2006.
# in this graph 3 is conditionally independent of 4 given 1 AND 2 I <- matrix(c(FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE), nrow=4, ncol=4, byrow=TRUE) K <- qpI2K(I) X <- qpSampleMvnorm(K, N=100) qpCItest(X, N=100, i=3, j=4, Q=1, long.dim.are.variables=FALSE) qpCItest(X, N=100, i=3, j=4, Q=c(1,2), long.dim.are.variables=FALSE)