#StackBounty: #r #probability #distributions #weibull Fitting weibull distribution to percentage vs proportion data

Bounty: 50

EDIT

After studying for a bit, now I understand what I need to do. What I am trying to do is a Weibull regression to the below data.

x <- structure(list(year = c(2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 
                    2016L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2014L, 
                    2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2013L, 2013L, 
                    2013L, 2013L, 2013L, 2013L, 2013L, 2012L, 2012L, 2012L, 2012L, 
                    2012L, 2012L, 2012L, 2012L, 2016L, 2016L, 2016L, 2016L, 2016L, 
                    2016L, 2015L, 2015L, 2015L, 2015L, 2015L, 2014L, 2014L, 2014L, 
                    2014L, 2014L, 2014L, 2013L, 2013L, 2013L, 2013L, 2013L, 2012L, 
                    2012L, 2012L, 2012L, 2012L, 2012L, 2016L, 2016L, 2016L, 2016L, 
                    2016L, 2016L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 
                    2014L, 2014L, 2014L, 2014L, 2014L, 2013L, 2013L, 2013L, 2013L, 
                    2013L, 2013L, 2012L, 2012L, 2012L, 2012L, 2012L, 2016L, 2016L, 
                    2016L, 2016L, 2016L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 
                    2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2013L, 2013L, 2013L, 
                    2013L, 2013L, 2013L, 2013L, 2012L, 2012L, 2012L, 2012L, 2012L, 
                    2012L, 2016L, 2016L, 2016L, 2016L, 2016L, 2016L, 2015L, 2015L, 
                    2015L, 2015L, 2015L, 2015L, 2014L, 2014L, 2014L, 2014L, 2014L, 
                    2014L, 2013L, 2013L, 2013L, 2013L, 2013L, 2013L, 2012L, 2012L, 
                    2012L, 2012L, 2012L, 2012L, 2016L, 2016L, 2016L, 2016L, 2016L, 
                    2016L, 2015L, 2015L, 2015L, 2015L, 2015L, 2014L, 2014L, 2014L, 
                    2014L, 2014L, 2014L, 2013L, 2013L, 2013L, 2013L, 2013L, 2012L, 
                    2012L, 2012L, 2012L, 2012L, 2016L, 2016L, 2016L, 2016L, 2016L, 
                    2016L, 2016L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 2014L, 
                    2014L, 2014L, 2014L, 2014L, 2014L, 2013L, 2013L, 2013L, 2013L, 
                    2013L, 2012L, 2012L, 2012L, 2012L, 2012L, 2016L, 2016L, 2016L, 
                    2016L, 2016L, 2016L, 2015L, 2015L, 2015L, 2015L, 2015L, 2015L, 
                    2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2013L, 2013L, 2013L, 
                    2013L, 2013L, 2013L, 2012L, 2012L, 2012L, 2012L, 2012L, 2012L, 
                    2016L, 2016L, 2016L, 2016L, 2016L, 2015L, 2015L, 2015L, 2015L, 
                    2015L, 2015L, 2015L, 2014L, 2014L, 2014L, 2014L, 2014L, 2013L, 
                    2013L, 2013L, 2013L, 2013L, 2012L, 2012L, 2012L, 2012L, 2012L, 
                    2012L, 2016L, 2016L, 2016L, 2016L, 2016L, 2015L, 2015L, 2015L, 
                    2015L, 2015L, 2014L, 2014L, 2014L, 2014L, 2014L, 2013L, 2013L, 
                    2013L, 2013L, 2013L, 2012L, 2012L, 2012L, 2012L, 2012L, 2016L, 
                    2016L, 2016L, 2016L, 2016L, 2016L, 2015L, 2015L, 2015L, 2015L, 
                    2015L, 2014L, 2014L, 2014L, 2014L, 2014L, 2014L, 2013L, 2013L, 
                    2013L, 2013L, 2013L, 2013L, 2012L, 2012L, 2012L, 2012L, 2012L, 
                    2016L, 2016L, 2016L, 2016L, 2015L, 2015L, 2015L, 2015L, 2015L, 
                    2015L, 2014L, 2014L, 2014L, 2014L, 2014L, 2013L, 2013L, 2013L, 
                    2013L, 2013L, 2012L, 2012L, 2012L, 2012L, 2012L, 2012L, 2012L
        ), week.id = c(17L, 18L, 19L, 20L, 21L, 22L, 23L, 18L, 19L, 20L, 
           21L, 22L, 23L, 24L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L, 18L, 
           19L, 20L, 21L, 22L, 23L, 24L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 
           24L, 19L, 20L, 21L, 22L, 23L, 24L, 20L, 21L, 22L, 23L, 24L, 19L, 
           20L, 21L, 22L, 23L, 24L, 20L, 21L, 22L, 23L, 24L, 19L, 20L, 21L, 
           22L, 23L, 24L, 19L, 20L, 21L, 22L, 23L, 24L, 18L, 19L, 20L, 21L, 
           22L, 23L, 24L, 19L, 20L, 21L, 22L, 23L, 19L, 20L, 21L, 22L, 23L, 
           24L, 19L, 20L, 21L, 22L, 23L, 19L, 20L, 21L, 22L, 23L, 19L, 20L, 
           21L, 22L, 23L, 24L, 18L, 19L, 20L, 21L, 22L, 23L, 18L, 19L, 20L, 
           21L, 22L, 23L, 24L, 18L, 19L, 20L, 21L, 22L, 23L, 19L, 20L, 21L, 
           22L, 23L, 24L, 19L, 20L, 21L, 22L, 23L, 24L, 19L, 20L, 21L, 22L, 
           23L, 24L, 19L, 20L, 21L, 22L, 23L, 24L, 19L, 20L, 21L, 22L, 23L, 
           24L, 18L, 19L, 20L, 21L, 22L, 23L, 19L, 20L, 21L, 22L, 23L, 18L, 
           19L, 20L, 21L, 22L, 23L, 19L, 20L, 21L, 22L, 23L, 19L, 20L, 21L, 
           22L, 23L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 18L, 19L, 20L, 21L, 
           22L, 23L, 18L, 19L, 20L, 21L, 22L, 23L, 18L, 19L, 20L, 21L, 22L, 
           18L, 19L, 20L, 21L, 22L, 18L, 19L, 20L, 21L, 22L, 23L, 18L, 19L, 
           20L, 21L, 22L, 23L, 18L, 19L, 20L, 21L, 22L, 23L, 18L, 19L, 20L, 
           21L, 22L, 23L, 18L, 19L, 20L, 21L, 22L, 23L, 21L, 22L, 23L, 24L, 
           25L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 20L, 21L, 22L, 23L, 24L, 
           20L, 21L, 22L, 23L, 24L, 19L, 20L, 21L, 22L, 23L, 24L, 20L, 21L, 
           22L, 23L, 24L, 21L, 22L, 23L, 24L, 25L, 20L, 21L, 22L, 23L, 24L, 
           20L, 21L, 22L, 23L, 24L, 20L, 21L, 22L, 23L, 24L, 20L, 21L, 22L, 
           23L, 24L, 25L, 22L, 23L, 24L, 25L, 26L, 20L, 21L, 22L, 23L, 24L, 
           25L, 20L, 21L, 22L, 23L, 24L, 25L, 21L, 22L, 23L, 24L, 25L, 22L, 
           23L, 24L, 25L, 21L, 22L, 23L, 24L, 25L, 26L, 21L, 22L, 23L, 24L, 
           25L, 21L, 22L, 23L, 24L, 25L, 20L, 21L, 22L, 23L, 24L, 25L, 26L
        ), location.id = c(41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 
               41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 
               41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 41L, 
               41L, 41L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 
               43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 
               43L, 43L, 43L, 43L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 
               42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 42L, 
               42L, 42L, 42L, 42L, 42L, 42L, 42L, 35L, 35L, 35L, 35L, 35L, 35L, 
               35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 
               35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 35L, 31L, 31L, 
               31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 
               31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 31L, 
               31L, 31L, 52L, 52L, 52L, 52L, 52L, 52L, 52L, 52L, 52L, 52L, 52L, 
               52L, 52L, 52L, 52L, 52L, 52L, 52L, 52L, 52L, 52L, 52L, 52L, 52L, 
               52L, 52L, 52L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 
               50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 50L, 
               50L, 50L, 50L, 50L, 50L, 50L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 
               51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 
               51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 51L, 29L, 29L, 29L, 
               29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 
               29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 29L, 17L, 
               17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 
               17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 21L, 21L, 
               21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 
               21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 
               22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 
               22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 
               22L), cumulative.percentage = c(4.1, 14, 31.9, 60, 81.2, 94.9, 
                                               100, 5.1, 26.3, 66, 80.7, 91, 98.1, 100, 1.2, 7, 25.6, 47, 73.1, 
                                               90, 98.9, 100, 2.2, 20.3, 47.2, 77.7, 95, 99.1, 100, 0.5, 3, 
                                               22.2, 46, 77.3, 97, 98.9, 100, 1, 9, 38, 79, 94, 100, 6, 28, 
                                               77, 92, 100, 3, 14, 46, 85, 99, 100, 6, 27, 63, 95, 100, 4, 14, 
                                               36, 78, 98, 100, 11, 31, 66, 88, 98, 100, 5, 17, 35, 67, 86, 
                                               98, 100, 7, 28, 62, 90, 100, 5, 22, 51, 81, 99, 100, 9, 20, 46, 
                                               83, 100, 14, 35, 73, 96, 100, 8, 26, 66, 93, 99, 100, 2, 12, 
                                               31, 61, 95, 100, 5, 21, 49, 81, 92, 98, 100, 1, 10, 31, 68, 93, 
                                               100, 9, 28, 63, 85, 96, 100, 2, 14, 52, 80, 93, 100, 1, 15, 41, 
                                               74, 91, 100, 11, 31, 70, 85, 95, 100, 2, 10, 56, 88, 99, 100, 
                                               1, 14, 43, 79, 98, 100, 6, 19, 59, 91, 100, 1, 12, 39, 70, 96, 
                                               100, 9, 28, 67, 89, 100, 12, 30, 67, 88, 100, 1, 4, 26, 63, 87, 
                                               99, 100, 1, 20, 62, 88, 98, 100, 4, 23, 56, 83, 99, 100, 1, 16, 
                                               55, 83, 100, 2, 22, 63, 91, 100, 4.51, 31.4, 67.73, 88.38, 97.59, 
                                               100, 1.7, 14.3, 38, 83.7, 95.6, 100, 2, 8.6, 20.4, 67.2, 93.3, 
                                               100, 0.8, 9.1, 50.6, 86, 97.2, 100, 1.8, 17.4, 50.3, 77.8, 97.4, 
                                               100, 27, 67, 91, 98, 100, 1, 19, 57, 78, 88, 95, 100, 6, 28, 
                                               65, 88, 100, 3, 17, 53, 82, 100, 1, 9, 34, 71, 90, 100, 4, 15, 
                                               35, 76, 100, 10, 43, 79, 98, 100, 3, 22, 63, 87, 100, 7, 29, 
                                               69, 92, 100, 3, 26, 62, 89, 100, 3, 11, 21, 45, 81, 100, 9, 20, 
                                               37, 71, 100, 7, 20, 59, 84, 96, 100, 6, 18, 63, 86, 94, 100, 
                                               8, 27, 61, 88, 100, 12, 34, 69, 100, 2, 18, 39, 64, 94, 100, 
                                               7, 23, 47, 78, 100, 3, 20, 46, 79, 100, 7, 17, 31, 59, 71, 93, 
                                               100)), class = "data.frame", row.names = c(NA, -348L))

This is my data which shows the pooled data of cumulative percentage of growth in a variable from multiple location and years. Hence goes from 0% to 100%. It is not always the case that same week reaches 100%. What I want to do is to fit a weibull regression to each location and iteratively change the shape and scale parameters in order to get the best match between the observed and predicted. Hence for each location, I will have a different shape and scale parameters.

Thank you to many members here who helped articulate the question clearly. I hope I can get some advise on how to do a weibull regression in R. Thank you


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.