emAlgorithm: Fit Multilevel model with EM

Description Usage Arguments Details

Description

To provide SEMA with good starting values, it might help to use the first part of the data as a training set.

Usage

1
2
3
4
emAlgorithm(data, id, y, start.fixed = c(90, rnorm(13)),
  start.random = runif(5, 0, 4), data.random = c(3, 9:12),
  start.cor = 0.15, start.res = 1, max.iter = 20,
  crit.value = 1e-04)

Arguments

data

A data frame

id

Integer, indicating in which column the grouping variable can be found.

y

Integer, indicating in which column the dependent variable can be found.

start.fixed

This is optional if the user wants to provide start values of the fixed effects, if no start values are provided, 0 is used. NOTE, if start values are provided make sure that the length of the vector of start values matches the number of fixed effects.

start.random

This is optional if the user wants to provide a start values of the variance of the random effects covariates, default start value is 1. NOTE, if start values are provided make sure that the length of the vector of start values matches the number of random effects.

data.random

A vector with indexes of the variables treated as random.

start.cor

Start value for correlation between the random effects.

start.res

This is optional if the user wants to provide a start value of the residual variance, default start value is 1.

max.iter

Integer, maximum number of iterations for EM algorithm.

crit.value

A threshold or stopping criterion, if the maximum change in parameter values from one iteration to the next is less than this value, the algorithm stops.

Details

This function fits the multilevel models offline to a small part of the data set.


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