Description Usage Arguments Value Examples
plot_ly_surf: Generate Interactive Plots of Response Surface Objects
1 2 3 4 5 6 7 8 9 10 11 12 13  | 
obj | 
 object created by resp_surf function  | 
inc | 
 Increments of data to be plotted.  | 
x1_lab | 
 label for x axis (X1)  | 
x2_lab | 
 label for y axis (X2)  | 
y_lab | 
 label for z axis (Y)  | 
showscale | 
 Show a color scale for the outcome variable via a legend.  | 
show_princ_axis | 
 Plot the first and second principle axis  | 
max_x1 | 
 max possible value of x1. Defines limits.  | 
min_x1 | 
 min possible value of x1. Defines limits.  | 
max_x2 | 
 max possible value of x2. Defines limits.  | 
min_x2 | 
 max possible value of x2. Defines limits.  | 
Interactive plot of response surface.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37  | # Importing for magrittr pipe (%>%)
library(tidyverse)
# 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)
# Defining betas x1, x2, x1^2, x2^2, and x1*x2
beta<-c(0, 0, -.075, -.075, .15)
# Defining sig_hat directly to save time for example
sig_hat <- 0.9549575  
# Generating data frame for response suface examining leaders and follower agreeableness
simmed_df<-gen_response_surf_x(1000, cov_mat, x_names = c("L_Agree", "F_Agree"))%>%
  gen_response_surf_y(beta = beta, sigma = sig_hat, y_name = "Satisfaction")
# Fitting a Response Surface Model
model_1<-resp_surf(dep_var = "Satisfaction", 
                   fit_var = c("L_Agree", "F_Agree"), 
                   data = simmed_df, 
                   robust = FALSE)
# Plotting Response Surface Model 
plot_ly_surf(obj = model_1, 
             max_x = 2, 
             min_x = -2,
             max_y =  2, 
             min_y = -2, 
             inc = .1, 
             x1_lab = "Leader Agreeableness", 
             x2_lab = "Follower Agreeableness", 
             y_lab = "Employee Satisfaction", 
             showscale = TRUE)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.