WordPress.com



############################################################################################## Supplement to the Introduction video about the dendroTools R package for ############################################################################################### 1) dendroTools installation# install.packages("dendroTools")# 2) load dendroTools R packagelibrary("dendroTools")# 3) load data needed for examples# (swit272)data(swit272_daily_temperatures) # E-OBS daily temperaturesdata(swit272_daily_precipitation) # E-OBS daily precipitation# 4) transform data into matrices of 366 columns and n number of rowsswit272_dt <- data_transform(swit272_daily_temperatures, date_format = "ymd")swit272_dp <- data_transform(swit272_daily_precipitation, date_format = "ymd")# 5) glimpse daily data# install.packages("ggplot2") # install ggplot2 packagelibrary("ggplot2") # needed to add labels and to modify themeglimpse_daily_data(swit272_dp) + theme(legend.position = "bottom", legend.direction = "horizontal") + labs(fill = "Precipitation [mm]")glimpse_daily_data(swit272_dt) + theme(legend.position = "bottom", legend.direction = "horizontal") + labs(fill = "Temperatures [°C]")# 6 daily_response()ds_results <- daily_response(response = swit272, env_data = swit272_dt, row_names_subset = TRUE, lower_limit = 21, upper_limit = 270, remove_insignificant = TRUE, method = "cor", alpha = 0.05)plot(ds_results, type = 1)plot(ds_results, type = 2)summary(ds_results)# additional outputsds_results$transfer_functionds_results$temporal_stability # 7 daily_response() with bootstrappds_results_boot <- daily_response(response = swit272, env_data = swit272_dt, row_names_subset = TRUE, lower_limit = 21, upper_limit = 270, remove_insignificant = TRUE, aggregate_function = 'mean', method = "cor", alpha = 0.05, cor_method = "pearson", boot = TRUE, boot_n = 1000)plot(ds_results_boot, type = 1)plot(ds_results_boot, type = 2)summary(ds_results_boot)# 8) partial correlation coefficent analysispcor_results <- daily_response_seascorr(response = swit272, env_data_primary = swit272_dt, env_data_control = swit272_dp, row_names_subset = TRUE, lower_limit = 21, upper_limit = 270, remove_insignificant = TRUE, aggregate_function_env_data_primary = 'mean', aggregate_function_env_data_control = 'sum', alpha = 0.05, pcor_method = "spearman")plot(pcor_results, type = 1)plot(pcor_results, type = 2)summary(pcor_results)# 9) example for analysis based on monthly data# 9.1) transform daily data into monthlyswit272_mt <- data_transform(swit272_daily_temperatures, format = "monthly", monthly_aggregate_function = "auto")swit272_mp <- data_transform(swit272_daily_precipitation, format = "monthly", monthly_aggregate_function = "auto")# 8.2) monthly_response()ms_results <- monthly_response(response = swit272, env_data = swit272_mt, row_names_subset = TRUE, lower_limit = 1, upper_limit = 12, remove_insignificant = FALSE, alpha = 0.05, method = "cor", aggregate_function = 'mean', cor_method = "pearson", boot = TRUE)plot(ms_results, type = 1)plot(ms_results, type = 2)summary(ms_results)# 9) example for monthly response seascorrms_results_seascorr <- monthly_response_seascorr(response = swit272, env_data_primary = swit272_mt, env_data_control = swit272_mp, row_names_subset = TRUE, remove_insignificant = FALSE, aggregate_function_env_data_primary ='mean', aggregate_function_env_data_control ='sum', alpha = 0.05, pcor_method = "spearman", boot = TRUE)plot(ms_results_seascorr, type = 1)plot(ms_results_seascorr, type = 2)summary(ms_results_seascorr) ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download