View(covid19_2)
sum_of_X=sum(covid19_2$Confirmed)
sum_of_Y=sum(covid19_2$Deaths)
sum_of_X2=sum( covid19_2$Confirmed ^2 )
sum_of_Y2=sum( covid19_2$Deaths ^2 )
sum_of_XY=sum( (covid19_2$Confirmed) *(covid19_2$Deaths) )
plot(Confirmed, Deaths, main = "scatterplot of confirmed cases and deaths",xlab = "Confirmed cases", ylab = "Deaths",pch=20)
cor(Confirmed, Deaths, method = "pearson")
abline(lm(Deaths ~ Confirmed, data = covid19_2), col="red")
library(readr)
covid19_2 <- read_csv("~/PSDA PROJECT2/DATA DOSM/covid19 2.csv")
View(covid19_2)
sum_of_X=sum(covid19_2$Confirmed)
sum_of_Y=sum(covid19_2$Deaths)
sum_of_X2=sum( covid19_2$Confirmed ^2 )
sum_of_Y2=sum( covid19_2$Deaths ^2 )
sum_of_XY=sum( (covid19_2$Confirmed) *(covid19_2$Deaths) )
plot(Confirmed, Deaths, main = "scatterplot of confirmed cases and deaths",xlab = "Confirmed cases", ylab = "Deaths",pch=20)
cor(Confirmed, Deaths, method = "pearson")
abline(lm(Deaths ~ Confirmed, data = covid19_2), col="red")
View(covid19_2)
sum_of_X=sum(covid19_2$Confirmed)
sum_of_Y=sum(covid19_2$Deaths)
sum_of_X2=sum( covid19_2$Confirmed ^2 )
sum_of_Y2=sum( covid19_2$Deaths ^2 )
sum_of_XY=sum( (covid19_2$Confirmed) *(covid19_2$Deaths) )
plot(Confirmed, Deaths, main = "scatterplot of confirmed cases and deaths",xlab = "Confirmed cases", ylab = "Deaths",pch=20)
cor(Confirmed, Deaths, method = "pearson")
abline(lm(Deaths ~ Confirmed, data = covid19_2), col="red")
View(covid19_2)
plot(Confirmed, Deaths, main = "scatterplot of confirmed cases and deaths",xlab = "Confirmed cases", ylab = "Deaths",pch=20)
cor(Confirmed, Deaths, method = "pearson")
abline(lm(Deaths ~ Confirmed, data = covid19_2), col="red")
View(covid19_2)
sum_of_X=sum(covid19_2$Confirmed)
sum_of_Y=sum(covid19_2$Deaths)
sum_of_X2=sum( covid19_2$Confirmed ^2 )
sum_of_Y2=sum( covid19_2$Deaths ^2 )
sum_of_XY=sum( (covid19_2$Confirmed) *(covid19_2$Deaths) )
plot(Confirmed, Deaths, main = "scatterplot of confirmed cases and deaths",xlab = "Confirmed cases", ylab = "Deaths",pch=20)
cor(Confirmed, Deaths, method = "pearson")
abline(lm(Deaths ~ Confirmed, data = covid19_2), col="red")
View(covid19_2)
sum_of_X=sum(covid19_2$Confirmed)
sum_of_Y=sum(covid19_2$Deaths)
sum_of_X2=sum( covid19_2$Confirmed ^2 )
sum_of_Y2=sum( covid19_2$Deaths ^2 )
sum_of_XY=sum( (covid19_2$Confirmed) *(covid19_2$Deaths) )
attach(covid19_2)
plot(Confirmed, Deaths, main = "scatterplot of confirmed cases and deaths",xlab = "Confirmed cases", ylab = "Deaths",pch=20)
cor(Confirmed, Deaths, method = "pearson")
abline(lm(Deaths ~ Confirmed, data = covid19_2), col="red")
View(covid19_2)
sum_of_X=sum(covid19_2$Confirmed)
sum_of_Y=sum(covid19_2$Deaths)
sum_of_X2=sum( covid19_2$Confirmed ^2 )
sum_of_Y2=sum( covid19_2$Deaths ^2 )
sum_of_XY=sum( (covid19_2$Confirmed) *(covid19_2$Deaths) )
attach(covid19_2)
plot(Confirmed, Deaths, main = "scatterplot of confirmed cases and deaths",xlab = "Confirmed cases", ylab = "Deaths",pch=20)
cor(Confirmed, Deaths, method = "pearson")
abline(lm(Deaths ~ Confirmed, data = covid19_2), col="red")
View(covid19_2)
sum_of_X=sum(covid19_2$Confirmed)
sum_of_Y=sum(covid19_2$Deaths)
sum_of_X2=sum( covid19_2$Confirmed ^2 )
sum_of_Y2=sum( covid19_2$Deaths ^2 )
sum_of_XY=sum( (covid19_2$Confirmed) *(covid19_2$Deaths) )
attach(covid19_2)
plot(Confirmed, Deaths, main = "scatterplot of confirmed cases and deaths",xlab = "Confirmed cases", ylab = "Deaths",pch=20)
cor(Confirmed, Deaths, method = "pearson")
abline(lm(Deaths ~ Confirmed, data = covid19_2), col="red")
View(covid19_2)
sum_of_X=sum(covid19_2$Confirmed)
sum_of_Y=sum(covid19_2$Deaths)
sum_of_X2=sum( covid19_2$Confirmed ^2 )
sum_of_Y2=sum( covid19_2$Deaths ^2 )
sum_of_XY=sum( (covid19_2$Confirmed) *(covid19_2$Deaths) )
plot(covid19_2$Confirmed, covid19_2$Deaths, main = "scatterplot of confirmed cases and deaths",xlab = "Confirmed cases", ylab = "Deaths",pch=20)
cor(covid19_2$Confirmed, covid19_2$Deaths, method = "pearson")
abline(lm(covid19_2$Deaths  ~ covid, data = covid19_2), col="red")
View(covid19_2)
sum_of_X=sum(covid19_2$Confirmed)
sum_of_Y=sum(covid19_2$Deaths)
sum_of_X2=sum( covid19_2$Confirmed ^2 )
sum_of_Y2=sum( covid19_2$Deaths ^2 )
sum_of_XY=sum( (covid19_2$Confirmed) *(covid19_2$Deaths) )
attach(covid19_2)
plot(covid19_2$Confirmed, covid19_2$Deaths, main = "scatterplot of confirmed cases and deaths",xlab = "Confirmed cases", ylab = "Deaths",pch=20)
cor(covid19_2$Confirmed, covid19_2$Deaths, method = "pearson")
abline(lm(covid19_2$Deaths ~ covid19_2$Confirmed, data = covid19_2), col="red")
View(covid19_2)
sum_of_X=sum(covid19_2$Confirmed)
sum_of_Y=sum(covid19_2$Deaths)
sum_of_X2=sum( covid19_2$Confirmed ^2 )
sum_of_Y2=sum( covid19_2$Deaths ^2 )
sum_of_XY=sum( (covid19_2$Confirmed) *(covid19_2$Deaths) )
plot(covid19_2$Confirmed, covid19_2$Deaths, main = "scatterplot of confirmed cases and deaths",xlab = "Confirmed cases", ylab = "Deaths",pch=20)
cor(covid19_2$Confirmed, covid19_2$Deaths, method = "pearson")
abline(lm(covid19_2$Deaths ~ covid19_2$Confirmed, data = covid19_2), col="red")
View(covid19_2)
sum_of_X=sum(covid19_2$Confirmed)
sum_of_Y=sum(covid19_2$Deaths)
sum_of_X2=sum( covid19_2$Confirmed ^2 )
sum_of_Y2=sum( covid19_2$Deaths ^2 )
sum_of_XY=sum( (covid19_2$Confirmed) *(covid19_2$Deaths) )
plot(covid19_2$Confirmed, covid19_2$Deaths, main = "scatterplot of confirmed cases and deaths",xlab = "Confirmed cases", ylab = "Deaths",pch=20)
cor(covid19_2$Confirmed, covid19_2$Deaths, method = "pearson")
abline(lm(covid19_2$Deaths ~ covid19_2$Confirmed, data = covid19_2), col="red")
x=88
n=113
p=0.5
q=1-p
p_=x/n
z=(p_-p)/(sqrt(p*q/n))
alpha=0.05
z.alpha=qnorm(1-alpha)
prop.test(x,n,p,correct=FALSE,alternative = "greater")
df <- data.frame(states=c("Selangor","WP Kuala Lumpur","N Sembilan","Johor","Sarawak",
"Pahang","Sabah","Perak","Melaka","Kelantan","P Pinang",
"Terengganu","Kedah","WP Putrajaya","Perlis","WP Labuan"),
newcase=c(8,38,0,0,0,0,0,0,0,0,0,0,0,1,0,0),
deaths=c(21,17,8,19,17,6,5,6,5,3,1,1,1,1,2,0) )
df
x <- c(8,38,0,0,0,0,0,0,0,0,0,0,0,1,0,0)
y <- c(21,17,8,19,17,6,5,6,5,3,1,1,1,1,2,0)
relation <- lm(y~x)
print(relation)
print(summary(relation))
plot(x,y,col = "black",main = "Regression of New cases on 17/5/2020 & Total Deaths according states ",
cex = 1.3,pch = 16,xlab = "New Cases ",ylab = "Deaths")
abline(lm(y~x),col="red")
#predict deaths with new cases=10
a <- data.frame(x =10)
result <-  predict(relation,a)
print(result)
View(covid19_2)
cor(covid19_2$Deaths,covid19_2$`New Cases` )
df <- data.frame(states=c("Selangor","WP Kuala Lumpur","N Sembilan","Johor","Sarawak",
"Pahang","Sabah","Perak","Melaka","Kelantan","P Pinang",
"Terengganu","Kedah","WP Putrajaya","Perlis","WP Labuan"),
newcase=c(8,38,0,0,0,0,0,0,0,0,0,0,0,1,0,0),
deaths=c(21,17,8,19,17,6,5,6,5,3,1,1,1,1,2,0) )
df
x <- c(8,38,0,0,0,0,0,0,0,0,0,0,0,1,0,0)
y <- c(21,17,8,19,17,6,5,6,5,3,1,1,1,1,2,0)
relation <- lm(y~x)
print(relation)
print(summary(relation))
ggplot(covid19_2, aes(x = covid19_2$`New Cases`, y = covid19_2$Deaths)) +
geom_point() +
stat_smooth(method = lm)
#predict deaths with new cases=100
a <- data.frame(x =100)
result <-  predict(relation,a)
print(result)
confint(relation)
sigma(relation)*100/mean(covid19_2$Deaths)
ggplot
library(ggplot)
library(ggplot2)
View(covid19_2)
cor(covid19_2$Deaths,covid19_2$`New Cases` )
df <- data.frame(states=c("Selangor","WP Kuala Lumpur","N Sembilan","Johor","Sarawak",
"Pahang","Sabah","Perak","Melaka","Kelantan","P Pinang",
"Terengganu","Kedah","WP Putrajaya","Perlis","WP Labuan"),
newcase=c(8,38,0,0,0,0,0,0,0,0,0,0,0,1,0,0),
deaths=c(21,17,8,19,17,6,5,6,5,3,1,1,1,1,2,0) )
df
x <- c(8,38,0,0,0,0,0,0,0,0,0,0,0,1,0,0)
y <- c(21,17,8,19,17,6,5,6,5,3,1,1,1,1,2,0)
relation <- lm(y~x)
print(relation)
print(summary(relation))
ggplot(covid19_2, aes(x = covid19_2$`New Cases`, y = covid19_2$Deaths)) +
geom_point() +
stat_smooth(method = lm)
#predict deaths with new cases=100
a <- data.frame(x =100)
result <-  predict(relation,a)
print(result)
confint(relation)
sigma(relation)*100/mean(covid19_2$Deaths)
install.packages("ggplot2")
library("ggplot2")
View(covid19_2)
cor(covid19_2$Deaths,covid19_2$`New Cases` )
df <- data.frame(states=c("Selangor","WP Kuala Lumpur","N Sembilan","Johor","Sarawak",
"Pahang","Sabah","Perak","Melaka","Kelantan","P Pinang",
"Terengganu","Kedah","WP Putrajaya","Perlis","WP Labuan"),
newcase=c(8,38,0,0,0,0,0,0,0,0,0,0,0,1,0,0),
deaths=c(21,17,8,19,17,6,5,6,5,3,1,1,1,1,2,0) )
df
x <- c(8,38,0,0,0,0,0,0,0,0,0,0,0,1,0,0)
y <- c(21,17,8,19,17,6,5,6,5,3,1,1,1,1,2,0)
relation <- lm(y~x)
print(relation)
print(summary(relation))
ggplot(covid19_2, aes(x = covid19_2$`New Cases`, y = covid19_2$Deaths)) +
geom_point() +
stat_smooth(method = lm)
#predict deaths with new cases=100
a <- data.frame(x =100)
result <-  predict(relation,a)
print(result)
confint(relation)
sigma(relation)*100/mean(covid19_2$Deaths)
install.packages("ggplot2")
View(covid19_2)
cor(covid19_2$Deaths,covid19_2$`New Cases` )
df <- data.frame(states=c("Selangor","WP Kuala Lumpur","N Sembilan","Johor","Sarawak",
"Pahang","Sabah","Perak","Melaka","Kelantan","P Pinang",
"Terengganu","Kedah","WP Putrajaya","Perlis","WP Labuan"),
newcase=c(8,38,0,0,0,0,0,0,0,0,0,0,0,1,0,0),
deaths=c(21,17,8,19,17,6,5,6,5,3,1,1,1,1,2,0) )
df
x <- c(8,38,0,0,0,0,0,0,0,0,0,0,0,1,0,0)
y <- c(21,17,8,19,17,6,5,6,5,3,1,1,1,1,2,0)
relation <- lm(y~x)
print(relation)
print(summary(relation))
ggplot(covid19_2, aes(x = covid19_2$`New Cases`, y = covid19_2$Deaths)) +
geom_point() +
stat_smooth(method = lm)
#predict deaths with new cases=100
a <- data.frame(x =100)
result <-  predict(relation,a)
print(result)
confint(relation)
sigma(relation)*100/mean(covid19_2$Deaths)
library(readr)
covid19_2 <- read_csv("~/PSDA PROJECT2/DATA DOSM/covid19 2.csv")
View(covid19_2)
View(covid19_2)
cor(covid19_2$Deaths,covid19_2$`New Cases` )
df <- data.frame(states=c("Selangor","WP Kuala Lumpur","N Sembilan","Johor","Sarawak",
"Pahang","Sabah","Perak","Melaka","Kelantan","P Pinang",
"Terengganu","Kedah","WP Putrajaya","Perlis","WP Labuan"),
newcase=c(8,38,0,0,0,0,0,0,0,0,0,0,0,1,0,0),
deaths=c(21,17,8,19,17,6,5,6,5,3,1,1,1,1,2,0) )
df
x <- c(8,38,0,0,0,0,0,0,0,0,0,0,0,1,0,0)
y <- c(21,17,8,19,17,6,5,6,5,3,1,1,1,1,2,0)
relation <- lm(y~x)
print(relation)
print(summary(relation))
ggplot(covid19_2, aes(x = covid19_2$`New Cases`, y = covid19_2$Deaths)) +
geom_point() +
stat_smooth(method = lm)
#predict deaths with new cases=100
a <- data.frame(x =100)
result <-  predict(relation,a)
print(result)
confint(relation)
sigma(relation)*100/mean(covid19_2$Deaths)
library(ggplot2)
View(covid19_2)
cor(covid19_2$Deaths,covid19_2$`New Cases` )
df <- data.frame(states=c("Selangor","WP Kuala Lumpur","N Sembilan","Johor","Sarawak",
"Pahang","Sabah","Perak","Melaka","Kelantan","P Pinang",
"Terengganu","Kedah","WP Putrajaya","Perlis","WP Labuan"),
newcase=c(8,38,0,0,0,0,0,0,0,0,0,0,0,1,0,0),
deaths=c(21,17,8,19,17,6,5,6,5,3,1,1,1,1,2,0) )
df
x <- c(8,38,0,0,0,0,0,0,0,0,0,0,0,1,0,0)
y <- c(21,17,8,19,17,6,5,6,5,3,1,1,1,1,2,0)
relation <- lm(y~x)
print(relation)
print(summary(relation))
ggplot(covid19_2, aes(x = covid19_2$`New Cases`, y = covid19_2$Deaths)) +
geom_point() +
stat_smooth(method = lm)
#predict deaths with new cases=100
a <- data.frame(x =100)
result <-  predict(relation,a)
print(result)
confint(relation)
sigma(relation)*100/mean(covid19_2$Deaths)
library(readr)
covid19_3 <- read_csv("PSDA PROJECT2/DATA DOSM/covid19 3.csv")
View(covid19_2)
x=88
n=113
p=0.5
q=1-p
p_=x/n
z=(p_-p)/(sqrt(p*q/n))
alpha=0.05
z.alpha=qnorm(1-alpha)
prop.test(x,n,p,correct=FALSE,alternative = "greater")
library(readr)
covid19_3 <- read_csv("~/PSDA PROJECT2/DATA DOSM/covid19 3.csv")
View(covid19_3)
library(readr)
covid19_3 <- read_csv("PSDA PROJECT2/DATA DOSM/covid19 3.csv")
View(covid19_2)
x=88
n=113
p=0.5
q=1-p
p_=x/n
z=(p_-p)/(sqrt(p*q/n))
alpha=0.05
z.alpha=qnorm(1-alpha)
prop.test(x,n,p,correct=FALSE,alternative = "greater")
library(readr)
covid19_3 <- read_csv("~/PSDA PROJECT2/DATA DOSM/covid19 3.csv")
View(covid19_3)
library(readr)
covid19_3 <- read_csv("~/PSDA PROJECT2/DATA DOSM/covid19 3.csv")
View(covid19_2)
x=88
n=113
p=0.5
q=1-p
p_=x/n
z=(p_-p)/(sqrt(p*q/n))
alpha=0.05
z.alpha=qnorm(1-alpha)
prop.test(x,n,p,correct=FALSE,alternative = "greater")
library(readr)
covid19_3 <- read_csv("~/PSDA PROJECT2/DATA DOSM/covid19 3.csv")
View(covid19_2)
x=88
n=113
p=0.5
q=1-p
p_=x/n
z=(p_-p)/(sqrt(p*q/n))
alpha=0.05
z.alpha=qnorm(1-alpha)
prop.test(x,n,p,correct=FALSE,alternative = "greater")
