-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake_table_stat_fn.R
35 lines (29 loc) · 1.36 KB
/
make_table_stat_fn.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
# Function to generate a table for npa results-summary with bivariate data,
# this one about asymmetry of tail dependence
fractxt<-function(fracval,numsurrog){
ptxt<-''
if (fracval>.5*numsurrog){
ptxt<-paste(">",fracval,sep='')
}
if (fracval<=.5*numsurrog){
ptxt<-paste("<",numsurrog-fracval,sep='')
}
return(ptxt)
}
make_table_stat_fn<-function(data){
#atdres<-data.frame(Statistic=c("$\\cor_{0,0.1}-\\cor_{0.9,1}$",
# "$\\Ps_{0,0.1}-\\Ps_{0.9,1}$",
# "$\\Dsq_{0.9,1}-\\Dsq_{0,0.1}$"),
atdres<-data.frame(Statistic=c("cor$_{FS}$-cor$_{LS}$",
"P$_{FS}$-P$_{LS}$",
"D$_{LS}^2$-D$_{FS}^2$"),
Kendall=rep("",3),
Spearman=rep("",3),stringsAsFactors = F)
atdres[1,2]<-fractxt(data$corlmcoru_frac_K,numsurrog = data$numsurrog_success_K)
atdres[1,3]<-fractxt(data$corlmcoru_frac_S,numsurrog = data$numsurrog_success_S)
atdres[2,2]<-fractxt(data$PlmPu_frac_K,numsurrog = data$numsurrog_success_K)
atdres[2,3]<-fractxt(data$PlmPu_frac_S,numsurrog = data$numsurrog_success_S)
atdres[3,2]<-fractxt(data$D2umD2l_frac_K,numsurrog = data$numsurrog_success_K)
atdres[3,3]<-fractxt(data$D2umD2l_frac_S,numsurrog = data$numsurrog_success_S)
return(atdres)
}