main_best_model_func: Returns the best model

Description Usage Arguments Value See Also Examples

View source: R/modeller.R

Description

This function returns the best model if there is one. Otherwise, returns an empty list.

Usage

1
2
main_best_model_func(inter_result, metric_vec = c(1, 2, 3, 4, 5),
  CV_RMSE_n = 0.25, Rsquared_n = 0.75)

Arguments

inter_result

A list containing information about parameters such as slopes, change-points, and stats such as RMSE.

metric_vec

A numeric (integer) vector. This vector determines the pirority of model types. Defaults to c(1,2,3,4,5) for models: '2P', '3PC', '3PH', '4P', '5P'.

CV_RMSE_n

A numeric value. CV-RMSE threshold value. Defaults to 0.25.

Rsquared_n

A numeric value. Rsquared threshold value. Defaults to 0.75.

Value

A list with components:

stats

A matrix of statistical results such as RMSE, R-squared

params

A matrix of parameters such as basload and slopes

cp1

Change point. The leftmost change point. This will be zero if model is '2P'.

cp2

Change point. The rightmost change point. This will be zero if model is not '5P'.

model

Model type.

stat_test$main_test

Main(final) test result. Will be 'Fail' if the model fails one of tTest, population test or shape test. Else, 'Passs'.

stat_test$tTest

t-test results

stat_test$pop_test

population test results

stat_test$shape_test

shape test results

figure

A parameter graph.

See Also

run_model, and run_model_retrofit

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
util = subset(unretrofit_utility, unretrofit_utility$bdbid == 'f3acce86'
			& unretrofit_utility$energy_type == 'Elec') #unretrofit data
result = run_model(util)
best_result = main_best_model_func(result, 'Elec') #best_model for unretrofit data
retrofit_util = subset(retrofit_utility, retrofit_utility$bdbid == 846152
					& retrofit_utility$energy_type == 'Elec') #retrofit data
retrofit_result = run_model_retrofit(retrofit_util)
retrofit_result$pre #result for pre-retrofit

#best_model for pre-retrofit data
retrofit_best_result = main_best_model_func(retrofit_result$pre, 'Elec')
## End(Not run)

tinnaing347/bRema documentation built on Aug. 23, 2019, 9:15 p.m.