Skip to contents

This function calculates predicted x values based on regression coefficients. The results of this function can be passed to other sim_*() functions.

Usage

make_xb(x, beta)

Arguments

x

a data.frame of independent variables generated with make_x().

beta

a vector of the beta coefficients for each of the variables. There must be ncol(x) + 1 values. The first element of the vector is the intercept.

Value

A numeric vector

Examples

x <- make_x(25, c(0,1), c(1,4))
betas <- c(1, 1.5, -2)
make_xb(x, betas)
#>  [1]  -0.3567657  -0.1256931   1.8555288 -10.6683271   0.3015307  -8.4782522
#>  [7]  -4.9188217  -1.5386842  -8.1614252  -0.8534938   3.3512145  -9.6649226
#> [13]   1.2543765  -9.4499332   2.3110266   2.7103753  -9.5494008  -9.7785263
#> [19]  -7.5042529  -3.1222614   2.0447478  -6.3063120  -7.3102681   4.7915787
#> [25]  -8.4926991