Closed williamlai2 closed 6 months ago
Or perhaps we just ignore this as distchoose()
is only meant to suggest normal, gamma and lognormal?
Though here is suggests 'Nonparametric'. https://github.com/alexkowa/EnvStats/issues/23
Not sure we need a function enpar(). When there are not uncensored observations, you can consider the sample mean as a nonparametric estimator of the population mean, since the sample mean is simply the mean of the empirical cdf. See for example: https://en.wikipedia.org/wiki/Empirical_distribution_function
Yes, I just bootstrapped the detected values to calculate the parameters, but I thought it would be good to have something in there to match the other functions.
Yes, I just bootstrapped the detected values to calculate the parameters, but I thought it would be good to have something in there to match the other functions.
I'm not sure I understand what you mean. If there are no censored values, then you can estimate parameters for any particular distribution as usual. What exactly would you want enpar()
to return? If you want to estimate the median and a CI for the median, you can use eqnapr()
:
> eqnpar(vals, ci = TRUE)
Results of Distribution Parameter Estimation
--------------------------------------------
Assumed Distribution: None
Estimated Quantile(s): Median = 5.5
Quantile Estimation Method: Nonparametric
Data: vals
Sample Size: 10
Confidence Interval for: 50'th %ile
Confidence Interval Method: interpolate (Nyblom, 1992)
Confidence Interval Type: two-sided
Confidence Level: 95%
Confidence Limit Rank(s): 2 3 9 8
Confidence Interval: LCL = 2.657658
UCL = 8.342342
I think I wanted the LCL and UCL of the mean. Similar to the other functions.
Hi @williamlai2 and @alexkowa , I wrote a function called enpar()
that does what I think William wants. Alex, if you want to add this to EnvStats, then I can write a companion Help file as well.
> set.seed(479)
> dat <- rgammaAlt(30, mean = 2, cv = 1)
>
> enpar(dat)
Results of Distribution Parameter Estimation
--------------------------------------------
Assumed Distribution: None
Estimated Parameter(s): mean = 2.0027422
sd = 2.0544111
se.mean = 0.3750824
Estimation Method: Sample Mean
Data: dat
Sample Size: 30
>
> enpar(dat, ci = TRUE)
Results of Distribution Parameter Estimation
--------------------------------------------
Assumed Distribution: None
Estimated Parameter(s): mean = 2.0027422
sd = 2.0544111
se.mean = 0.3750824
Estimation Method: Sample Mean
Data: dat
Sample Size: 30
Confidence Interval for: mean
Confidence Interval Method: Bootstrap
Number of Bootstraps: 1000
Confidence Interval Type: two-sided
Confidence Level: 95%
Confidence Interval: Pct.LCL = 1.339372
Pct.UCL = 2.722864
BCa.LCL = 1.298334
BCa.UCL = 2.654668
t.LCL = 1.383849
t.UCL = 2.989514
yes, please. add it.
enparCensored()
doesn't work with datasets where there are no censored values. Should there be something to matchenorm()
,egamma()
,elnorm()
, etc.?Or should I be using some other function?