3

I am trying to create a Q-Q plot to test if my data can be modeled by the Weibull distribution using the command

qqplot(x,'weibull')   

using the data in

x =c(3.367, 0.769,0.8,1,1.2)

I keep getting presented with with the error

 "In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion"

and cannot figure out why. Does this mean I can't fit the Weibull distribution to my data? If anyone could help point me to why this isn't working, I would be very grateful.

Thomas Worm
  • 33
  • 1
  • 4
  • 2
    what makes you think qqplot can be used like that? are you using something other than `stats::qqplot`? – rawr Dec 08 '15 at 22:20

2 Answers2

1

Making a qqplot requires some distribution to compare your data against. You'll need to establish some Weibull distribution first and then create the plot. For example:

x =sort(c(3.367, 0.769,0.8,1,1.2))
dist = rweibull(5, 2, 1)
qqplot(dist, x)

Do you have parameters for a Weibull distribution in mind? See ?rweibull for more information, but it appears to require an n, a shape parameter, and a scale parameter.

Nancy
  • 3,989
  • 5
  • 31
  • 49
0

You can use qualityTools package and the qqPlot() function. If you need to estimate the parameters you can use fitdistrplus package.

   fit.weibull <- fitdist(x, "weibull")
   qqplot(qweibull(ppoints(length(x), shape = fit.weibull$estimate[1], 
           scale = fit.weibull$estimate[2]), x)
Matías
  • 35
  • 5