mnpProb: Compute MNP Probabilities

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/mnpProb.R

Description

mnpProb computes MNP probabilities for a given X matrix corresponding to one observation. This function can be used with output from rmnpGibbs to simulate the posterior distribution of market shares or fitted probabilties.

Usage

1
mnpProb(beta, Sigma, X, r)

Arguments

beta

MNP coefficients

Sigma

Covariance matrix of latents

X

X array for one observation – use createX to make

r

number of draws used in GHK (def: 100)

Details

See rmnpGibbs for definition of the model and the interpretation of the beta and Sigma parameters. Uses the GHK method to compute choice probabilities. To simulate a distribution of probabilities, loop over the beta and Sigma draws from rmnpGibbs output.

Value

p x 1 vector of choice probabilites

Author(s)

Peter Rossi, Anderson School, UCLA, [email protected].

References

For further discussion, see Chapters 2 and 4, Bayesian Statistics and Marketing by Rossi, Allenby, and McCulloch.
http://www.perossi.org/home/bsm-1

See Also

rmnpGibbs, createX

Examples

1
2
3
4
5
6
7
8
9
## example of computing MNP probabilites
## here Xa has the prices of each of the 3 alternatives

Xa    = matrix(c(1,.5,1.5), nrow=1)
X     = createX(p=3, na=1, nd=NULL, Xa=Xa, Xd=NULL, DIFF=TRUE)
beta  = c(1,-1,-2)  ## beta contains two intercepts and the price coefficient
Sigma = matrix(c(1, 0.5, 0.5, 1), ncol=2)

mnpProb(beta, Sigma, X)

Example output

Halton sequence is generated by the smallest prime numbers: 
   2 3 
Halton sequence is generated by the smallest prime numbers: 
   2 3 
[1] 0.83154553 0.15485219 0.01360228

bayesm documentation built on July 21, 2017, 7:18 p.m.