[Rd] plogis (and other p* functions), vectorized lower.tail

Matthias Gondan m@tth|@@-gond@n @end|ng |rom gmx@de
Wed Dec 8 19:37:09 CET 2021

Dear R developers,

I have seen that plogis silently ignores vector elements of lower.tail,

> plogis(q=0.5, location=1, lower.tail=TRUE) 
[1] 0.3775407
> plogis(q=0.5, location=1, lower.tail=FALSE) 
[1] 0.6224593
> plogis(q=c(0.5, 0.5), location=1, lower.tail=c(TRUE, FALSE)) 
[1] 0.3775407 0.3775407

For those familiar with psychological measurement: A use case of the above function is the so-called Rasch model, where the probability that a person with some specific ability (q) makes a correct (lower.tail=TRUE) or wrong response (lower.tail=FALSE) to an item with a specific difficulty (location). A vectorized version of plogis would enable to determine the likelihood of an entire response vector in a single call. My current workaround is an intermediate call to „Vectorize“.

I am wondering if the logical argument of lower.tail can be vectorized (?). I see that this may be a substantial change in many places (basically, all p and q functions of probability distributions), but in my understanding, it would not break existing code which assumes lower.tail to be a single element. If that’s not
possible/feasible, I suggest to issue a warning if a vector of length > 1 is given in lower.tail. I am aware that the documentation clearly states that lower.tail is a single boolean.

Thank you for your consideration.

With best wishes,


	[[alternative HTML version deleted]]

More information about the R-devel mailing list