monteCarlo {DIETCOST} | R Documentation |
Monte Carlo simulation
Description
Creates a Monte Carlo simulation to a given number of iterations. A hit meal consists of one that returnz zero difference between nutrient targets and random meal plan, food groups serves and respects lower linked foods serves lower or equal to higher linked foods serves, if existent.
Usage
monteCarlo(
dir_path,
iterations,
foods_df,
nutrient_targets_df,
food_group_targets_df,
person,
diet,
allowed_varieties,
min_serve_size_difference,
allow_discretionary = TRUE,
allow_alcohol = TRUE,
allow_takeaway = TRUE,
emission_cols = NULL,
nutrient_cols = NULL,
nutrient_constraints = NULL,
linked_low_1 = NULL,
linked_high_1 = NULL,
linked_low_2 = NULL,
linked_high_2 = NULL
)
Arguments
dir_path |
A string containing the path where a directory will be created. |
iterations |
Number of iterations. Integer. |
foods_df |
Foods dataframe. |
nutrient_targets_df |
Nutrient constraints dataframe. |
food_group_targets_df |
Food group serves dataframe. |
person |
Individual whose random meal plan will be created to. Can be one of man, woman, boy or girl. |
diet |
Chosen diet. Must be DIETNAME from 'constraints_DIETNAME_diet_foods' sheet in dataset. |
allowed_varieties |
Permitted food varieties. Can be a vector of the following: 1,2 and/or 3. |
min_serve_size_difference |
Multiplier to serve difference. A float between 0 and 1. |
allow_discretionary |
Boolean variable checking if discretionary foods are permitted. Default TRUE. |
allow_alcohol |
Boolean variable checking if alcohol is permitted. Default TRUE. |
allow_takeaway |
Boolean variable checking if takeaway is permitted. Default TRUE. |
emission_cols |
Optional parameter. Emission column names if standard dataset isn't used. |
nutrient_cols |
Optional parameter. Nutrients column names if standard dataset isn't used. |
nutrient_constraints |
Optional parameter. Vector of nutrients column names to be used if not all nutrients are to be used as constraints. |
linked_low_1 |
Optional parameter. Vector of lower bound food IDs. |
linked_high_1 |
Optional parameter. Vector of higher bound food IDs. |
linked_low_2 |
Optional parameter. Vector of lower bound food IDs. |
linked_high_2 |
Optional parameter. Vector of higher bound food IDs. |
Value
List of dataframes, containing results of simulation.