By the nature of long.landing value and risky.landing value, if it’s a risky landing, it must be a long landing, so I decided not to include the risky.landing variable in this regression analysis. Based on the regression summary statistics, we can see that speed_air and speed ground has significant impact on increasing the risk of being a long landing. Aircraft’s P value is very close to 0.05 threshold, but it still indicates that there may not be a significant impact.
Based on the three different plots above, we can see that when speed ground and speed air increase, the risk of having a long landing increase as well, especially when the speed passes 100-105 MPH.
The full model can be written as P(long.landing = 1) = exp(-52.89 + 0.52 * speed_air) / 1 + exp(-52.89 + 0.52 * speed_air). For every 1 unit increase in speed_air, the log-odds of a long landing increase by 0.52234, the higher speed_air is associated with a greater likelihood of a long landing. The odds ratio is 1.686, for every 1-unit increase in speed_air, the odds of a long landing are multiplied by approx. 1.686, a 68.6% increase in odds.
model_null <- glm(long.landing ~ 1, data = FAA, family = binomial)
step_aic <- step(model_null, direction = "forward", scope = ~aircraft_num + no_pasg + speed_ground + speed_air + height + pitch + duration, family = binomial)
Start: AIC=272.2
long.landing ~ 1
Df Deviance AIC
+ speed_air 1 94.155 98.155
+ speed_ground 1 105.304 109.304
+ aircraft_num 1 266.574 270.574
<none> 270.199 272.199
+ pitch 1 268.570 272.570
+ height 1 269.133 273.133
+ duration 1 269.935 273.935
+ no_pasg 1 270.169 274.169
Step: AIC=98.15
long.landing ~ speed_air
Df Deviance AIC
+ aircraft_num 1 63.206 69.206
+ height 1 83.909 89.909
+ pitch 1 86.314 92.314
<none> 94.155 98.155
+ speed_ground 1 93.673 99.673
+ no_pasg 1 94.107 100.107
+ duration 1 94.153 100.153
Step: AIC=69.21
long.landing ~ speed_air + aircraft_num
Df Deviance AIC
+ height 1 36.798 44.798
+ pitch 1 60.882 68.882
<none> 63.206 69.206
+ speed_ground 1 62.514 70.514
+ duration 1 62.570 70.570
+ no_pasg 1 63.047 71.047
Step: AIC=44.8
long.landing ~ speed_air + aircraft_num + height
Df Deviance AIC
+ pitch 1 34.278 44.278
<none> 36.798 44.798
+ no_pasg 1 35.974 45.974
+ speed_ground 1 36.379 46.379
+ duration 1 36.704 46.704
Step: AIC=44.28
long.landing ~ speed_air + aircraft_num + height + pitch
Df Deviance AIC
<none> 34.278 44.278
+ no_pasg 1 33.331 45.331
+ speed_ground 1 34.094 46.094
+ duration 1 34.162 46.162
summary(step_aic)
Call:
glm(formula = long.landing ~ speed_air + aircraft_num + height +
pitch, family = binomial, data = FAA)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -174.0912 47.8457 -3.639 0.000274 ***
speed_air 1.5923 0.4285 3.716 0.000203 ***
aircraft_num -8.1444 2.3153 -3.518 0.000435 ***
height 0.3635 0.1142 3.184 0.001454 **
pitch 1.5957 1.0958 1.456 0.145327
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 270.199 on 194 degrees of freedom
Residual deviance: 34.278 on 190 degrees of freedom
AIC: 44.278
Number of Fisher Scoring iterations: 10
No, we get a different result with the step forward AIC. From the step forward AIC result we can see that it considered additional variables are potential significant factors to long landing. Compare with the table 3, it added aircraft, height, and pitch to be included in the model. Even though, pitch is not showing significant, however, the AIC score is lower than when it’s not included.
step_bic <- step(model_null, direction = "forward", scope = ~aircraft_num + no_pasg + speed_ground + speed_air + height + pitch + duration, family = binomial, k = log(nrow(FAA)))
Start: AIC=275.47
long.landing ~ 1
Df Deviance AIC
+ speed_air 1 94.155 104.70
+ speed_ground 1 105.304 115.85
<none> 270.199 275.47
+ aircraft_num 1 266.574 277.12
+ pitch 1 268.570 279.12
+ height 1 269.133 279.68
+ duration 1 269.935 280.48
+ no_pasg 1 270.169 280.71
Step: AIC=104.7
long.landing ~ speed_air
Df Deviance AIC
+ aircraft_num 1 63.206 79.025
+ height 1 83.909 99.728
+ pitch 1 86.314 102.133
<none> 94.155 104.701
+ speed_ground 1 93.673 109.492
+ no_pasg 1 94.107 109.926
+ duration 1 94.153 109.972
Step: AIC=79.03
long.landing ~ speed_air + aircraft_num
Df Deviance AIC
+ height 1 36.798 57.890
<none> 63.206 79.025
+ pitch 1 60.882 81.974
+ speed_ground 1 62.514 83.606
+ duration 1 62.570 83.662
+ no_pasg 1 63.047 84.139
Step: AIC=57.89
long.landing ~ speed_air + aircraft_num + height
Df Deviance AIC
<none> 36.798 57.890
+ pitch 1 34.278 60.643
+ no_pasg 1 35.974 62.339
+ speed_ground 1 36.379 62.744
+ duration 1 36.704 63.069
summary(step_bic)
Call:
glm(formula = long.landing ~ speed_air + aircraft_num + height,
family = binomial, data = FAA)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -143.22264 34.95184 -4.098 4.17e-05 ***
speed_air 1.35748 0.32882 4.128 3.65e-05 ***
aircraft_num -7.42305 1.97283 -3.763 0.000168 ***
height 0.32871 0.09986 3.292 0.000996 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 270.199 on 194 degrees of freedom
Residual deviance: 36.798 on 191 degrees of freedom
AIC: 44.798
Number of Fisher Scoring iterations: 10
In the BIC result, we can see that it took out the pitch variable. That’s because BIC is more conservative in selecting variables, it applies a heavier penalty for the model complexity.
bic_coeff <- summary(step_bic)$coefficients
bic_odds_ratio <- exp(bic_coeff[, 1]) # Calculate odds ratios from BIC coefficients
bic_direction <- ifelse(bic_coeff[, 1] > 0, "Positive", "Negative") # Direction based on coefficient sign
bic_p_value <- bic_coeff[, 4] # P-values from BIC model
table_bic <- data.frame(
Coefficient = bic_coeff[, 1], # Coefficients from BIC model
Odds_Ratio = bic_odds_ratio, # Odds ratios from BIC model
Direction = bic_direction, # Direction (Positive or Negative)
P_Value = bic_p_value # P-values from BIC model
)
# Sort the BIC table by absolute value of coefficients (important variables at the top)
table_bic_sorted <- table_bic[order(abs(table_bic$P_Value), decreasing = FALSE), ]
print("BIC Model Table:")
[1] "BIC Model Table:"
print(table_bic_sorted)
The above table displayed a summary of the BIC model, ranking variables by importance. As we can see that the speed_air is the most siginificant factor variable.
The model I chose is based on the BIC: log(P(long.landing = 1) / 1 - P(long.landing=1)) = -143.22 + 1.35 * speed_air - 7.42 * aircraft_num + 0.33 * height.
library(ggplot2)
# Create predicted probabilities for different airspeeds
FAA$predicted_prob <- predict(step_bic, type = "response")
# Scatter plot with logistic regression curve
ggplot(FAA, aes(x = speed_air, y = long.landing)) +
geom_jitter(height = 0.05, alpha = 0.5) + # Add jitter for visibility
geom_smooth(method = "glm", method.args = list(family = "binomial"), se = FALSE, color = "blue") +
labs(title = "Effect of Airspeed on Long Landing Probability",
x = "Airspeed",
y = "Probability of Long Landing") +
theme_minimal()
Figure 1: displayed the relationship between speed_air and long landing probability. We can see that when the speed_air increases, the probability of long landing increase as well.
ggplot(FAA, aes(x = factor(aircraft), fill = factor(long.landing))) +
geom_bar(position = "fill") +
labs(title = "Long Landing Rate by Aircraft Type, (0 = No, 1 = Yes)",
x = "Aircraft Type",
y = "Proportion of Landings",
fill = "Long Landing") +
theme_minimal()
Figure 2: displayed aircraft type and long landing rate. I used a bar chart to show the proportion of long landings per aircraft type. We can see that boeing has more long landings than airbus.
ggplot(FAA, aes(x = height, y = long.landing)) +
geom_jitter(height = 0.05, alpha = 0.5) +
geom_smooth(method = "glm", method.args = list(family = "binomial"), se = FALSE, color = "red") +
labs(title = "Effect of Approach Height on Long Landing Probability",
x = "Approach Height",
y = "Probability of Long Landing") +
theme_minimal()
Figure 3: displayed the relationship between height and probability of long landing. A smoothed curve illustrating how approach height influences long landing probability - when height increases, the probability of long landing increases as well.
To summarize, the 4 bullet points are:
Higher airspeed significantly increases the likelihood of a long landing.
Aircraft type is a strong predictor - some models have much lower risk, such as airbus.
Approach height matters - higher altitudes lead to longer landing.
Reducing airspeed and optimizing approach height can help mitigate long landing.
#Calculate the frequency distribution of risky.landing
risky_landing_counts <- round(table(risky.landing)/length(risky.landing)*100,1)
# Label the pie chart slices
labels.risky <- paste(names(risky_landing_counts), ": ", risky_landing_counts,"%", sep = "")
# Create the pie chart
pie(
risky_landing_counts,
labels = labels.risky,
main = "Distribution of risky Landing, (0 = No, 1 = Yes)",
col = c("lightblue", "salmon") # Custom colors for 0 and 1
)
There are 30.8% of risky landing, and 69.2% of non-risky landing.
I have sorted the regression summary by how important each factor is. As we can see, speed_ground and speed_air are the two most significant factors in a risky landing. Aircraft has a P value of 0.073, which is greater than the 0.05 threshold, so it may not be an important factor. The rest of the P values are way larger than 0.05 threshold, so we can say that they are not important factors.
# Jitter plot for speed_ground vs. risky.landing
ggplot(FAA, aes(y = as.factor(risky.landing), x = speed_ground)) +
geom_jitter(width = 0.2, aes(color = as.factor(risky.landing))) +
labs(title = "Jitter Plot: Speed_Ground vs Risky Landing",
x = "Speed Ground)",
y = "Risky Landing (0 = No, 1 = Yes)") +
scale_color_manual(values = c("blue", "red"), name = "Risky Landing") +
theme_minimal()
# Jitter plot for speed_air vs. long.landing
ggplot(FAA, aes(y = as.factor(risky.landing), x = speed_air)) +
geom_jitter(width = 0.2, aes(color = as.factor(risky.landing))) +
labs(title = "Jitter Plot: Speed_Air vs Risky Landing",
x = "Speed Air",
y = "Risky Landing (0 = No, 1 = Yes)") +
scale_color_manual(values = c("blue", "red"), name = "Risky Landing") +
theme_minimal()
Jitter plots to show the relation between Speed_ground, speed_air vs Risky Landing.
# Histogram with density line for speed_ground by risky.landing
ggplot(FAA, aes(x = speed_ground, fill = as.factor(risky.landing), color = as.factor(risky.landing))) +
geom_histogram(aes(y = ..density..), binwidth = 5, position = "identity", alpha = 0.5) +
geom_density(alpha = 0.7) +
labs(title = "Histogram and Density: Speed_Ground by Risky Landing, (0 = No, 1 = Yes)",
x = "Speed Ground",
y = "Density",
fill = "Risky Landing",
color = "Risky Landing") +
scale_fill_manual(values = c("blue", "red")) +
scale_color_manual(values = c("blue", "red")) +
theme_minimal()
# Histogram with density line for speed_air by risky.landing
ggplot(FAA, aes(x = speed_air, fill = as.factor(risky.landing), color = as.factor(risky.landing))) +
geom_histogram(aes(y = ..density..), binwidth = 5, position = "identity", alpha = 0.5) +
geom_density(alpha = 0.7) +
labs(title = "Histogram and Density: Speed_Air by Risky Landing, (0 = No, 1 = Yes)",
x = "Speed Air",
y = "Density",
fill = "Risky Landing",
color = "Risky Landing") +
scale_fill_manual(values = c("blue", "red")) +
scale_color_manual(values = c("blue", "red")) +
theme_minimal()
Based on the two different plots above, we can see that when speed ground and speed air increase, the risk of having a long landing increase as well, especially when the speed passes 105-110 MPH.
library(faraway)
# Fit the full logistic regression model with speed_air
full_model2 <- glm(risky.landing ~ speed_air,
data = FAA,
family = binomial)
# View the summary of the model
summary(full_model2)
Call:
glm(formula = risky.landing ~ speed_air, family = binomial, data = FAA)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -91.4819 20.1681 -4.536 5.73e-06 ***
speed_air 0.8512 0.1876 4.536 5.72e-06 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 240.72 on 194 degrees of freedom
Residual deviance: 44.19 on 193 degrees of freedom
AIC: 48.19
Number of Fisher Scoring iterations: 9
odds2 <- exp(coef(full_model2)["speed_air"])
paste("Oddes for a risky landing is ", odds2)
[1] "Oddes for a risky landing is 2.34249672689146"
#visualize fitted model
beta.full.model2 <- coef(full_model2)
plot(jitter(risky.landing, 0.1) ~ jitter(speed_air), FAA, xlab = "Speed Air", ylab = "Risky Landing", pch = ".")
curve(ilogit(beta.full.model2[1]+beta.full.model2[2]*x), add = TRUE)
Based on previous analysis, due to the collinearity, I omitted the speed_ground. The full model can be written as P(risky.landing = 1) = exp(-91.48 + 0.85 * speed_air) / 1 + exp(-91.48 + 0.85 * speed_air). For every 1 unit increase in speed_air, the log-odds of a risky landing increase by 0.85, the higher speed_air is associated with a greater likelihood of a risky landing. The odds ratio is 2.342, for every 1-unit increase in speed_air, the odds of a long landing are multiplied by approx. 2.342, a 134.2% increase in odds.
model_null2 <- glm(risky.landing ~ 1, data = FAA, family = binomial)
step_aic2 <- step(model_null2, direction = "forward", scope = ~aircraft_num + no_pasg + speed_ground + speed_air + height + pitch + duration, family = binomial)
Start: AIC=242.72
risky.landing ~ 1
Df Deviance AIC
+ speed_air 1 44.190 48.190
+ speed_ground 1 57.971 61.971
+ aircraft_num 1 237.389 241.389
+ no_pasg 1 238.687 242.687
<none> 240.724 242.724
+ pitch 1 239.895 243.895
+ duration 1 240.648 244.648
+ height 1 240.657 244.657
Step: AIC=48.19
risky.landing ~ speed_air
Df Deviance AIC
+ aircraft_num 1 26.281 32.281
+ pitch 1 40.006 46.006
<none> 44.190 48.190
+ no_pasg 1 43.512 49.512
+ speed_ground 1 43.591 49.591
+ height 1 43.778 49.778
+ duration 1 44.095 50.095
Step: AIC=32.28
risky.landing ~ speed_air + aircraft_num
Df Deviance AIC
<none> 26.281 32.281
+ no_pasg 1 24.505 32.505
+ height 1 24.765 32.765
+ duration 1 25.252 33.252
+ pitch 1 25.422 33.422
+ speed_ground 1 26.264 34.264
summary(step_aic2)
Call:
glm(formula = risky.landing ~ speed_air + aircraft_num, family = binomial,
data = FAA)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -129.1675 32.4018 -3.986 6.71e-05 ***
speed_air 1.2206 0.3064 3.984 6.78e-05 ***
aircraft_num -4.5499 1.5124 -3.008 0.00263 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 240.724 on 194 degrees of freedom
Residual deviance: 26.281 on 192 degrees of freedom
AIC: 32.281
Number of Fisher Scoring iterations: 9
From the step forward AIC, we see that even though the model we got with only speed_air as a significant factor, the AIC score dropped tremendously from 242 to 48, it seems the aircraft is another significant factor for a risky landing, a small P value shows it’s significance, and has a lower AIC score of 32.
step_bic2 <- step(model_null2, direction = "forward", scope = ~ aircraft_num + no_pasg + speed_ground + speed_air + height + pitch + duration, family = binomial, k = log(nrow(FAA)))
Start: AIC=246
risky.landing ~ 1
Df Deviance AIC
+ speed_air 1 44.190 54.736
+ speed_ground 1 57.971 68.517
<none> 240.724 245.997
+ aircraft_num 1 237.389 247.935
+ no_pasg 1 238.687 249.233
+ pitch 1 239.895 250.441
+ duration 1 240.648 251.194
+ height 1 240.657 251.203
Step: AIC=54.74
risky.landing ~ speed_air
Df Deviance AIC
+ aircraft_num 1 26.281 42.100
<none> 44.190 54.736
+ pitch 1 40.006 55.825
+ no_pasg 1 43.512 59.331
+ speed_ground 1 43.591 59.410
+ height 1 43.778 59.597
+ duration 1 44.095 59.914
Step: AIC=42.1
risky.landing ~ speed_air + aircraft_num
Df Deviance AIC
<none> 26.281 42.100
+ no_pasg 1 24.505 45.597
+ height 1 24.765 45.857
+ duration 1 25.252 46.344
+ pitch 1 25.422 46.514
+ speed_ground 1 26.264 47.356
summary(step_bic2)
Call:
glm(formula = risky.landing ~ speed_air + aircraft_num, family = binomial,
data = FAA)
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -129.1675 32.4018 -3.986 6.71e-05 ***
speed_air 1.2206 0.3064 3.984 6.78e-05 ***
aircraft_num -4.5499 1.5124 -3.008 0.00263 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 240.724 on 194 degrees of freedom
Residual deviance: 26.281 on 192 degrees of freedom
AIC: 32.281
Number of Fisher Scoring iterations: 9
The BIC result seems to be the same compare to the AIC result, shows both speed_air and aircraft are the significant factors to a risky landing.
bic_coeff2 <- summary(step_bic2)$coefficients
bic_odds_ratio2 <- exp(bic_coeff2[, 1]) # Calculate odds ratios from BIC coefficients
bic_direction2 <- ifelse(bic_coeff2[, 1] > 0, "Positive", "Negative") # Direction based on coefficient sign
bic_p_value2 <- bic_coeff2[, 4] # P-values from BIC model
table_bic2 <- data.frame(
Coefficient = bic_coeff2[, 1], # Coefficients from BIC model
Odds_Ratio = bic_odds_ratio2, # Odds ratios from BIC model
Direction = bic_direction2, # Direction (Positive or Negative)
P_Value = bic_p_value2 # P-values from BIC model
)
# Sort the BIC table by absolute value of coefficients (important variables at the top)
table_bic_sorted2 <- table_bic2[order(abs(table_bic2$P_Value), decreasing = FALSE), ]
print("BIC Model Table for Risky Landing:")
[1] "BIC Model Table for Risky Landing:"
print(table_bic_sorted2)
The above table displayed a summary of the BIC model, ranking variables by importance. As we can see that the speed_air is the most significant factor and aircraft is next.
The model I chose is based on the BIC: log(P(long.landing = 1) / 1 - P(long.landing=1)) = -129.17 + 1.22 * speed_air - 4.55 * aircraft_num.
# Create predicted probabilities for different airspeeds
FAA$predicted_prob2 <- predict(step_bic2, type = "response")
# Scatter plot with logistic regression curve
ggplot(FAA, aes(x = speed_air, y = risky.landing)) +
geom_jitter(height = 0.05, alpha = 0.5) + # Add jitter for visibility
geom_smooth(method = "glm", method.args = list(family = "binomial"), se = FALSE, color = "blue") +
labs(title = "Effect of Airspeed on Risky Landing Probability",
x = "Airspeed",
y = "Probability of Risky Landing") +
theme_minimal()
Figure 1: displayed the relationship between speed_air and risky landing probability. We can see that when the speed_air increases, the probability of risky landing increase significantly.
ggplot(FAA, aes(x = factor(aircraft), fill = factor(risky.landing))) +
geom_bar(position = "fill") +
labs(title = "Risky Landing Rate by Aircraft Type, (0 = No, 1 = Yes)",
x = "Aircraft Type",
y = "Proportion of Landings",
fill = "Risky Landing") +
theme_minimal()
Figure 2: displayed aircraft type and risky landing rate. I used a bar chart to show the proportion of risky landings per aircraft type. We can see that airbus is quite safer and has less risky landing compared to boeing.
To summarize, the 3 bullet points are:
Faster landings significantly increase the risk of a risky landing.
Certain aircraft types are safer, showing lower risk, such as Airbus.
Reducing airspeed during landing could mitigate risks.
Significant Factors: The “long landing” model includes three significant factors—speed_air, aircraft, and height—while the “risky landing” model only includes speed_air and aircraft.
Criteria for Risk: A risky landing is always a long landing (i.e., the distance must be over 2500), but a long landing is not necessarily risky, as it requires a distance greater than 2500.
library(pROC)
# Fit the final models
final_long <- glm(long.landing ~ speed_air + aircraft_num + height,
family = binomial, data = FAA)
final_risky <- glm(risky.landing ~ speed_air + aircraft_num,
family = binomial, data = FAA)
# Predict probabilities for both models
final_long_pred <- predict(final_long, FAA, type = "response")
final_risky_pred <- predict(final_risky, FAA, type = "response")
# Compute ROC curves for both models
roc_final_long <- roc(FAA$long.landing, final_long_pred)
roc_final_risky <- roc(FAA$risky.landing, final_risky_pred)
# Plot the ROC curves
plot(roc_final_long, col = "blue", main = "ROC Curves for Final Models", lwd = 2)
lines(roc_final_risky, col = "red", lwd = 2)
# Add a legend
legend("bottomright", legend = c("Long Landing Model", "Risky Landing Model"),
col = c("blue", "red"), lwd = 2)
# Add AUC to the plot
auc_value_long <- auc(roc_final_long)
auc_value_risky <- auc(roc_final_risky)
legend("bottomleft", legend = c(paste("AUC (Long Landing) =", round(auc_value_long, 3)),
paste("AUC (Risky Landing) =", round(auc_value_risky, 3))),
col = c("blue", "red"), lwd = 2)
The area under curve score is near 1.0, suggests that both models are able to correctly classify observations with high certainty.
# Define the input data for the new airplane observation
new_airplane <- data.frame(speed_air = 120,aircraft_num = 0,height = 40,pitch = 4,no_pasg = 80,duration = 200,speed_ground = 115)
# Predict the probability for long landing (final_long)
long_landing_pred <- predict(final_long, new_airplane, type = "response", se.fit = TRUE)
# Predict the probability for risky landing (final_risky)
risky_landing_pred <- predict(final_risky, new_airplane, type = "response", se.fit = TRUE)
# Calculate the 95% confidence intervals for both predictions
#long_landing_ci_lower <- round(ilogit(c(long_landing_pred$fit - 1.96 * long_landing_pred$se.fit)),3)
#long_landing_ci_upper <- round(ilogit(c(long_landing_pred$fit + 1.96 * long_landing_pred$se.fit)),3)
long_landing_ci_lower <- long_landing_pred$fit - 1.96 * long_landing_pred$se.fit
long_landing_ci_upper <- long_landing_pred$fit + 1.96 * long_landing_pred$se.fit
#risky_landing_ci_lower <- round(ilogit(c(risky_landing_pred$fit - 1.96 * risky_landing_pred$se.fit)),3)
#risky_landing_ci_upper <- round(ilogit(c(risky_landing_pred$fit + 1.96 * risky_landing_pred$se.fit)),3)
risky_landing_ci_lower <- risky_landing_pred$fit - 1.96 * risky_landing_pred$se.fit
risky_landing_ci_upper <- risky_landing_pred$fit + 1.96 * risky_landing_pred$se.fit
# Print the predicted probabilities and confidence intervals
cat("Predicted probability for Long Landing:\n")
Predicted probability for Long Landing:
cat("Probability: ", long_landing_pred$fit, "\n")
Probability: 1
cat("95% CI: [", long_landing_ci_lower, ", ", long_landing_ci_upper, "]\n")
95% CI: [ 1 , 1 ]
cat("\nPredicted probability for Risky Landing:\n")
Predicted probability for Risky Landing:
cat("Probability: ", risky_landing_pred$fit, "\n")
Probability: 1
cat("95% CI: [", risky_landing_ci_lower, ", ", risky_landing_ci_upper, "]\n")
95% CI: [ 0.9999997 , 1 ]
Since the given airplane has a speed_air of 120, which is way higher than 100-110 range, it increased the risk of having a long landing and a risk landing. Based on the analysis, the probability of having a long landing and risky landing is 100%. The 95% confidence interval is at 99.99, almost perfect.