+ Reply to Thread
Results 1 to 6 of 6

Thread: Why are the parameters of weibull not unique for a given data ?

  1. #1
    Points: 30, Level: 1
    Level completed: 60%, Points required for next Level: 20

    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Why are the parameters of weibull not unique for a given data ?




    I have a data which is the interval days of customers purchasing products.
    I try to estimate the shape and scale params by scipy.stat.weibull_min

    But, the parameters returned from the fit function is not unique and when I try to constrain the scale param to be 1, it does not work.

    Here is the three results with different ways for input:
    shape, loc, scale = scipy.stats.weibull_min.fit(data,floc=1,scale=1)
    #constrain scale to be 1 yellow curve
    loc:1 shape:0.7318249351 scale:75.22852953

    shape, loc, scale = scipy.stats.weibull_min.fit(data,floc=1, f0=1)
    #constrain shape to be 1 blue curve
    loc:1 shape:1 scale:90.85

    shape, loc, scale = scipy.stats.weibull_min.fit(data,floc=1)
    #no constrain green curve
    loc:1 shape:0.7 scale:127.26

    Besides, which curve best fit the original distribution?
    Attached Images  

  2. #2
    TS Contributor
    Points: 14,811, Level: 78
    Level completed: 91%, Points required for next Level: 39
    Miner's Avatar
    Location
    Greater Milwaukee area
    Posts
    1,171
    Thanks
    34
    Thanked 405 Times in 363 Posts

    Re: Why are the parameters of weibull not unique for a given data ?

    Why are you setting the location parameter = 1? Your histogram appears to show a location parameter = 0, which simplifies to a 2-parameter Weibull. Setting a location parameter =1 is stating that it is impossible for the interval to be < 1.

  3. #3
    Points: 30, Level: 1
    Level completed: 60%, Points required for next Level: 20

    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Why are the parameters of weibull not unique for a given data ?

    Quote Originally Posted by Miner View Post
    Why are you setting the location parameter = 1? Your histogram appears to show a location parameter = 0, which simplifies to a 2-parameter Weibull. Setting a location parameter =1 is stating that it is impossible for the interval to be < 1.
    My data's min is 1 so the hist start from 1. And if I don't specify loc as 1, the output for loc param is also 1.

  4. #4
    TS Contributor
    Points: 14,811, Level: 78
    Level completed: 91%, Points required for next Level: 39
    Miner's Avatar
    Location
    Greater Milwaukee area
    Posts
    1,171
    Thanks
    34
    Thanked 405 Times in 363 Posts

    Re: Why are the parameters of weibull not unique for a given data ?

    In general, you should not constrain any parameters unless you have historical data or theoretical knowledge of what a particular parameter is, or should be. Visually, the green curve (no constraints) appears to be the best fit of the three show. This provides an interesting insight into the data set. A shape parameter less than 1 (i.e., 0.7) indicates that the event rate is decreasing (i.e., time between events is increasing), which is not a good thing in sales.

  5. #5
    Points: 13, Level: 1
    Level completed: 25%, Points required for next Level: 37

    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Why are the parameters of weibull not unique for a given data ?

    Hi,
    the correct way to fix the scale parameter when using scipy.stats distributions is fscale=const. If you write scale=const. you are specifying an initial value for the optimization algorithm that searches parameter values which maximize the likelihood (the .fit(data) method is an MLE).
    I agree with Miner in that you should leave all three parameters free and accept the estimators the procedure provides. Fixing some parameters makes sense if you lack data (e.g. you have only 5 values) and have some prior information about the parameter you are fixing.
    Your scale (the 63.2 percentile) looks to be around 150 so fixing it at 1 does not make much sense.

    Besides, I don't think the Weibull distribution is the proper way to model purchases. Weibull is an extreme value distribution. You should look for a more appropriate distribution for your random process.

  6. #6
    TS Contributor
    Points: 12,287, Level: 72
    Level completed: 60%, Points required for next Level: 163
    rogojel's Avatar
    Location
    I work in Europe, live in Hungary
    Posts
    1,471
    Thanks
    160
    Thanked 332 Times in 312 Posts

    Re: Why are the parameters of weibull not unique for a given data ?


    Quote Originally Posted by Rostislav View Post
    Besides, I don't think the Weibull distribution is the proper way to model purchases. Weibull is an extreme value distribution. You should look for a more appropriate distribution for your random process.
    I always saw Weibull as a very flexibile distribution - surely not ONLY for extreme values: see its uses in reliability theory for example.

+ Reply to Thread

           




Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats