rmw_normalise: Function to normalise a variable for "average" meteorological...

View source: R/rmw_normalise.R

rmw_normaliseR Documentation

Function to normalise a variable for "average" meteorological conditions.

Description

Function to normalise a variable for "average" meteorological conditions.

Usage

rmw_normalise(
  model,
  df,
  variables = NA,
  n_samples = 300,
  replace = TRUE,
  se = FALSE,
  aggregate = TRUE,
  keep_samples = FALSE,
  n_cores = NA,
  verbose = FALSE
)

Arguments

model

A ranger model object from rmw_train_model.

df

Input data used to calculate model using rmw_prepare_data.

variables

Variables to randomly sample. Default is all variables used for training the model with the exception of date_unix, the trend term.

n_samples

Number of times to sample df and then predict?

replace

Should variables be sampled with replacement?

se

Should the standard error of the predictions be calculated too? The standard error method is the "infinitesimal jackknife for bagging" and will slow down the predictions significantly.

aggregate

Should all the n_samples predictions be aggregated?

keep_samples

When aggregate is FALSE, should the sampled/shuffled observations be kept?

n_cores

Number of CPU cores to use for the model predictions. Default is system's total minus one.

verbose

Should the function give messages and display a progress bar?

Value

Tibble.

Author(s)

Stuart K. Grange

See Also

rmw_prepare_data, rmw_train_model

Examples




# Load package
library(dplyr)

# Keep things reproducible
set.seed(123)

# Prepare example data
data_london_prepared <- data_london %>% 
  filter(variable == "no2") %>% 
  rmw_prepare_data()

# Normalise the example no2 data
data_normalised <- rmw_normalise(
  model_london, 
  df = data_london_prepared, 
  n_samples = 300,
  verbose = TRUE
)




rmweather documentation built on June 22, 2024, 9:33 a.m.