Coding assignment: Bradlow et al (2008).

advertisement
Assignment 5-Count Models Based on Weibull Interarrival Times (Bradlow, et al. 2008)
Linli
1. Model Summary (Weibull with covariates)
Suppose there is a total number of I products (i=1,…,I) in the market. Let Yin be the time from the
measurement origin at which the n-th event (sales) occurs for product i. We assume that this arrival time
is independently and identically distributed as a Weibull with density given by:


f Yin  y | i ,c   i cy c 1 exp  i y c ,
(1)
where i is the baseline hazard rate for product i and c is the shape parameter of the Weibull distribution.
Before introducing the Weibull count model, we’ll discuss the relationship between the interarrival times
and their count equivalent first. Let N ( t ) be the number of units that has been sold up until time t. The
amount of time at which the n-th event occurred from the time origin is less than or equal to t if and only
if the number of events that have occurred by time t is greater than or equal to n, i.e.
Yn  t  N t   n ,
(2)
We therefore have the following relationships that allow us to derive the Weibull count model:
Pr N t   n   Pr N t   n   Pr N t   n  1
 Pr Yn  t   Pr Yn1  t 
,
 Fn t   Fn1 t 
(3)
where Fn t  is the cumulative density function (cdf) of Yn .
The Taylor series expansion for both the cdf and pdf of the Weibull distribution are:
j
j 1

 1 t c 
F t   
 j  1
j 1

,
(4)
and
j 1

 1 cj j t cj 1
f t   
.
 j  1
j 1

(5)
1
Based on equation (3)-(5), we have the Weibull count model (we assume t=1 in our estimation exercise):
 1 j n   j  nj
, n  0,1, 2, ...
cj  1
j n

Pr( N  n )  
where  0j 
(6)
j 1
( cj  1 )
( cj  cm  1 )
, j=0, 1, 2,… and  nj 1    mn
for n=0, 1, 2,… and j=n+1, n+2,
( j  1 )
( j  m  1 )
mn
n+3,….
We can see the standard Poisson count model is one special case of the Weibull count model, when c  1
in equation (6):
Model (1) Pr( N  n ) 
 1 j n   j , n  0,1, 2, ...

 j  1
j n

(7)
The parameters to be estimated is  .
When c  1 , the Weibull count model is given by equation (6):
 1 j n   j  nj
Pr( N  n )  
, n  0,1, 2, ...
cj  1
j n

Model(2)
(8)
The parameters to be estimated are c and  ;
If we assume the heterogeneous individual hazard rates are drawn from a gamma distribution
i ~ gammar ,1 /  , it gives us the Weibull count model with heterogeneity:
 1 j n  nj r  j 
Pr( N  n )  
, n  0,1, 2, ...
j
j  n cj  1 r 

Model (3)
(9)
The parameters to be estimated are c , r , and  .
We can use maximum likelihood to estimate the parameters. Let n  (n1 ,..., n I ) be a vector of observed
sales across I products. The log likelihood function is given as:
2
I
l( n; Z , ,c ,  )   log Pr  N  ni  ,
(10)
i 1
where n  n1 , n2 ,..., nI  is the vector of observed number of sales. To estimate the parameters in each
case (Model (1)-Model (3)), you can plug in Pr N  ni  term described above in equation (7)-(9).
2. Estimation Exercise
The estimation exercise has two parts:
1) Estimate the standard Poisson count model and the Weibull count model without heterogeneity
(Model(1)-Model(2)).
2) Estimate Model (3)- the Weibull count model with heterogeneity and compare the results from 1).
2.1 Data Description
 The data has the number of sales for each product and there are totally 1000 (I=1000) products.
2.2 Estimation Tips
 To calculate the sum of infinite terms in equation (7)-(9), you can sum over finite number of R
terms, where R=50 or 100.
 When estimating Model (3), set the starting value of c as a positive integer
 Parameters r and  might be different based on different starting values for Model (3) , so try a
couple of different sets of starting values and compare log likelihood function values.
 Report your parameter estimates, not the integers that you round up/down from your estimates!
3
Download