AtCtEt: Fitting the ACE(t) model

View source: R/AtCtEt.R

AtCtEtR Documentation

Fitting the ACE(t) model

Description

The ACE(t) model with the A, C and E variance components as functions with respect to age modelled by B-splines.

Usage

AtCtEt(data_m, data_d, mod = c('d','d','d'), knot_a = 5, knot_c = 5, knot_e = 5, 
loc = c('e','e','e'), boot=FALSE, num_b = 100, init = rep(0,3), robust = 0)

Arguments

data_m

An N_m x 3 data matrix for MZ twins. N_m is the number of MZ twin pairs. The first two columns are centered trait values (i.e. the mean should be zero) and the third column is age (or other covariates).

data_d

An N_d x 3 data matrix for DZ twins. N_d is the number of DZ twin pairs. The first two columns are centered trait values (i.e. the mean should be zero) and the third column is age (or other covariates).

mod

A character vector of length 3. Each element specifies the function for the A, C or E component respectively. The A and C components can be 'd'(dynamic), 'c'(constant) or 'n'(NA). The E component can only be 'd' or 'c'. Thus, model=c('c','c','c') is corresponding to the classical ACE model.

knot_a

The number of interior knots of the B-spline for the A component, which must be no less than 3. The default value is 5.

knot_c

The number of interior knots of the B-spline for the C component, which must be no less than 3. The default value is 5.

knot_e

The number of interior knots of the B-spline for the E component, which must be no less than 3. The default value is 5.

loc

A 1x3 character vector indicating how to place knots for each component: evenly ("e") or quantile-based ("q"). The default value is "e".

boot

A logical indicator of whether to use the bootstrap method to calculate the confidence interval. The default is FALSE.

num_b

The number of replicates when the bootstrap method is used (i.e. boot=TRUE). The default value is 100.

init

A 3x1 vector of the initial values for the optimization. The default values are 1.

robust

An integer indicating the number of different initial values that the function will randomly generate and try in the optimization. The default value is 0.

Details

If the variance is close to the boundary (0), it is better to use the bootstrap method to get the CIs. The optimization algorithm may sometimes end up with a local minimum. It is recommended to try different random initial values by setting 'robust'.

Value

n_beta_a

The number of spline coefficients for the A component.

n_beta_c

The number of spline coefficients for the C component.

n_beta_e

The number of spline coefficients for the E component.

beta_a

The estimated spline coefficients (if the model parameter is 'd') or variance (if the model parameter is 'c') of the A component.

beta_c

The estimated spline coefficients (if the model parameter is 'd') or variance (if the model parameter is 'c') of the C component.

beta_e

The estimated spline coefficients (if the model parameter is 'd') or variance (if the model parameter is 'c') of the E component.

hessian_ap

The approximate numerical observed information matrix from the quasi-Newton algorithm.

hessian

The expected information matrix calculated analytically.

con

An indicator of convergence of the optimization algorithm. An integer code 0 indicates successful completion. See 'optim' for more details.

lik

The minus log-likelihood.

knots_a

A vector of the knot positions for the A component.

knots_c

A vector of the knot positions for the C component.

knots_e

A vector of the knot positions for the E component.

boot

A list containing pointwise CIs estimated from the bootstrap method when boot=TRUE

Author(s)

Liang He

References

He, L., Sillanpää, M.J., Silventoinen, K., Kaprio, J. and Pitkäniemi, J., 2016. Estimating Modifying Effect of Age on Genetic and Environmental Variance Components in Twin Models. Genetics, 202(4), pp.1313-1328.

He, L., Pitkäniemi, J., Silventoinen, K. and Sillanpää, M.J., 2017. ACEt: An R package for estimating dynamic heritability and comparing twin models. Behavior Genetics, 47(6), pp.620-641.

Examples

data(data_ace)

result <- AtCtEt(data_ace$mz, data_ace$dz, mod=c('d','d','c'))


ACEt documentation built on May 31, 2023, 9:25 p.m.