-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregression.R
More file actions
28 lines (17 loc) · 753 Bytes
/
regression.R
File metadata and controls
28 lines (17 loc) · 753 Bytes
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
#importing data
nfl.df = read.csv(file = "summary.csv")
View(nfl.df)
#regression equation
lrPoints = lm(Total.Points~ (Average.Starting.Field.Position + Median.Rush.Yards + Median.Pass.Yards + Sacks + Big.Plays + Time.Of.Possession + Number.Of.Runs), data = nfl.df)
summary(lrPoints)
lrPoints = lm(Total.Points ~ Big.Plays)
summary(lrPoints)$coefficients[1]
# values = nfl.df
# values[,2] = nfl.df[,2] * summary(lrPoints)$coefficients[2]
# values[,3] = nfl.df[,3] * summary(lrPoints)$coefficients[3]
# values[,4] = nfl.df[,4] * summary(lrPoints)$coefficients[4]
# values[,5] = nfl.df[,5] * summary(lrPoints)$coefficients[5]
# values[,6]
View(values)
abline = lm(Total.Points~Big.Plays, data = nfl.df)
plot(abline)