-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatch_func.R
More file actions
23 lines (17 loc) · 704 Bytes
/
match_func.R
File metadata and controls
23 lines (17 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## Matching function for mapping one distribution into another i.e.,
## distribution matching
##
## Dependency: stats
## Dependency_own: lambda_functions
################################################################################
match_func <- function(knots, vals, new_vals, lims) {
source("lambda_functions.R")
## Limits for function inputs...
if (missing(lims))
lims <- c(min(knots), max(knots))
## Inverse CDF mapping...
map <- stats::approxfun(x = vals, y = knots, yleft = lims[1], yright = lims[2], method = "linear", ties = "ordered", rule = 2)
## Get matched values...
new_knots <- confined(map(new_vals), lims)
new_knots
}