lrt_null_dist_dim_same {tensr} | R Documentation |
Draw from null distribution of likelihood ratio test statistic.
Description
When testing for the covariance structure of modes, this function may be used to draw a sample from the null distribution of the likelihood ratio test stistics, whose distribution doesn't depend on any unknown parameters under the null.
Usage
lrt_null_dist_dim_same(p, null_ident = NULL, alt_ident = NULL,
null_diag = NULL, alt_diag = NULL, reference_dist = "normal",
t_df = NULL, itermax = 100, holq_itermax = 100, holq_tol = 10^-9)
Arguments
p |
A vector of integers. The dimensions of the array. |
null_ident |
A vector of integers. The modes that under the null have identity covariance. |
alt_ident |
A vector of integers. The modes that under the alternative have the identity covariance. |
null_diag |
A vector of integers. The modes that under the null have diagonal covariance. |
alt_diag |
A vector of integers. The modes that under the alternative have diagonal covariance. |
reference_dist |
Two options are supported, 'normal' and 't'. If 't' is
specified, you have to specify |
t_df |
A numeric. If |
itermax |
An integer. The number of draws from the null distribution of the likelihood ratio test statistic that is to be performed. |
holq_itermax |
An integer. The maximum number of block coordinate ascent iterations to perform when calculating the MLE at each step. |
holq_tol |
A numeric. The stopping criterion when calculating the MLE. |
Details
Let vec(X)
be N(0,\Sigma)
. Given two nested hypotheses,
H_1:
\Sigma = \Psi_K\otimes\cdots\otimes\Psi_1
versus
H_0: \Sigma =
\Omega_K\otimes\cdots\otimes\Omega_1,
this function will draw from the null
distribution of the likelihood ratio test statistic. The possible options are
that \Psi_i
or \Omega_i
are the identity matrix, a diagonal
matrix, or any positive definite matrix. By default, it's assumed that these
matrices are any positive definite matrix.
Unfortunately, this fuction does not support testing for the hypothesis of modeling the covariance between two modes with a single covariance matrix. I might code this up in later versions.
Value
A vector of draws from the null distribution of the likelihood ratio test statistic.
Author(s)
David Gerard.
References
Gerard, D., & Hoff, P. (2016). A higher-order LQ decomposition for separable covariance models. Linear Algebra and its Applications, 505, 57-84. https://doi.org/10.1016/j.laa.2016.04.033 http://arxiv.org/pdf/1410.1094v1.pdf
See Also
lrt_stat
for calculating the likelihood ratio test
statistic.
Examples
#Test for all identity versus all unconstrained.
p = c(4,4,4)
null1 <- lrt_null_dist_dim_same(p,null_ident = 1:3)
#Generate Null Data
X <- array(stats::rnorm(prod(p)), dim = p)
sig_null <- holq(X, mode_rep = 1:3)$sig
sig_alt <- holq(X)$sig
lrt_x <- lrt_stat(sig_null, sig_alt, p = p)
p_value <- mean(null1 > lrt_x)
hist(null1,main = 'Null Distribution of LRT', xlab = 'LRT Statistic')
abline(v = lrt_x, lty = 2, col = 2, lwd = 2)
legend('topleft', 'Observed LRT Statistic', lty = 2, col = 2, lwd = 2)
mtext(side = 1, paste('P-value = ', round(p_value, digits = 2), sep = ''),
line = 2)
#-------------------------------------------------------------------------
#Test for all identity versus all mode 1 identity,
# mode 2 diagonal, mode 3 unconstrained.
p = c(4,4,4)
null2 <- lrt_null_dist_dim_same(p,null_ident = 1:3,
alt_ident = 1, alt_diag = 2)
#Generate Null Data
X <- array(stats::rnorm(prod(p)), dim = p)
sig_null <- holq(X, mode_rep = 1:3)$sig
sig_alt <- holq(X, mode_rep = 1, mode_diag = 2)$sig
lrt_x <- lrt_stat(sig_null, sig_alt, p = p)
p_value <- mean(null2 > lrt_x)
hist(null2,main = 'Null Distribution of LRT', xlab = 'LRT Statistic')
abline(v = lrt_x, lty = 2, col = 2, lwd = 2)
legend('topleft', 'Observed LRT Statistic', lty = 2, col = 2, lwd = 2)
mtext(side = 1, paste('P-value = ', round(p_value, digits = 2), sep = ''),
line = 2)