varkernel | R Documentation |
Perform a two-dimensional kernel density estimation for an outcome variable and a given influencing variable.
The function produces a matrix of the estimated density (z) of an outcome variable (y) and an observed variable expected to influence the outcome variable (x). As the density function restricts the shape of the kernel to a bivariate normal kernel, it looks slightly different compared to the scatter plot estimates in the uncertainty::varscatter() function. Density surface plot of an influencing variable (x) and an outcome variable (y). The legend shows the value for the estimated density (z).
varkernel( in_var, out_var, xlab = "Influencing variable", ylab = "Outcome variable" )
in_var |
is a vector of observations of a given influencing variable corresponding to another list with observed values of an outcome variable out_var. |
out_var |
is a vector of observed values of an outcome variable corresponding to another list with observations of a given influencing variable in_var. |
xlab |
is a label for the influencing variable in_var on the x axis, the default label is "Influencing variable". |
ylab |
is a label for the outcome variable out_var on the y axis, the default label is "Outcome variable". |
in_var <- sample(x = 1:50, size = 20, replace = TRUE) out_var <- sample(x = 1000:5000, size = 20, replace = TRUE) varkernel(in_var, out_var)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.