-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reworke twCoefLogitnormMLEFlat, mirgrate to testthat
- Loading branch information
Showing
13 changed files
with
229 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,13 @@ Version: 0.8.38 | |
Author: Thomas Wutzler | ||
Maintainer: Thomas Wutzler <[email protected]> | ||
Description: Density, distribution, quantile and random generation function for the logitnormal distribution. Estimation of the mode and the first two moments. Estimation of distribution parameters. | ||
Depends: | ||
Suggests: RUnit, knitr, markdown, ggplot2, reshape2 | ||
Suggests: | ||
knitr, | ||
markdown, | ||
ggplot2, | ||
testthat (>= 3.0.0) | ||
VignetteBuilder: knitr | ||
License: GPL-2 | ||
LazyData: true | ||
RoxygenNote: 7.1.1 | ||
Config/testthat/edition: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
library(testthat) | ||
library(logitnorm) | ||
|
||
test_check("logitnorm") |
44 changes: 22 additions & 22 deletions
44
inst/unitTests/runitdlogitnormLog.R → tests/testthat/test_dlogitnormLog.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
#require(logitnorm) | ||
|
||
test.dlogitnorm <- function() { | ||
# Check dlogitnorm with arbitrary parameters at arbitrary points. | ||
m <- 1.4 | ||
s <- 0.8 | ||
x <- c(0.1, 0.8); | ||
# taken from https://en.wikipedia.org/w/index.php?title=Logit-normal_distribution&oldid=708557844 | ||
x.density <- 1/s/sqrt(2*pi) * exp(-(log(x/(1-x)) - m)^2/2/s^2) / x / (1-x) | ||
stopifnot(all.equal(x.density, dlogitnorm(x, m, s))) | ||
stopifnot(all.equal(log(x.density), dlogitnorm(x, m, s, log=TRUE))) | ||
} | ||
|
||
test.plogitnorm <- function() { | ||
# Check plogitnorm with arbitrary parameters at arbitrary points. | ||
m <- 1.4 | ||
s <- 0.8 | ||
x <- c(0.1, 0.8); | ||
stopifnot(all.equal(pnorm(log(x/(1-x)), m, s), plogitnorm(x, m, s))) | ||
stopifnot(all.equal(pnorm(log(x/(1-x)), m, s, log=TRUE), log(plogitnorm(x, m, s)))) | ||
} | ||
|
||
#require(logitnorm) | ||
|
||
test_that("dlogitnorm", { | ||
# Check dlogitnorm with arbitrary parameters at arbitrary points. | ||
m <- 1.4 | ||
s <- 0.8 | ||
x <- c(0.1, 0.8); | ||
# taken from https://en.wikipedia.org/w/index.php?title=Logit-normal_distribution&oldid=708557844 | ||
x.density <- 1/s/sqrt(2*pi) * exp(-(log(x/(1-x)) - m)^2/2/s^2) / x / (1-x) | ||
expect_equal(x.density, dlogitnorm(x, m, s)) | ||
expect_equal(log(x.density), dlogitnorm(x, m, s, log=TRUE)) | ||
}) | ||
|
||
test_that("plogitnorm", { | ||
# Check plogitnorm with arbitrary parameters at arbitrary points. | ||
m <- 1.4 | ||
s <- 0.8 | ||
x <- c(0.1, 0.8); | ||
expect_equal(pnorm(log(x/(1-x)), m, s), plogitnorm(x, m, s)) | ||
expect_equal(pnorm(log(x/(1-x)), m, s, log=TRUE), log(plogitnorm(x, m, s))) | ||
}) | ||
|
Oops, something went wrong.