Learn R Programming

psychmeta (version 2.6.4)

mix_matrix: Estimate mixture covariance matrix from within-group covariance matrices

Description

Estimate mixture covariance matrix from within-group covariance matrices

Usage

mix_matrix(
  sigma_list,
  mu_mat,
  p_vec,
  N = Inf,
  group_names = NULL,
  var_names = NULL
)

Value

List of mixture covariances and means.

Arguments

sigma_list

List of covariance matrices.

mu_mat

Matrix of mean parameters, with groups on the rows and variables on the columns.

p_vec

Vector of proportion of cases in each group.

N

Optional total sample size across all groups (used to compute unbiased covariance estimates).

group_names

Optional vector of group names.

var_names

Optional vector of variable names.

Examples

Run this code
out <- unmix_matrix(sigma_mat = reshape_vec2mat(.5, order = 2),
                    mu_mat = rbind(c(0, 0), c(.5, 1)),
                    p_vec =  c(.3, .7), N = 100)

mix_matrix(sigma_list = out$cov_group_unbiased,
           mu_mat = out$means_raw[-3,],
           p_vec = out$p_group, N = out$N)

Run the code above in your browser using DataLab