Learn R Programming

rockchalk (version 1.3.2)

genCorrelatedData: Generates a data frame (x1,x2,y) with user-specified correlation between x1 and x2

Description

Generates a data frame (x1,x2,y) with user-specified correlation between x1 and x2

Usage

genCorrelatedData(N = 100, means = c(50, 50),
    sds = c(10, 10), rho = 0, stde = 1,
    beta = c(0, 0.2, 0.2, 0))

Arguments

N
Number of cases desired
means
2-vector of means for x1 and x2
sds
2-vector of standard deviations for x1 and x2
rho
Correlation coefficient for x1 and x2
stde
standard deviation of the error term in the data generating equation
beta
beta vector of at most 4 coefficients for intercept, slopes, and interaction