dummy {BETS} R Documentation

## Create a monthly or quarterly dummy

### Description

Returns a monthly or quarterly dummy (a time series with only 0s and 1s).

### Usage

```dummy(start = NULL, end = NULL, frequency = 12, year = NULL,
month = NULL, quarter = NULL, date = NULL, from = NULL, to = NULL)
```

### Arguments

 `start` An `integer vector`. The period of the first observation. The first element of the `vector` specifies the year of the first observation, whereas the second, the month (for monthly dummies) or quarter (for quarterly dummies) `end` An `integer vector`. The period of the last observation. The first element of the `vector` specifies the year of the last observation, whereas the second, the month (for monthly dummies) or quarter (for quarterly dummies) `frequency` An `integer`. The frequency of the dummy, that is, the number of observations per unit of time. The defaulf is 12 (a monthly dummy). `year` An `integer`, a `seq` or a `vector`. The years for which the dummy must be set to 1. All periods of these years will be set to 1. `month` An `integer`, a `seq` or a `vector`. The months for which the dummy must be set to 1. These months will be set to 1 for all years. `quarter` An `integer`, a `seq` or a `vector`. The quarters for which the dummy must be set to 1. The quarters will be set to 1 for all years. `date` a `list`. The periods for which the dummy must be set to one. Periods must be represented as integer vectors, as described for `start` and `end`. `from` An `integer vector` The starting period of a sequence of perids for which the dummy must be set to one. Periods must be represented as integer vectors, as described for `start` and `end`. `to` The ending period of a sequence of perids for which the dummy must be set to one. Periods must be represented as integer vectors, as described for `start` and `end`.

### Value

A monthly or a quarterly `ts` object.

`ts`, `dummy`

### Examples

```
#1 from a specific date to another specific date
dummy(start = c(2000,1),end = c(2012,5),frequency = 12,from = c(2005,1),to = c(2006,12))

#Other options that may be helpful:

#over a month equal to 1
dummy(start = c(2000,1), end = c(2012,5), frequency = 12, month = c(5,12))

#Months equal to 1 only for some year
dummy(start = c(2000,1), end = c(2012,5), frequency = 12, month = 5, year = 2010)
dummy(start = c(2000,1), end = c(2012,5), frequency = 12, month = 8, year = 2002)

#Months equal to 1 only for some years
dummy(start = c(2000,1), end = c(2012,5), frequency = 12, month = 5, year = 2005:2007)
dummy(start = c(2000,1), end = c(2012,5), frequency = 12, month = 3, year = c(2005,2007))
dummy(start = c(2000,1), end = c(2012,5), frequency = 12, month = 5:6, year = c(2005,2007))

#specific dates
dummy(start = c(2000,1), end = c(2012,5), frequency = 12, date = list(c(2010,1)))
dummy(start = c(2000,1), end = c(2012,5),
freq = 12, date = list(c(2010,9), c(2011,1), c(2000,1)) )

```

[Package BETS version 0.4.9 Index]