# BMA mixture model fit

### Description

Fits a BMA mixture model to ensemble forecasts. Allows specification of a model, training rule, and forecasting dates.

### Usage

1 2 | ```
ensembleBMA( ensembleData, trainingDays, dates = NULL, control = NULL,
model = NULL, exchangeable = NULL, minCRPS = NULL)
``` |

### Arguments

`ensembleData` |
An |

`dates` |
The dates for which BMA forecasting models are desired.
By default, this will be all dates in |

`trainingDays` |
An integer giving the number of time steps (e.g. days) in the training period. There is no default. |

`control` |
A list of control values for the fitting functions.
The default is |

`model` |
A character string describing the BMA model to be fit.
Current choices are |

`exchangeable` |
A numeric or character vector or factor indicating groups of
ensemble members that are exchangeable (indistinguishable).
The model fit will have equal weights and parameters within each group.
The default determines exchangeability from |

`minCRPS` |
A logical variable indicating whether or not to add a postprocessing step after a normal BMA fit to choose the standard deviation so as to minimize the CRPS for the training data. This argument is used only for normal models, and the default is to not do the CRPS minimization for those models because it may require consderably more computation time, expecially when there are many ensemble members. |

### Details

If dates are specified in `dates`

that cannot be forecast
with the training rule, the corresponding BMA model parameter outputs will
be missing (`NA`

) but not `NULL`

.

The training rule uses the number of days corresponding to its
`length`

regardless of whether or not the dates are consecutive.

The following methods are available for the output of `ensembleBMA`

:
`cdf`

, `quantileForecast`

, `modelParameters`

,
`brierScore`

, `crps`

, `CRPS`

and `MAE`

.

### Value

A list with the following output components:

`dateTable` |
The table of observations corresponding to the dates in |

`trainingDays` |
The number of days in the training period as specified in input. |

`...` |
One or more components corresponding to fitted coefficients for the model. |

`weights` |
The fitted BMA weights for the mixture components for each ensemble member at each date. |

`power` |
A scalar value giving the power (if any) by which the data was
transformed for modeling.
The untransformed forecast is used to fit the variance model.
This is input as part of |

### References

A. E. Raftery, T. Gneiting, F. Balabdaoui and M. Polakowski,
Using Bayesian Model Averaging to calibrate forecast ensembles,
*Monthly Weather Review 133:1155–1174, 2005*.

J. M. Sloughter, A. E. Raftery, T. Gneiting and C. Fraley,
Probabilistic quantitative precipitation forecasting
using Bayesian model averaging,
*Monthly Weather Review 135:3209–3220, 2007*.

C. Fraley, A. E. Raftery, T. Gneiting and J. M. Sloughter,
`ensembleBMA`

: An `R`

Package for Probabilistic Forecasting
using Ensembles and Bayesian Model Averaging,
Technical Report No. 516R, Department of Statistics, University of
Washington, 2007 (revised 2010).

C. Fraley, A. E. Raftery, T. Gneiting,
Calibrating Multi-Model Forecast Ensembles
with Exchangeable and Missing Members using Bayesian Model Averaging,
*Monthly Weather Review 138:190–202, 2010*.

J. M. Sloughter, T. Gneiting and A. E. Raftery,
Probabilistic wind speed forecasting
using ensembles and Bayesian model averaging,
*Journal of the American Statistical Association, 105:25–35, 2010*.

### See Also

`ensembleData`

,
`ensembleBMAnormal`

,
`ensembleBMAgamma0`

,
`ensembleBMAgamma`

,
`cdf`

,
`quantileForecast`

,
`modelParameters`

,
`brierScore`

,
`crps`

,
`MAE`

,
`controlBMAnormal`

,
`controlBMAgamma0`

,
`controlBMAgamma`

### Examples

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 | ```
data(ensBMAtest)
ensMemNames <- c("gfs","cmcg","eta","gasp","jma","ngps","tcwb","ukmo")
obs <- paste("T2","obs", sep = ".")
ens <- paste("T2", ensMemNames, sep = ".")
tempTestData <- ensembleData( forecasts = ensBMAtest[,ens],
dates = ensBMAtest[,"vdate"],
observations = ensBMAtest[,obs],
station = ensBMAtest[,"station"],
forecastHour = 48,
initializationTime = "00")
## Not run: # R checl
tempTestFit <- ensembleBMA( tempTestData, trainingDays = 30,
model = "normal")
## equivalent to
## tempTestFit <- ensembleBMAnormal( tempTestData, trainingDays = 30)
## End(Not run)
# for quick run only; use more training days for forecasting
tempTestFit <- ensembleBMA( tempTestData[1:20,], trainingDays = 8,
model = "normal")
``` |