daily_response: daily_response

Description Usage Arguments Value Examples

View source: R/daily_response.R

Description

Function calculates all possible values of a selected statistical measure between one or more response variables and daily sequences of environmental data. Calculations are based on moving window which is defined with two arguments: window width and a location in a matrix of daily sequences of environmental data. Window width could be fixed (use fixed_width) or variable width (use lower_limit and upper_limit arguments). In this case, all window widths between lower and upper limit will be used. All calculated measures are stored in a matrix. The location of stored calculated measure in the matrix is indicating a window width (row names) and a location in a matrix of daily sequences of environmental data (column names).

Usage

1
2
3
4
daily_response(response, env_data, method = "lm", measure = "r.squared",
  lower_limit = 30, upper_limit = 270, fixed_width = 0,
  previous_year = FALSE, neurons = 2, brnn_smooth = TRUE,
  remove_insignificant = TRUE, alpha = 0.05, row_names_subset = FALSE)

Arguments

response

a data frame with tree-ring proxy variables as columns and (optional) years as row names. Row.names should be matched with those from a env_data data frame. If not, set row_names_subset = TRUE.

env_data

a data frame of daily sequences of environmental data as columns and (optional) years as row names. Each row represents a year and each column represents a day of a year. Row.names should be matched with those from a response data frame. If not, set row_names_subset = TRUE.

method

a string specifying which method to use. Current possibilities are "cor", "lm" and "brnn".

measure

a string specifying which measure to use. Current possibilities are "r.squared" and "adj.r.squared". If method = "cor", measure is not relevant.

lower_limit

lower limit of window width

upper_limit

upper limit of window width

fixed_width

fixed width used for calculation. If fixed_width is assigned a value, upper_limit and lower_limit will be ignored

previous_year

if set to TRUE, env_data and response variables will be rearranged in a way, that also previous year will be used for calculations of selected statistical measure.

neurons

positive integer that indicates the number of neurons used for brnn method

brnn_smooth

if set to TRUE, a smoothing algorithm is applied that removes unrealistic calculations which are a result of neural net failure.

remove_insignificant

if set to TRUE, removes all correlations bellow the significant threshold level, based on a selected alpha. For "lm" and "brnn" method, squared threshold is used, which corresponds to R squared statistics.

alpha

significance level used to remove insignificant calculations.

row_names_subset

if set to TRUE, row.names are used to subset env_data and response data frames. Only years from both data frames are kept.

Value

a list with four elements: @calculations, @method, @measure, @optimized_result

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Not run: 
data(daily_temperatures_example)
data(example_proxies_1)
library(dplyr)
oxygen_isotope <- select(example_proxies_1, O)
carbon_isotope <- select(example_proxies_1, C)

Example1 <- daily_response(response = carbon_isotope,
env_data = daily_temperatures_example, method = "lm", measure = "r.squared",
lower_limit = 100, upper_limit = 104)

Example2 <- daily_response(response = example_proxies_1,
env_data = daily_temperatures_example, method = "brnn",
measure = "adj.r.squared", fixed_width = 90)

Example3 <- daily_response(response = oxygen_isotope,
env_data = daily_temperatures_example, method = "cor", lower_limit = 60,
upper_limit = 70, remove_insignificant = TRUE)

# Example with negative correlations. Data frames are automatically subset.
data(example_proxies_2)
Example4 <- daily_response(response = example_proxies_2,
env_data = daily_temperatures_example, method = "cor",
lower_limit = 30, upper_limit = 40, row_names_subset = TRUE)

## End(Not run)

jernejjevsenak/dendroExtra documentation built on Aug. 5, 2017, 7:53 p.m.