Learn R Programming

WALS (version 0.2.5)

gammaToBeta: Internal function: Transform gammas back to betas

Description

Transforms posterior means \(\hat{\gamma}_2\) and variances corresponding to transformed auxiliary regressors \(Z_2\) back to regression coefficients \(\hat{\beta}\) of original regressors \(X_1\) and \(X_2\).

Usage

gammaToBeta(
  posterior,
  y,
  Z1,
  Z2,
  Delta1,
  D2,
  sigma,
  Z1inv,
  method = "original",
  svdZ1
)

Arguments

posterior

Object returned from computePosterior.

y

Response \(y\).

Z1

Transformed focus regressors \(Z_1\).

Z2

Transformed auxiliary regressors \(Z_1\).

Delta1

\(\Delta_1\) or \(\bar{\Delta}_1\).

D2

From semiorthogonalize, if postmult = FALSE was used, then D2 = \(\Delta_2 T \Lambda^{-1/2}\), where \(T\) are the eigenvectors of \(\Xi\) and \(\Lambda\) the diagonal matrix containing the corresponding eigenvalues. If postmult = TRUE was used, then D2 = \(\Delta_2 T \Lambda^{-1/2} T^{\top} = \Delta_2 \Xi^{-1/2}\).

sigma

Prespecified or estimated standard deviation of the error term.

Z1inv

\((Z_{1}^{\top} Z_{1})^{-1}\).

method

Character. \(\hat{\gamma}_1\) is obtained from a linear regression of \(Z_1\) on pseudo-responses \(y - Z_2 \hat{\gamma}_2\). If method = original, then we use lm.fit to perform the linear regression, if method = "svd", then reuse the SVD of \(Z_1\) in svdZ1 to perform the regression.

svdZ1

Optional, only needed if method = "svd". SVD of \(Z_1\) computed using svd.

Details

The same transformations also work for GLMs, where we replace \(X_1\), \(X_2\), \(Z_1\) and \(Z_2\) with \(\bar{X}_1\), \(\bar{X}_2\), \(\bar{Z}_1\) and \(\bar{Z}_2\), respectively. Generally, we need to replace all variables with their corresponding "bar" version. Further, for GLMs sigma is always 1.

See magnus2016wals;textualWALS, deluca2018glm;textualWALS and huynhwals;textualWALS for the definitions of the variables.

References