I need a function that takes some variables, and an effect size for each of them, and this creates a new variable where y = Xb + e, where X is the matrix of independent variables, b is their effect sizes, and e is a noise term. By default it's easier if b relates to the variance explained by each vector in X, and e has variance of 1 - sum(b).

make_phen(effs, indep, vy = 1, vx = rep(1, length(effs)), my = 0)

Arguments

effs

An array of effect sizes that the variables in indep have on the variable that you are simulating

indep

A matrix of variables, rows = Samples and columns = variables that have an influence on the variable that you are simulating

vy

What variance the output should have. Default = 1, meaning effs relate to the signed rsq of the influence of the indep variables on the outcome

vx

What variance the indep variables should have. Default is to set to 1, meaning that the effects are the signed variance explained

my

mean value of y to be output

Value

Vector of y values