Confidence Interval for Mu in a Log normal Distributions in R -
Suppose that our parameters are a random sample of size n = 8 with an unusual distribution with mu and sigma, suppose
Since this is a small sample, I am using confidence interval from a non-general population. I ran a simulation to determine the true (simulated) CI in a 90% T-CI in which Mu = 1 and sigma = 1.5
My problem is that my code follows normal distribution below And it needs to be an abnormal distribution. I know that the Ranomum has to be transformer so that random variables can come from log distribution. But I need to change mu and sigma. In normal distribution, mu and sigma are not equal in log delivery.
Log in delivery = exp (μ + 1/2 σ ^ 2) in mu. And sigma XP (2 (μ + sigma ^ 2)) - Exp 2 (μ + sigma ^ 2)
I'm just confused by how I incorporated these two equations into my code Can i
BTW- If you do not anticipate already, then I am very new to R. Any help would be appreciated!
MC < - Number of samples to simulate 10000 # result & lt; - c (1: MC) mu & lt; - 1 sigma & lt; - 1.5 n & lt; - 8; # Sample size alpha & lt; - 0.1 # Nominal confidence level 100 (1-alpha) percent t_criticalValue & lt; For qt (p = (1-alpha / 2), df = (n-1)) (i in 1: mc) {mySample & lt; - rlnorm (n = n, mean = mu, sd = sigma) lowerCL & lt; - Mean (mySample) -t_criticalValue * sd (mySample) / sqrt (n) Upper CL & lt; - Mean (mySample) + T_criticalValue * sd (mySample) / sqrt (n) Results [i] & lt; - ((Lower CL & amp; lt; mu) & amp; (mu & lt; Upper CL)) Simulated Confidential Level & lt; - Mean (result)
Edit: So I tried to replace Mu and SD with my related sources ...
(mu = exp (μ + 1/2 σ2) sigma = XP (2μ + σ2) (exp (Σ2) - 1)
And I got the 5000 simulated confidence level.
Here are some sample data samples:
(x <- rlnorm (8, 1, 2) Your definition of important value was correct :
n <- length (x) alpha & lt; - 0.1 t_critical_value qt (1 > < There is a utility function in the Ggplot2
package that creates a plot and calculates standard errors. In this case, you can find it for mu
Applying to your logs of data and its confidence interval.
Library (ggplot2) mean_se (log (x), T_cratical_value) ## y ymin ymax ## 1 1.088481 -0.006944755 2.183907
Comments
Post a Comment