R Code belonging to the manuscript "Estimation of Latent Network Flows in Bike-Sharing Systems" (to appear in the Statistical Modelling Journal)

Contact: Marc Schneble, Department of Statisics, LMU Munich (marc.schneble@lmu.de)

Overview over the Code + Data
- Main.R: This is the main file. Sourcing the first few lines loads all data, packages, functions, etc. The rest of the file is partitioned into the different analyses that appear in the paper.
- Confidential.R: Sourcing this file will load the confidential data (if available).
- Descriptives.R: Sourcing this file will produce all the plots which are shown in Section 4.1 of the paper.
- Functions.R, FunctionsPlotting.R and FunctionsSimulation.R contains all functions written by the authors.
- Designs: In this folder all designs will be saved. Some of them are needed at a later stage to plot results.
- Fits: In this folder all model fits will be saved.
- Plots: In this folder all plots will be saved.
- Data: This folder contains all the data that we use for our analyses. It contains the subfolders
	- Public: These data are not confidential.
	- Confidential: These data ARE confidential and are not supplied by default. The confidential datasets are
		- weather.csv: Hourly weather data of Vienna in the year 2014 (temperature, precipitation amount and duration, sunshine duration). If this dataset is not available
			       you can use the artificially created weather dataset in the "Public" folder which is similar to this one.
		- N.rds and N_wo_P.rds: Trip data including and not including the provider's interventions. These datasets are merely needed to run the Poisson models and to 
				        check the performance of the Skellam model.
		- P.rds: This datasets contains the provider intervention data. This dataset is merely needed if the observed differences of station feeds should be corrected
			 by the provider interventions, which corresponds to setting the argument "interventions" to "corrected".
		- Format: The latter three datasets are each a list consisting of a three-dimensional array "dyadic" (dyadic trip/interventions counts with first dimension "time", 
			  second dimension "outgoing station", third dimension "incoming station"), "outgoing" (outgoing trip/interventions counts with first dimension "time" and second dimension
                          "outgoing station") and "incoming" (incoming trip/intervention counts with first dimension "time" and second dimension "incoming station")