gaussCItwd {micd}R Documentation

Fisher's z-Test for (Conditional) Independence between Gaussian Variables with Missings

Description

A wrapper for pcalg::gaussCItest, to be used within pcalg::skeleton, pcalg::pc or pcalg::fci when the data contain missing values. Observations where at least one of the variables involved in the test is missing are deleted prior to performing the test (test-wise deletion).

Usage

gaussCItwd(x, y, S = NULL, suffStat)

Arguments

x, y, S

(integer) position of variable X, Y and set of variables S, respectively, in each correlation matrix in suffStat. It is tested whether X and Y are conditionally independent given the subset S of the remaining variables.

suffStat

data.frame containing the raw data.

Value

See pcalg::gaussCItest for details on Fisher's z-test. Test-wise deletion is valid if missingness does not jointly depend on X and Y.

A p-value.

See Also

pcalg::condIndFisherZ() for complete data, gaussCItestMI() for multiply imputed data

Examples


## load data (numeric variables)
dat <- as.matrix(windspeed)

## delete some observations
set.seed(123)
dat[sample(1:length(dat), 260)] <- NA

## analyse data
# complete data:
suffcomplete <- getSuff(windspeed, test="gaussCItest")
gaussCItest(1, 2, c(4,5), suffStat = suffcomplete)

# test-wise deletion: ==========
gaussCItwd(1, 2, c(4,5), suffStat = dat)

# list-wise deletion: ==========
sufflwd <- getSuff(dat[complete.cases(dat), ], test="gaussCItest")
gaussCItest(1, 2, c(4,5), suffStat = sufflwd)

## use gaussCItwd within pcalg::pc
pc.fit <- pc(suffStat = dat, indepTest = gaussCItwd, alpha = 0.01, p = 6)
pc.fit


[Package micd version 1.1.1 Index]