MixfMRI (version 0.1-0)

Compute Statistics for Log Odds Ratio of Posterior Probability: Compute Statistics for Log Odds Ratio of Posterior Probability

Description

The function computes statistics for log odds ratio of posterior probability.

Usage

logor.stat(x, fcobj, post.z, cov.param = NULL, cov.post.z = NULL,
                 cov.logit.z = NULL, all.x = FALSE, drop.ETA1 = FALSE)

Arguments

x

an input list of two elements X.gbd and PV.gbd.

fcobj

a fclust object.

post.z

a matrix of dim = N * K for posterior probabilities, which is also the return value of post.prob().

cov.param

a covariance matrix of dim = d * d for parameters, which is also a return of cov.param(). d is total number of parameters which is dependent on data and models.

cov.post.z

a covariance list of length equal to number of active voxels, which is also a return of cov.post.z().

cov.logit.z

a covariance list of length equal to number of active voxels, which is also a return of cov.logit.z().

all.x

all cov matrices for all observations are returned if TRUE, while for only active observations (those of class ids are greater than 1) if FALSE.

drop.ETA1

if drop the ETA[1] from the cov matrix due to the min.1st.prop constrain.

Value

A list is returned with four elements: log.or, cov.log.or, df, and test.stat.

Details

For posterior probability, this function compute log odd ratio, cov matrix of log odd ratio, degrees of freedom, and testing statistics.

References

http://maitra.public.iastate.edu/

See Also

post.prob(), cov.param(), cov.post.z(), cov.logit.z().

Examples

Run this code
# NOT RUN {
library(MixfMRI, quietly = TRUE)
.FC.CT$model.X <- "I"
.FC.CT$CONTROL$debug <- 0
K <- 3

### Fit toy1.
set.seed(1234)
X.gbd <- toy1$X.gbd
X.range <- apply(X.gbd, 2, range)
X.gbd <- t((t(X.gbd) - X.range[1,]) / (X.range[2,] - X.range[1,]))
PV.gbd <- toy1$PV.gbd
fcobj <- fclust(X.gbd, PV.gbd, K = K, min.1st.prop = 0.5)

### Test log odds ratio.
x <- list(X.gbd = X.gbd, PV.gbd = PV.gbd)
post.z <- post.prob(x, fcobj)
lor <- logor.stat(x, fcobj, post.z)

### Check if 95% CE covers log odd ratio = 1.
id <- !is.na(lor$df)
id.cover.0 <- which(lor$test.stat[id] < pchisq(0.95, lor$df[id]))

### Get voxels needed for merging.
id.active <- which(fcobj$class != 1)
id.merge <- id.active[id][id.cover.0]

### Check results.
post.z[id.merge,]
cbind(toy1$X.gbd[id.merge,], toy1$PV.gbd[id.merge])
# }

Run the code above in your browser using DataLab