# Managing MIRAGE-e results #

## Managing results with R #

There is a way to easily exploit MIRAGE output using R statistical software, thanks to the gdxtools package.

### Installing gdxtools #

In the R console, or in RStudio:

- Please ensure that the
`'devtools`

’ packages is already installed

```
install.packages("devtools")
```

- Install
`'gdxtools`

’ directly from GitHub:

```
library("devtools")
install_github('lolow/gdxtools')
```

### Using gdxtools #

#### Load the GDX file #

```
library(gdxtools)
mygdx <- gdx(PATH_TO_GDX_FILE)
```

#### Retrieving data from GDX file #

```
xvol <- mygdx["XVol"]
```

And that’s it !

## Creating result file using Excel #

This utility does not work with Excel versions more recent than Excel 2007

TCD.xla / TCD.xla (slightly different version, works with txt result files)

### Installing the TCD utility (Excel 2007) #

Add the TCD macro as an Excel complement: Alt+F Options / Complements, etc., and tick the box to activate it. A new tab, called ‘Compléments’, should appear.

The TCD utility should also be compatible with earlier versions of Excel. The installation procedure may slightly differ.

### Using the TCD utility #

Click on the `TCD: Aggregation of results files`

button and follow
instructions. You will have to indicate the location of txt (or csv)
results files generated by Mirage simulations, and choose the
appropriate simulations that you want to join and compare. An Excel file
containing several pivot tables will be created. Each of them contains
indicators for a given dimensionality.

In the top part of each spreadsheet, some information (sectors, region, year) has to be chosen. It is not optional.

Ticking the appropriate box on the right hand-side of the spreadsheet (Excel 2007) will make initial values appear. Initial values correspond to yearly baseline levels: beware that initial values vary with time.

### Troubleshooting #

You may encounter an error with some computers (something like
this and then
this), due to
the fact that the default delimiter is set to `,`

instead of `;`

. You
can fix this with a simple modification of your registry.

At `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Text`

(`...\SOFTWARE\Wow6432Node\Microsoft\...`

on 64-bit systems), the value
`Format`

, initially set at CSVDelimited, should be changed to
Delimited(`;`

).

If you are unfamiliar with the registry, you can save and run these fixes:

If you don’t know which fix to use, use both, it won’t damage anything.

## Units #

Results are presented in different ways, depending on the angle retained. Any variable $XX$ might be presented in value ($XX^{val}$), in volume ($XX^{vol}$) or using Fisher indices $XX^{Fisher}$. In general :

- Fisher indices make sense for variation between baseline and simulation
- Volume indices make sens for inter-temporal comparison

To illustrate the difference between these measures, we will consider that $XX_{sim}$ is an aggregate of different quantities $q_{sim}$ which are valuated in the model at price $p_{sim}$. $sim$ will denote any simulation, baseline included, while $ref$ will only represent the baseline.

### Volume #

Results in volume are presented at initial prices:

### Value #

Results in value are presented at current prices

### Fisher indices #

Fisher volume indices are defined as the geometric average of Paasche and Laspeyres indices:

The variation in Fisher index in MIRAGE results are the variation in $I_q^F$.

The value of variables measured using Fisher indices are:

It is also worth noting that, in case there is no aggregation, such as with bilateral trade by sector, volume and Fisher indices variations are strictly equal (but amounts differ).