gendat_linreg_X: Generate Data Matrix (X) From a Linear Regression Model.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/gendat.R

Description

Generates random data matrix from a k-variable linear regression model.

Usage

1
gendat_linreg_X(n, k, constant = TRUE, rFUN_X = rnorm, ...)

Arguments

n

Sample size.

k

Number of regressors.

constant

Logical. An option to include or to exclude the vector of constants. If TRUE, the vector of constants is included. If FALSE, the vector of constants is excluded.

rFUN_X

The distribution function used to generate values of \mathbf{X}. The default value is rnorm for the Gaussian probability density function.

...

Arguments to pass to rFUN_X.

Details

Randomly generates the data matrix (\mathbf{X}), that is an n \times k dimensional matrix of n observations of k regressors, which includes a regressor whose value is 1 for each observation. The data generating function is supplied by the argument rFUN_X (rnorm is the default value). Additional arguments to rFUN_X are supplied using the ... argument. The data matix is also called the design matrix and model matrix.

Value

If constant = TRUE, returns an n \times k numeric matrix where the first column consists of 1s. If constant = FALSE, returns an n \times k - 1 numeric matrix.

Author(s)

Ivan Jacob Agaloos Pesigan

See Also

Other data generating functions: gendat_linreg_y(), gendat_linreg(), gendat_mvn_a(), gendat_mvn_fe(), gendat_mvn(), gendat_vm(), gendat()

Examples

1
2
3
4
5
6
7
8
X <- gendat_linreg_X(
  n = 100,
  k = 3,
  constant = TRUE,
  rFUN_X = rnorm,
  mean = 100,
  sd = 15
)

jeksterslabds/jeksterslabRds documentation built on July 16, 2020, 3:41 p.m.