Learn R Programming

pim (version 2.0.2)

P: Probability function

Description

This functions transform a comparison or otherwise logical value to a numeric value for use in a pim.

Usage

P(x)

PO(x, y = NULL)

Arguments

x

for P, a logical value. For PO a numeric value.

y

a numeric value or NULL. If NULL, the function will try to calculate PO(L(x),R(x)), provided the functions L and R are defined correctly. This is the case when PO is used in the context of a probabilistic index model fitted with pim.

Value

A numeric value of 0, 0.5 or 1. 1 if x < y, 0.5 if x == y and 0 if x > y

Details

These functions are constructed purely for notation. P is completely equivalent to as.numeric, apart from an extra control to check whether it actually makes sense to do so. The function PO is just short for P(x < y) + 0.5*P(x == y)

See Also

pim and pim.formula for more information on how this is used inside a pim context.

Examples

Run this code
# NOT RUN {
# Check in pim

# }

Run the code above in your browser using DataLab