LW: Lambert's W

View source: R/ultimatum.r

LWR Documentation

Lambert's W

Description

Solves for W in the equation W e^W = x.

Usage

LW(x)

Arguments

x

vector of values to solve for.

Details

The function is based on the code given in Barry et al. (1995). It is used to calculate fitted values for the ultimatum model.

If negative values of x are supplied, NaNs will likely be returned.

Value

Solutions to Lambert's W for each value in x.

Author(s)

Curt Signorino (curt.signorino@rochester.edu)

References

D.A. Barry, P.J. Culligan-Hensley, and S.J. Barry. 1995. "Real Values of the W-Function." ACM Transactions on Mathematical Software 21(2):161–171.

Examples

x <- rexp(10)
w <- LW(x)
all.equal(x, w * exp(w))

ccrismancox/games2 documentation built on April 17, 2025, 3:21 a.m.