This commit is contained in:
ION606
2025-09-18 19:08:48 -04:00
2 changed files with 49 additions and 6 deletions
+7 -6
View File
@@ -2,6 +2,7 @@ library(readr)
library(EnvStats)
library(nortest)
# install.packages(c("readr", "EnvStats"))
# set working directory (relative path)
setwd("~/Desktop/Data Analytics/Lab 1")
@@ -15,7 +16,7 @@ epi.data <- read_csv("epi_results_2024_pop_gdp.csv")
View(epi.data)
# print summary of variables in dataframe
summary(epi.data$RLI.new)
summary(epi.data$epi_results_2024_pop_gdp.csv.new)
# print values in variable
epi.data$RLI.new
@@ -68,7 +69,7 @@ PHL.noNA
PHL.above30 <- PHL.noNA[PHL.noNA>30]
PHL.above30
# stats
summary(PHL.above30)
@@ -79,16 +80,16 @@ boxplot(RLI, PHL.above30, names = c("RHI","PHL"))
### Histograms ###
# histogram (frequency distribution)
hist(RLI)
# hist(RLI)
# define sequence of values over which to plot histogram
x <- seq(0., 100., 10)
# histogram (frequency distribution) over range
hist(RLI, x, prob=TRUE)
hist(RLI, x, breaks=brks, prob=TRUE)
# print estimated density curve for variable
lines(density(RLI,na.rm=TRUE,bw=1.)) # or try bw=“SJ”
lines(density(RLI, na.rm=TRUE)) # or try bw=“SJ”
# print rug
rug(RLI)
@@ -109,7 +110,7 @@ rug(RLI)
hist(RLI.new, breaks = "FD", prob=TRUE)
# range
x1<-seq(20,80,1)
x1<-seq(5,95,1)
# generate probability density values for a normal distribution with given mean and sd
d1 <- dnorm(x1,mean=45, sd=11,log=FALSE)