Compute Statistics for Log Odds Ratio of Posterior Probability {MixfMRI} | R Documentation |
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 |
fcobj |
a |
post.z |
a matrix of |
cov.param |
a covariance matrix of |
cov.post.z |
a covariance list of length equal to number of active
voxels, which is also a return of |
cov.logit.z |
a covariance list of length equal to number of active
voxels, which is also a return of |
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 |
Details
For posterior probability, this function compute log odd ratio, cov matrix of log odd ratio, degrees of freedom, and testing statistics.
Value
A list is returned with four elements: log.or
, cov.log.or
,
df
, and test.stat
.
Author(s)
Wei-Chen Chen and Ranjan Maitra.
References
Chen, W.-C. and Maitra, R. (2021) “A Practical Model-based Segmentation Approach for Accurate Activation Detection in Single-Subject functional Magnetic Resonance Imaging Studies”, arXiv:2102.03639.
See Also
post.prob()
, cov.param()
, cov.post.z()
,
cov.logit.z()
.
Examples
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])