0

I want to extract the fitted values from fitdist function output model in R. Thus, I've used fitted(model.object) function and the output obtained was Null. The code is as follows:

OutEst
  [1,]  0.872143630
  [2,]  7.868779497
  [3,]  0.226875954
  [4,] 24.267572943
  [5,] 14.158973514
  [6,]  4.346251412
  [7,]  1.636542003
  [8,]  0.175979073
  [9,]  0.074331029
 [10,]  4.224522868
 [11,]  1.607480300
 [12,]  0.040918175
 [13,] 13.664916344
 [14,] 19.480406350
 [15,] 24.104609740
 [16,]  8.079880744
 [17,]  0.027317015
 [18,]  2.321946237
 [19,]  0.000000000
 [20,]  0.409755218
 [21,]  0.000000000
 [22,]  0.414827263
 [23,]  2.755841830
 [24,]  1.091825488
 [25,]  1.288534896
 [26,]  5.611259902
 [27,]  0.000000000
 [28,]  0.000000000
 [29,]  4.845565803
 [30,]  0.027317015
 [31,]  4.322232168
 [32,]  2.282156424
 [33,]  2.856332014
 [34,]  2.161989934
 [35,]  0.409755218
 [36,]  0.156282073
 [37,]  0.116098780
 [38,]  0.000000000
 [39,]  3.653546885
 [40,]  7.450890103
 [41,]  5.093254715
 [42,] 13.182175978
 [43,]  3.116889736
 [44,]  2.729517705
 [45,] 10.203076371
 [46,]  2.183626721
 [47,]  1.199209304
 [48,]  0.042188763
 [49,]  6.039777894
 [50,]  0.533895025

fitg1=fitdist(OutEst,"gamma");fitg1
fitted.fitg1=fitted(fitg1)
fitted.fitg1
NULL

Really appreciate if someone could help me in this

  • 2
    What do you mean by the fitted values from the distribution? You are just trying to estimate the distribution parameters, right? That doesn't give you fitted values. Are you trying to randomly draw from that distribution? Also, be sure to be clear about what packages you are using (i'm assuming `fitdistplus`) and share your data in a more [reproducible](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) format. – MrFlick Oct 14 '15 at 03:09
  • yes I'm using fitdistplus package to estimate the parameter. if possible I want to extract the fitted values from the output of fitdist function. if not, is there any other way to extract the fitted values. OutEst can be generated with this rgamma(50,0.104,0.0231) – Miss Zahrah Oct 14 '15 at 03:40
  • 2
    I still have no idea what you mean by "fitted values" in this case. Do you mean the `shape ` and `rate` estimates? You can get those with `coef(fitg1)`. – MrFlick Oct 14 '15 at 03:42
  • I'm sorry @MrFlick because I'm still exploring and learning on distribution fitting. Actually, I want to extracts fitted values from objects returned by modeling functions. For example, x = rnorm(10); y = rpois(10, exp(x)); m = glm(y ~ x, family="poisson"); print(fitted(m)) . I want to use the fitted function to get the fitted values. – Miss Zahrah Oct 14 '15 at 03:56
  • 1
    Well, fitted values in a `glm` context makes sense. Here you're estimating the parameters of a univariate distribution. There's no dependent variable that you are modeling/predicting so you don't have a fitted/estimated value. I suggest you consult a statistician, not a programmer, for further help. – MrFlick Oct 14 '15 at 04:00
  • thank you so much for the suggestion @MrFlick. I'm sorry for the misunderstanding. – Miss Zahrah Oct 14 '15 at 04:05

0 Answers0