Closed tnt2501 closed 2 months ago
@tnt2501 Hi Tyler,
To obtain a confidence interval for the regression slope, you need to compute both the lower bound and the upper bound. The lower bound can be calculated as B1 - t*SE, and the upper bound can be calculated as B1 + t*SE. You can find the t-value for a 95% confidence level on page 36 of the lecture note.
https://canvas.asu.edu/courses/162538/files/69868083?wrap=1 (The "effect size" lecture note in module 2)
You also need to check if zero is within this confidence interval or not to see if this estimate is statistically significantly different from zero (the null hypothesis).
Thank you for the response
So the structure should look like this ? -4.22 - 1.96 (0.18) = -4.5728 -4.22 + 1.96 (0.18) = -3.8672 Which is statistically significant because this is telling us since 0 is not included the p-value will be less the 0..05
Also In Q5 it says to draw the three c.i - How would I go about drawing this in R?
So the structure should look like this ? -4.22 - 1.96 (0.18) = -4.5728 -4.22 + 1.96 (0.18) = -3.8672 Which is statistically significant because this is telling us since 0 is not included the p-value will be less the 0..05
Correct.
Also In Q5 it says to draw the three c.i - How would I go about drawing this in R?
Use the R scripts provided in the lab 2 instruction with modifications.
mod1.slope <- -2.01
mod1.ci.lower <- -3
mod1.ci.upper <- -1
mod2.slope <- -2.32
mod2.ci.lower <- -5
mod2.ci.upper <- 1
# etc.
# slopes <- c( mod1.slope, mod2.slope, ... mod5.slope )
# ci.lower <- c( mod1.ci.lower, mod2.ci.lower, ... mod5.ci.lower )
# ci.upper <- c( mod1.ci.upper, mod2.ci.upper, ... mod5.ci.upper )
# model.labels <- c("Model 1", "Model 2", ... "Model 5")
slopes <- c( mod1.slope, mod2.slope )
ci.lower <- c( mod1.ci.lower, mod2.ci.lower )
ci.upper <- c( mod1.ci.upper, mod2.ci.upper )
model.labels <- c("Model 1", "Model 2")
min.x <- min( ci.lower )
max.x <- max( max( ci.upper ), 1 )
plot( -8:3, -8:3, bty="n", type="n", yaxt="n",
ylab="", xlab="Slope for Class Size",
xlim=c(min.x-1,max.x+1), ylim=c(0,length(slopes)+1) )
abline( v=0, col="darkgray" ) # null hypothesis
segments( x0=ci.lower, x1=ci.upper, y0=1:length(slopes),
col="orange", lwd=2 )
points( slopes, 1:length(slopes), pch=19, col="orange", cex=2 )
text( slopes, 1:length(slopes), model.labels,
col="darkgray", pos=3, cex=1.2, offset=1 )
Hello,
I am currently having some troubles with Calculating the confidence intervals within R. I understand the intuition and concept of confidence intervals and statistical significants, but I can't understand how to achieve the calculations in R.
Any help is appreciated! Thank you