From a8f931674f00450d781580ebc8b82dd310dcdd33 Mon Sep 17 00:00:00 2001 From: Peder <pbac@dtu.dk> Date: Mon, 9 May 2022 15:50:34 +0200 Subject: [PATCH] fixed url, submitted again --- vignettes/forecast-evaluation.Rmd | 2 +- vignettes/model-selection.Rmd | 2 +- vignettes/online-updating.Rmd | 2 +- vignettes/setup-and-use-model.Rmd | 2 +- vignettes/setup-data.Rmd | 52 +++++++++++++++---------------- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/vignettes/forecast-evaluation.Rmd b/vignettes/forecast-evaluation.Rmd index 723e221..f013f24 100644 --- a/vignettes/forecast-evaluation.Rmd +++ b/vignettes/forecast-evaluation.Rmd @@ -89,7 +89,7 @@ knit_hooks$set(chunk = function(x, options) { ``` -[onlineforecasting]: https://onlineforecasting.org/articles/onlineforecasting.pdf +[onlineforecasting]: https://arxiv.org/abs/2109.12915 [building heat load forecasting]: https://onlineforecasting.org/examples/building-heat-load-forecasting.html [onlineforecasting.org]: https://onlineforecasting.org <!--shared-init-end--> diff --git a/vignettes/model-selection.Rmd b/vignettes/model-selection.Rmd index df3bbd1..1b0fdfd 100644 --- a/vignettes/model-selection.Rmd +++ b/vignettes/model-selection.Rmd @@ -89,7 +89,7 @@ knit_hooks$set(chunk = function(x, options) { ``` -[onlineforecasting]: https://onlineforecasting.org/articles/onlineforecasting.pdf +[onlineforecasting]: https://arxiv.org/abs/2109.12915 [building heat load forecasting]: https://onlineforecasting.org/examples/building-heat-load-forecasting.html [onlineforecasting.org]: https://onlineforecasting.org <!--shared-init-end--> diff --git a/vignettes/online-updating.Rmd b/vignettes/online-updating.Rmd index d9ef959..f946906 100644 --- a/vignettes/online-updating.Rmd +++ b/vignettes/online-updating.Rmd @@ -88,7 +88,7 @@ knit_hooks$set(chunk = function(x, options) { }) ``` -[onlineforecasting]: https://onlineforecasting.org/articles/onlineforecasting.pdf +[onlineforecasting]: https://arxiv.org/abs/2109.12915 [building heat load forecasting]: https://onlineforecasting.org/examples/building-heat-load-forecasting.html [onlineforecasting.org]: https://onlineforecasting.org <!--shared-init-end--> diff --git a/vignettes/setup-and-use-model.Rmd b/vignettes/setup-and-use-model.Rmd index 2018be0..3e9a6c0 100644 --- a/vignettes/setup-and-use-model.Rmd +++ b/vignettes/setup-and-use-model.Rmd @@ -89,7 +89,7 @@ knit_hooks$set(chunk = function(x, options) { ``` -[onlineforecasting]: https://onlineforecasting.org/articles/onlineforecasting.pdf +[onlineforecasting]: https://arxiv.org/abs/2109.12915 [building heat load forecasting]: https://onlineforecasting.org/examples/building-heat-load-forecasting.html [onlineforecasting.org]: https://onlineforecasting.org <!--shared-init-end--> diff --git a/vignettes/setup-data.Rmd b/vignettes/setup-data.Rmd index 51f78fe..d996e80 100644 --- a/vignettes/setup-data.Rmd +++ b/vignettes/setup-data.Rmd @@ -90,7 +90,7 @@ knit_hooks$set(chunk = function(x, options) { ``` -[onlineforecasting]: https://onlineforecasting.org/articles/onlineforecasting.pdf +[onlineforecasting]: https://arxiv.org/abs/2109.12915 [building heat load forecasting]: https://onlineforecasting.org/examples/building-heat-load-forecasting.html [onlineforecasting.org]: https://onlineforecasting.org <!--shared-init-end--> @@ -107,7 +107,7 @@ available [here](setup-data.R). More information on [onlineforecasting.org]. First load the package: ```{r} -## Load the package +# Load the package library(onlineforecast) ``` @@ -118,13 +118,13 @@ heat load forecasting in the building-heat-load-forecasting vignette. When the package is loaded the data is also loaded, so we can access it directly. Let's start out by: ```{r} -## Keep it in D to simplify notation +# Keep it in D to simplify notation D <- Dbuilding ``` The class is 'data.ĺist': ```{r} -## The class of D +# The class of D class(D) ``` @@ -134,7 +134,7 @@ order to have functions for the particular format of data - the format is explai It consists of vectors of time, vectors of observations (model output) and data.frames of forecasts (model input): ```{r} -## Print the names to see the variables in the data +# Print the names to see the variables in the data names(D) ``` @@ -157,7 +157,7 @@ then the check of the variables format is passed. See the help with First, lets have a look at `D$t`, which is the vector of time points: ```{r} -## The time +# The time class(D$t) head(D$t) tail(D$t) @@ -188,9 +188,9 @@ operations can be done with: A helper function is provided with the `ct` function which can be called using `?`, or `?ct`. See example below: ```{r} -## Convert from a time stamp (tz="GMT" per default) +# Convert from a time stamp (tz="GMT" per default) ct("2019-01-01 11:00") -## Convert from unix time +# Convert from unix time ct(3840928387) ``` Note that for all functions where a time value as a character is given, the time @@ -220,7 +220,7 @@ str(D$heatload) It must have the same length as the time vector: ```{r} -## Same length as time +# Same length as time length(D$t) length(D$heatload) ``` @@ -233,11 +233,11 @@ plot(D$t, D$heatload, type="l", xlab="Time", ylab="Headload (kW)") The convention used in all examples is that the time points are always set to the time interval end point, e.g.: ```{r} -## The observation +# The observation D$heatload[2] -## Represents the average load between +# Represents the average load between D$t[1] -## and +# and D$t[2] ``` The main idea behind setting the time point at the end of the interval is: @@ -262,18 +262,18 @@ The rules are: Have a look at the forecasts of the global radiation: ```{r} -## Global radiation forecasts +# Global radiation forecasts head(D$I) ``` At the first time point: ```{r} -## First time point +# First time point D$t[1] ``` the available forecast ahead in time is at the first row: ```{r} -## The forecast available ahead in time is in the first row +# The forecast available ahead in time is in the first row D$I[1, ] ``` @@ -289,10 +289,10 @@ the steps are hourly, is an equi-distant time series. Picking out the entire series can be done by `D$I$k8` - hence a plot (together with the observations) can be generated by: ```{r} -## Just pick some points by +# Just pick some points by i <- 200:296 plot(D$t[i], D$I$k8[i], type="l", col=2, xlab="Time", ylab="Global radiation (W/m²)") -## Add the observations +# Add the observations lines(D$t[i], D$Iobs[i]) legend("topright", c("8-step forecasts","Observations"), bg="white", lty=1, col=2:1) ``` @@ -358,15 +358,15 @@ and note that the forecasts are lagged to be aligned in time. See `?pairs.data.l Just as a quick side note: This is the principle used for fitting onlineforecast models, simply shift forecasts to align with the observations: ```{r, fig.width=fhs, fig.height=fhs, out.width=ows} -## Lag the 8-step forecasts to be aligned with the observations +# Lag the 8-step forecasts to be aligned with the observations x <- lagvec(D$I$k8, 8) -## Take a smaller range +# Take a smaller range x <- x[i] -## Take the observations +# Take the observations y <- D$Iobs[i] -## Fit a linear regression model +# Fit a linear regression model fit <- lm(y ~ x) -## Plot the result +# Plot the result plot(x, y, xlab="8-step forecasts (W/m²)", ylab="Obsservations (W/m²)", main="Global radiation") abline(fit) ``` @@ -389,7 +389,7 @@ Taking a subset of a `data.list` is very useful and it can easily be done in different ways using the `subset` function (i.e. it's really the `subset.data.list` function called when: ```{r} -## Take the 1 to 4 values of each variable in D +# Take the 1 to 4 values of each variable in D Dsub <- subset(D, 1:4) summary(Dsub) ``` @@ -430,11 +430,11 @@ class(Df) After processing it is easily converted back to the `data.list` again by: ```{r} -## Set back to data.frame +# Set back to data.frame setDF(Df) -## Convert to a data.list +# Convert to a data.list Dsub2 <- as.data.list(Df) -## Compare it with the original Dsub +# Compare it with the original Dsub summary(Dsub2) summary(Dsub) ``` -- GitLab