Disclaimer: I'm not a statistician but a software engineer. Most of my knowledge in statistics comes from self-education, thus I still have many gaps in understanding concepts that may seem trivial for other people here.
I would like to fit the following data, as a beta distribution if that makes sense, but I am getting the following error:
x = c(0.038, 0.017, 0.08, 0.013, 0.01, 0.031, 0.021, 0.029, 0.02,
0.005, 0.013, 0.027, 0.019, 0, 0.042, 0.02, 0.016, 0.004, 0.022,
0.003, 0.022, 0.025, 0.043, 0.033, 0.021, 0.006, 0.009, 0.031,
0.006, 0.037, 0.035, 0.015, 0.028, 0.018, 0.014, 0.012, 0.022,
0.026, 0.08, 0.034, 0.007, 0.018, 0.02, 0.03, 0.045, 0.026, 0.009,
0.012, 0.01, 0.012, 0.02, 0.019, 0.019, 0.007, 0.024, 0.008,
0.031, 0.028, 0.017, 0.011, 0.039, 0.012, 0.03, 0.002, 0.027,
0.021, 0.003, 0.057, 0.019, 0.025, 0.007, 0.021, 0.004, 0.027,
0.013, 0.004, 0.01, 0.031, 0.009, 0.045, 0.008, 0.013, 0.02,
0.008, 0.024, 0.013, 0.007, 0.015, 0.048, 0.025, 0.047, 0.027,
0.025, 0.023, 0.007, 0.018, 0.023, 0.014, 0.024, 0.021, 0.007,
0.021, 0.005, 0.008, 0.029, 0.026, 0.002, 0.021, 0.001, 0.001,
0.026, 0.025, 0.008, 0.004, 0.005, 0, 0.01, 0.045, 0.004, 0.035,
0.038, 0.02, 0.015, 0.035, 0.028, 0.027, 0.042, 0.034, 0.028,
0.024, 0.019, 0.033, 0.033, 0.033, 0.014, 0.026, 0.012, 0.019,
0.035, 0.019, 0.017, 0.005, 0.015, 0.024, 0.044, 0.008, 0.011,
0.012, 0.031, 0.01, 0.076, 0.019, 0.035, 0.003, 0.041, 0.023,
0.005, 0.038, 0.013, 0.005, 0.043, 0.01, 0, 0.026, 0.009, 0.015,
0.014, 0.023, 0.021, 0.005, 0.002, 0.006, 0.003, 0.014, 0.057,
0.054, 0.017, 0.031, 0.063, 0.02, 0.006, 0.02, 0.045, 0.035,
0.013, 0.009, 0.019, 0.033, 0.028, 0.018, 0.012, 0.007, 0, 0.023,
0.04, 0.009, 0.039, 0.021, 0.006, 0.019)
m <- MASS::fitdistr(x, dbeta, start = list(shape1 = 1, shape2 = 10))
Error in stats::optim(x = c(0.038, 0.017, 0.08, 0.013, 0.01, 0.031, 0.021, :
non-finite finite-difference value [1]
I am not sure that a beta distribution makes sense. Here is a plot of the distribution (histogram) of the whole data (above is just a sample):
Can this be fitted with a beta distribution? And if yes, how?
The reason I want to fit it as a beta distribution is to be able to use this distribution as a prior for a Bayesian estimate as explained here.