build.rg: Reference Grid for 'substitution' model.

View source: R/substitution-helpers.R

build.rgR Documentation

Reference Grid for substitution model.

Description

Build a dataset for fitted.brmcoda used in substitution model

Usage

build.rg(object, ref, level, weight, fill = FALSE)

Arguments

object

A fitted brmcoda object.

ref

Either a character value or vector or a dataset. Can be "grandmean" and/or "clustermean", or a data.frame or data.table of user's specified reference grid consisting of combinations of covariates over which predictions are made. User's specified reference grid is only possible for simple substitution. Single level models are default to "grandmean".

level

A character string or vector. Should the estimate of multilevel models focus on the "between" and/or "within" or "combined" variance? Single-level models are default to "combined".

weight

A character value specifying the weight to use in calculation of the reference composition. If "equal", give equal weight to units (e.g., individuals). If "proportional", weights in proportion to the frequencies of units being averaged (e.g., observations across individuals). Default to "equal" for ref = "grandmean" and "proportional" for ref = "clustermean".

fill

Logical value only relevant when ref is an user's specified reference grid in which information about some, but not all covariates is provided (e.g., models including age and sex as covariate but only age was provided in the reference grid). If TRUE, the unspecified covariates are filled with the default reference grid. If FALSE, users will be asked to provide a full reference grid. Currently only support the default to FALSE.

Value

A reference grid consisting of a combination of covariates in brmcoda


florale/multilevelcoda documentation built on April 21, 2024, 9:44 a.m.