-
Notifications
You must be signed in to change notification settings - Fork 0
/
tdv_jeremy 2.R
55 lines (41 loc) · 1.42 KB
/
tdv_jeremy 2.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
#I didn't end up using this script
library(ggplot2)
library(pastecs)
Technicaldebt <- read.csv("C:\\Users\\Jeremy\\Desktop\\tdv.csv")
attach(Technicaldebt)
loc = Technicaldebt$loc
activeDevs = Technicaldebt$activedevs
totalDevs=Technicaldebt$totaldevs
yearcount=Technicaldebt$yearcount
totaluniquedevs=Technicaldebt$totaluniquedevs
bugcount=Technicaldebt$bugcount
vulnerabilities=Technicaldebt$vulerabilities.in.the.last.10.versions
cocomo=Technicaldebt$cocomo
cor(bugcount,vulnerabilities, method = 'pearson')
# correlation=.35
cor(finaldata$cocomo,finaldata$vulnerabilities)
#NA
cor(finaldata$activedevs, finaldata$totaldevs)
'Linear Model'
lm.out=lm(vulnerabilities~cocomo)
summary(lm.out)
'Residuals'
lm.resid <- resid(lm.out)
'Fitted Values'
lm.fitted <- fitted(lm.out)
'Normal Probability Plots'
qqnorm(vulnerabilities, main = 'Normal Probability Plot of Vulnerabilities')
qqnorm(cocomo, main = 'Normal Probability Plot of Cocomo')
'Residual Plots - Check for equal variance'
qplot(lm.fitted, lm.resid) + geom_hline(yintercept = 0)
'----Root Transormation----'
root.vuln <- (vulnerabilities)^.25
root.cocomo <- (cocomo)^.25
'Fitted model after transformation'
log.lm <- lm(root.vuln~root.cocomo)
trans.resid <- resid(log.lm)
trans.fitted <- fitted(log.lm)
'Zero values for vulnerabilities are messing with data, but this looks better'
qqnorm(root.vuln)
qqnorm(root.cocomo)
qplot(trans.fitted, trans.resid) + geom_hline(yintercept = 0)