Description Usage Arguments Value Examples
Performs a hypothesis test for goodness-of-fit based on the estimated kernel densities.
1 2 3 |
data |
A numeric vector of data. |
rfunc |
A function to generate data from the real density (see examples). |
dfunc |
A function to evaluate real density values (see examples). |
perm |
Boolean indicating weather to obtain the p-value trough the permutation test or just return return the common area between densities. |
B |
Number of permutations. |
bw |
The bandwidth used to estimate the kernel densities. |
npoints |
The number of points used to estimate the kernel densities. |
threads |
Number of cores to be used for parallel computing. |
param_names |
A vector of variable names (as character). This parameter can be ignored when threads = 1. When using more then 1 threads, it is needed to export the global parameters name on the rfunc and dfunc functions (see examples). |
A list containing:
- density: The estimated density for the data.
- dfunc: The theoric density function.
- ca: Common area between the kernel and the theoric density.
- pvalue: The p-value generated by the permutation test (if perm = TRUE).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #When using no extra parameters on rfunc and dfunc:
data = rnorm(100)
rfunc = function(n) {
return(rnorm(n, 0, 1))
}
dfunc = function(x) {
return(dnorm(x, 0, 1))
}
kGOFTest(data, rfunc, dfunc)
#When using parameters on rfunc and dfunc:
data = rnorm(100)
param1 = 0
param2 = 1
var_names = c(param1, param2)
rfunc = function(n) {
return(rnorm(n, param1, param2))
}
dfunc = function(x) {
return(dnorm(x, param1, param2))
}
kGOFTest(data, rfunc, dfunc, param_names = c('param1', 'param2'))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.