sim.2var: Simulate data from a a linear model with an unobserved...

Description Usage Arguments Value Examples

Description

Generates nsim samples of n independent pairs of observations using a linear model y = a + b1*x + b2*z + disturbance where z is unobserved. x and z are jointly normally distributed, and the disturbances are also normal.

Usage

1
sim.2var(n, nsim, a, b1, b2 = 0, sigma.disturb = 1, correl = 0)

Arguments

n

The number of independent pairs of observations to generate per simulation.

nsim

The number of simulations to run.

a

The intercept.

b1

The slope for the observed independent variable.

b2

The slope for the unobserved confounder.

sigma.disturb

The standard deviation of the disturbances.

correl

The correlation of (observed) x and (unobserved) z.

Value

A list of two matrices. The first matrix contains the x values from each simulation, with one simuluation in each row. The second matrix contains the y values in the same configuration.

Examples

1
sim.2var(10, 5, a = 3, b1 = 1/2, b2 = 1/5, sigma.disturb = 1, correl = .5)

mdedge/stfspack documentation built on May 9, 2019, 8:17 a.m.