You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two things we need to test for our parametric distributions (taken from #9)
Testing quantities
We will next need to check that the formulas were inputted correctly. We can automate this. If you have time and are up for a challenge, give this a try.
The idea is to check each quantity against its manual calculation using the distributional representations (like quantile function, cdf, etc.).
I'm thinking something like this:
Loop along each distribution in .quantities.
Get the "formula version" of the quantity, by executing the function directly on an example distribution (such as mu1 <- mean(distribution))
Calculate each quantity present for that distribution using the distributional representations, by accessing the .dst method. So, mu2 <- mean.dst(distribution).
Compare the two: expect_equal(mu1, mu2). Hopefully numerical precision isn't a problem here.
Testing manually coded distributions, like GPD and GEV
For distributions that we had to code manually, like the GPD and GEV, we should also check that the representations are coded correctly. So, if we coded the cdf, density, and quantile function, we could do this by:
calculate numerical derivative of the cdf at a bunch of points, and compare against the density (shows that cdf and density align);
check that eval_cdf(distribution, eval_quantile(distribution, 1:9/10)) returns 1:9/10 (shows that cdf and quantile function align); and
check that the density integrates to 1 (shows that the distribution itself is valid).
The text was updated successfully, but these errors were encountered:
Update: looped the distributions in test-quantile and marked the descriptions for test results.
For some distributions, even though the test results have some warnings or failures, the primary functions (such as mean, variance, skewness instead of .dst) are correct due to the properties of the distributions themselves.
For example, the Cauchy distribution, whose mean/var/skewness/kurtosis does not exist, the test gives a failure result due to the integral issues from .dst functions. As we are sure that the primary mean, var, skewness, and kurtosis functions are correct, it is unnecessary to care about the test failures of such distributions.
Hence, now we may be able to narrow down the range of distributions and their corresponding functions that need fixing.
Update 2: Most of the errors or failures reported in test-quantiles are issues of .dst functions. We may need to pay attention to the kurtosis of weibull. Otherwise should be fine right now.
There are two things we need to test for our parametric distributions (taken from #9)
Testing quantities
We will next need to check that the formulas were inputted correctly. We can automate this. If you have time and are up for a challenge, give this a try.
The idea is to check each quantity against its manual calculation using the distributional representations (like quantile function, cdf, etc.).
I'm thinking something like this:
Loop along each distribution in
.quantities
.Get the "formula version" of the quantity, by executing the function directly on an example distribution (such as
mu1 <- mean(distribution)
)Calculate each quantity present for that distribution using the distributional representations, by accessing the
.dst
method. So,mu2 <- mean.dst(distribution)
.Compare the two:
expect_equal(mu1, mu2)
. Hopefully numerical precision isn't a problem here.Testing manually coded distributions, like GPD and GEV
For distributions that we had to code manually, like the GPD and GEV, we should also check that the representations are coded correctly. So, if we coded the cdf, density, and quantile function, we could do this by:
eval_cdf(distribution, eval_quantile(distribution, 1:9/10))
returns1:9/10
(shows that cdf and quantile function align); andThe text was updated successfully, but these errors were encountered: