create_theta_main: Sema model list

Description Usage Arguments Details Value Examples

Description

This function creates a list with all required objects at the global level needed by the sema algorithm

Usage

1
2
create_theta_main(n_fixed, n_random, start_resid_var = 1,
  start_random_var = 1, start_fixed_coef = NULL, prior_n, prior_j)

Arguments

n_fixed

Number of fixed effects.

n_random

Number of random effects.

start_resid_var

Start values residual variance, default start value equals 1.

start_random_var

Start values variance of random effects, default start values equal 1. Make sure that the length of start_random_var matches the number of random effects.

start_fixed_coef

The default is set to NULL, when no start values are provided, start_fixed_coef is set to rep(1, n_fixed) within the create_theta_main function. Note that the length of the start values must match the number of fixed effects.

prior_n

A scalar indicating the weight of the start value of the residual variance.

prior_j

A scalar indicating the weight of the start values of the fixed effects coefficients and random effects variance.

Details

The function creates a list with objects used by the sema algorithm, most are not used for interpretation. The user can provide start values to enhance the algorithm's performance. In that case, the function also requires the weight of those start values, when no starting values are given default values are used.

Value

A list which contains: the fixed effects coefficients, fixed_coef_hat; the Complete Data Sufficient Statistic of the fixed effects, t1; the variance of the random effects random_var_hat; the Complete Data Sufficent Statistics of the variance of random effects, t2; the residual variance, resid_var_hat; the Complete Data Sufficiant Statistic of the residual variance, t3, the number of observations, n; the number of individuals, j; the average dependent variable, which can be used for prediction purposes but it is not needed for the algorithm, y; the square matrix of squared fixed effects, which is only updated as long as the matrix is not yet invertible, once inverted, only the inverted matrix is updated, x_sq; the product of fixed effects and dependent variable, xy_vector; the inverse of the x_sq matrix, x_inv.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Create a list of objects required to fit the multilevel model using
## sema:
## NOTE: default start values fixed effect coefficients, residual variance 
## and random effects variance is equal to 1. When this function is used 
## outside the sema_fit functions, prior_n and prior_j, i.e., weight given 
## to the start values should be entered. Within the sema_fit functions 
## defaults are given. 

model_statistics <- create_theta_main(n_fixed = 5,
                                      n_random = 3,
                                      start_resid_var = 1,
                                      start_random_var = 1,
                                      start_fixed_coef = NULL,
                                      prior_n = 0,
                                      prior_j = 0)

L-Ippel/SEMA documentation built on May 30, 2019, 8:23 a.m.