mean_stress {CIS.DGLM} | R Documentation |
Mean Stress
Description
This function provides the mean stress among As and Bs, corresponding to different environment levels, for a list of variables.
Usage
mean_stress(
dataset,
var,
stress_variable,
output.name = "mean_stress.txt",
use.output = TRUE,
bin.levels = c(0, 1)
)
Arguments
dataset |
Data set to be utilized. For the purposes of this function, the binary values in each variable are considered to be -1 and 1. |
var |
A list of variables. If using variables from a DGLM, use the variables from the mean model (or, if trying to find intervals for use in the plotting functions draw.crossplots and draw.squareplots, use all variables in both mean and variance models). |
stress_variable |
Name of the variable with the stress values. |
output.name |
Name of the output file to which to save the outputs. Defaults to 'mean_stress.txt'. |
use.output |
A binary variable to indicate whether the output is automatically saved to an external text file. Defaults to TRUE. If FALSE, the output will not be saved to a file. |
bin.levels |
A list that provides the binary values utilized in the dataset. Defaults to c(0,1), indicating that 0 and 1 are used as the binary outcomes; can also be 1, -1. List the value for the "A" environment level first, then the value for the "B" environment level. |
Value
Produces a data frame with three columns: var, AvgB, and AvgA. These provide the variable and its corresponding mean stress values for As and Bs, corresponding to different environment levels.
Examples
test.data <- simu.inter.dat.interboth(n.rep = 2, n.obs.per.rep = 15, ran.seed = 1)
variables <- colnames(test.data[-1])
mean_stress(test.data, variables, 'stress', use.output = FALSE)