vv: value varier function

View source: R/vv.R

vvR Documentation

value varier function

Description

Many variables vary over time and it may not be desirable to ignore this variation in time series analyses. This function produces time series that contain variation from a specified mean and a desired coefficient of variation. A trend can be added to this time series

Usage

vv(
  var_mean,
  var_CV,
  n,
  distribution = "normal",
  absolute_trend = NA,
  relative_trend = NA,
  lower_limit = NA,
  upper_limit = NA
)

Arguments

var_mean

mean of the variable to be varied

var_CV

desired coefficient of variation (in percent)

n

integer; number of values to produce

distribution

probability distribution for the introducing variation. Currently only implemented for "normal"

absolute_trend

absolute increment in the var_mean in each time step. Defaults to NA, which means no such absolute value trend is present. If both absolute and relative trends are specified, only original means are used

relative_trend

relative trend in the var_mean in each time step (in percent). Defaults to NA, which means no such relative value trend is present. If both absolute and relative trends are specified, only original means are used

lower_limit

lowest possible value for elements of the resulting vector

upper_limit

upper possible value for elements of the resulting vector

Details

Note that only one type of trend can be specified. If neither of the trend parameters are NA, the function uses only the original means

Value

vector of n numeric values, representing a variable time series, which initially has the mean var_mean, and then increases according to the specified trends. Variation is determined by the given coefficient of variation var_CV

Author(s)

Eike Luedeling

Examples


valvar<-vv(100,10,30)
plot(valvar)

valvar<-vv(100,10,30,absolute_trend=5)
plot(valvar)

valvar<-vv(100,10,30,relative_trend=5)
plot(valvar)


decisionSupport documentation built on Oct. 6, 2023, 1:06 a.m.