1

RELIABILITY MODELLING : Calculating the shape and scale to Identify the Life of the instrument or Sensor. Here is the thing i was been trying to calculate the shape and scale parameter in group manner with a one go and create and shape and scale parameter for respective grouped criteria i am getting an error Error in summarise_impl(.data, dots) : non-finite value supplied by optim I know some body has pasted same query but it isnt in a proper form Kindly do guide me on this below is the code and observed error i got .

G= c("P52" ,"P52","P66 - PARK II","P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P82 V3","P82 V3","P82 V3","P52","P52","P66 - PARK II" ,"P66 - PARK II" ,"P82 V3","P66 - PARK II" ,"P66 - PARK II" ,"P82 V3","P82 V3"        ,"P88","P88","P88","P52","P82 V3","P66 - PARK II" ,"P66 - PARK II" ,"P82 V3","P52","P88","P88","P52" ,"P88","P82 V3","P88","P82 V3","P82 V3","P82 V3","P88","P88","P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P88","P66 - PARK II" ,"P88"           ,"P52","P52","P52","P52","P52","P52","P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II","P88","P82 V3","P82 V3","P88","P88","P66 - PARK II" ,"P66 - PARK II" ,"P52","P52","P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II","P66 - PARK II" ,"P82 V3","P66 - PARK II" ,"P82 V3","P88","P82 V3","P88","P88","P66 - PARK II","P82 V3","P82 V3" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P82 V3","P88","P88","P82 V3","P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P66 - PARK II" ,"P88"           ,"P66 - PARK II" ,"P66 - PARK II","P66 - PARK II" )
GA = c(   170 ,170 ,169 ,135 ,135 ,135 ,331 ,331 ,331 ,136 ,170 ,169 ,169 ,183 ,135 ,135 ,331 ,331 ,431 ,431 ,183 ,170 ,183 ,135 ,135 ,331 ,136  ,94 ,115 ,136 ,154 ,103 ,183 ,114 ,114 ,114 ,183 ,149  ,51
            ,169 ,169 ,135  ,94 ,136 ,117 ,170 ,170 ,170 ,170 ,170 ,170 ,51 ,169 ,169 ,364 ,183 ,183  ,94 ,364 ,114  ,51 ,113 ,170  ,51 ,169 ,170 ,169 ,169 ,135 ,135 ,135 ,135 ,170 ,103 ,117 ,103  ,10  ,10
            ,183 ,183 ,111 ,103 ,150 ,137 ,137 ,137  ,10  ,10  ,95 ,103 ,169 ,169 ,170 ,169 ,169 ,169  ,10 ,137 ,137 ,137)
GL = c(  1645 ,1645 ,1645 ,1645 ,1645 ,1645 ,1645 ,1645 ,1645 ,1645 ,1646 ,1646 ,1646 ,1646 ,1646 ,1646 ,1646 ,1646 ,1647 ,1647 ,1647 ,1647 ,1647 ,1647 ,1647 ,1647 ,1647 ,1648 ,1648 ,1648 ,1648
           ,1649 ,1649 ,1649 ,1649 ,1649 ,1649 ,1649 ,1649 ,1649 ,1649 ,1649 ,1649 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1650 ,1651 ,1651 ,1651
           ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1651 ,1653 ,1653 ,1653 ,1653 ,1653 ,1653 ,1654 ,1654 ,1654 ,1654 ,1654 ,1654 ,1654 ,1654 ,1654 ,1654
           ,1654 ,1654 ,1654 ,1654 ,1655 ,1655 ,1655)


df=data.frame(G=G,GA=GA,GL=GL)

library(MASS)
library(dplyr)
by_G<- group_by(df,G,GA)
fg1 <- summarise(by_G,
                 shape=fitdistr(GL, "weibull")$estimate[1],
                 scale=fitdistr(GL, "weibull")$estimate[2],
                 n=n())

Observed Error:

Error in summarise_impl(.data, dots) : non-finite value supplied by optim

Imtiaz Ali
  • 15
  • 6
  • `Error in fitdistr(df$GL, densfun = "weibull") : optimization failed`, so there's no values for shape and scale. – Roman Luštrik May 25 '17 at 05:39
  • @RomanLuštrik sorry i did't get you ,logically if we think this code should work..but it is't working. – Imtiaz Ali May 25 '17 at 05:46
  • If you replace the `shape` and `scale` in your `summarise` statement with some fake values, it works. BUT, when you are fitting a Weibull distribution to the `GL` (at least in this small sample you provided), the fitting fails. If you feel Weibull distribution is the way to go for this dataset, try handing `fitdistr()` starting values for shape and scale. – Roman Luštrik May 25 '17 at 05:47
  • @RomanLuštrik we have to find shape scale by grouping `G and GA` using `filtdistr()` we cannot replace shape and scale by any value instead we need to find the shape and scale parameter for the grouped data ,so for every grouping their will always be data frame formed and for that data frame `GL` we need to compute shape and scale .so similarly their would be many shape and scale parameter. – Imtiaz Ali May 25 '17 at 05:56
  • It would appear we are not understanding each other. I suggested replacing shape and scale parameters in summarise in order to demonstrate that the logic indeed works. Where this logic stops is when you get an error in `fitdistr()`. – Roman Luštrik May 25 '17 at 06:41
  • @RomanLuštrik i totally agree with you here .The error occurs at `fitdistr()` that where i need a help . whats the solution for that , Because if we we remove both `fitdistr()` from summaries it execute perfectly But with including of `fitdistr()` it gives an error of `Error in summarise_impl(.data, dots) : non-finite value supplied by optim` – Imtiaz Ali May 25 '17 at 06:58
  • @GGamba sir can you please guide me on this – Imtiaz Ali May 25 '17 at 09:04
  • This is a totally different question. Modify your question or open a new one. It should address the fitting part. You first need to demonstrate why you think your data follows a Weibull distribution, what you've tried to make a model fit and where you get stuck. Assuming the fit is possible, try passing arguments to `optim` via `...`. – Roman Luštrik May 25 '17 at 09:07
  • @RomanLuštrik Please go ahead and Modify. – Imtiaz Ali May 25 '17 at 09:12
  • My suggestion would be to scrub this question and make a new question. – Roman Luštrik May 25 '17 at 10:57
  • @RomanLuštrik Question : Fitting a data in Weibull distribution in groupwise ? is this correct one ? – Imtiaz Ali May 25 '17 at 11:24
  • Your example probably won't fit any meaningful distribution because you don't have enough points per group combination. Try `aggregate(GL ~ G + GA, FUN = length, data = df)` and see how many data points each group has. Hopefully this is just a small small subset of your whole data.frame. If not, you'll have to think of other strategies on how to get a fit. – Roman Luštrik May 25 '17 at 11:32
  • @RomanLuštrik So i have a question how should we identify how the given data fits weibull distribution or not ... – Imtiaz Ali May 25 '17 at 11:50
  • I think we need to make a step back and [review what's the best way to ask a question](https://stackoverflow.com/help). Please see the link and ask a proper, new question. My recommendation would be to delete this one as it's unlikely to gather an answer. – Roman Luštrik May 25 '17 at 20:37

0 Answers0