Predict.interval: Make prediction intervals for the time series

Description Usage Arguments Value Examples

View source: R/regression.R

Description

prepare high & low values for time series

Usage

1
Predict.interval (df, loc, ind, kpi, periods, interval.width)

Arguments

df

dataframe which have to include the next columns: scenario, year, value

loc

name of location where we create interval

ind

name of industry where we create interval

kpi

name of indicator which we create interval

periods

the number of months

interval.width

the size from 0.7 till 0.99

Value

dataframe

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
num_loc <- distinct(data_10, location) %>% arrange(location) %>% rowid_to_column() %>% mutate(total = nrow(.))
num_ind <- distinct(data_10, industry) %>% arrange(industry   ) %>% rowid_to_column() %>% mutate(total = nrow(.))
num_kpi <- distinct(data_10, indicator) %>% arrange(indicator) %>% rowid_to_column() %>% mutate(total = nrow(.))
data_1 <- data_10 %>%
 nest_by(location,indicator,industry) %>%
 mutate(data = list(Prediction_interval(data,
                                        loc = num_loc[grepl(location , num_loc$location  ),],
                                        ind = num_ind[grepl(industry , num_ind$industry  ),],
                                        kpi = num_kpi[grepl(indicator, num_kpi$indicator ),]))) %>%
 unnest(data) %>% ungroup() %>%
 mutate(year = as.integer(year),
        value = ifelse (value<0,0,value))

St-Digital-Twin/Dtwin documentation built on Jan. 1, 2022, 8:11 p.m.