Learn R Programming

games (version 1.1.2)

LW: Lambert's W

Description

Solves for W in the equation $W * exp(W) = x$.

Usage

LW(x)

Arguments

x
vector of values to solve for.

Value

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

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.

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

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

Run the code above in your browser using DataLab