This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #### IMPORT LIBRARIES #### | |
| rm(list = ls()) | |
| library(brms) | |
| library(dplyr) | |
| library(ggplot2) | |
| library(rethinking) | |
| library(dmetar) | |
| library(meta) | |
| library(tidybayes) | |
| library(ggridges) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rm(list = ls()) | |
| require(dplyr) | |
| require(ggplot2) | |
| require(ISOweek) | |
| require(scales) | |
| library(readr) | |
| library(timetk) | |
| rivm.data <- read_csv("COVID-19_casus_landelijk_2020-07-01.csv") | |
| rivm.death <- rivm.data %>% | |
| dplyr::filter(Deceased == "Yes") ## Extract deaths data only |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(readr) | |
| library(ggplot2) | |
| library(gganimate) | |
| library(tidyverse) | |
| library(ggrepel) | |
| library(lubridate) | |
| library(tidymodels) | |
| library(modeltime) | |
| library(tsbox) | |
| library(TSstudio) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rm(list = ls()) | |
| library(tidyverse) | |
| library(readr) | |
| library(ggthemes) | |
| library(lubridate) | |
| library(zoo) | |
| library(gganimate) | |
| library(cowplot) | |
| getwd() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plot(ts(mymts[,1])) | |
| # DWT with level of 2^3 | |
| data_dwt <- repr_dwt(mymts[,1], level = 6); length(data_dwt) | |
| # first 84 DFT coefficients are extracted and then inverted | |
| data_dft <- repr_dft(mymts[,1], coef = 63); length(data_dft) | |
| # first 84 DCT coefficients are extracted and then inverted | |
| data_dct <- repr_dct(mymts[,1], coef = 63); length(data_dct) | |
| # Classical PAA | |
| data_paa <- repr_paa(mymts[,1], q = 65, func = mean); length(data_paa) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mymts<-dataset%>% | |
| dplyr::select(VO2i_methode1,DO2i_methode1,RQ_methode1)%>% | |
| ts(., frequency=31557600) | |
| plot(ts(mymts)) | |
| mod.foreca <- foreca(mymts, n.comp = 3, plot = TRUE, spectrum.control=list(method="pspectrum")) | |
| mod.foreca | |
| plot(mod.foreca) | |
| biplot(mod.foreca) | |
| summary(mod.foreca) | |
| mod.foreca$scores <- ts(mod.foreca$scores, start = start(mymts),freq = frequency(mymts)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nums <- unlist(lapply(dataset, is.numeric)) | |
| datasetnums<-dataset[ , nums] | |
| corr <- round(cor(datasetnums), 1) | |
| ggcorrplot(corr, hc.order = TRUE, | |
| type = "lower", | |
| lab = TRUE, | |
| lab_size = 3, | |
| title="Correlogram of dataset", | |
| ggtheme=theme_bw) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wide<-dataset%>%dplyr::select(ID,Meting,Hb)%>%spread(Meting, Hb) | |
| wide<-as.data.frame(wide) | |
| wide_cld <- kml::cld(traj = wide, | |
| idAll = wide[,1], | |
| timeInData = 2:125, | |
| maxNA = 2) | |
| class(wide_cld) | |
| wide_klm<-kml::kml(wide_cld, | |
| nbRedrawing = 50, | |
| toPlot='traj') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nums <- unlist(lapply(dataset, is.numeric)) | |
| datasetnums<-dataset[ , nums] | |
| TSdist::EuclideanDistance(dataset$VCO2i, dataset$Hb) | |
| diss <- TSdist::TSDatabaseDistances(datasetnums, distance="euclidean", diag=T, upper=T) %>% | |
| as.matrix() | |
| diss %>% | |
| reshape::melt() %>% | |
| ggplot2::ggplot()+ | |
| ggplot2::geom_tile(ggplot2::aes(x = X1, y = X2, fill = value))+ | |
| ggplot2::scale_fill_viridis_c() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try <- dataset %>% | |
| dplyr::select(VO2cdi, Meting, ID) %>% | |
| drop_na() %>% # must drop NAs for clustering to work | |
| glimpse() | |
| spread_try <- try %>% | |
| spread(ID,VO2cdi) %>% | |
| glimpse() | |
| VO2_cluster <- t(spread_try[-1]) | |
| VO2_cluster_dist <- dist(VO2_cluster , method="euclidean") | |
| fit <- hclust(VO2_cluster_dist, method="ward.D") |