R Markdown
Project Cloud Seeding
’’’{r} # Load necessary libraries for data manipulation and
visualization library(tidyverse) # Includes dplyr for data manipulation
and ggplot2 for plotting library(ggplot2) # Specifically for advanced
plotting
Load the data from a CSV file into a data frame
clouds <- read.csv(“clouds.csv”)
Inspect the first few rows of the data to understand its
structure
head(clouds)
Get a summary of each column in the data frame to check for any
anomalies or interesting points
summary(clouds)
Convert relevant columns to factors (categorical data type)
‘seeding’ indicates whether seeding occurred (‘no’ or ‘yes’)
clouds\(seeding <-
factor(clouds\)seeding, levels = c(“no”, “yes”)) # ‘echomotion’
indicates the motion of the radar echo (‘stationary’ or ‘moving’)
clouds\(echomotion <-
factor(clouds\)echomotion, levels = c(“stationary”,
“moving”))
Create a boxplot to visualize the distribution of rainfall based on
seeding status
ggplot(clouds, aes(x = seeding, y = rainfall)) + geom_boxplot() + #
Adds boxplots labs(title = “Rainfall by Seeding Status”, x = “Seeding”,
y = “Rainfall (cubic metres x 1e+8)”)
Calculate and display the mean and standard deviation of rainfall
for each seeding status
clouds %>% group_by(seeding) %>% summarize(mean_rainfall =
mean(rainfall), sd_rainfall = sd(rainfall))
Build a multiple linear regression model to predict rainfall
The independent variables are seeding, cloudcover, prewetness,
echomotion, and sne
model <- lm(rainfall ~ seeding + cloudcover + prewetness +
echomotion + sne, data = clouds) summary(model) # Display the summary of
the model, which includes coefficients and their significance
anova(model) # Perform an analysis of variance (ANOVA) on the model
Build a linear regression model for the seeding experiments
only
seeding_model <- lm(rainfall ~ sne, data = subset(clouds, seeding
== “yes”)) summary(seeding_model) # Display the summary of the model
Build a linear regression model for the non-seeding experiments
only
non_seeding_model <- lm(rainfall ~ sne, data = subset(clouds,
seeding == “no”)) summary(non_seeding_model) # Display the summary of
the model
Compare the coefficients of the two models (seeding
vs. non-seeding)
coefficients(seeding_model) # Coefficients for the seeding model
coefficients(non_seeding_model) # Coefficients for the non-seeding
model
Create a scatter plot with regression lines to visualize the
relationship between sne and rainfall
Separate lines are drawn for seeding and non-seeding data
ggplot(clouds, aes(x = sne, y = rainfall, color = seeding)) +
geom_point() + # Adds scatter points geom_smooth(method = “lm”, se =
FALSE) + # Adds linear regression lines without confidence intervals
labs(title = “Rainfall vs. Suitability Index (sne) by Seeding Status”, x
= “Suitability Index (sne)”, y = “Rainfall (cubic metres x 1e+8)”)
’’’
1. Which variables appear to influence rainfall the most?
Based on the summary of the multiple linear regression model, it
appears that ‘seeding’ and ‘echomotion’ have some influence on rainfall,
although their p-values are not highly significant. The ‘sne’ variable
also shows a relatively low p-value, suggesting it might be somewhat
influential.
2. Compare the coefficients for the two models, and produce a figure
showing the two models. What does the difference in slope suggest?
The coefficients from the two models (seeding and non-seeding) show
that ‘sne’ has a negative relationship with rainfall in both models.
However, the changes of the slope is different: it is steeper in the
seeding model (-2.22) compared to the non-seeding model (-1.05). This
suggests that the suitability index (sne) has a stronger negative impact
on rainfall when seeding occurs, showing that higher suitability indices
may result in less rainfall from seeded clouds compared to non-seeded
clouds.
Comments addressing the questions: