24 #ifndef Rcpp__stats__lnorm_h
25 #define Rcpp__stats__lnorm_h
42 -(M_LN_SQRT_2PI + 0.5 * y * y + ::
log(x)) :
43 M_1_SQRT_2PI * ::
exp(-0.5 * y * y) / x);
47 inline double dlnorm_1(
double x,
double meanlog,
int log_p){
51 if (ISNAN(x) || ISNAN(meanlog))
52 return x + meanlog + 1.0;
57 y = (
::log(x) - meanlog);
59 -(M_LN_SQRT_2PI + 0.5 * y * y + ::
log(x)) :
60 M_1_SQRT_2PI *
::exp(-0.5 * y * y) / x);
65 inline double plnorm_0(
double x,
int lower_tail,
int log_p){
76 inline double plnorm_1(
double x,
double meanlog,
int lower_tail,
int log_p) {
78 if (ISNAN(x) || ISNAN(meanlog))
79 return x + meanlog + 1.0;
87 inline double qlnorm_0(
double p,
int lower_tail,
int log_p){
94 return ::exp(::Rf_qnorm5(p, 0.0, 1.0, lower_tail, log_p));
97 inline double qlnorm_1(
double p,
double meanlog,
int lower_tail,
int log_p){
99 if (ISNAN(p) || ISNAN(meanlog))
100 return p + meanlog + 1.0;
104 return ::exp(::Rf_qnorm5(p, meanlog, 1.0, lower_tail, log_p));
112 RCPP_DPQ_2(lnorm,::Rf_dlnorm,::Rf_plnorm,::Rf_qlnorm)
#define RCPP_DPQ_2(__NAME__, __D__, __P__, __Q__)
#define RCPP_DPQ_1(__NAME__, __D__, __P__, __Q__)
#define RCPP_DPQ_0(__NAME__, __D__, __P__, __Q__)
void exp(InputIterator begin, InputIterator end, OutputIterator out)
void log(InputIterator begin, InputIterator end, OutputIterator out)
double qlnorm_0(double p, int lower_tail, int log_p)
double pnorm_0(double x, int lower_tail, int log_p)
double pnorm_1(double x, double mu, int lower_tail, int log_p)
double dlnorm_0(double x, int log_p)
double qlnorm_1(double p, double meanlog, int lower_tail, int log_p)
double plnorm_0(double x, int lower_tail, int log_p)
double plnorm_1(double x, double meanlog, int lower_tail, int log_p)
double dlnorm_1(double x, double meanlog, int log_p)
#define R_Q_P01_boundaries(p, _LEFT_, _RIGHT_)