robust_find_optimum: Routine for more robust local optimum search of MASSIVE...

Description Usage Arguments Value Examples

View source: R/find_optimum.R

Description

Routine for more robust local optimum search of MASSIVE posterior, where the search is repeated until a better value cannot be found any more.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
robust_find_optimum(
  J,
  N,
  SS,
  sigma_G,
  prior_sd,
  skappa_X,
  skappa_Y,
  tol = 1e-06,
  post_fun = scaled_neg_log_posterior,
  gr_fun = scaled_neg_log_gradient,
  hess_fun = scaled_neg_log_hessian
)

Arguments

J

Integer number of genetic instrumental variables.

N

Integer number of observations.

SS

Numeric matrix containing first- and second-order statistics.

sigma_G

Numeric vector of genetic IV standard deviations.

prior_sd

List of standard deviations for the parameter Gaussian priors.

skappa_X

Scale-free confounding coefficient to exposure used for initialization.

skappa_Y

Scale-free confounding coefficient to outcome used for initialization.

tol

Numeric tolerance value used to decide if a better optimum was found.

post_fun

Function for computing the IV model posterior value.

gr_fun

Function for computing the IV model posterior gradient.

hess_fun

Function for computing the IV model posterior Hessian.

Value

optim object (see optim containing optimum parameters, the value obtained at the optimum, and the Hessian at the optimum.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
J <- 5 # number of instruments
N <- 1000 # number of samples
parameters <- random_Gaussian_parameters(J) 
EAF <- runif(J, 0.1, 0.9) # EAF random values
dat <- generate_data_MASSIVE_model(N, 2, EAF, parameters)
robust_find_optimum(
  J, N, dat$SS, binomial_sigma_G(dat$SS), 
  prior_sd = decode_IV_model(get_random_IV_model(J), 1, 0.01), 
  skappa_X = 1, skappa_Y = 1
)

igbucur/MASSIVE documentation built on Oct. 26, 2020, 1:26 a.m.