-
Notifications
You must be signed in to change notification settings - Fork 0
/
delivery_time.R
106 lines (99 loc) · 3.54 KB
/
delivery_time.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
##Delivery_time
## independent variable or predictor = sorting time, dependent or response variable = delivery time
library('lattice')
library(psych)
summary(delivery_time$Delivery.Time)
summary(delivery_time$Sorting.Time)
attach(delivery_time)
dotplot(delivery_time)
boxplot(delivery_time)
qqnorm(Delivery.Time,pch=19)
qqline(Delivery.Time)
qqnorm(Sorting.Time,pch=19)
qqline(Sorting.Time,pch=19)
plot(delivery_time)
plot(Sorting.Time,prob=T) # this is showing positive relation
cor(Delivery.Time,Sorting.Time) ## correlation coefficient = 0.8259973 considerable
hist(Delivery.Time)
hist(Sorting.Time)
plot(Sorting.Time,Delivery.Time,main="Scatter plot", col = "Dodgerblue4",
col.main="Dodgerblue4",col.lab="green",ylab = "Delivery Time", xlab = "Sorting Time"
,pch=19)
reg_sim <- lm(Delivery.Time~Sorting.Time,data = delivery_time)
summary(reg_sim)
confint(reg_sim,level = 0.95)
pred_sim <- predict(reg_sim,interval = 'predict')
pred_sim <- as.data.frame(pred_sim)
cor_val_sim <- cor(pred_sim$fit,delivery_time) # 0.8259973
cor_val_sim <- as.data.frame(cor_val_sim)
cor_val_sim[1,1]
str(pred_sim)
confint(reg_sim,level = 0.95)
total_result <- data.frame(
'algoname' =NULL,
'correlation' = NULL
)
temp.data <- data.frame('reg_sim',cor_val_sim[1,1])
names(temp.data) <- c('algoname','correlation')
total_result <- rbind(total_result,temp.data)
total_result
reg_sqrt <- lm(Delivery.Time~sqrt(Sorting.Time), data = delivery_time)
summary(reg_sqrt)
confint(reg_sqrt)
pred_sqrt <- predict(reg_sqrt,interval = 'predict')
pred_sqrt
pred_sqrt <- as.data.frame(pred_sqrt)
cor_val_sqrt <- cor(pred_sqrt$fit,Sorting.Time)
cor_val_sqrt
temp.data <- data.frame('reg_sqrt',cor_val_sqrt)
names(temp.data) <- c('algoname','correlation')
total_result <- rbind(total_result,temp.data)
total_result
reg_log <- lm(Sorting.Time~log(Delivery.Time),data = delivery_time)
summary(reg_log)
confint(reg_log)
pred_log <- predict(reg_log,interval='predict')
pred_log
pred_log <- as.data.frame(pred_log)
cor_val_log <- cor(pred_log$fit,Delivery.Time)
cor_val_log
temp.data <- data.frame('reg_log',cor_val_log)
names(temp.data) <- c('algoname','correlation')
total_result <- rbind(total_result,temp.data)
total_result
reg_expo <- lm(log(Delivery.Time)~Sorting.Time + I(Sorting.Time*Sorting.Time),data = delivery_time)
summary(reg_expo)
pred_expo <- predict(reg_expo,interval = 'predict')
pred_expo <- as.data.frame(pred_expo)
pred_expo
pred_expo$fit <- exp(pred_expo$fit)
pred_expo
cor_val_expo <- cor(pred_expo$fit,Delivery.Time)
cor_val_expo
temp.data <- data.frame('pred_expo',cor_val_expo)
names(temp.data) <- c('algoname','correlation')
total_result <- rbind(total_result,temp.data)
total_result
reg_sqrt_dil <- lm(sqrt(Delivery.Time)~Sorting.Time,data = delivery_time)
summary(reg_sqrt_dil)
pred_sqrt_dil <- predict(reg_sqrt_dil,interval = 'predict')
pred_sqrt_dil
pred_sqrt_dil <- as.data.frame(pred_sqrt_dil)
cor_val_sqrt_dil <- cor(pred_sqrt_dil$fit,Delivery.Time)
cor_val_sqrt_dil
temp.data <- data.frame('reg_sqrt_dil',cor_val_sqrt_dil)
names(temp.data) <- c('algoname','correlation')
total_result <- rbind(total_result,temp.data)
total_result
reg_log_at <- lm(log(Delivery.Time)~Sorting.Time,data = delivery_time)
summary(reg_log_at)
pred_log_at <- predict(reg_log_at,interval = 'predict')
pred_log_at
pred_log_at <- as.data.frame(pred_log_at)
pred_log_at$fit <- exp(pred_log_at$fit)
cor_val_log_at <- cor(pred_log_at$fit,Sorting.Time)
cor_val_log_at
temp.data <- data.frame('reg_log_at',cor_val_log_at)
names(temp.data) <- c('algoname','correlation')
total_result <- rbind(total_result,temp.data)
rm(total_result[6,])