Fits harmonic models to rainfall probabilities for a Markov model (J.O. Ong’ala & D.B. Baird).

### Options

`PRINT` = string tokens |
Controls printed output for each fitted model (`model` , `deviance` , `summary` , `estimates` , `correlations` , `fittedvalues` , `accumulated` , `monitoring` , `confidence` ); default `mode` , `summ` , `esti` , `accu` |

`PLOT` = string token |
What plots to display (`results` ); default `resu` |

`NHARMONICS` = scalar |
Defines the number of harmonics to fit (1…4); default 2 |

`SPREADSHEET` = string tokens |
What to save in a spreadsheet (`results` ); default `*` |

### Parameters

`COUNTS` = table |
Supplies the table of counts by Markov class and day within the year (1…366) |

`WINDOW` = scalars |
Window to plot the graph; default 3 for a single class and 1 otherwise |

`TITLE` = texts |
The title for the plot; default forms an automatic description |

`RESULTS` = pointers |
Saves a pointer to variates of fitted rainfall probabilities by day for each wet state |

`OUTFILE` = texts |
File (with extension `.gwb` , or `.xlsx` ) to save the selected spreadsheet components |

### Description

`RFFPROBABILITY`

fits harmonic (Fourier) models with a period of 366 days to rainfall counts produced by `RFSUMMARY`

. The Markov model fitted by `RFSUMMARY`

splits the days into different classes based on the history of the preceding days. The daily states, order and type of the Markov model can be formed by `RFSUMMARY`

. The harmonic model is a linear combination of sine and cosine terms with periods of 366/*n*.. The number of harmonic terms (*n*) is specified by the `NHARMONICS`

option, and can be 1, 2, 3 or 4.

The `COUNTS`

parameter supplies the table of counts for each Markov class by day within the year (1…366). The `RESULTS`

parameter can save fitted probabilities by wet class for each day.

Printed output of the summaries is controlled by the `PRINT`

option, with the same settings as the `FIT`

directive. The probabilities can be displayed in a spreadsheet by setting option `SPREADSHEET=results`

. This creates a sheet containing variates giving the fitted probabilities for each day in the year by the wet Markov classes. The spreadsheet can be saved to a file by setting the `OUTFILE`

parameter to a Genstat or Excel spreadsheet filename (`.gwb`

or `.xlsx`

).

You can set option `PLOT=results`

to plot the fitted probabilities. The `TITLE`

parameter can supply a title for the graph; if this not set, a descriptive title will be created from the Markov-chain options. The `WINDOW`

parameter specifies the window to use for the graph.

Options: `PRINT`

, `PLOT`

, `NHARMONICS`

, `SPREADSHEET`

.

Parameters: `COUNTS`

, `WINDOW`

, `TITLE`

, `RESULTS`

, `OUTFILE`

.

### Method

The procedure calculates sine and cosine terms for the number of harmonics and fits a binomial generalized linear model to the counts of wet days vs dry days for each history from the preceding days.

### Reference

Ong’ala, J.O. (2011). Simplifying the Markov chain analysis of rainfall data using Genstat. *MSc Thesis*, Maseno University.

### See also

Directive: `FIT`

.

Procedures: `RFFAMOUNT`

, `RFSUMMARY`

.

Commands for: Basic and nonparametric statistics.

### Example

CAPTION 'RFFPROBABILITY example','41 years rainfall for Katumani, Kenya'; \ STYLE=meta,minor IMPORT [PRINT=summary] '%Data%/Rainfall Katumani 1961-2001.gsh' RFSUMMARY [PRINT=*; PLOT=*; DAY=Date; ORDER=1] Rainfall; \ COUNTS=RFCounts; AMOUNTS=RFAmounts RFFPROBAB [PLOT=results] COUNTS=RFCounts; \ TITLE='Katumani rainfall probabilities 1961-2001'