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

Description Usage Arguments Value Author(s) See Also Examples

View source: R/rmw_normalise.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
rmw_normalise(
  model,
  df,
  variables = NA,
  n_samples = 300,
  replace = TRUE,
  se = FALSE,
  aggregate = TRUE,
  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?

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?

Value

Tibble.

Author(s)

Stuart K. Grange

See Also

rmw_prepare_data, rmw_train_model

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# 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 July 8, 2020, 7:35 p.m.