-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
512 lines (512 loc) · 18.5 KB
/
.Rhistory
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
font = list(
size = 12,
family = "Segoe UI Light"
),
title = "Bivariate Normal Distribution"
))
plot_ly(x=x1,y=x2,z=f,type = "surface")%>%layout(xaxis=list(title="x1"),yaxis=list(title="x2"),title="Bi-Variate Normal Distribution")
source("~/.active-rstudio-document", echo=TRUE)
source("~/.active-rstudio-document", echo=TRUE)
source("~/Mvn_Plot.R", echo=TRUE)
knitr::opts_chunk$set(
echo = FALSE,
message = FALSE,
warning = FALSE,
cache = TRUE,
dpi = 400)
#Loading Essential Libraries####
library(randtests)
library(kableExtra)
library(broom)
library(dplyr)
library(xlsx)
library(ggplot2)
library(tseries)
library(ggspectra)
library(ggfortify)
library(gt)
library(gtExtras)
library(ggthemes)
library(tidyr)
library(prettydoc)
library(hrbrthemes)
library(knitr)
library(gridExtra)
library(ie2misc)
library(zoo)
library(xts)
library(grid)
library(sysfonts)
library(showtext)
sysfonts::font_add("Economica","C:\\Users\\Debaditya\\AppData\\Local\\Microsoft\\Windows\\Fonts\\Economica-Bold.ttf")
knitr::include_graphics("upi_log.png")
#loading the data set####
upi<-xlsx::read.xlsx(file = "C:\\Users\\Debaditya\\Documents\\Project_Work\\UPI_Analytics.xlsx" ,sheetIndex = 1)
#converting the data set to a data frame for ease####
upi<-as.data.frame(upi)
#reversing the order of rows since we want the data to begin from 2016-04####
data1<-as.data.frame(t(rev(as.data.frame(t(upi)))))
colnames(data1)<-c("Month","No. of Banks live on UPI","Volume(In Mn)","Value(In Cr)","Volume(In Cr)")
val_time<-ts(data=as.numeric(data1$`Value(In Cr)`),start = c(2016,4),end=c(2024,2),deltat = 1/12)
vol_time<-ts(data=as.numeric(data1$`Volume(In Cr)`),start = c(2016,4),end=c(2024,2),deltat = 1/12)
per_trans<-ts(data=val_time/vol_time,start = c(2016,4),end = c(2024,2),deltat=1/12)
bank_num<-ts(data=as.numeric(data1$`No. of Banks live on UPI`),start=c(2016,4),end=c(2024,2),deltat = 1/12)
plot1<-ggplot()+
geom_line(data = upi,mapping = aes(x=upi$Month,y=upi$Value..in.Cr..,color="Value in Cr"),linewidth=1)+
labs(x="",
y = "Value In Cr",
color = "",title = "UPI Monthly Transaction Value ",subtitle = "2016-2024",caption = "Source : NPCI")+
theme_economist()+
theme(
plot.title = element_text(
family = "Economica",
face = "bold",
size = 16
),
plot.subtitle = element_text(
family = "Economica",
face="italic",
size = 11,hjust = 0),
axis.text.x = element_text(
family = "Economica",
size = 8),
plot.caption = element_text(
family = "Economica",
size = 9),
axis.title =element_text(
family = "Economica",
size = 9),
)
plot2<-ggplot()+
geom_line(data = upi,mapping = aes(x=upi$Month,y=upi$Volume..in.Cr..,color="Volume in Cr"),linewidth=1)+scale_color_manual(values = "yellow3")+
labs(x="",
y = "Volume In Cr",
color = "",title = "UPI Monthly Transaction Volume",subtitle = "2016-2024",caption = "Source :NPCI")+
theme_economist(base_family = "Economica")+
theme(
plot.title = element_text(
family = "Economica",
face = "bold",
size = 16
),
plot.subtitle = element_text(
family = "Economica",
face="italic",
size = 11,hjust = 0),
axis.text.x = element_text(
family = "Economica",
size = 8),
plot.caption = element_text(
family = "Economica",
size = 9),
axis.title =element_text(
family = "Economica",
size = 9),
)
grid.arrange(plot1, plot2, ncol=2)
regions <- tibble(x1 =as.Date("2016-04-01") , x2 = as.Date("2017-11-01"), y1 = -Inf, y2 = +Inf )
autoplot(per_trans,ts.fill = "blue4",ts.size =1)+
theme_economist(base_size = 3,base_family = "Economica")+
geom_rect(data = regions,
inherit.aes = FALSE,
mapping = aes(xmin = x1, xmax = x2,
ymin = y1, ymax = y2),
color = "transparent",
fill = "blue",
alpha = .2)+
geom_vline(xintercept =as.Date("2017-11-01"),linetype="dashed",color="green")+
labs(y="Amount Per Transaction in Rupee",title = "",caption = "Source : NPCI")+
theme(
plot.title = element_text(
family = "Economica",
face = "bold",
size = 16
),
plot.subtitle = element_text(
family = "Economica",
face="italic",
size = 11,hjust = 0),
axis.text.x = element_text(
family = "Economica",
size = 8),
plot.caption = element_text(
family = "Economica",
size = 9),
axis.title =element_text(
family = "Economica",
size = 9),
)
autoplot(bank_num,ts.fill = "green4",ts.size =1)+
theme_economist(base_size = 6,base_family = "Economica")+
labs(y="Number of Banks",title = "Number of Banks Live on UPI",subtitle = "2016-2024",caption = "Source : NPCI")+
theme(
plot.title = element_text(
family = "Economica",
face = "bold",
size = 16
),
plot.subtitle = element_text(
family = "Economica",
face="italic",
size = 11,hjust = 0),
axis.text.x = element_text(
family = "Economica",
size = 8),
plot.caption = element_text(
family = "Economica",
size = 9),
axis.title =element_text(
family = "Economica",
size = 9),
)
library(forecast)
smth_val<-ma(val_time,order = 6)
smth_vol<-ma(vol_time,order = 6)
plot1<-autoplot(val_time,colour = "green",ts.size = 1)+geom_line(aes(y=smth_val,color="Moving Average"),size=1)+labs(x="Year",y="Value Of total Transactions",color="",title = "UPI Transaction value per month",subtitle = "Moving average superimposed")+theme_economist()+
theme(
plot.title = element_text(
family = "Economica",
face = "bold",
size = 16
),
plot.subtitle = element_text(
family = "Economica",
face="italic",
size = 11,hjust = 0),
axis.text.x = element_text(
family = "Economica",
size = 8),
plot.caption = element_text(
family = "Economica",
size = 9),
axis.title =element_text(
family = "Economica",
size = 9)
)
plot2<-autoplot(vol_time,colour="blue",ts.size = 1)+geom_line(aes(y=smth_vol,color="Moving Average"),size=1)+labs(x="Year",y="Volume Of total Transactions",color="",title = "UPI Transaction volume per month",subtitle = "Moving average superimposed")+theme_economist()+
theme(
plot.title = element_text(
family = "Economica",
face = "bold",
size = 16
),
plot.subtitle = element_text(
family = "Economica",
face="italic",
size = 11,hjust = 0),
axis.text.x = element_text(
family = "Economica",
size = 8),
plot.caption = element_text(
family = "Economica",
size = 9),
axis.title =element_text(
family = "Economica",
size = 9)
)
grid.arrange(plot1, plot2, ncol=2)
#Creating Period instead of time observation
per1<-1:length(val_time)
#fitting the model
mod1<-nls(val_time~SSlogis(per1,k,b,a))
#Creating Period instead of time observation
per1<-1:length(val_time)
#fitting the model
mod1<-nls(val_time~SSlogis(per1,k,b,a))
#Creating Period instead of time observation
per2<-1:length(vol_time)
#fitting the model
mod2<-nls(vol_time~SSlogis(per2,k,b,a))
new1 <- data.frame(per1=1:150)
date11<- seq.Date(as.Date("2016/4/1"),by="month",length.out = length(val_time) )
date21<- seq.Date(as.Date("2016/4/1"),by="month",length.out = 150)
plot1<- ggplot()+
geom_line(aes(x=date21,y=predict(mod1,newdata = new1)),linewidth=1)+
scale_color_manual(values = "green")+
geom_point(aes(x=date11,y=val_time))+
labs(color="",title = 'Forecast based on logistic curve for \nMonthly UPI value metric',x="",y="")+
theme_ft_rc()+theme(plot.title = element_text(size = 12))
date12<-seq.Date(as.Date("2016/4/1"),by="month",length.out = length(vol_time) )
date22<-seq.Date(as.Date("2016/4/1"),by="month",length.out = 131)
new2 <- data.frame(per2=1:131)
plot2<-ggplot()+
geom_line(aes(x=date22,y=predict(mod2,newdata = new2)),linewidth=1)+
scale_color_manual(values = "green")+
geom_point(aes(x=date12,y=vol_time))+
labs(color="",title = 'Forecast based on logistic curve for \nMonthly UPI volume metric',x="",y="")+
theme_ft_rc()+theme(plot.title = element_text(size = 12))
grid.arrange(plot1, plot2, ncol=2)
mod1
summary(mod1)
plot(val_time-predict(mod1))
plot(log(val_time-predict(mod1)))
plot(log(val_time-predict(mod1))
plot(log(val_time-predict(mod1))
plot(val_time-predict(mod1))
source("~/.active-rstudio-document", echo=TRUE)
source("~/.active-rstudio-document", echo=TRUE)
plot(xx, yy, type = "l", axes = FALSE, ylim = c(0,6), xlim = c(-1, 5),
xlab = "", ylab = "", lwd = 2,
main = "Parameters in the SSlogis model")
mtext(quote(list(phi[1] == "Asym", phi[2] == "xmid", phi[3] == "scal")))
usr <- par("usr")
arrows(usr[1], 0, usr[2], 0, length = 0.1, angle = 25)
arrows(0, usr[3], 0, usr[4], length = 0.1, angle = 25)
text(usr[2] - 0.2, 0.1, "x", adj = c(1, 0))
text( -0.1, usr[4], "y", adj = c(1, 1))
abline(h = 5, lty = 3)
arrows(-0.8, c(2.1, 2.9),
-0.8, c(0, 5 ), length = 0.1, angle = 25)
text (-0.8, 2.5, quote(phi[1]))
segments(c(2,2.6,2.6), c(0, 2.5,3.5), # NB. SSlogis(x = xmid = 2) = 2.5
c(2,2.6,2 ), c(2.5,3.5,2.5), lty = 2, lwd = 0.75)
text(2, -.1, quote(phi[2]))
arrows(c(2.2, 2.4), 2.5,
c(2.0, 2.6), 2.5, length = 0.08, angle = 25)
text( 2.3, 2.5, quote(phi[3])); text(2.7, 3, "1")
par(op)
yy<-SSlogis(xx,k,b,a)# == SSlogis(xx, *):
yy<-SSlogis(xx)# == SSlogis(xx, *):
Chick.1 <- ChickWeight[ChickWeight$Chick == 1, ]
SSlogis(Chick.1$Time, 368, 14, 6) # response only
local({
Asym <- 368; xmid <- 14; scal <- 6
SSlogis(Chick.1$Time, Asym, xmid, scal) # response _and_ gradient
})
getInitial(weight ~ SSlogis(Time, Asym, xmid, scal), data = Chick.1)
## Initial values are in fact the converged one here, "Number of iter...: 0" :
fm1 <- nls(weight ~ SSlogis(Time, Asym, xmid, scal), data = Chick.1)
summary(fm1)
####Installing packages####
#install.packages("netstat")
library(tidyverse)#For data Cleaning
library(dplyr)#Data Wrangling
library(stringr)#String Manipulation
#library(purrr)
library(rvest)#static webpage scraping
library(RSelenium)#dynamic scraping
library(wdman)
library(netstat)#find unused port
library(data.table)#for the rbindlist function
####Settting up the server####
wdman::selenium()
chrome()
binman::list_versions("chromedriver")
chromecommmand<-chrome(retcommand = T,verbose = F,check = F)
#chromecommmand
rs_driver_object<-rsDriver(browser = "chrome",chromever = "104.0.5112.79",verbose = F,port = free_port())
binman::list_versions("chromedriver")
binman::list_versions("chromedriver")
binman::list_versions("chromedriver")
binman::list_versions("chromedriver")
####Installing packages####
#install.packages("netstat")
library(tidyverse)#For data Cleaning
library(dplyr)#Data Wrangling
library(stringr)#String Manipulation
#library(purrr)
library(rvest)#static webpage scraping
library(RSelenium)#dynamic scraping
library(wdman)
library(netstat)#find unused port
library(data.table)#for the rbindlist function
####Settting up the server####
wdman::selenium()
chrome()
####Settting up the server####
wdman::selenium()
####Settting up the server####
wdman::selenium()
# Assuming your dataframe is named df and you want the mean of a column named 'value'
team_means <- mk %>%
group_by(Team) %>%summary()
library(xlsx)
library(dplyr)
library(tidyverse)
# Assuming your dataframe is named df and you want the mean of a column named 'value'
team_means <- mk %>%
group_by(Team) %>%summary()
mk<-read.xlsx("Project_updated.xlsx",sheetIndex = 1)
setwd("Manik Project")
mk<-read.xlsx("Project_updated.xlsx",sheetIndex = 1)
mk<-mk[-1,]
mk <- mk %>%
# Create a group identifier based on the row number
mutate(group = (row_number() - 1) %/% 5) %>%
# Group by the new group identifier
group_by(group) %>%
# Fill the missing values in the team column with the first non-missing value in each group
fill(Team, .direction = "down") %>%
# Ungroup and remove the temporary group column
ungroup() %>%
select(-group)
mk <- mk %>% mutate(across(-2:-1,as.numeric))
mk<-mk[,-12:-10]
# Assuming your dataframe is named df and you want the mean of a column named 'value'
team_means <- mk %>%
group_by(Team) %>%summary()
team_means
View(team_means)
rm(team_means)
View(mk)
colnames(mk)[3:6]
colnames(mk)[4:6]
colnames(mk)[4:6]<-c("Income","Expenditure","Gross")
View(mk)
mk_num<-mk[,-1]
mk_num
mk_num<-mk[,-2:-1]
mk_num
cor(mk_num)
cor(mk_num,use = "everything")
mk <- mk %>% mutate(across(-2:-1,as.numeric))
mk<-mk[,-12:-10]
mk_num<-mk[,-2:-1]
mk<-read.xlsx("Project_updated.xlsx",sheetIndex = 1)
mk<-mk[-1,]
colnames(mk)[4:6]<-c("Income","Expenditure","Gross")
mk <- mk %>%
# Create a group identifier based on the row number
mutate(group = (row_number() - 1) %/% 5) %>%
# Group by the new group identifier
group_by(group) %>%
# Fill the missing values in the team column with the first non-missing value in each group
fill(Team, .direction = "down") %>%
# Ungroup and remove the temporary group column
ungroup() %>%
select(-group)
mk <- mk %>% mutate(across(-2:-1,as.numeric))
mk<-mk[,-12:-10]
mk<-read.xlsx("Project_updated.xlsx",sheetIndex = 1)
mk<-mk[-1,]
colnames(mk)[4:6]<-c("Income","Expenditure","Gross")
mk<-read.xlsx("Project_updated.xlsx",sheetIndex = 1)
mk<-mk[-1,]
colnames(mk)[4:6]<-c("Income","Expenditure","Gross")
mk<-mk[,-12:-10]
mk <- mk %>%
# Create a group identifier based on the row number
mutate(group = (row_number() - 1) %/% 5) %>%
# Group by the new group identifier
group_by(group) %>%
# Fill the missing values in the team column with the first non-missing value in each group
fill(Team, .direction = "down") %>%
# Ungroup and remove the temporary group column
ungroup() %>%
select(-group)
mk <- mk %>% mutate(across(-2:-1,as.numeric))
View(mk)
View(mk)
mk<-mk[-153:136,]
mk<-mk[-153:-136,]
View(mk)
mk_num<-mk[,-2:-1]
View(mk)
cor(mk_num,use = "complete.obs")
plot(cor(mk_num,use = "complete.obs"))
cor_mat<-cor(mk_num,use = "complete.obs")
corrplot::corrplot(cor_mat,method = "circle")
cor_mat<-cor(mk_num,use = "na.or.complete")
corrplot::corrplot(cor_mat,method = "circle")
cor_mat<-cor(mk_num,use = "all.obs")
cor_mat<-cor(mk_num,use = "pairwise.complete.obs")
corrplot::corrplot(cor_mat,method = "circle")
corrplot::corrplot(cor_mat)
View(mk)
mk$Points.Scored%>%hist()
mk$Points.Scored%>%hist(main="Histogram of Points Scored")
par(mfrow=c(2,2))
mk%>%plot(Average.Age.of.Players,Points.Scored)
mk%>%plot(Average.Age.of.Players,Points.Scored)
fill(mk)
fill(mk)<-mk_fil
mk_fil<-fill(mk)
mk_fil%>%plot(Average.Age.of.Players,Points.Scored)
View(mk_fil)
mk_fil%>%plot(Average.Age.of.Players,Points.Scored,Points.Scored)
na.omit(mk_fil)%>%plot(Average.Age.of.Players,Points.Scored,Points.Scored)
fin_mk<-na.omit(mk_fil)
plot(fin_mk$Average.Age.of.Players,fin_mk$Points.Scored,Points.Scored)
plot(fin_mk$Average.Age.of.Players,fin_mk$Points.Scored)
plot(fin_mk$Average.Age.of.Players,fin_mk$Points.Scored,xlab = "Average Age of players",ylab="Points Scored")
plot(fin_mk$Expenditure,fin_mk$Points.Scored,xlab = "Expenditure",ylab="Points Scored")
plot(fin_mk$Manager.s.Years.of.experience,fin_mk$Points.Scored,xlab="Managers Year of Experience", ylab="Points Scored")
View(fin_mk)
par(mfrow=c(2,2))
plot(fin_mk$Average.Age.of.Players,fin_mk$Points.Scored,xlab = "Average Age of players",ylab="Points Scored")
plot(fin_mk$Expenditure,fin_mk$Points.Scored,xlab = "Expenditure",ylab="Points Scored")
plot(fin_mk$Manager.s.Years.of.experience,fin_mk$Points.Scored,xlab="Managers Year of Experience", ylab="Points Scored")
cor_mat<-cor(fin_mk)
corrplot::corrplot(cor_mat)
cor_mat<-cor(fin_mk)
mk_num<-fin_mk[,-2:-1]
cor_mat<-cor(fin_mk)
cor_mat<-cor(mk_num)
corrplot::corrplot(cor_mat)
#Scatterplots
par(mfrow=c(2,2))
plot(fin_mk$Average.Age.of.Players,fin_mk$Points.Scored,xlab = "Average Age of players",ylab="Points Scored")
plot(fin_mk$Expenditure,fin_mk$Points.Scored,xlab = "Expenditure",ylab="Points Scored")
plot(fin_mk$Manager.s.Years.of.experience,fin_mk$Points.Scored,xlab="Managers Year of Experience", ylab="Points Scored")
mk$Points.Scored%>%hist(main="Histogram of Points Scored")
plot(fin_mk$Income,fin_mk$Points.Scored,xlab="Income", ylab="Points Scored")
#Scatterplots
par(mfrow=c(2,2),main="Scatterplot for Different Variables")
#Scatterplots
par(mfrow=c(2,2))
plot(fin_mk$Average.Age.of.Players,fin_mk$Points.Scored,xlab = "Average Age of players",ylab="Points Scored")
plot(fin_mk$Expenditure,fin_mk$Points.Scored,xlab = "Expenditure",ylab="Points Scored")
plot(fin_mk$Manager.s.Years.of.experience,fin_mk$Points.Scored,xlab="Managers Year of Experience", ylab="Points Scored")
plot(fin_mk$Income,fin_mk$Points.Scored,xlab="Income", ylab="Points Scored")
mk$Points.Scored%>%hist(main="Histogram of Points Scored")
mk$Points.Scored%>%hist(main="Histogram of Points Scored")
fin_mk%>%plot(Gross,Average.Age.of.Players)
plot(fin_mk$Gross,fin_mk$Average.Age.of.Players)
plot(fin_mk$Average.Age.of.Players,fin_mk$Gross)
plot(fin_mk)
plot(mk_num)
plot(fin_mk$Average.Age.of.Players,fin_mk$Manager.s.Years.of.experience,xlab="Average Age of players",ylab="Managers year of Experience")
plot(fin_mk$Average.Age.of.Players,fin_mk$Previous.Standing,xlab="Average Age of players",ylab="Previous Standings")
View(fin_mk)
fin_mk%>%lm(Points.Scored~Average.Age.of.Players+Manager.s.Years.of.experience+Gross+Previous.Standing)
lm(Points.Scored~Average.Age.of.Players+Manager.s.Years.of.experience+Gross+Previous.Standing,fin_mk)
model<-lm(Points.Scored~Average.Age.of.Players+Manager.s.Years.of.experience+Gross+Previous.Standing,fin_mk)
summary(model)
predict(model)
round(predict(model),digits = 0)
kk<-round(predict(model),digits = 0)
df1<-data.frame(fin_mk$Team,kk)
df1
plot(fin_mk$Previous.Standing,fin_mk$Manager.s.Years.of.experience,xlab="Average Age of players",ylab="Managers year of Experience")
plot(fin_mk$Previous.Standing,fin_mk$Manager.s.Years.of.experience,xlab="Previous Standing",ylab="Managers year of Experience")
plot(fin_mk$Gross,fin_mk$Manager.s.Years.of.experience,xlab="Financial Situation",ylab="Managers year of Experience")
plot(fin_mk$Average.Age.of.Players,fin_mk$Gross,xlab="Average Age of players",ylab="Financial Situation")
plot(fin_mk$Average.Age.of.Players,fin_mk$Manager.s.Years.of.experience,xlab="Average Age of players",ylab="Managers year of Experience")
plot(fin_mk$Average.Age.of.Players,fin_mk$Previous.Standing,xlab="Average Age of players",ylab="Previous Standings")
plot(fin_mk$Previous.Standing,fin_mk$Manager.s.Years.of.experience,xlab="Previous Standing",ylab="Managers year of Experience")
plot(fin_mk$Gross,fin_mk$Manager.s.Years.of.experience,xlab="Financial Situation",ylab="Managers year of Experience")
plot(fin_mk$Gross,fin_mk$Points.Scored,xlab = "Finanicial Situation",ylab="Points Scored")
plot(fin_mk$Expenditure,fin_mk$Points.Scored,xlab = "Expenditure",ylab="Points Scored")
plot(fin_mk$Previous.Standing,fin_mk$Gross,xlab="Previous Standing",ylab="Financial Situation")
colnames(df1)<-c("Team","Points")
team_means <- df1 %>%
group_by(Team) %>%
summarize(mean_value = round(mean(value, na.rm = TRUE),digits = 0))
team_means <- df1 %>%
group_by(Team) %>%
summarize(mean_value = round(mean(Points, na.rm = TRUE),digits = 0))
View(team_means)
standings<-sort(team_means,decreasing = T)
standings<-team_means%>%arrange(desc(mean_value))
View(standings)
#Modeling
model<-lm(Points.Scored~Average.Age.of.Players+Manager.s.Years.of.experience+Expenditure+Previous.Standing,fin_mk)
summary(model)
knitr::opts_chunk$set(echo = TRUE)
library(knitr)
library(kableExtra)
kable(standings,caption = "Predicted Standings")
colnames(standings)[2]<-"Predicted Points"
kable(standings,caption = "Predicted Standings")
library(writexl)
write.xlsx(standings,"Predicted Standings.xlsx")