This function estimates variables observed at a "source" region into a "target" region. "Source" and "target" regions represent two different ways to divide a city, for example. For more details, see https://lcgodoy.me/smile/articles/sai.html.
Usage
ai(source, target, vars)
ai_var(source, target, vars, vars_var, sc_vars = FALSE, var_method = "CS")
Arguments
- source
a
sf
object - source spatial data.- target
a
sf
object - target spatial data.- vars
a
character
representing the variables (observed at the source) to be estimated at the target data.- vars_var
a scalar of type
character
representing the name of the variable in the source dataset that stores the variances of the variable to be estimated at the target data.- sc_vars
boolean indicating whether
vars
should be scaled by its observed variance (if available).- var_method
a
character
representing the method to approximate the variance of the AI estimates. Possible values are "CS" (Cauchy-Schwartz) or "MI" (Moran's I).
Examples
data(nyc_surv)
data(nyc_comd)
## creating variables that store the variance for each area
## this is done to exemplify the functionality of the package
nyc_surv <- transform(nyc_surv,
my_var = moe / qnorm(p = .975))
nyc_surv <- transform(nyc_surv, my_var = my_var * my_var)
if (FALSE) {
## areal interpolation
estimate_comd <-
ai(source = nyc_surv, target = nyc_comd,
vars = "estimate")
## areal interpolation with uncertainty estimation
estimate_comd <-
ai_var(source = nyc_surv, target = nyc_comd,
vars = "estimate", vars_var = "my_var",
var_method = "MI")
}