Two-dimensional Monte Carlo

From Testiwiki
Jump to: navigation, search


How to perform two-dimensional Monte Carlo in Opasnet?


Use function mc2d to perform two-dimensional Monte Carlo. The function samples the current ovariable results by bootstrapping, applies an aggregate function to the samples, and then produces a new Iter index location for each sample. The function requires a parameter list mc2dparam, which contains the following parameters (with some example values):

  • N2 = 1000, # Number of iterations in the new Iter
  • run2d = TRUE, # Should the mc2d function be used or not?
  • newmarginals = c("Gender", "Ages", "Country"), # Names of columns that are non-marginals but will be sampled enough to become marginals # : The function will produce an ovariable that correctly has these indices as marginals. However, if the function is used within an ovariable formula (which is typically the case), the marginal status is in the end inherited from parents and they are re-converted to non-marginals. This should be fixed somehow. --Jouni (talk) 15:11, 11 June 2017 (UTC)
  • method = "bootstrap", # which method to use for 2D Monte Carlo? Currently bootsrap is the only option.
  • fun = mean # Function for aggregating the first Iter dimension.

You can call the function by using code

objects.latest("Op_en7805", code_name = "mc2d")


+ Show code

See also