mcmodelr: monte carlo simulation function for use with mcr and...

View source: R/mcmodelr.R

mcmodelrR Documentation

monte carlo simulation function for use with mcr and model_ols_gpm

Description

takes model_ols_gpm, passes it input data produced with mcr, and passes back key results

Usage

mcmodelr(
  nsims = NULL,
  myinputspreadsheet = NULL,
  myinputdatasheet = NULL,
  mypredictiondf = NULL,
  myresponse_ols = NULL,
  myresponse_gpm = NULL,
  myterms = NULL,
  sigmafrom = NULL,
  sigmato = NULL,
  sigmaby = NULL,
  myfolds = NULL,
  myseed1 = NULL,
  myseed2 = NULL,
  mygraphsize = 1000,
  mygraphtextsize = 10,
  mytag = NULL
)

Arguments

nsims

the desired number of Monte Carlo simulations

myinputspreadsheet

is the name of the spreadsheet with the input data.

myinputdatasheet

the name of the sheet with the input data.

mypredictiondf

(optional) a dataframe to be used as a basis for predictions

myresponse_ols

the name of the dependent variable for the OLS model

myresponse_gpm

the name of the dependent variable for the GPM model. This will normally be the residuals of the OLS model: "residuals".

myterms

a character vector containing the names of the independent variables.

sigmafrom

the lower limit of the test range for sigma

sigmato

the upper limit of the test range for sigma

sigmaby

the increment of the test values for sigma

myfolds

the number of folds for k-fold cross-validation

myseed1

the first random number seed

myseed2

the second random number seed

mygraphsize

the pixel dimension for the output graphs

mygraphtextsize

the size of all text elements on the graph.

mytag

a character string that will be used in the output file names. #'

Examples


nsims <- 1000

myinputfile <- system.file("extdata", "risk_variable_distributions.xlsx", package = "humblr")
mytest1 <- mcr(myinputfile, nsims = nsims, myseed = 12345L)
mytest1

mycorrmatfile <- system.file("extdata", "correlation_matrix.xlsx", package = "humblr")
mytest2 <- mcr(myinputfile, mycorrmatfilename = mycorrmatfile, nsims = nsims, myseed = 12345L)
mytest2

myinputfile <- system.file("extdata", "model_ols_gpm_test.xlsx", package = "humblr")
mymodel_results <- mcmodelr(nsims = nsims, myinputspreadsheet = myinputfile, myinputdatasheet = "data", mypredictiondf = mytest2, myresponse_ols = "depvar", myresponse_gpm = "residuals", myterms = c("var2",	"var3",	"var4",	"var5",	"var6",	"var7",	"var8",	"var9",	"var10"), sigmafrom = 1, sigmato= 10, sigmaby = 1, myfolds = 10, myseed1 = 123, myseed2 = 456, mygraphsize = 1000, mygraphtextsize = 20, mytag = "mymodel")




alexmitrani/humblr documentation built on April 4, 2022, 8:29 a.m.