-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathValidateModel.Rmd
64 lines (56 loc) · 3.08 KB
/
ValidateModel.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
title: "Validating `r modelname` Model"
date: "`r Sys.Date()`"
output:
html_document:
keep_md: yes
editor_options:
chunk_output_type: console
---
This document presents validation results of `r modelname` model.
### Build and Calculate Model
```{r, results='markup'}
model <- buildModel(modelname)
```
### Validate that commodity output can be recalculated (within 1%) with the model total requirements matrix (L) and demand vector (y) for US production
```{r}
econval <- compareOutputandLeontiefXDemand(model, tolerance = 0.01)
cat(paste("Number of sectors passing:",econval$N_Pass))
cat(paste("Number of sectors failing:",econval$N_Fail))
cat(paste("Sectors failing:", paste(econval$Failure$rownames, collapse = ", ")))
```
### Validate that commodity output can be recalculated (within 1%) with model total domestic requirements matrix (L_d) and model demand (y) for US production
```{r}
econval <- compareOutputandLeontiefXDemand(model,use_domestic=TRUE, tolerance = 0.01)
cat(paste("Number of sectors passing:",econval$N_Pass))
cat(paste("Number of sectors failing:",econval$N_Fail))
cat(paste("Sectors failing:", paste(econval$Failure$rownames, collapse = ", ")))
```
### Validate that flow totals by commodity (E_c) can be recalculated (within 1%) using the model satellite matrix (B), market shares matrix (V_n), total requirements matrix (L), and demand vector (y) for US production
```{r}
modelval <- compareEandLCIResult(model, tolerance = 0.01)
cat(paste("Number of flow totals by commodity passing:",modelval$N_Pass))
cat(paste("Number of flow totals by commodity failing:",modelval$N_Fail))
#cat(paste("Sectors failing:", paste(modelval$Failure$variable, collapse = ", ")))
```
### Validate that flow totals by commodity (E_c) can be recalculated (within 1%) using the model satellite matrix (B), market shares matrix (V_n), total domestic requirements matrix (L_d), and demand vector (y) for US production
```{r}
dom_val <- compareEandLCIResult(model,use_domestic=TRUE, tolerance = 0.01)
cat(paste("Number of flow totals by commodity passing:",dom_val$N_Pass))
cat(paste("Number of flow totals by commodity failing:",dom_val$N_Fail))
cat(paste("Sectors with flow totals failing:", paste(dom_val$Failure$variable, collapse = ", ")))
```
### Validate that commodity output are properly transformed to industry output via MarketShare
```{r}
q_x_val <- compareCommodityOutputXMarketShareandIndustryOutputwithCPITransformation(model, tolerance = 0.01)
cat(paste("Number of flow totals by commodity passing:",q_x_val$N_Pass))
cat(paste("Number of flow totals by commodity failing:",q_x_val$N_Fail))
cat(paste("Sectors with flow totals failing:", paste(q_x_val$Failure$rownames, collapse = ", ")))
```
### Validate that commodity output equals to domestic use plus production demand
```{r}
q_val <- compareCommodityOutputandDomesticUseplusProductionDemand(model, tolerance = 0.01)
cat(paste("Number of flow totals by commodity passing:",q_val$N_Pass))
cat(paste("Number of flow totals by commodity failing:",q_val$N_Fail))
cat(paste("Sectors with flow totals failing:", paste(q_val$Failure$rownames, collapse = ", ")))
```