coefxiv: Regression coefficient from a linear DAG possibly using an IV

View source: R/coefx.R

coefxivR Documentation

Regression coefficient from a linear DAG possibly using an IV

Description

Given a linear DAG, find the population regression coefficient for X using IV estimation using data with the marginal covariance structure implied by the linear DAG.

Usage

coefxiv(fmla, dag, iv = NULL, var = covld(to_dag(dag)))

Arguments

fmla

a linear model formula. The variables in the formula must be column names of dag. For IV estimation, the right hand side should have two variables, the first one will be treated as the 'X' variable and the second, as the IV.

dag

a square matrix defining a linear DAG. The column names and row names of A must be identical. The non-diagonal entries of dag contain the causal of coefficients of arrows pointing from the column variable to the row variable. The diagonal entries are standard deviations of the normally distributed independent component generating the row variable. A matrix defines a linear dag if the same permutation of its rows and columns can transform it into a lower diagonal matrix.

iv

a one-sided formula with a single variable (at present) specifying a variable to be used as an instrumental variable

var

the variance matrix of the variables, as an alternative input to 'dag'. If 'var' is provided, then dag does not need to be provided.

Value

a list with class 'coefx' containing the population coefficient for the first predictor variable in fmla, the residual standard error of the regression, the conditional standard deviation of the residual of the first predictor and the ratio of the last two quantities which constitutes the 'standard error factor' which, if multiplied by 1/sqrt(n) is an estimate of the standard error of the estimate of the regression coefficient for the first predictor variable.


gmonette/causalsim documentation built on April 21, 2022, 1:40 a.m.