convert: Convert alphas to gammas

Description Usage Arguments Details Value See Also

View source: R/utility_functions.R

Description

function that takes a vector of betas (which are the main effects) and alphas (which are the interaction effects) and converts the alphas to gammas.

Usage

1
2
convert(betas.and.alphas, main.effect.names, interaction.names,
  epsilon = 1e-05)

Arguments

betas.and.alphas

q x 1 data.frame or matrix of main effects and interaction estimates. For example the output from the uni_fun function. The rownames must be appropriately labelled because these labels will be used in other functions

main.effect.names

character vector of main effects names. MUST be ordered in the same way as the column names of x. e.g. if the column names of x are \"x1\",\"x2\" then main.effect.names = c("x1","x2")

interaction.names

character vector of interaction names. MUST be separated by a colon (e.g. x1:x2), AND MUST be ordered in the same way as the column names of x

epsilon

threshold to avoid division by a very small beta e.g. if any of the main effects are less than epsilon, set gamma to zero. This should not really be an important parameter because this function is only used in the initialization step, where the intial estimates are from OLS or ridge regression and therefor should not be very close to 0

Details

note that

y = β_0 + β_1 x_1 + ... + β_p x_p + α_{12} x_1 x_2 + ... + α_{p-1,p} x_p x_{p-1}

and

α_{ij} = γ_{ij} * β_i*β_j , i < j

This function is used because the fitting algorithm estimates the gammas, and furthermore, the L1 penalty is placed on the gammas. It is used only in the initialization step in the shim function

Value

a labelled q x 1 data.frame of betas and gammas

See Also

shim, Q_theta


sahirbhatnagar/shim documentation built on May 29, 2019, 12:59 p.m.