Description Usage Arguments Value Note Examples
This function predicts the number of considered health outcomes. Each outcome is predicted with GAM models previously trained on historical data. Once trained, GAM model estimates the number of health event of the simulated day with relative 95 data frame. The data frame is composed by simulated days: n rows and 6 columns. Each row gives the fitted number, with relative 95 considered health outcomes for each simulated day. Each column represents respectively the date of the simulated day, the health outcomes, the 95 number of events, the predicted average daily number of events and the the 95 events.
1 2 3 4 5 6 7 8 9 |
models |
[lst] A list with 7 elements. Each element corresponds to previously trained model for the outcome of interest. |
weather_history |
[data frame] A data frame with weather historical data to use as history for each "today" predicted. At least the following column (with exactly the same column names) are needed: - date = date expressed in the format 'yyyy-mm-dd'; - temp_mean = mean temperature of corresponding day (Celsius); - press_bar_mean = mean pressure of corresponding day (hPascal); - pm10 = mean value of pm10 of corresponding day (μ g/m^3); - pm25 = mean value of pm25 of corresponding day (μ g/m^3); - no2 = mean value of no2 of corresponding day (μ g/m^3). If provided, by a column named |
weather_today |
[data frame] A data frame with data on weather for the simulated day(s) to be predicted. The data frame must contains at least the following column (with exactly the same column names): - date = date expressed in the format 'yyyy-mm-dd'; - temp_mean = mean temperature of corresponding day (Celsius); - press_bar_mean = mean pressure of corresponding day (hPascal); - pm10 = mean value of pm10 of corresponding day (μ g/m^3); - pm25 = mean value of pm25 of corresponding day (μ g/m^3); - no2 = mean value of no2 of corresponding day (μ g/m^3). If provided, by a column named |
... |
possible further arguments passed to the function |
full_year |
[lgl] should the models (and prediction) be made on the
same full-year data or should summer or non-summer models be used?
If |
digits |
integer indicating the number of decimal places (round). default is 4. |
a data frame with the fitted value (i.e., average predicted
events) including 95
and upper
) for each type of event mange by the models
used for each date considered.
To provide teh prediction, the models use lags up to three day in the past for every 'weather_today' predicted. That means that for each date/records in the 'weather_today', in the 'weather_history' there must be present at least information upt to three days earlier (with the corresponding dates)
1 2 3 4 5 6 7 8 9 10 11 | library(imthcm)
default_models <- train_event_models(use_ita = TRUE)
predict_hm(default_models, test_weather, test_weather[731L, ])
predict_hm(default_models, test_weather, test_weather[c(731L, 730L), ],
full_year = TRUE
)
no_o3_test_weather <- dplyr::select(test_weather, -o38h)
predict_hm(default_models, no_o3_test_weather,
no_o3_test_weather[731L, ]
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.