Recommand · October 14, 2021 0

How to find confidence interval from the simulation of linear model

I have used the arm package, sim() function, to create a simulation of linear model. The simulation result contains the coefficients and residual error. I would like to find the 95% confidence interval for the coefficients. How do I find it?

The codes I have used to run the simulation are provided below.

mod <- lm(y ~ normal_dist + uniform_dist)
sims <- arm::sim(mod, n = 1000)

Is this what you’re looking for? 95% CI for coefficients with data iris, replace petal.length with your coefficients of choice

  fit <- lm(Petal.Width ~Petal.Length,iris)


  2.5 %    97.5 %
Petal.Length 0.3968193 0.4346915