get_example_modSpec: Transformation functions for theta_y

Description Usage Details Author(s)

View source: R/theta_y_transforms.R

Description

A number of transformation functions for theta_y – for example, converting from a list to vector representation, and vice versa.

Usage

1

Details

For for variable definitions see powLawMix.R. For every ordinal variable, rho, tau, and s are uniquely specified. For every continuous variable, a, r, b, and s are uniquely specified. For all variables, kappa (the heteroskedastic parameter) and z (the correlation parameter) can be grouped or set to zero using the vectors heteroSpec and cdepSpec in the model specification, modSpec.

For example, consider a model with two ordinal and two continuous variables with the following model specification (this can be obtained by calling the function yada::get_example_modSpec):

modSpec <- list(meanSpec = 'powLaw') modSpec$J <- 2 modSpec$K <- 2 modSpec$M <- c(1,2) modSpec$hetSpec <- 'sd_x' modSpec$hetGroups <- c(1,NA,2,1) modSpec$cdepSpec <- 'dep' modSpec$cdepGroups <- c(1,1,2,2)

To obtain and check this model use:

modSpec <- get_example_modSpec() check_model(modSpec)

For this model specification, the full heteroskedastic parameter vector is:

kappa_full = [kappa1; 0; kappa2; kappa1]

The full covariance matrix is:

Sigma_full = [ s1*s1, z1*s1*s2, z3*s1*s3, z3*s1*s4; z1*s2*s1, s2*s2, z3*s2*s3, z3*s2*s4; z3*s3*s1, z3*s3*s2, s3*s3, z2*s3*s4; z3*s4*s1, z3*s4*s2, z2*s4*s3, s4*s4]

The specification of kappa is relatively straightforward. For variable i, kappa_full[i] = 0 if hetSpec[i] is NA. Otherwise, kappa_full[i] is kappa[hetSpec[i]].

The specification of the covariance matrix correlation terms is more involved. If cdpeGroups[i] is NA then all correlation terms associated with that variable are 0. Beyond this, there are two components to the reduced correlation vector z: intra-group correlations and inter-group correlations.

The intra-group correlations are for non-singleton groups – that is, groups with more than one entry in cdepGroups. Let Gns be the number of such non-singleton groups. The first entries of the reduced z are these correlations. In the example above, they are zns = [z1; z2].

The inter-group correlations link all groups, whether singleton or not. Let Gz be the number of unique groups of all types. In the example above, Gz = 2. The number of unique inter-group correlations is choose(Gz,2). In the example above, there is one cross-term, zcross = [z3], and z = [zns; zcros] = [z1; z2; z3].

The full specification for z (a vector with choose(J+K,2) terms) is

zfull = [z1; z3; z3; z3; z3; z2]

These correspond to the correlation terms in the upper-right part of Sigma_full, "unwrapped" by rows. Identically, the components of zfull can be thought of as the lexically ordered unique variable pairs 11,12,13,14,23,24,34; in each pair, the first element gives the row index in Sigma_full and the second element the column index.

Author(s)

Michael Holton Price <MichaelHoltonPrice@gmail.com>


eehh-stanford/yada documentation built on June 18, 2020, 8:05 p.m.