OracleStage2: Fit Second Stage of Oracle-2SLS

View source: R/OracleStage2.R

OracleStage2R Documentation

Fit Second Stage of Oracle-2SLS

Description

This function is for fitting the second stage model of oracle-2SLS method, assuming the truly set of invalid IVs is known.

Usage

OracleStage2(
  gamma.hat.stage1,
  cor.Y2Z2,
  Estimated.Sigma,
  n1,
  n2,
  p,
  ind.stage2,
  posdef = 1e-04,
  Est.Sigma1Square,
  Est.Sigma2Square
)

Arguments

gamma.hat.stage1

A vector of length p, containing estimated effects from IVs to exposure obtained in the first stage model.

cor.Y2Z2

A vector of length p, containing sample correlations (summary data) between outcome Y and p IVs calculated with the second sample.

Estimated.Sigma

Estimated correlation matrix with reference panel.

n1

Sample size in first stage.

n2

Sample size in second stage.

p

Number of instruments.

ind.stage2

Indices of truly invalid IVs (as this is the oracle model).

posdef

A small positive constant to be added on diagonal of covariance matrix to ensure it is positive definite.

Est.Sigma1Square

A number, estimated variance of random error in the first stage.

Est.Sigma2Square

A number, estimated variance of random error in the second stage.

Value

This function returns a list with two elements, (1) betaalpha.hat.stage2: a vector of length (p+1), the first element is the estimated beta (causal effect from exposure to outcome), the rest p elements are estimated alpha's (direct effects from IVs to outcome); (2) Asympt.Var.BetaHat: the uncorrected estimated variance for estimated beta.


xue-hr/TScML documentation built on Feb. 4, 2025, 12:59 a.m.