Skip to content

Commit

Permalink
First argument name of dlogitnorm renamed from q to x
Browse files Browse the repository at this point in the history
  • Loading branch information
bgctw committed Jul 30, 2018
1 parent 5525073 commit 214ec8f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# logitnorm 0.8.37

- Density returns 0 instead of NAN outside (0,1)
- Changed first argument name of dlogitnorm from q to x

# logitnorm 0.8.36
Remove the library call to MASS.
Expand Down
16 changes: 8 additions & 8 deletions R/logitnorm.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ rlogitnorm <- function(

plogitnorm <- function(
### Distribution function for logitnormal distribution
q
q ##<< vector of quantiles
, mu = 0, sigma = 1 ##<< distribution parameters
, ...
){
Expand All @@ -51,7 +51,7 @@ plogitnorm <- function(

dlogitnorm <- function(
### Density function of logitnormal distribution
q ##<< quantiles
x ##<< vector of quantiles
, mu = 0, sigma = 1 ##<< distribution parameters
, log = FALSE ##<< if TRUE, the log-density is returned
, ... ##<< further arguments passed to \code{\link{dnorm}}: \code{mean},
Expand All @@ -68,25 +68,25 @@ dlogitnorm <- function(
##seealso<< \code{\link{logitnorm}}
##details<< The function is only defined in interval (0,1), but the density
## returns 0 outside the support region.
ql <- qlogis(q)
ql <- qlogis(x)
# multiply (or add in the log domain) by the Jacobian (derivative) of the
# back-Transformation (logit)
if (log) {
ifelse(
q <= 0 | q >= 1, 0,
dnorm(ql, mean = mu, sd = sigma, log = TRUE, ...) - log(q) - log1p(-q)
x <= 0 | x >= 1, 0,
dnorm(ql, mean = mu, sd = sigma, log = TRUE, ...) - log(x) - log1p(-x)
)
} else {
ifelse(
q <= 0 | q >= 1, 0,
dnorm(ql,mean = mu,sd = sigma,...)/q/(1 - q)
x <= 0 | x >= 1, 0,
dnorm(ql,mean = mu,sd = sigma,...)/x/(1 - x)
)
}
}

qlogitnorm <- function(
### Quantiles of logitnormal distribution.
p
p ##<< vector of probabilities
, mu = 0, sigma = 1 ##<< distribution parameters
, ...
){
Expand Down
4 changes: 2 additions & 2 deletions man/dlogitnorm.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
\alias{dlogitnorm}
\title{dlogitnorm}
\description{Density function of logitnormal distribution }
\usage{dlogitnorm(q, mu = 0, sigma = 1, log = FALSE,
\usage{dlogitnorm(x, mu = 0, sigma = 1, log = FALSE,
...)}
\arguments{
\item{q}{quantiles}
\item{x}{vector of quantiles}
\item{mu}{distribution parameters}
\item{sigma}{
}
Expand Down
3 changes: 1 addition & 2 deletions man/plogitnorm.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
\description{Distribution function for logitnormal distribution }
\usage{plogitnorm(q, mu = 0, sigma = 1, ...)}
\arguments{
\item{q}{
}
\item{q}{vector of quantiles}
\item{mu}{distribution parameters}
\item{sigma}{
}
Expand Down
3 changes: 1 addition & 2 deletions man/qlogitnorm.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
\description{Quantiles of logitnormal distribution. }
\usage{qlogitnorm(p, mu = 0, sigma = 1, ...)}
\arguments{
\item{p}{
}
\item{p}{vector of probabilities}
\item{mu}{distribution parameters}
\item{sigma}{
}
Expand Down

0 comments on commit 214ec8f

Please sign in to comment.