alpha.multi.est {gnonadd}R Documentation

Variance parameters

Description

This function jointly estimates the variance effect of a set of (continuous) variables on a qt trait. More precisely. It finds the maximum likelyhood estimators.

Usage

alpha.multi.est(
  qt,
  x,
  iter_num = 50,
  eps_param = 1e-10,
  initial_guess = rep(0, ncol(x))
)

Arguments

qt

A numeric vector.

x

A numeric matrix, each column represents a covariate.

iter_num

An integer. Represents the number of iterations performed in the Gauss-Newton algorithm

eps_param

A number. The Gauss-Newton algorithm terminates if the incriment change of all variance estimates is smaller than this number.

initial_guess

A vector of length ncol(x). Represents the initial guess of parameters for the Gauss-Newton algorithm.

Value

A vector with a variance estimate for each variable.

Examples

n_val <- 50000
x <- matrix(0,nrow = n_val, ncol = 4)
for(i in 1:4) {
x[, i] <- rnorm(n_val)
}
var_vec <- exp(0.2 * x[, 1] - 0.3 * x[, 4])
qt_vec <- rnorm(n_val, 0, sqrt(var_vec))
res <- alpha.multi.est(qt_vec, x)

[Package gnonadd version 1.0.2 Index]