Traffic Counts at Sonnenberg in the Harz Region

Description

This dataset contains daily traffic counts close to Sonnenberg, located in the Harz region in Germany. It covers a period of nearly three years, from 2021-01-01 to 2023-11-30.

Usage

data("HarzTraffic", package = "gamlss2")

Format

A data frame containing 1057 observations on 16 variables.

date
Date, the date of the record.
yday
Integer, the day of the year.
bikes
Integer, the number of motorcycles on that day.
cars
Integer, the number of cars on that day.
trucks
Integer, the number of trucks on that day.
others
Integer, the number of other vehicles on that day.
tempmin
Numeric, minimum temperature in \(^{\circ}C\).
tempmax
Numeric, maximum temperature in \(^{\circ}C\).
temp
Numeric, mean temperature in \(^{\circ}C\).
humidity
Numeric, mean relative humidity in percent.
tempdew
Numeric, average dewpoint temperature in \(^{\circ}C\).
cloudiness
Numeric, average cloud cover in percent.
rain
Numeric, amount of precipitation in mm (snow and rain).
sunshine
Numeric, sunshine duration in minutes.
wind
Numeric, mean wind speed in m/s.
windmax
Numeric, maximum wind speed in m/s.

Source

Weather Data:

Data Source:
Deutscher Wetterdienst (DWD), Climate Data Center (CDC).
Licence:
CC BY 4.0
URL:
https://opendata.dwd.de/climate_environment/CDC/
Station:
Wernigerode (5490; Sachsen-Anhalt)
Position:
10.7686/51.8454/233 (lon, lat, alt, EPSG 4326)

Traffic Data:

Data Source:
Bundesanstalt für Strassenwesen (BASt)
Licence:
CC BY 4.0
URL:
https://www.bast.de, https://www.bast.de/DE/Verkehrstechnik/Fachthemen/v2-verkehrszaehlung/Verkehrszaehlung.html

Examples

library("gamlss2")

## seasonal variation of motorcycle counts at Sonnenberg/Harz
data("HarzTraffic", package = "gamlss2")
plot(bikes ~ yday, data = HarzTraffic)

## count distribution
barplot(table(HarzTraffic$bikes))

## negative binomial seasonal model using cyclic splines
m <- gamlss2(bikes ~ s(yday, bs = "cc") | s(yday, bs = "cc"),
  data = HarzTraffic, family = NBI)
GAMLSS-RS iteration  1: Global Deviance = 10163.082 eps = 0.148402     
GAMLSS-RS iteration  2: Global Deviance = 10151.144 eps = 0.001174     
GAMLSS-RS iteration  3: Global Deviance = 10151.1409 eps = 0.000000     
## visualize effects
plot(m)

## residual diagnostics
plot(m, which = "resid")

## fitted parameters for each day of the year
nd <- data.frame(yday = 1:365)
par <- predict(m, newdata = nd)

## corresponding quantiles
p <- sapply(c(0.05, 0.5, 0.95), function(q) family(m)$q(q, par))

## visualization
plot(bikes ~ yday, data = HarzTraffic, pch = 19, col = gray(0.1, alpha = 0.3))
matplot(nd$yday, p, type = "l", lty = c(2, 1, 2), lwd = 2, col = 4, add = TRUE)