Learn R Programming

rACMEMEEV (version 1.0.1)

pipeline: Pipeline used for running a model start to finish.

Description

This is an unexported function that can run the entire pre-model, attenuation-contamination matrix, and model fitting from start to finish.

Usage

pipeline(data, formula, parameters, columns, stan = FALSE, seed = 42)

Value

list The output parameters

Arguments

data

data.frame The input data

formula

character The formula for the multivariate model

parameters

vector The validity coefficients

columns

vector The columns of the covariates

stan

bool If you would like to run with the Stan backend

seed

numeric The random seed to use

Examples

Run this code
data <- data.frame(
 list(
   "BMI" = rnorm(100, mean = 0, sd = 1),
   "fruit" = rnorm(100, mean = 0, sd = 1),
   "veg" = rnorm(100, mean = 0, sd = 1),
   "tobacco" = rnorm(100, mean = 0, sd = 1)
 )
)
parameters <- list(
  fruit = c(0.3, 0.55, 0.8),
  veg = c(0.25, 0.5, 0.75),
  tobacco = c(0.4, 0.55, 0.7)
)
grid <- expand.grid(parameters)
param_grid <- list()
for (i in seq_len(nrow(grid))) {
  name <- paste0("iteration_", i)
  param_grid[[name]] <- list(
    parameters = grid[i, ]
  )
}
output <- pipeline(
   data,
   "BMI ~ fruit + veg + tobacco",
   as.numeric(param_grid[[i]][["parameters"]]),
   c("fruit", "veg", "tobacco")
)

Run the code above in your browser using DataLab