predict_data: Data approximation

Description Usage Arguments Value Examples

View source: R/pdata.R

Description

This function builds an approximation model on data containing some observation interval and then use this model to appoximate another observation interval.

Usage

1
2
3
4
5
6
7
8
9
predict_data(
  .data,
  .interval,
  method = "lm",
  ...,
  merge = TRUE,
  mark = FALSE,
  vars = NULL
)

Arguments

.data

Source data (data.frame). Must contain interval and observation variables (for example, year and value)

.interval

Target interval variable (vector)

method

Approximation function ('lm', 'loess', 'glm', 'gam')

...

Parameters for approximation function

merge

If TRUE, results are merged with source data

mark

If TRUE, a 'forecast' variable will be added to result

vars

Names of interval and observation variable (1st and 2nd numeric columns by default)

Value

Approximation results (data.frame)

Examples

1
2
3
4
5
6
7
8
## Not run: 
predict_data(.data = data.frame(
               y = c(2010, 2013, 2014),
               total = c(30800000.00, 32285714.00, 41500000.00)),
             .interval = seq(from = 2015, to = 2020, by = 1),
             method = "gam")

## End(Not run)

skolchin/statp documentation built on April 21, 2020, 2:08 a.m.