HLM_model: HLM Model

Description Usage Arguments Value

View source: R/HLM_Model.R

Description

The function calls the 'nlme::lme'. See 'nlme::lme' for full documentation

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
HLM_model(
  data,
  response_variable,
  level_1_factors,
  level_2_factors,
  two_way_interaction_factor = NULL,
  three_way_interaction_factor = NULL,
  id,
  estimation_method = "REML",
  opt_control = "optim",
  na.action = na.exclude
)

Arguments

data

dataframe

response_variable

character or vector of length 1

level_1_factors

vector. Lower level variables (e.g., individual-level)

level_2_factors

vector. Contains higher level variables (e.g., country-level)

two_way_interaction_factor

vector of length more than 2. Default to 'null“

three_way_interaction_factor

vector of length 3. Two-way interaction factors are included

id

character or vector of length 1. The nesting variable (e.g. country)

estimation_method

character. default to 'REML'. See 'nlme::lme' for other option

opt_control

character. default to 'optim'. Be aware that nlme::lme default to nlminb. See 'nlme::lme' for other option

na.action

default to 'na.exclude'. See 'nlme::lme' for other option

Value

An object of class "lme" representing the linear mixed-effects model fit.


jasonmoy28/HLM_Model_R_Package documentation built on March 9, 2021, 3:05 p.m.