designMatrix: designmatrix: A package for creating design matrices with...

Description Usage Arguments Value designmatrix functions Examples

Description

The designmatrix package creates deisgn/model matrices for dates. The workhorse designMatrix function supports many differetn terms (e.g. weekday, month, leap years, holidays, etc). Some of these are in development and as yet not implemented.

Usage

1
2
3
4
5
designMatrix(x = NULL, weekdays = NULL, months = NULL, holidays = NULL,
  years = NULL, interactions = NULL, dayOfMonth = NULL,
  daysInMonth = NULL, leapYear = FALSE, quarters = NULL, weeks = NULL,
  weekend = FALSE, weekday = FALSE, removeUnusedLevels = FALSE,
  returnType = "numeric")

Arguments

x

A vector of dates.

weekdays

A character vector of the weekdays to include.

months

A numeric vector of the months to include.

holidays

TODO (A character vector of the holidays to include.)

years

A numeric vector of the years to include.

interactions

TODO (A character vector of the weekdays to include.)

dayOfMonth

TODO A numeric vector of the day of the month to include.

daysInMonth

TODO A numeric vector of the days in the month to include.

leapYear

TODO A logical that includes to include a leap year indicator.

quarters

TODO A character vector of the quarters to include.

weeks

TODOA numeric vector to include the week number of the year.

weekend

A logical that indicates if a weekend (Saturday or Sunday) indicator should be included

weekday

A logical that indicates if a weekday (Monday through Friday) indicator should be included

removeUnusedLevels

A TODO logical that indicates if colinear terms of the return matrix should be removed by dropping columns with zero variance.

returnType

TODO A character vector indicating the data type for the return matrix. Acceptable values are "integer", "factor", "numeric", and "logical".

Value

The design matrix for the input dates.

designmatrix functions

designMatrix

Examples

1
2
3
4
5
alldates <- seq(from = as.Date("2000-01-01"), to = as.Date("2005-10-01"), by = "days")

designMatrix(x = alldates, weekdays = "all", months = "January")
designMatrix(x = alldates, weekdays = c("Wednesday", "Friday"), quarters = "all")
designMatrix(x = alldates, months = "all", years = c(2002, 2004))

dashaub/designmatrix documentation built on May 14, 2019, 6:11 p.m.