gen_response_surf_x: gen_response_surface_x: Generate IVs for Response Surface

Description Usage Arguments Value Examples

View source: R/gen_response_surface_x.R

Description

A helper function for simulating the independent variables for a response surface. Automatically calculates the interaction and quadratic terms. For simplicities sake, assumes that variables have mean 0

Usage

1
gen_response_surf_x(n, cov_mat, x_names = NULL)

Arguments

n

Number of observations to simulate.

cov_mat

Covariance matrix defining how X1 and X2 are related along with their scale.

x_names

Character vector of length two containing the names of X variables (optional)

Value

Data frame of IVs with requested column names.

Examples

1
2
3
4
5
6
7
8
# Defining Correlation Matrix describing how x1 and x2 are related
# Covarince and variance of x1^2, x2^2, and x1*x2 follow from this matrix
cov_mat<-matrix(c(1, 0,
                  0, 1), byrow = TRUE, 2, 2)

# Generating data frame for response suface examining leaders and follower agreeableness
x_df<-gen_response_surf_x(1000, cov_mat, x_names = c("L_Agree", "F_Agree"))
x_df

jimmyrigby94/rrs documentation built on May 12, 2020, 3:41 p.m.