Skip to contents

Performs a likelihood ratio test of either common variance terms between the response trajectories in a mixture of random (or mixed) effects regressions or for common variance-covariance matrices for the random effects mixture distribution.

Usage

test.equality.mixed(y, x, w=NULL, arb.R = TRUE, 
                    arb.sigma = FALSE, lambda = NULL, 
                    mu = NULL, sigma = NULL, R = NULL, 
                    alpha = NULL, ...)

Arguments

y

The responses for regmixEM.mixed.

x

The predictors for the random effects in regmixEM.mixed.

w

The predictors for the (optional) fixed effects in regmixEM.mixed.

arb.R

If FALSE, then a test for different variance-covariance matrices for the random effects mixture is performed.

arb.sigma

If FALSE, then a test for different variance terms between the response trajectories is performed.

lambda

A vector of mixing proportions (under the null hypothesis) with same purpose as outlined in regmixEM.mixed.

mu

A matrix of the means (under the null hypothesis) with same purpose as outlined in regmixEM.mixed.

sigma

A vector of standard deviations (under the null hypothesis) with same purpose as outlined in regmixEM.mixed.

R

A list of covariance matrices (under the null hypothesis) with same purpose as outlined in regmixEM.mixed.

alpha

An optional vector of fixed effects regression coefficients (under the null hypothesis) with same purpose as outlined in regmixEM.mixed.

...

Additional arguments passed to regmixEM.mixed.

Value

test.equality.mixed returns a list with the following items:

chi.sq

The chi-squared test statistic.

df

The degrees of freedom for the chi-squared test statistic.

p.value

The p-value corresponding to this likelihood ratio test.

See also

Examples

##Test of equal variances in the simulated data set.

data(RanEffdata)
set.seed(100)
x<-lapply(1:length(RanEffdata), function(i) 
          matrix(RanEffdata[[i]][, 2:3], ncol = 2))
x<-x[1:15]
y<-lapply(1:length(RanEffdata), function(i) 
          matrix(RanEffdata[[i]][, 1], ncol = 1))
y<-y[1:15]

out<-test.equality.mixed(y, x, arb.R = TRUE, arb.sigma = FALSE,
                         epsilon = 1e-1,  verb = TRUE,
                         maxit = 50,
                         addintercept.random = FALSE)
#> iteration= 1 diff= Inf log-likelihood -1622.421 
#> iteration= 2 diff= 112.3115 log-likelihood -1510.109 
#> iteration= 3 diff= 115.3644 log-likelihood -1394.745 
#> iteration= 4 diff= 39.04732 log-likelihood -1355.698 
#> iteration= 5 diff= 1.742983 log-likelihood -1353.955 
#> iteration= 6 diff= 0.07205075 log-likelihood -1353.883 
#> number of iterations= 6 
#> iteration= 1 diff= Inf log-likelihood -1171.546 
#> iteration= 2 diff= 24.89026 log-likelihood -1146.656 
#> iteration= 3 diff= 0.970001 log-likelihood -1145.686 
#> iteration= 4 diff= 0.3165138 log-likelihood -1145.369 
#> iteration= 5 diff= 0.1618543 log-likelihood -1145.207 
#> iteration= 6 diff= 0.09839932 log-likelihood -1145.109 
#> number of iterations= 6 
out
#> $chi.sq
#> [1] 417.5472
#> 
#> $df
#> [1] 1
#> 
#> $p.value
#> [1] 0
#>