Source code for this document is found here.

###################### Set up data

# devtools::install_github("fredhasselman/casnet")

# edidata %>%
#   dplyr::select(-date) %>%
#   names() %>%
#   purrr::map(~ggplot(edidata, aes_string(x = .)) + geom_histogram(binwidth = 500))
#
# edidata %>%
#   dplyr::select(-date) %>%
#   names() %>%
#   purrr::map(~ggplot(edidata, aes_string(x = .)) +
#         geom_density() +
#         theme_bw())
#
# edidata %>%
#   dplyr::select(-date) %>%
#   purrr::map(~summary(.))

# edidata <- readr::read_tsv("../motivation-dynamics/data/data.tsv") %>%
#   tidyr::spread(Field, Value) %>%
#   dplyr::select(autonomy, competence, relatedness,
#                 pleasure, interest, importance,
#                 situation_requires = required,
#                 anxiety_guilt_avoidance = anxiety_guilt,
#                 another_wants = for_others,
#                 Date,
#                 User) %>%
#   type.convert()  %>%
#   dplyr::mutate(Date = as.POSIXct(Date)) %>%
#   dplyr::filter(stringr::str_detect(User, "Moti")) %>%
#   na.omit()
# 
# readr::write_csv(edidata, path = "./data/data_20p_9var_plus_time.csv")
mydata <- readr::read_csv("./data/data_20p_9var_plus_time.csv")
  
emadata_nested <- mydata %>% dplyr::group_by(User) %>% 
  tidyr::nest() 

# Show sample size for each participant:
# emadata_nested %>% 
#   mutate(n = map_dbl(data, nrow))

emadata_nested_wrangled <- emadata_nested %>% 
  dplyr::mutate(data = purrr::map(data, ~dplyr::mutate(.x, 
                                                       date = as.Date(Date),
                                                       timediff = c(NA, diff(Date))))) %>% 
  # Filter out answers less than 15 minutes from the last one, then remove the difference variable
  dplyr::mutate(data = purrr::map(data, ~dplyr::filter(.x, timediff > 15))) %>% 
  dplyr::mutate(data = purrr::map(data, ~dplyr::select(.x, 
                                                       -timediff,
                                                       -Date,
                                                       -date)))
###################### Generate result tables

emadata_nested_wrangled_tests <- emadata_nested_wrangled %>%
  dplyr::mutate(observations = purrr::map_dbl(.x = data,
                                              .f = ~nrow(.)))
test_results <- list()
data_assumptions <- list()
alphaLevel <- 0.05 / 4

for(i in 1:nrow(emadata_nested_wrangled_tests)){

data_assumptions[[i]] <- emadata_nested_wrangled_tests$data[[i]]

H0_randomness_H1_nonrandomness <- data_assumptions[[i]] %>% # dplyr::select(-date) %>%
  purrr::map_df(~randtests::bartels.rank.test(., alternative = "two.sided")$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3)) 
H0_randomness_H1_nonrandomness$name <- "Bartel's rank test\nH0: randomness\nH1: nonrandomness"
H0_randomness_H1_nonrandomness$User <- emadata_nested_wrangled[i, 1][[1]]

H0_randomness_H1_trend <- data_assumptions[[i]] %>% # dplyr::select(-date) %>%
  purrr::map_df(~randtests::bartels.rank.test(., alternative = "left.sided")$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3)) 
H0_randomness_H1_trend$name <- "Bartel's rank test\nH0: randomness\nH1: trend"
H0_randomness_H1_trend$User <- emadata_nested_wrangled[i, 1][[1]]
  
H0_randomness_H1_systematic_oscillation <- data_assumptions[[i]] %>% # dplyr::select(-date) %>%
  purrr::map_df(~randtests::bartels.rank.test(., alternative = "right.sided")$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3)) 
H0_randomness_H1_systematic_oscillation$name <- "Bartel's rank test\nH0: randomness\nH1: systematic oscillation"
H0_randomness_H1_systematic_oscillation$User <- emadata_nested_wrangled[i, 1][[1]]

H0_randomness_H1_upward_or_downward_trend <- data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~randtests::cox.stuart.test(na.exclude(.), alternative = "two.sided")$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_randomness_H1_upward_or_downward_trend$name <- "Cox-Stuart test\nH0: randomness\nH1: upward or downward trend"
H0_randomness_H1_upward_or_downward_trend$User <- emadata_nested_wrangled[i, 1][[1]]

H0_randomness_H1_upward_trend <- data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~randtests::cox.stuart.test(na.exclude(.), alternative = "right.sided")$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_randomness_H1_upward_trend$name <- "Cox-Stuart test\nH0: randomness\nH1: upward trend"
H0_randomness_H1_upward_trend$User <- emadata_nested_wrangled[i, 1][[1]]

H0_randomness_H1_downward_trend <- data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~randtests::cox.stuart.test(na.exclude(.), alternative = "left.sided")$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_randomness_H1_downward_trend$name <- "Cox-Stuart test\nH0: randomness\nH1: downward trend"
H0_randomness_H1_downward_trend$User <- emadata_nested_wrangled[i, 1][[1]]

H0_level_stationarity_H1_unit_root_no_level_stationarity <- data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~tseries::kpss.test(na.exclude(.), lshort = TRUE, null = "Level")$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_level_stationarity_H1_unit_root_no_level_stationarity$name <- "KPSS test\nH0: stationary level\nH1: non-stationary level"
H0_level_stationarity_H1_unit_root_no_level_stationarity$User <- emadata_nested_wrangled[i, 1][[1]]

H0_trend_stationarity_H1_no_trend_stationarity <- data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~tseries::kpss.test(na.exclude(.), lshort = TRUE, null = "Trend")$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_trend_stationarity_H1_no_trend_stationarity$name <- "KPSS test\nH0: stationary trend\nH1: non-stationary trend"
H0_trend_stationarity_H1_no_trend_stationarity$User <- emadata_nested_wrangled[i, 1][[1]]

H0_some_AR_process_H1_no_AR_process <- data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~TSA::Keenan.test(na.exclude(.))$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_some_AR_process_H1_no_AR_process$name <- "Keenan's test for nonlinearity\nH0: linear AR process\nH1: not a linear AR process"
H0_some_AR_process_H1_no_AR_process$User <- emadata_nested_wrangled[i, 1][[1]]

H0_some_AR_process_H1_no_ARCH_process <- data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~TSA::McLeod.Li.test(y = ., plot = FALSE, omit.initial = TRUE)$p.values %>% 
                  max(.) %>% 
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_some_AR_process_H1_no_ARCH_process$name <- "McLeod-Li test\nH0: linear AR process\nH1: not an ARCH process"
H0_some_AR_process_H1_no_ARCH_process$User <- emadata_nested_wrangled[i, 1][[1]]

H0_some_AR_process_H1_no_ARiMA_process <- data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~TSA::McLeod.Li.test(object = forecast::auto.arima(.), 
                                     plot = FALSE, 
                                     omit.initial = TRUE)$p.values %>%
                  max(.) %>%
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_some_AR_process_H1_no_ARiMA_process$name <- "McLeod-Li test\nH0: linear AR process\nH1: not an ARiMA process"
H0_some_AR_process_H1_no_ARiMA_process$User <- emadata_nested_wrangled[i, 1][[1]]

H0_AR_process_H1_no_AR_process <- data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~TSA::Tsay.test(na.exclude(.))$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_AR_process_H1_no_AR_process$name <- "Tsay's test for nonlinearity\nH0: linear AR process\nH1: not a linear AR process"
H0_AR_process_H1_no_AR_process$User <- emadata_nested_wrangled[i, 1][[1]]

test_results[[i]] <- rbind(H0_randomness_H1_nonrandomness,
                      H0_randomness_H1_trend,
                      H0_randomness_H1_systematic_oscillation,
                      H0_randomness_H1_upward_or_downward_trend,
                      H0_randomness_H1_upward_trend,
                      H0_randomness_H1_downward_trend,
                      H0_level_stationarity_H1_unit_root_no_level_stationarity,
                      H0_trend_stationarity_H1_no_trend_stationarity,
                      H0_some_AR_process_H1_no_AR_process,
                      H0_some_AR_process_H1_no_ARCH_process,
                      H0_some_AR_process_H1_no_ARiMA_process,
                      H0_AR_process_H1_no_AR_process) %>% 
  dplyr::select(User, name, everything())
}

test_nested <- test_results %>% purrr::map_df(., rbind) %>% 
  dplyr::group_by(User) %>% 
  tidyr::nest() 

test_nested <- test_nested %>% 
  dplyr::mutate(data = purrr::map(.x = data,
                                  .f = ~dplyr::mutate_at(.x, vars(2:ncol(test_nested$data[[1]])), 
                                                              funs(as.numeric))),
                data_binarised = purrr::map(.x = data,
                                            .f = ~dplyr::transmute_if(.x, is.numeric,
                                                                      ~dplyr::case_when(. < alphaLevel ~ 1,
                                                                                        TRUE ~ 0)) %>% 
                                              dplyr::mutate(test_number = row_number())),
                data = purrr::map(.x = data, 
                                  .f = ~dplyr::mutate(.x, test_number = row_number())))

test_nested <- dplyr::full_join(test_nested,
                 emadata_nested_wrangled_tests %>% dplyr::select(User, observations),
                 by = "User")

# test_nested_segments_aggregates$aggregated_proportions
# test_nested_segments_aggregates$aggregated_series
# test_nested_segments_aggregates$series_numbers
# test_nested_segments_aggregates$data_binarised
# test_nested$data
# test_nested$data_binarised

############### Rejections by variable 
tests_number_of_series <- test_nested$data_binarised %>% 
  purrr::map_df(., rbind) %>% 
  tidyr::pivot_longer(cols = -test_number) %>% 
  dplyr::group_by(test_number, name) %>% 
  dplyr::summarise(value = sum(value)) %>% 
  dplyr::ungroup() %>% 
  tidyr::pivot_wider(names_from = name, values_from = value)

tests_number_of_series$name <- test_nested$data[[1]]$name

tests_number_of_series <- tests_number_of_series %>% dplyr::select(name,
                                                                   everything(),
                                                                   -test_number)

############### Rejections by participant
test_nested_by_participant <- test_nested %>% 
  dplyr::mutate(rejected_vars_per_test = purrr::map(.x = data_binarised,
                                                    .f = ~dplyr::select(.x, -test_number) %>% 
                                                      rowSums))

rejected_vars_per_test <- test_nested_by_participant$rejected_vars_per_test %>% 
  dplyr::bind_cols()

names(rejected_vars_per_test) <- paste0(test_nested_by_participant$User,
                                        " (n=",
                                        test_nested_by_participant$observations,
                                        ")")

rejected_vars_per_test$name <- test_nested$data[[1]]$name

rejected_vars_per_test <- rejected_vars_per_test %>% 
  dplyr::select(name, everything())
alphaLo_emadata_nested_wrangled <- emadata_nested_wrangled

alphaLo_emadata_nested_wrangled_tests <- alphaLo_emadata_nested_wrangled %>%
  dplyr::mutate(observations = purrr::map_dbl(.x = data,
                                              .f = ~nrow(.)))
alphaLo_test_results <- list()
alphaLo_data_assumptions <- list()
alphaLo <- 0.05 / 12

for(i in 1:nrow(alphaLo_emadata_nested_wrangled_tests)){

alphaLo_data_assumptions[[i]] <- alphaLo_emadata_nested_wrangled_tests$data[[i]]

H0_randomness_H1_nonrandomness <- alphaLo_data_assumptions[[i]] %>% # dplyr::select(-date) %>%
  purrr::map_df(~randtests::bartels.rank.test(., alternative = "two.sided")$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3)) 
H0_randomness_H1_nonrandomness$name <- "Bartel's rank test\nH0: randomness\nH1: nonrandomness"
H0_randomness_H1_nonrandomness$User <- alphaLo_emadata_nested_wrangled[i, 1][[1]]

H0_randomness_H1_trend <- alphaLo_data_assumptions[[i]] %>% # dplyr::select(-date) %>%
  purrr::map_df(~randtests::bartels.rank.test(., alternative = "left.sided")$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3)) 
H0_randomness_H1_trend$name <- "Bartel's rank test\nH0: randomness\nH1: trend"
H0_randomness_H1_trend$User <- alphaLo_emadata_nested_wrangled[i, 1][[1]]
  
H0_randomness_H1_systematic_oscillation <- alphaLo_data_assumptions[[i]] %>% # dplyr::select(-date) %>%
  purrr::map_df(~randtests::bartels.rank.test(., alternative = "right.sided")$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3)) 
H0_randomness_H1_systematic_oscillation$name <- "Bartel's rank test\nH0: randomness\nH1: systematic oscillation"
H0_randomness_H1_systematic_oscillation$User <- alphaLo_emadata_nested_wrangled[i, 1][[1]]

H0_randomness_H1_upward_or_downward_trend <- alphaLo_data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~randtests::cox.stuart.test(na.exclude(.), alternative = "two.sided")$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_randomness_H1_upward_or_downward_trend$name <- "Cox-Stuart test\nH0: randomness\nH1: upward or downward trend"
H0_randomness_H1_upward_or_downward_trend$User <- alphaLo_emadata_nested_wrangled[i, 1][[1]]

H0_randomness_H1_upward_trend <- alphaLo_data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~randtests::cox.stuart.test(na.exclude(.), alternative = "right.sided")$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_randomness_H1_upward_trend$name <- "Cox-Stuart test\nH0: randomness\nH1: upward trend"
H0_randomness_H1_upward_trend$User <- alphaLo_emadata_nested_wrangled[i, 1][[1]]

H0_randomness_H1_downward_trend <- alphaLo_data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~randtests::cox.stuart.test(na.exclude(.), alternative = "left.sided")$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_randomness_H1_downward_trend$name <- "Cox-Stuart test\nH0: randomness\nH1: downward trend"
H0_randomness_H1_downward_trend$User <- alphaLo_emadata_nested_wrangled[i, 1][[1]]

H0_level_stationarity_H1_unit_root_no_level_stationarity <- alphaLo_data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~tseries::kpss.test(na.exclude(.), lshort = TRUE, null = "Level")$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_level_stationarity_H1_unit_root_no_level_stationarity$name <- "KPSS test\nH0: stationary level\nH1: non-stationary level"
H0_level_stationarity_H1_unit_root_no_level_stationarity$User <- alphaLo_emadata_nested_wrangled[i, 1][[1]]

H0_trend_stationarity_H1_no_trend_stationarity <- alphaLo_data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~tseries::kpss.test(na.exclude(.), lshort = TRUE, null = "Trend")$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_trend_stationarity_H1_no_trend_stationarity$name <- "KPSS test\nH0: stationary trend\nH1: non-stationary trend"
H0_trend_stationarity_H1_no_trend_stationarity$User <- alphaLo_emadata_nested_wrangled[i, 1][[1]]

H0_some_AR_process_H1_no_AR_process <- alphaLo_data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~TSA::Keenan.test(na.exclude(.))$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_some_AR_process_H1_no_AR_process$name <- "Keenan's test for nonlinearity\nH0: linear AR process\nH1: not a linear AR process"
H0_some_AR_process_H1_no_AR_process$User <- alphaLo_emadata_nested_wrangled[i, 1][[1]]

H0_some_AR_process_H1_no_ARCH_process <- alphaLo_data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~TSA::McLeod.Li.test(y = ., plot = FALSE, omit.initial = TRUE)$p.values %>% 
                  max(.) %>% 
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_some_AR_process_H1_no_ARCH_process$name <- "McLeod-Li test\nH0: linear AR process\nH1: not an ARCH process"
H0_some_AR_process_H1_no_ARCH_process$User <- alphaLo_emadata_nested_wrangled[i, 1][[1]]

H0_some_AR_process_H1_no_ARiMA_process <- alphaLo_data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~TSA::McLeod.Li.test(object = forecast::auto.arima(.), 
                                     plot = FALSE, 
                                     omit.initial = TRUE)$p.values %>%
                  max(.) %>%
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_some_AR_process_H1_no_ARiMA_process$name <- "McLeod-Li test\nH0: linear AR process\nH1: not an ARiMA process"
H0_some_AR_process_H1_no_ARiMA_process$User <- alphaLo_emadata_nested_wrangled[i, 1][[1]]

H0_AR_process_H1_no_AR_process <- alphaLo_data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~TSA::Tsay.test(na.exclude(.))$p.value %>% 
                  round(., digits = 3) %>% format(., nsmall = 3))
H0_AR_process_H1_no_AR_process$name <- "Tsay's test for nonlinearity\nH0: linear AR process\nH1: not a linear AR process"
H0_AR_process_H1_no_AR_process$User <- alphaLo_emadata_nested_wrangled[i, 1][[1]]

alphaLo_test_results[[i]] <- rbind(H0_randomness_H1_nonrandomness,
                      H0_randomness_H1_trend,
                      H0_randomness_H1_systematic_oscillation,
                      H0_randomness_H1_upward_or_downward_trend,
                      H0_randomness_H1_upward_trend,
                      H0_randomness_H1_downward_trend,
                      H0_level_stationarity_H1_unit_root_no_level_stationarity,
                      H0_trend_stationarity_H1_no_trend_stationarity,
                      H0_some_AR_process_H1_no_AR_process,
                      H0_some_AR_process_H1_no_ARCH_process,
                      H0_some_AR_process_H1_no_ARiMA_process,
                      H0_AR_process_H1_no_AR_process) %>% 
  dplyr::select(User, name, everything())
}

alphaLo_test_nested <- alphaLo_test_results %>% purrr::map_df(., rbind) %>% 
  dplyr::group_by(User) %>% 
  tidyr::nest() 

alphaLo_test_nested <- alphaLo_test_nested %>% 
  dplyr::mutate(data = purrr::map(.x = data,
                                  .f = ~dplyr::mutate_at(.x, vars(2:ncol(alphaLo_test_nested$data[[1]])), 
                                                              funs(as.numeric))),
                data_binarised = purrr::map(.x = data,
                                            .f = ~dplyr::transmute_if(.x, is.numeric,
                                                                      ~dplyr::case_when(. < alphaLo ~ 1,
                                                                                        TRUE ~ 0)) %>% 
                                              dplyr::mutate(test_number = row_number())),
                data = purrr::map(.x = data, 
                                  .f = ~dplyr::mutate(.x, test_number = row_number())))

alphaLo_test_nested <- dplyr::full_join(alphaLo_test_nested,
                 alphaLo_emadata_nested_wrangled_tests %>% dplyr::select(User, observations),
                 by = "User")

# alphaLo_test_nested_segments_aggregates$aggregated_proportions
# alphaLo_test_nested_segments_aggregates$aggregated_series
# alphaLo_test_nested_segments_aggregates$series_numbers
# alphaLo_test_nested_segments_aggregates$data_binarised
# alphaLo_test_nested$data
# alphaLo_test_nested$data_binarised

############### Rejections by variable 
alphaLo_tests_number_of_series <- alphaLo_test_nested$data_binarised %>% 
  purrr::map_df(., rbind) %>% 
  tidyr::pivot_longer(cols = -test_number) %>% 
  dplyr::group_by(test_number, name) %>% 
  dplyr::summarise(value = sum(value)) %>% 
  dplyr::ungroup() %>% 
  tidyr::pivot_wider(names_from = name, values_from = value)

alphaLo_tests_number_of_series$name <- alphaLo_test_nested$data[[1]]$name

alphaLo_tests_number_of_series <- alphaLo_tests_number_of_series %>% dplyr::select(name,
                                                                   everything(),
                                                                   -test_number)

############### Rejections by participant
alphaLo_test_nested_by_participant <- alphaLo_test_nested %>% 
  dplyr::mutate(alphaLo_rejected_vars_per_test = purrr::map(.x = data_binarised,
                                                    .f = ~dplyr::select(.x, -test_number) %>% 
                                                      rowSums))

alphaLo_rejected_vars_per_test <- alphaLo_test_nested_by_participant$alphaLo_rejected_vars_per_test %>% 
  dplyr::bind_cols()

names(alphaLo_rejected_vars_per_test) <- paste0(alphaLo_test_nested_by_participant$User,
                                        " (n=",
                                        alphaLo_test_nested_by_participant$observations,
                                        ")")

alphaLo_rejected_vars_per_test$name <- alphaLo_test_nested$data[[1]]$name

alphaLo_rejected_vars_per_test <- alphaLo_rejected_vars_per_test %>% 
  dplyr::select(name, everything())


# DT::datatable(alphaLo_test_results,
#               options = list(pageLength = 11),
#               caption = "P-values (or maximum p-values in case of McLeod-Li test) 
#               for tests of assumptions of data-generating processes") %>%
#     DT::formatRound(columns = colnames(alphaLo_test_results), digits=3)

# alphaLo_test_results %>% summarise_if(is.numeric, ~((sum(.<0.05) / nrow(alphaLo_test_results)) %>% scales::percent())) %>% 
#   knitr::kable(caption = paste0("Percentage of ", 
#                                 nrow(alphaLo_test_results), 
#                                 " assumption tests indicating deviance at the p < 0.05 level"))
#Keenan's test error message

data_assumptions[[i]] %>% # dplyr::select(-date) %>% 
  purrr::map_df(~TSA::Keenan.test(na.exclude(.))$p.value)

TSA::Keenan.test(c(20, 25, 15, 45, 45, 46, 8, 46, 44, 40, 24, 6, 23, 33, 45, 28, 23, 37, 39, 35, 39, 38, 41, 38))

nonlinearTseries::nonlinearityTest(c(20, 25, 15, 45, 45, 46, 8, 46, 44, 40, 24, 6, 23, 33, 45, 28, 23, 37, 39, 35, 39, 38, 41, 38))

cat(data_assumptions[[3]]$competence, sep = ", ")

This dataset consists of 20 individuals and their responses to 9 questions. See “Dataset” in the top navigation bar for details.

In those tables below, where exact p-values are not reported, we choose the threshold of p < 0.0125 to reject the test. The rationale for this is that we consider what’s presented as the “Overview table” of four tests to consist of a family of tests, hence 0.05 / 4 = 0.0125. We also present the tables using an alpha level of 0.05 / 12 = 0.0041667. Ultimately, many different choices could be justified, and we encourage the reader to do their own analysis with the shared data. Obviously, not correcting for multiple testing and using 0.05 as the cutoff, would reject much more time series. Note: the KPSS test is built in such a way that it does not produce p-values < 0.01, hence interpretation is not sensible for alpha levels below that.

The four tests presented in the Overview table, show what we consider the most important factors in this context:

  1. The common way to deal with non-stationarities in data is to detrend the data, but if the trend is non-stationary, or if the mean level changes abruptly, detrending can confound the analysis.
  2. The use of linear modeling is problematic if the data is not generated by an autoregressive process.

Percentage of time series tests rejected in segments based on number of responses

In the first tables, the participants are segmented into those with less than 100 response occasions, those with more than 100, and those (one person) with more than 100 response occasions.

Interpretation instructions: One time series is one variable in one person’s data. The top-left percentage indicates the proportion of time series, which is rejected at p < alpha. In other words, it is the number of rejected time series in the segment signified in the column header, divided by total number of time series (i.e. number of individuals in that segment, multiplied by the number of variables per individual, i.e. 9).

Overview table (alpha = 0.0125)


test_nested <- test_nested %>% 
  dplyr::mutate(obs_segment = dplyr::case_when(observations < 100 ~ 1,
                                               observations < 1000 ~ 2,
                                               TRUE ~ 3))

test_nested_segments <- test_nested %>% dplyr::select(data_binarised, obs_segment) %>% 
  dplyr::group_by(obs_segment) %>% 
  tidyr::nest()

test_nested_segments <- test_nested_segments %>%
  dplyr::mutate(people = purrr::map_dbl(.x = data,
                                              .f = ~nrow(.)))

test_nested_segments_aggregates <- test_nested_segments %>% 
  dplyr::mutate(data_binarised = purrr::map(.x = data,
                                            .f = ~.x[["data_binarised"]] %>% 
                                              purrr::map_df(., rbind)))

test_nested_segments_aggregates <- test_nested_segments_aggregates %>% 
  dplyr::mutate(series_numbers = purrr::map(.x = data_binarised,
                                            .f = ~tidyr::pivot_longer(.x, cols = -test_number) %>% 
                                              dplyr::group_by(test_number, name) %>% 
                                              dplyr::summarise(value = sum(value)) %>% 
                                              dplyr::ungroup() %>% 
                                              tidyr::pivot_wider(names_from = name, values_from = value)
  ))

test_nested_segments_aggregates <- test_nested_segments_aggregates %>% 
  dplyr::mutate(aggregated_series = purrr::map(.x = series_numbers,
                                            .f = ~tidyr::pivot_longer(.x, cols = -test_number) %>% 
                                              dplyr::group_by(test_number) %>% 
                                              dplyr::summarise(value = sum(value)) %>% 
                                              dplyr::ungroup() %>% 
                                              tidyr::pivot_wider(names_from = test_number, values_from = value)
  ))

test_nested_segments_aggregates <- test_nested_segments_aggregates %>% 
  dplyr::mutate(aggregated_proportions = purrr::pmap(list(..1 = aggregated_series,
                                                          ..2 = people),
                                                     .f = ~..1 %>% dplyr::mutate(., people_n = ..2)),
                aggregated_proportions = purrr::map(.x = aggregated_proportions,
                                                    .f = ~dplyr::mutate_at(.x, 
                                                                           vars(-contains("people_n")), 
                                                                           funs(./(people_n*9)))))

segment1_max <- test_nested %>% 
  dplyr::ungroup() %>% 
  dplyr::filter(observations < 100) %>% 
  dplyr::arrange(desc(observations)) %>% 
  dplyr::filter(row_number() == 1) %>% 
  dplyr::pull(observations)

segment1_min <- test_nested %>% 
  dplyr::ungroup() %>% 
  dplyr::filter(observations < 100) %>% 
  dplyr::arrange(desc(observations)) %>% 
  dplyr::filter(row_number() == n()) %>% 
  dplyr::pull(observations)

segment2_max <- test_nested %>% 
  dplyr::ungroup() %>% 
  dplyr::filter(observations >= 100 & observations <= 1000) %>% 
  dplyr::arrange(desc(observations)) %>% 
  dplyr::filter(row_number() == 1) %>% 
  dplyr::pull(observations)

segment2_min <- test_nested %>% 
  dplyr::ungroup() %>% 
  dplyr::filter(observations >= 100 & observations <= 1000) %>% 
  dplyr::arrange(desc(observations)) %>% 
  dplyr::filter(row_number() == n()) %>% 
  dplyr::pull(observations)

segment3_minmax <- test_nested %>% 
  dplyr::ungroup() %>% 
  dplyr::filter(observations > 1000) %>% 
  dplyr::arrange(desc(observations)) %>% 
  dplyr::filter(row_number() == n()) %>% 
  dplyr::pull(observations)

segment_proportions <- test_nested_segments_aggregates$aggregated_proportions %>% 
  dplyr::bind_rows() %>% 
  dplyr::mutate(group = c(paste0(segment1_min, "-", segment1_max, " observations (n = ", people_n[1], ")"),
                          paste0(segment2_min, "-", segment2_max, " observations (n = ", people_n[2], ")"),
                          paste0(segment3_minmax, " observations (n = ", people_n[3], ")"))) %>% 
  tidyr::pivot_longer(cols = c(-"people_n", -"group")) %>% 
  dplyr::select(-people_n) %>% 
  tidyr::pivot_wider(names_from = group, values_from = value)

segment_proportions$name <- test_nested$data[[1]]$name

DT::datatable(segment_proportions %>%
                dplyr::mutate_at(vars(-name), funs(scales::percent(., accuracy = 0.1))) %>% 
                dplyr::slice(c(7, 8, 9, 12)),
              options = list(pageLength = 12),
              caption = paste0("Tests for stationarity and non-linearity. Columns indicate 
                               segments in the full sample of n = 20, and rows indicate tests. 
                               Each cell indicates the percentage of time series (out of n 
                               times 9, as each participant collected data on 9 variables), 
                               where H0 is rejected at p<", alphaLevel, ". AR = autoregressive."))

Full table (alpha = 0.0125)


DT::datatable(segment_proportions %>%
                dplyr::mutate_at(vars(-name), funs(scales::percent(., accuracy = 0.1))),
              options = list(pageLength = 12),
              caption = paste0("Tests for stationarity and non-linearity. Columns indicate 
                               segments in the full sample of n = 20, and rows indicate tests. 
                               Each cell indicates the percentage of time series (out of n 
                               times 9, as each participant collected data on 9 variables), 
                               where H0 is rejected at p<", alphaLevel, ". AR = autoregressive."))

Overview table (alpha = 0.0042)


alphaLo_test_nested <- alphaLo_test_nested %>% 
  dplyr::mutate(obs_segment = dplyr::case_when(observations < 100 ~ 1,
                                               observations < 1000 ~ 2,
                                               TRUE ~ 3))

alphaLo_test_nested_segments <- alphaLo_test_nested %>% 
  dplyr::select(data_binarised, obs_segment) %>% 
  dplyr::group_by(obs_segment) %>% 
  tidyr::nest()

alphaLo_test_nested_segments <- alphaLo_test_nested_segments %>%
  dplyr::mutate(people = purrr::map_dbl(.x = data,
                                              .f = ~nrow(.)))

alphaLo_test_nested_segments_aggregates <- alphaLo_test_nested_segments %>% 
  dplyr::mutate(data_binarised = purrr::map(.x = data,
                                            .f = ~.x[["data_binarised"]] %>% 
                                              purrr::map_df(., rbind)))

alphaLo_test_nested_segments_aggregates <- alphaLo_test_nested_segments_aggregates %>% 
  dplyr::mutate(series_numbers = purrr::map(.x = data_binarised,
                                            .f = ~tidyr::pivot_longer(.x, cols = -test_number) %>% 
                                              dplyr::group_by(test_number, name) %>% 
                                              dplyr::summarise(value = sum(value)) %>% 
                                              dplyr::ungroup() %>% 
                                              tidyr::pivot_wider(names_from = name, 
                                                                 values_from = value)
  ))

alphaLo_test_nested_segments_aggregates <- alphaLo_test_nested_segments_aggregates %>% 
  dplyr::mutate(aggregated_series = purrr::map(.x = series_numbers,
                                            .f = ~tidyr::pivot_longer(.x, cols = -test_number) %>% 
                                              dplyr::group_by(test_number) %>% 
                                              dplyr::summarise(value = sum(value)) %>% 
                                              dplyr::ungroup() %>% 
                                              tidyr::pivot_wider(names_from = test_number, 
                                                                 values_from = value)
  ))

alphaLo_test_nested_segments_aggregates <- alphaLo_test_nested_segments_aggregates %>% 
  dplyr::mutate(aggregated_proportions = 
                  purrr::pmap(list(..1 = aggregated_series,
                                   ..2 = people),
                              .f = ~..1 %>% 
                                dplyr::mutate(., people_n = ..2)),
                aggregated_proportions = 
                  purrr::map(.x = aggregated_proportions,
                             .f = ~dplyr::mutate_at(.x, 
                                                    vars(-contains("people_n")), 
                                                    funs(./(people_n*9)))))

segment1_max <- alphaLo_test_nested %>% 
  dplyr::ungroup() %>% 
  dplyr::filter(observations < 100) %>% 
  dplyr::arrange(desc(observations)) %>% 
  dplyr::filter(row_number() == 1) %>% 
  dplyr::pull(observations)

segment1_min <- alphaLo_test_nested %>% 
  dplyr::ungroup() %>% 
  dplyr::filter(observations < 100) %>% 
  dplyr::arrange(desc(observations)) %>% 
  dplyr::filter(row_number() == n()) %>% 
  dplyr::pull(observations)

segment2_max <- alphaLo_test_nested %>% 
  dplyr::ungroup() %>% 
  dplyr::filter(observations >= 100 & observations <= 1000) %>% 
  dplyr::arrange(desc(observations)) %>% 
  dplyr::filter(row_number() == 1) %>% 
  dplyr::pull(observations)

segment2_min <- alphaLo_test_nested %>% 
  dplyr::ungroup() %>% 
  dplyr::filter(observations >= 100 & observations <= 1000) %>% 
  dplyr::arrange(desc(observations)) %>% 
  dplyr::filter(row_number() == n()) %>% 
  dplyr::pull(observations)

segment3_minmax <- alphaLo_test_nested %>% 
  dplyr::ungroup() %>% 
  dplyr::filter(observations > 1000) %>% 
  dplyr::arrange(desc(observations)) %>% 
  dplyr::filter(row_number() == n()) %>% 
  dplyr::pull(observations)

alphaLo_segment_proportions <- alphaLo_test_nested_segments_aggregates$aggregated_proportions %>% 
  dplyr::bind_rows() %>% 
  dplyr::mutate(group = c(paste0(segment1_min, "-", segment1_max, " observations (n = ", people_n[1], ")"),
                          paste0(segment2_min, "-", segment2_max, " observations (n = ", people_n[2], ")"),
                          paste0(segment3_minmax, " observations (n = ", people_n[3], ")"))) %>% 
  tidyr::pivot_longer(cols = c(-"people_n", -"group")) %>% 
  dplyr::select(-people_n) %>% 
  tidyr::pivot_wider(names_from = group, values_from = value)

alphaLo_segment_proportions$name <- alphaLo_test_nested$data[[1]]$name

DT::datatable(alphaLo_segment_proportions %>%
                dplyr::mutate_at(vars(-name), funs(scales::percent(., accuracy = 0.1))) %>% 
                dplyr::slice(c(7, 8, 9, 12)),
              options = list(pageLength = 12),
              caption = paste0("Tests for stationarity and non-linearity. Columns indicate 
                               segments in the full sample of n = 20, and rows indicate tests. 
                               Each cell indicates the percentage of time series (out of n 
                               times 9, as each participant collected data on 9 variables), 
                               where H0 is rejected at p<", alphaLo %>% round(., 4),
                               ". AR = autoregressive."))

Full table (alpha = 0.0042)


DT::datatable(alphaLo_segment_proportions %>%
                dplyr::mutate_at(vars(-name), funs(scales::percent(., accuracy = 0.1))),
              options = list(pageLength = 12),
              caption = paste0("Tests for stationarity and non-linearity. Columns indicate 
                               segments in the full sample of n = 20, and rows indicate tests. 
                               Each cell indicates the percentage of time series (out of n 
                               times 9, as each participant collected data on 9 variables), 
                               where H0 is rejected at p<", alphaLo %>% round(., 4), 
                               ". AR = autoregressive."))

Rejections per variable

Interpretation instructions: One time series is one variable in one person’s data. The top-left number indicates the number of rejected time series, using the test indicated by row name, in the variable indicated by column name. The total possible number of tested time series would be the number of collected time series of that variable, that is, the number of individuals in the dataset (20).

Overview table (alpha = 0.0125)

Rejections out of a total of 20 participants. Rejection threshold at p<0.0125.


DT::datatable(tests_number_of_series %>% 
                dplyr::slice(c(7, 8, 9, 12)),
              options = list(pageLength = 12),
              caption = paste0("Number of time series (out of number of participants = 20) 
                               where H0 is rejected at p<", 
                               alphaLevel)) 

Full table (alpha = 0.0125)


DT::datatable(tests_number_of_series,
              options = list(pageLength = 12),
              caption = paste0("Number of time series (out of number of participants = 20) 
                               where H0 is rejected at p<", 
                               alphaLevel)) #%>%

Overview table (alpha = 0.0042)

Rejections out of a total of 20 participants. Rejection threshold at p<0.0042.


DT::datatable(alphaLo_tests_number_of_series %>% 
                dplyr::slice(c(7, 8, 9, 12)),
              options = list(pageLength = 12),
              caption = paste0("Number of time series (out of number of participants = 20) 
                               where H0 is rejected at p<", 
                               alphaLo %>% round(., 4))) #%>%

Full table (alpha = 0.0042)


DT::datatable(alphaLo_tests_number_of_series,
              options = list(pageLength = 12),
              caption = paste0("Number of time series (out of number of participants = 20) 
                               where H0 is rejected at p<", 
                               alphaLo %>% round(., 4))) #%>%

Rejections per person

Interpretation instructions: One time series is one variable in one person’s data. The top left number indicates how many time series—for the person indicated by the column heading—were rejected by the test indicated by the row heading. The maximum possible number of rejections is the number of variables collected by the person, that is, nine.

Overview table (alpha = 0.0125)

DT::datatable(rejected_vars_per_test %>% 
                dplyr::slice(c(7, 8, 9, 12)),
              options = list(pageLength = 12),
              caption = paste0("Number of time series (out of 9, i.e. per person per test), 
                               where H0 is rejected at p<", 
                               alphaLevel))

Full table (alpha = 0.0125)

DT::datatable(rejected_vars_per_test,
              options = list(pageLength = 12),
              caption = paste0("Number of time series (out of 9, i.e. per person per test), 
                               where H0 is rejected at p<", 
                               alphaLevel))

Overview table (alpha = 0.0042)

DT::datatable(alphaLo_rejected_vars_per_test %>% 
                dplyr::slice(c(7, 8, 9, 12)),
              options = list(pageLength = 12),
              caption = paste0("Number of time series (out of 9, i.e. per person per test), 
                               where H0 is rejected at p<", 
                               alphaLo %>% round(., 4)))

Full table (alpha = 0.0042)

DT::datatable(alphaLo_rejected_vars_per_test,
              options = list(pageLength = 12),
              caption = paste0("Number of time series (out of 9, i.e. per person per test), 
                               where H0 is rejected at p<", 
                               alphaLo %>% round(., 4)))

Raw results for individual participants

Interpretation instructions: Each table indicates results for one person. Numbers in cells show the p-values (or maximum p-values in case of McLeod-Li test) for tests of assumptions of data-generating processes.


for(i in test_nested$User) {
test_nested_oneperson <- test_nested %>%
  dplyr::filter(User == i)

test_results <- DT::datatable(test_nested_oneperson$data[[1]] %>% 
                                dplyr::select(-`test_number`) %>% 
                                mutate_if(is.numeric, ~sprintf(., fmt="%#.3f")), # preserve 3 decimals
              options = list(pageLength = 12),
              caption = "P-values (or maximum p-values in case of McLeod-Li test) 
              for tests of assumptions of data-generating processes") %>%
    DT::formatRound(columns = 2:10, 
                    digits=3)

cat('\n\n##', i, '\n\n  ')

cat(knitr::knit_print(test_results))

}

Moti_P01

Moti_P02

Moti_P03

Moti_P04

Moti_P05

Moti_P06

Moti_P07

Moti_P08

Moti_P09

Moti_P10

Moti_P11

Moti_P12

Moti_P13

Moti_P14

Moti_P15

Moti_P16

Moti_P17

Moti_P18

Moti_P19

Moti_P20


\(~\)

Session information

Description of the R environment can be found below.

devtools::session_info()
## - Session info -------------
##  setting 
##  version 
##  os      
##  system  
##  ui      
##  language
##  collate 
##  ctype   
##  tz      
##  date    
##  value                       
##  R version 4.0.5 (2021-03-31)
##  Windows 10 x64              
##  x86_64, mingw32             
##  RStudio                     
##  (EN)                        
##  Finnish_Finland.1252        
##  Finnish_Finland.1252        
##  Europe/Helsinki             
##  2021-05-19                  
## 
## - Packages -----------------
##  package            *
##  abind               
##  assertthat          
##  backports           
##  base64enc           
##  BiocManager         
##  bookdown           *
##  brainGraph          
##  broom               
##  bslib               
##  cachem              
##  callr               
##  casnet              
##  cellranger          
##  checkmate           
##  cli                 
##  cluster             
##  codetools           
##  colorspace          
##  corpcor             
##  cowplot             
##  crayon              
##  crosstalk           
##  curl                
##  data.table          
##  DBI                 
##  dbplyr              
##  desc                
##  devtools            
##  digest              
##  DirectedClustering  
##  doParallel          
##  dplyr              *
##  DT                  
##  ellipsis            
##  evaluate            
##  fansi               
##  farver              
##  fastmap             
##  fdrtool             
##  forcats            *
##  foreach             
##  forecast            
##  foreign             
##  Formula             
##  fracdiff            
##  fs                  
##  generics            
##  ggimage             
##  ggplot2            *
##  ggplotify           
##  glasso              
##  glue                
##  gridExtra           
##  gridGraphics        
##  gtable              
##  gtools              
##  haven               
##  highr               
##  Hmisc               
##  hms                 
##  htmlTable           
##  htmltools           
##  htmlwidgets         
##  httpuv              
##  httr                
##  igraph              
##  invctr              
##  iterators           
##  jpeg                
##  jquerylib           
##  jsonlite            
##  knitr              *
##  labeling            
##  later               
##  lattice             
##  latticeExtra        
##  lavaan              
##  leaps               
##  lifecycle           
##  lmtest              
##  locfit              
##  lubridate           
##  magick              
##  magrittr            
##  MASS                
##  Matrix              
##  memoise             
##  mgcv                
##  mime                
##  mnormt              
##  modelr              
##  munsell             
##  nlme                
##  nnet                
##  pander              
##  patchwork          *
##  pbapply             
##  pbivnorm            
##  permute             
##  pillar              
##  pkgbuild            
##  pkgconfig           
##  pkgload             
##  plyr                
##  png                 
##  prettyunits         
##  processx            
##  promises            
##  proxy               
##  ps                  
##  psych               
##  purrr              *
##  qgraph              
##  quadprog            
##  quantmod            
##  R6                  
##  randtests           
##  RColorBrewer        
##  Rcpp                
##  readr              *
##  readxl              
##  remotes             
##  reprex              
##  reshape2            
##  rlang               
##  rmarkdown           
##  rpart               
##  rprojroot           
##  rstudioapi          
##  rvcheck             
##  rvest               
##  sass                
##  scales              
##  sessioninfo         
##  shiny              *
##  stabledist          
##  stringi             
##  stringr            *
##  survival            
##  testthat            
##  tibble             *
##  tidyr              *
##  tidyselect          
##  tidyverse          *
##  timeDate            
##  tmvnsim             
##  TSA                 
##  tseries             
##  TTR                 
##  urca                
##  usethis             
##  utf8                
##  vctrs               
##  viridisLite         
##  withr               
##  xfun                
##  xml2                
##  xtable              
##  xts                 
##  yaml                
##  zoo                 
##  version    date       lib
##  1.4-5      2016-07-21 [1]
##  0.2.1      2019-03-21 [1]
##  1.2.1      2020-12-09 [1]
##  0.1-3      2015-07-28 [1]
##  1.30.12    2021-03-28 [1]
##  0.21       2020-10-13 [1]
##  3.0.0      2020-09-29 [1]
##  0.7.6.9001 2021-04-19 [1]
##  0.2.4      2021-01-25 [1]
##  1.0.4      2021-02-13 [1]
##  3.6.0      2021-03-28 [1]
##  0.1.6      2021-05-17 [1]
##  1.1.0      2016-07-27 [1]
##  2.0.0      2020-02-06 [1]
##  2.4.0      2021-04-05 [1]
##  2.1.1      2021-02-14 [2]
##  0.2-18     2020-11-04 [2]
##  2.0-0      2020-11-11 [1]
##  1.6.9      2017-04-01 [1]
##  1.1.1      2020-12-30 [1]
##  1.4.1      2021-02-08 [1]
##  1.1.1      2021-01-12 [1]
##  4.3        2019-12-02 [1]
##  1.14.0     2021-02-21 [1]
##  1.1.1      2021-01-15 [1]
##  2.1.1      2021-04-06 [1]
##  1.3.0      2021-03-05 [1]
##  2.4.0      2021-04-07 [1]
##  0.6.27     2020-10-24 [1]
##  0.1.1      2018-01-11 [1]
##  1.0.16     2020-10-16 [1]
##  1.0.5      2021-03-05 [1]
##  0.18       2021-04-14 [1]
##  0.3.1      2020-05-15 [1]
##  0.14       2019-05-28 [1]
##  0.4.2      2021-01-15 [1]
##  2.1.0      2021-02-28 [1]
##  1.1.0      2021-01-25 [1]
##  1.2.16     2021-01-06 [1]
##  0.5.1      2021-01-27 [1]
##  1.5.1      2020-10-15 [1]
##  8.14       2021-03-11 [1]
##  0.8-81     2020-12-22 [2]
##  1.2-4      2020-10-16 [1]
##  1.5-1      2020-01-24 [1]
##  1.5.0      2020-07-31 [1]
##  0.1.0      2020-10-31 [1]
##  0.2.8      2020-04-02 [1]
##  3.3.3      2020-12-30 [1]
##  0.0.5      2020-03-12 [1]
##  1.11       2019-10-01 [1]
##  1.4.2      2020-08-27 [1]
##  2.3        2017-09-09 [1]
##  0.5-1      2020-12-13 [1]
##  0.3.0      2019-03-25 [1]
##  3.8.2      2020-03-31 [1]
##  2.3.1      2020-06-01 [1]
##  0.9        2021-04-16 [1]
##  4.5-0      2021-02-28 [1]
##  1.0.0      2021-01-13 [1]
##  2.1.0      2020-09-16 [1]
##  0.5.1.1    2021-01-22 [1]
##  1.5.3      2020-12-10 [1]
##  1.5.5      2021-01-13 [1]
##  1.4.2      2020-07-20 [1]
##  1.2.6      2020-10-06 [1]
##  0.1.0      2019-03-07 [1]
##  1.0.13     2020-10-15 [1]
##  0.1-8.1    2019-10-24 [1]
##  0.1.3      2020-12-17 [1]
##  1.7.2      2020-12-09 [1]
##  1.32       2021-04-14 [1]
##  0.4.2      2020-10-20 [1]
##  1.1.0.1    2020-06-05 [1]
##  0.20-41    2020-04-02 [2]
##  0.6-29     2019-12-19 [1]
##  0.6-8      2021-03-10 [1]
##  3.1        2020-01-16 [1]
##  1.0.0      2021-02-15 [1]
##  0.9-38     2020-09-09 [1]
##  1.5-9.4    2020-03-25 [1]
##  1.7.10     2021-02-26 [1]
##  2.7.1      2021-03-20 [1]
##  2.0.1      2020-11-17 [1]
##  7.3-53.1   2021-02-12 [2]
##  1.3-2      2021-01-06 [2]
##  2.0.0      2021-01-26 [1]
##  1.8-34     2021-02-16 [2]
##  0.10       2021-02-13 [1]
##  2.0.2      2020-09-01 [1]
##  0.1.8      2020-05-19 [1]
##  0.5.0      2018-06-12 [1]
##  3.1-152    2021-02-04 [2]
##  7.3-15     2021-01-24 [2]
##  0.6.3      2018-11-06 [1]
##  1.1.1      2020-12-17 [1]
##  1.4-3      2020-08-18 [1]
##  0.6.0      2015-01-23 [1]
##  0.9-5      2019-03-12 [1]
##  1.6.0      2021-04-13 [1]
##  1.2.0      2020-12-15 [1]
##  2.0.3      2019-09-22 [1]
##  1.2.1      2021-04-06 [1]
##  1.8.6      2020-03-03 [1]
##  0.1-7      2013-12-03 [1]
##  1.1.1      2020-01-24 [1]
##  3.5.1      2021-04-04 [1]
##  1.2.0.1    2021-02-11 [1]
##  0.4-25     2021-03-05 [1]
##  1.6.0      2021-02-28 [1]
##  2.1.3      2021-03-27 [1]
##  0.3.4      2020-04-17 [1]
##  1.6.9      2021-01-28 [1]
##  1.5-8      2019-11-20 [1]
##  0.4.18     2020-12-09 [1]
##  2.5.0      2020-10-28 [1]
##  1.0        2014-11-17 [1]
##  1.1-2      2014-12-07 [1]
##  1.0.6      2021-01-15 [1]
##  1.4.0      2020-10-05 [1]
##  1.3.1      2019-03-13 [1]
##  2.3.0      2021-04-01 [1]
##  2.0.0      2021-04-02 [1]
##  1.4.4      2020-04-09 [1]
##  0.4.10     2020-12-30 [1]
##  2.7        2021-02-19 [1]
##  4.1-15     2019-04-12 [2]
##  2.0.2      2020-11-15 [1]
##  0.13       2020-11-12 [1]
##  0.1.8      2020-03-01 [1]
##  1.0.0      2021-03-09 [1]
##  0.3.1      2021-01-24 [1]
##  1.1.1      2020-05-11 [1]
##  1.1.1      2018-11-05 [1]
##  1.6.0      2021-01-25 [1]
##  0.7-1      2016-09-12 [1]
##  1.5.3      2020-09-09 [1]
##  1.4.0      2019-02-10 [1]
##  3.2-10     2021-03-16 [2]
##  3.0.2      2021-02-14 [1]
##  3.1.1      2021-04-18 [1]
##  1.1.3      2021-03-03 [1]
##  1.1.0      2020-05-11 [1]
##  1.3.1      2021-04-15 [1]
##  3043.102   2018-02-21 [1]
##  1.0-2      2016-12-15 [1]
##  1.3        2020-09-13 [1]
##  0.10-48    2020-12-04 [1]
##  0.24.2     2020-09-01 [1]
##  1.3-0      2016-09-06 [1]
##  2.0.1      2021-02-10 [1]
##  1.2.1      2021-03-12 [1]
##  0.3.7      2021-03-29 [1]
##  0.3.0      2018-02-01 [1]
##  2.4.2      2021-04-18 [1]
##  0.22       2021-03-11 [1]
##  1.3.2      2020-04-23 [1]
##  1.8-4      2019-04-21 [1]
##  0.12.1     2020-09-09 [1]
##  2.2.1      2020-02-01 [1]
##  1.8-9      2021-03-09 [1]
##  source                               
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  Github (tidymodels/broom@0f4c1ca)    
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.4)                       
##  Github (fredhasselman/casnet@bb112ee)
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.4)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.4)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.4)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.4)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.4)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.4)                       
##  CRAN (R 4.0.3)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.5)                       
##  CRAN (R 4.0.4)                       
##  CRAN (R 4.0.5)                       
## 
## [1] C:/rlibs/4.0.5
## [2] C:/Program Files/R/R-4.0.5/library

pander::pander(sessionInfo())

R version 4.0.5 (2021-03-31)

Platform: x86_64-w64-mingw32/x64 (64-bit)

locale: LC_COLLATE=Finnish_Finland.1252, LC_CTYPE=Finnish_Finland.1252, LC_MONETARY=Finnish_Finland.1252, LC_NUMERIC=C and LC_TIME=Finnish_Finland.1252

attached base packages: stats, graphics, grDevices, utils, datasets, methods and base

other attached packages: patchwork(v.1.1.1), bookdown(v.0.21), knitr(v.1.32), shiny(v.1.6.0), forcats(v.0.5.1), stringr(v.1.4.0), dplyr(v.1.0.5), purrr(v.0.3.4), readr(v.1.4.0), tidyr(v.1.1.3), tibble(v.3.1.1), ggplot2(v.3.3.3) and tidyverse(v.1.3.1)

loaded via a namespace (and not attached): readxl(v.1.3.1), backports(v.1.2.1), Hmisc(v.4.5-0), plyr(v.1.8.6), igraph(v.1.2.6), splines(v.4.0.5), crosstalk(v.1.1.1), usethis(v.2.0.1), digest(v.0.6.27), foreach(v.1.5.1), casnet(v.0.1.6), htmltools(v.0.5.1.1), magick(v.2.7.1), fansi(v.0.4.2), magrittr(v.2.0.1), checkmate(v.2.0.0), memoise(v.2.0.0), cluster(v.2.1.1), doParallel(v.1.0.16), remotes(v.2.3.0), modelr(v.0.1.8), stabledist(v.0.7-1), xts(v.0.12.1), forecast(v.8.14), tseries(v.0.10-48), prettyunits(v.1.1.1), jpeg(v.0.1-8.1), colorspace(v.2.0-0), rvest(v.1.0.0), haven(v.2.3.1), xfun(v.0.22), callr(v.3.6.0), crayon(v.1.4.1), jsonlite(v.1.7.2), survival(v.3.2-10), zoo(v.1.8-9), iterators(v.1.0.13), glue(v.1.4.2), gtable(v.0.3.0), pkgbuild(v.1.2.0), DirectedClustering(v.0.1.1), quantmod(v.0.4.18), abind(v.1.4-5), scales(v.1.1.1), DBI(v.1.1.1), Rcpp(v.1.0.6), xtable(v.1.8-4), viridisLite(v.0.3.0), htmlTable(v.2.1.0), tmvnsim(v.1.0-2), gridGraphics(v.0.5-1), foreign(v.0.8-81), proxy(v.0.4-25), brainGraph(v.3.0.0), Formula(v.1.2-4), randtests(v.1.0), DT(v.0.18), stats4(v.4.0.5), htmlwidgets(v.1.5.3), httr(v.1.4.2), lavaan(v.0.6-8), RColorBrewer(v.1.1-2), ellipsis(v.0.3.1), pkgconfig(v.2.0.3), farver(v.2.1.0), sass(v.0.3.1), nnet(v.7.3-15), invctr(v.0.1.0), dbplyr(v.2.1.1), locfit(v.1.5-9.4), utf8(v.1.2.1), later(v.1.1.0.1), ggplotify(v.0.0.5), tidyselect(v.1.1.0), labeling(v.0.4.2), rlang(v.0.4.10), reshape2(v.1.4.4), munsell(v.0.5.0), cellranger(v.1.1.0), tools(v.4.0.5), cachem(v.1.0.4), cli(v.2.4.0), generics(v.0.1.0), devtools(v.2.4.0), broom(v.0.7.6.9001), fdrtool(v.1.2.16), evaluate(v.0.14), fastmap(v.1.1.0), yaml(v.2.2.1), processx(v.3.5.1), fs(v.1.5.0), pander(v.0.6.3), glasso(v.1.11), pbapply(v.1.4-3), nlme(v.3.1-152), mime(v.0.10), leaps(v.3.1), xml2(v.1.3.2), compiler(v.4.0.5), rstudioapi(v.0.13), curl(v.4.3), png(v.0.1-7), testthat(v.3.0.2), reprex(v.2.0.0), bslib(v.0.2.4), pbivnorm(v.0.6.0), stringi(v.1.5.3), ggimage(v.0.2.8), highr(v.0.9), ps(v.1.6.0), TSA(v.1.3), qgraph(v.1.6.9), desc(v.1.3.0), lattice(v.0.20-41), Matrix(v.1.3-2), psych(v.2.1.3), urca(v.1.3-0), permute(v.0.9-5), vctrs(v.0.3.7), pillar(v.1.6.0), lifecycle(v.1.0.0), BiocManager(v.1.30.12), lmtest(v.0.9-38), jquerylib(v.0.1.3), data.table(v.1.14.0), cowplot(v.1.1.1), corpcor(v.1.6.9), httpuv(v.1.5.5), R6(v.2.5.0), latticeExtra(v.0.6-29), promises(v.1.2.0.1), gridExtra(v.2.3), sessioninfo(v.1.1.1), codetools(v.0.2-18), gtools(v.3.8.2), MASS(v.7.3-53.1), assertthat(v.0.2.1), pkgload(v.1.2.1), rprojroot(v.2.0.2), withr(v.2.4.2), fracdiff(v.1.5-1), mnormt(v.2.0.2), mgcv(v.1.8-34), parallel(v.4.0.5), hms(v.1.0.0), timeDate(v.3043.102), quadprog(v.1.5-8), grid(v.4.0.5), rpart(v.4.1-15), rmarkdown(v.2.7), rvcheck(v.0.1.8), TTR(v.0.24.2), lubridate(v.1.7.10) and base64enc(v.0.1-3)