22 #ifndef Rcpp__stats__logis_h
23 #define Rcpp__stats__logis_h
35 e =
::exp(-::fabs(x));
43 if (ISNAN(x) || ISNAN(location))
44 return x + location + 1.0;
47 x = ::fabs((x - location));
55 int lower_tail,
int log_p) {
61 if (ISNAN(x))
return R_NaN;
64 x =
::exp(lower_tail ? -x : x);
65 return (log_p ? -::
log1p(x) : 1 / (1 + x));
69 inline double plogis_1(
double x,
double location ,
70 int lower_tail,
int log_p) {
72 if (ISNAN(x) || ISNAN(location))
73 return x + location + 1.0;
77 if (ISNAN(x))
return R_NaN;
80 x =
::exp(lower_tail ? -x : x);
81 return (log_p ? -::
log1p(x) : 1 / (1 + x));
85 int lower_tail,
int log_p) {
100 p =
::log(lower_tail ? (p / (1. - p)) : ((1. - p) / p));
107 int lower_tail,
int log_p) {
109 if (ISNAN(p) || ISNAN(location))
110 return p + location + 1.0;
122 p =
::log(lower_tail ? (p / (1. - p)) : ((1. - p) / p));
132 RCPP_DPQ_2(logis,::Rf_dlogis,::Rf_plogis,::Rf_qlogis)
#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 plogis_1(double x, double location, int lower_tail, int log_p)
double plogis_0(double x, int lower_tail, int log_p)
double qlogis_1(double p, double location, int lower_tail, int log_p)
double dlogis_1(double x, double location, int give_log)
double dlogis_0(double x, int give_log)
double qlogis_0(double p, int lower_tail, int log_p)
#define R_P_bounds_Inf_01(x)
#define R_Q_P01_boundaries(p, _LEFT_, _RIGHT_)