some edit
This commit is contained in:
parent
20e525668d
commit
ff0613b39f
|
|
@ -56,9 +56,9 @@ cpd$test_inclusion = as.logical(cpd$test_inclusion)
|
|||
cpd$issue_tag = as.logical(cpd$issue_tag)
|
||||
|
||||
|
||||
cpd$repo_id = interaction("prj",cpd$repo_id)
|
||||
#cpd$repo_id = interaction("prj",cpd$repo_id)
|
||||
cpd$repo_id = as.factor(cpd$repo_id)
|
||||
cpd$pair = interaction("pair",cpd$pair)
|
||||
#cpd$pair = interaction("pair",cpd$pair)
|
||||
cpd$pair = as.factor(cpd$pair)
|
||||
cpd$final_check = as.factor(cpd$final_check)
|
||||
|
||||
|
|
@ -90,75 +90,20 @@ biserial.cor(cpd$churn, cpd$test_inclusion, use = c("all.obs", "complete.obs"),
|
|||
library(pROC)
|
||||
# build Conditional logistic regression for paired data
|
||||
library("survival")
|
||||
library(mclogit)
|
||||
library(MuMIn)
|
||||
library(performance)
|
||||
library(DescTools)
|
||||
library(JWileymisc)
|
||||
library(rcompanion)
|
||||
library(pubh)
|
||||
library(descr)
|
||||
data("electors")
|
||||
|
||||
|
||||
#########################################################
|
||||
|
||||
|
||||
library(lme4)
|
||||
|
||||
|
||||
dd <- within(electors,party.time<-interaction(party,time))
|
||||
dd <- within(dd,class.time<-interaction(time,class))
|
||||
#########################################################
|
||||
# 1. submitter-level
|
||||
|
||||
#-------------
|
||||
|
||||
library(mlogit)
|
||||
dp.CLR1 <- clogit(prefer~
|
||||
dp.CLR1 <- mclogit(cbind(prefer,pair)~
|
||||
log(prev_pullreqs+0.5)+ log(followers+0.5)
|
||||
+ first_pr_proj+ author_core + log(co_occur_strength+0.5)
|
||||
+ strata(pair)
|
||||
+ (1|repo_id)
|
||||
,
|
||||
data=cpd
|
||||
)
|
||||
|
||||
|
||||
dp.CLR1 <- glmer(prefer~
|
||||
log(prev_pullreqs+0.5)+ log(followers+0.5)
|
||||
+ first_pr_proj+ author_core + log(co_occur_strength+0.5)
|
||||
+ (1|repo_id),
|
||||
data=cpd,
|
||||
family="binomial"
|
||||
)
|
||||
|
||||
model_performance(dp.CLR1)
|
||||
r2.mmclogit(dp.CLR1)
|
||||
|
||||
logLik(dp.CLR1)
|
||||
logLik(dp.CLR0)
|
||||
|
||||
as.vector(logLik(dp.CLR0) - logLik(dp.CLR1)) / logLik(dp.CLR0)
|
||||
|
||||
#Pesudo R square
|
||||
#x = full model deviance
|
||||
#y = null model deviance
|
||||
#k = number of parameters
|
||||
|
||||
x = logLik(dp.CLR1)
|
||||
y = logLik(dp.CLR0)
|
||||
k = 5
|
||||
|
||||
PRsq<- function (x, y, k ) {
|
||||
a= 1- (x/y)
|
||||
b= 1- ((x-k)/y)
|
||||
cat ("Pesudo R Square Estimates", "\n")
|
||||
cat ("McFadden's: ", a, "\n")
|
||||
cat ("adjusted McFadden's: ", b, "\n")
|
||||
}
|
||||
|
||||
PRsq(x,y,k)
|
||||
|
||||
vif(dp.CLR1)
|
||||
summary(dp.CLR1)
|
||||
prob=predict(dp.CLR1, type='response')
|
||||
cpd$prob=prob
|
||||
|
|
@ -166,7 +111,16 @@ a = roc(prefer ~ prob, data = cpd)
|
|||
a
|
||||
|
||||
|
||||
prob=predict(dp.CLR1, type='risk')
|
||||
dp.CLR1 <- clogit(prefer~
|
||||
log(prev_pullreqs+0.5)+ log(followers+0.5)
|
||||
+ first_pr_proj+ author_core + log(co_occur_strength+0.5)
|
||||
+ strata(pair)
|
||||
+repo_id
|
||||
,
|
||||
data=cpd
|
||||
)
|
||||
summary(dp.CLR1)
|
||||
prob=predict(dp.CLR, type='risk')
|
||||
cpd$prob=prob
|
||||
a = roc(prefer ~ prob, data = cpd)
|
||||
a
|
||||
|
|
@ -235,7 +189,7 @@ dp.CLR <- mclogit(cbind(prefer,pair) ~
|
|||
+ BT
|
||||
+ CLA
|
||||
+ CR
|
||||
+ (1 | repo_id)
|
||||
#+ (1 | repo_id)
|
||||
#+ final_check
|
||||
#+ log(total_checks+0.5)
|
||||
#+ log(check_tools+0.5)
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue