View source: R/rsimilarity_model.R
| rsimilarity_model | R Documentation |
Quantify the similarity of net rainfall and model this hydrological similarity from catchment similarity predictors
rsimilarity_model(
Rn,
msim = NULL,
predictors,
newpredictors,
FUN = "invKGE",
power = 0.5,
symmetrize = mean,
model = "glmnet",
args_glmnet = list(s = "lambda.min", lower.limits = 0),
standardisation = FALSE,
linearisation = FALSE,
first_model = NULL,
parallel = FALSE,
cores = NULL,
verbose = TRUE,
seed = NULL
)
Rn |
net rainfall matrix of gauged catchments (rows for time index, and columns for catchment index) |
msim |
similarity matrix of net rainfall time series (as produced by rsimilarity) |
predictors |
a list of at least two square matrices that could be used to predict similarity of net rainfall. The matrices should be square to describe the similarity of each pair of gauged catchments. High values should indicate a high probability of similarity in net rainfall |
newpredictors |
a matrix or data frame of predictors to be used as new input to the model being built
and from which net rainfall similarity will be predicted. Typically, its rows describe the similarities between
an ungauged catchment and several gauged catchments that may be weighted as donors. Each column should correspond
to one element of |
FUN |
either a function or a character string specifying the name of a predefined function to quantify the similarity of two net rainfall time series. See rsimilarity for more details |
power |
exponent applied on |
symmetrize |
a function to combine |
model |
the method to estimate similarity of |
args_glmnet |
list of arguments to be passed to |
standardisation |
logical indicating whether the predictors should be standardised (in particular to make their coefficient comparable) |
linearisation |
logical indicating whether a power transformation should be applied to the predictors in order to maximise linearity with the target variable, based on the Pearson correlation coefficient |
first_model |
a first model to use for predicting similarity (generally based on distance, see |
parallel |
logical indicating whether the computation of Rn similarities should be parallelised |
cores |
the number of cores to use for parallel execution if |
verbose |
logical indicating if warning messages should be written to the console |
seed |
integer value to be used by |
rsimilarity, mixr
data(Oudon)
obs <- as_transfr(st = Oudon$obs, hl = Oudon$hl)
obs <- velocity(obs, method = "loire2016")
obs <- uh(obs)
obs <- lagtime(obs)
obs <- rapriori(obs)
obs <- inversion(obs)
mdist1 <- hdist(x = obs, y = obs, method = "rghosh", parallel = TRUE, cores=2)
mdist2 <- mdist1^2
rghosh1 <- seq(1000, 5000, by=100)
rghosh2 <- rghosh1^2
res <- rsimilarity_model(Rn = obs$st$RnInv,
predictors = list(rghosh1=1/mdist1, rghosh2=1/mdist2),
newpredictors = data.frame(rghosh1=1/rghosh1, rghosh2=1/rghosh2),
seed=1234)
plot(rghosh1, res$similarity, ylab = "Predicted Rn similarity")
plot(rghosh2, res$similarity, ylab = "Predicted Rn similarity")
# rsimilarity_model() is automatically called by mixr() if mdist is a list
obs <- mixr(obs = obs, mdist = mdist1,
similarity = list(rghosh1=1/mdist1, rghosh2=1/mdist2),
parallel = TRUE, cores=2, cv = TRUE, save_donor = TRUE)
obs$similarity_models
obs <- convolution(obs)
plot(obs, i = 1, attribute = c("Qobs", "Qsim"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.