Learn R Programming

factorQR (version 0.1-4)

makeData: Function to make synthetic data for the factorQR function

Description

makeData simulates data from a factor quantile regression model.

Arguments

N
The sample size.
whichFactor
A vector that indicates which factor each manifest variable relates to. E.g., whichFactor = c(1,1,1,2,2) would indicate a two-factor model, with the first three manifest variables relating to the first factor and the second two to the second factor.
pQuant
The quantile of interest. Defaults to 0.5.
lambda
The vector of the non-zero elements of the factor loading matrix, with length equal to that of whichFactor. Do not include the factor loadings related to the response variable. Defaults to 1.
LambdaS
The vector of factor loadings related to the response. Must have length equal to the number of distinct values in whichFactor. Defaults to 0.
Phi
Matrix of latent factor covariances. Must be symmetric and positive-definite and have dimension equal to the number of latent factors. Defaults to the identity matrix.
lapScale
Scale of the asymmetric Laplace error distribution. Defaults to 1.
Psi
Vector of error variances for the manifest explanatory variables.

Value

Returns a matrix whose first column is the response Y and whose remaining columns are the explanatory manifest variables with the underlying factor grouping implied by whichFactor.