ind_init combines the time vector and the indicator (IND) and pressure data into
one tibble with defined training and test observations. All INDs are combined
with all pressures provided as input.
A data frame, matrix or tibble containing only the (numeric) IND variables. Single indicators should be coerced into a data frame to keep the indicator name. If kept as vector, default name will be 'ind'.
A data frame, matrix or tibble containing only the (numeric) pressure variables. Single pressures should be coerced into a data frame to keep the pressure name. If kept as vector, default name will be 'press'.
A vector containing the actual time steps (e.g. years; should be the same as in the IND and pressure data).
The proportion of observations that should go into the training data on which the GAMs are later fitted. Has to be a numeric value between 0 and 1; the default is 0.9.
logical; should the observations for the training data be randomly chosen? Default is FALSE, so that the last time units (years) are chosen as test data.
ind_init will combine every column in ind_tbl with every column in press_tbl
so that each row will represent one IND~press combination. The input data will be
split into a training and a test data set. The returned tibble is the basis for all
IND~pressure modeling functions.
If not all IND~pressure combinations should be modeled,
the respective rows can simply be removed from the output tibble or
applied multiple times on data subsets and their output tibbles merged later using
The function returns a
tibble, which is a trimmed down version of
the data.frame(), including the following elements:
Numerical IDs for the IND~press combinations.
Indicator names.These might be modified to exclude any character, which is not in the model formula (e.g. hyphens, brackets, etc. are replaced by an underscore, variables starting with a number will get an x before the number.
Pressure names.These might be modified to exclude any character, which is not in the model formula (e.g. hyphens, brackets, etc. are replaced by an underscore, variables starting with a number will get an x before the number.
A list-column with indicator values of the training data.
A list-column with pressure values of the training data.
A list-column with the time steps of the training data.
A list-column with indicator values of the test data.
A list-column with pressure values of the test data.
A list-column with the time steps of the test data.
logical; indicates the joint missing values in the training IND and pressure data. That includes the original NAs as well as randomly selected test observations that are within the training period. This vector is needed later for the determination of temporal autocorrelation.
1 2 3 4 5 6 7 8 9 10 11
# Using the Baltic Sea demo data in this package press_tbl <- press_ex[ ,-1] # excl. Year ind_tbl <- ind_ex[ ,-1] # excl. Year time <- ind_ex[ ,1] # Assign randomly 50% of the observations as training data and # the other 50% as test data ind_init(ind_tbl, press_tbl, time, train = 0.5, random = TRUE) # To keep the name when testing only one indicator and pressure, coerce both vectors # data frames ind_init(ind_tbl = data.frame(MS = ind_tbl$MS), press_tbl = data.frame(Tsum = press_tbl$Tsum), time, train = .5, random = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.