id
stringlengths 40
40
| repo_name
stringlengths 5
110
| path
stringlengths 2
233
| content
stringlengths 0
1.03M
⌀ | size
int32 0
60M
⌀ | license
stringclasses 15
values |
---|---|---|---|---|---|
31ea9fcd32a4abbe86e6955e8439ecbc1ab20520 | chendaniely/multidisciplinary-diffusion-model-experiments | staging/recurrent/src/helper-goodness.R | ################################################################################
#
# Goodness calculation functions
#
################################################################################
get_input_i <- function(unit_number){
input <- 0
return(input)
}
get_bias_i <- function(i_j_index_number){
bias <- 1
return(bias)
}
#' get index values for all other nodes in the
#' 'input', 'hidden', and 'inputmirror' banks
get_ks <- function(i_or_j, i_value, j_value, num_units_per_bank_0,
num_units_per_hidden_bank_0){
all_same_bank_number <- c(0:num_units_per_bank_0)
same_bank <-all_same_bank_number[!all_same_bank_number %in% c(i_value,
j_value)]
opposite_bank <- ifelse(i_or_j == 'i', i_value, j_value)
hidden_bank <- c(0:num_units_per_hidden_bank_0)
return(list(same_bank = same_bank,
opposite_bank = opposite_bank,
hidden_bank = hidden_bank))
}
k_ai <- get_ks('i', a_i_index, a_j_index, num_units_per_bank_0, 9)
k_ai
#' get activation value for a_k
#' currently returns 0.5
get_a_k <- function(){
return(0.5)
}
#'get
get_w_ij_k <- function(index_in_unlist_k_ai){
}
#' First term of the Goodness function on the 2 activation units
#' 2 activation units share 1 weight between them
#' \sum_{i}\sum_{j > i} w_{ij} a_i a_j
calculate_goodness_t1 <- function(ai, aj, a_i_pu_index, a_j_pu_index,
same_bank_values){
w <- same_bank_weight_matrix[
row.names(same_bank_weight_matrix) ==
a_i_pu_index,
colnames(same_bank_weight_matrix) ==
a_j_pu_index]
t1 <- w * ai * aj
if (is.na(t1)){
stop("t1 value is NA")
}
return(w * ai * aj)
}
calculate_goodness_t2 <- function(ai, input_i){
t2 <- ai * input_i
if (is.na(t2)){
stop("t2 is null")
}
return(t2)
}
calculate_goodness <- function(ai_aj_set, a_i_pu_index, a_j_pu_index,
same_bank_values,
opposite_bank_values,
hidden_bank_values){
ai <- ai_aj_set[1]
aj <- ai_aj_set[2]
t1 <- calculate_goodness_t1(ai, aj, a_i_pu_index, a_j_pu_index,
same_bank_values)
t2 <- calculate_goodness_t2(ai, 1)
return(sum(t1, t2))
}
| 2,494 | mit |
e22f543b37e4be7ccff548b5b2cf69d75c4c16b3 | Monash-RNA-Systems-Biology-Laboratory/patseqers | Shiny_tutorial/helper.R | # Generates a data frame of random numbers
make_df <- function(number_of_points){
x <- rnorm(number_of_points, mean = 20, sd = 5)
y <- rnorm(number_of_points, mean = 50, sd = 50)
df <- data.frame(x,y)
return(df)
}
| 251 | gpl-2.0 |
b4681f5d4cccf3c2e7478898ef64c0940770a574 | bwilbertz/kaggle_allen_ai | R/runFullModelPipeline.R | # The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#SOFTWARE.
#
# Author: Benedikt Wilbertz
###############################################################################
# input
source("createInputFile.R")
source("createInputFile_NVAO.R")
# feature generation
source("createBasicStatFeatures.R")
# IR
source("createQueryData.R")
source("createQueryFeatures.R")
# PMI
source("createPMIFeatures.R")
source("createPMIFeaturesNVAO.R")
# FeatureHashing
source("createHashFeatures.R")
# model prediction
source("runModel.R")
| 1,547 | mit |
849f3460ee05af84e210dd8c74a1ce45cc189065 | eclee25/flu-SDI-exploratory-age | mapping_code/zipcode_maps_R_code/map-zipcodes_ECLedit.R | ## Name: Elizabeth Lee
## Date: 7/19/13
## Function:
### 1. draw OR map per season, popsize as bubble size
### 1b. draw log(OR map) per season 7/31/13, popsize as bubble size
### 1c. draw OR map per season, incidence as bubble size
### 2. draw incidence map per season
### 3) incidence maps by week 7/23/13
## Note: need 11 color bins because that is the max that the diverging color brewer palette will take
## Input Filenames: lat/long- mapping_code/cleanedmapdata/zip3_ll.txt; 1)
#### OR data by season (includes only 545 zip3s where data is present for all 10 seasons) - mapping_code/cleanedmapdata/zip3_OR_season.txt
#### incidence data by season OR popstat data for weekly incdence maps (includes only 843 zip3s where data is present for all 10 seasons) - mapping_code/cleanedmapdata/zip3_incid_season.txt
#### incidence data by week (includes only 843 zip3s where there is popstat data for all 10 seasons) - mapping_code/cleanedmapdata/zip3_incid_week.txt
## Output Filenames:
## Data Source: SDI, mapping_code/Coord3digits.csv (lat/long data)
##
library(ggplot2)
dfsumm<-function(x) {
if(!class(x)[1]%in%c("data.frame","matrix"))
stop("You can't use dfsumm on ",class(x)," objects!")
cat("\n",nrow(x),"rows and",ncol(x),"columns")
cat("\n",nrow(unique(x)),"unique rows\n")
s<-matrix(NA,nrow=6,ncol=ncol(x))
for(i in 1:ncol(x)) {
iclass<-class(x[,i])[1]
s[1,i]<-paste(class(x[,i]),collapse=" ")
y<-x[,i]
yc<-na.omit(y)
if(iclass%in%c("factor","ordered"))
s[2:3,i]<-levels(yc)[c(1,length(levels(yc)))] else
if(iclass=="numeric")
s[2:3,i]<-as.character(signif(c(min(yc),max(yc)),3)) else
if(iclass=="logical")
s[2:3,i]<-as.logical(c(min(yc),max(yc))) else
s[2:3,i]<-as.character(c(min(yc),max(yc)))
s[4,i]<-length(unique(yc))
s[5,i]<-sum(is.na(y))
s[6,i]<-!is.unsorted(yc)
}
s<-as.data.frame(s)
rownames(s)<-c("Class","Minimum","Maximum","Unique (excld. NA)","Missing values","Sorted")
colnames(s)<-colnames(x)
print(s)
}
##############################################################################################
# 1) OR maps by season
#communities file should have a list of nodes and data (nodes = zipcodes, data = OR or incidence)
setwd('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/mapping_code/cleanedmapdata')
communities <- read.csv('zip3_OR_season.txt', header=F, sep=",", colClasses='character') # includes zip3s that are present for all 10 seasons
names(communities)<-c('season','zip3','OR')
communities$OR<-as.numeric(communities$OR)
latlong <- read.csv('zip3_ll.txt', header=F, sep=',', colClasses='character') # file for source of lat/longs
names(latlong)<-c('zip3', 'latitude', 'longitude')
latlong$latitude<-as.numeric(latlong$latitude)
latlong$longitude<-as.numeric(latlong$longitude)
mergeddata = merge(communities, latlong, by.x='zip3', by.y='zip3')
# ORs are floats, so they need to be binned
# how many bins should there be?
hist(communities$OR, breaks=50, freq=FALSE)
hist(communities$OR, breaks=50, freq=FALSE,xlim=c(0,30))
hist(communities$OR, breaks=50, freq=FALSE,xlim=c(15,65), ylim=c(0, 0.03))
quantile(communities$OR) # 0% (0.3044887) 25% (2.2441 670) 50% (3.4471814) 75% (5.4550541) 100% (64.2965544)
# explore the large ORs
highOR<-communities[communities$OR>20,] # seems to include both urban and rural communities
mergeddata$OR_bin<-cut(mergeddata$OR, breaks=c(seq(0,16, by=2), 20, 30, 65)) # bin the ORs
popstat<-read.csv('zip3_incid_season.txt', header=T, sep=",", colClasses='character')
popstat6<-popstat[popstat$season=='6',] # use popstat values from season 6 since it is in the middle of the dataset
# are all zip3s from mergeddata present in popstat10?
sum(unique(mergeddata$zip3) %in% popstat6$zip3) # 843 zip3s
length(unique(mergeddata$zip3)) # 843 zip3s - all zip3s from mergeddata are present in rucc
mergethree <- merge(mergeddata, popstat6[,2:4], by = 'zip3')
mergethree$popstat<-as.numeric(mergethree$popstat)
mergethree$OR_bin<-factor(mergethree$OR_bin, rev(levels(mergethree$OR_bin)))
# 7/29/13 unused factors are not dropped
for (i in 1:10){
Sdat<-mergethree[mergethree$season==as.character(i),]
g <- ggplot(data=Sdat, aes(size=popstat))
g <- g + labs(title = paste("Odds Ratio, Season", i))
g <- g + scale_size_continuous(range=c(1,5))
g <- g + scale_size("population size")
g <- g + geom_point(aes(x=longitude, y=latitude, color=OR_bin))
g <- g + labs(x=NULL, y=NULL)
g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
g <- g + scale_color_brewer("odds ratio", type="div", palette=7, labels=sort(unique(mergethree$OR_bin)), drop=FALSE)
# ggsave(g, width=6, height=4, filename=paste("OR_map_S",i,".png", sep=''))
}
## Continental US only ##
# remove Alaska and Hawaii dots - continental US only
AKHI<-c('995', '996', '997', '998', '999', '967', '968')
mergefour<-mergethree[!(mergethree$zip3 %in% AKHI),]
for (i in 1:10){
Sdat<-mergefour[mergefour$season==as.character(i),]
g <- ggplot(data=Sdat, aes(size=popstat))
g <- g + labs(title = paste("Odds Ratio, Season", i))
g <- g + scale_size_continuous(range=c(1,5))
g <- g + scale_size("population size")
g <- g + geom_point(aes(x=longitude, y=latitude, color=OR_bin))
g <- g + labs(x=NULL, y=NULL)
g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
g <- g + scale_color_brewer("odds ratio", type="div", palette=7, labels=sort(unique(mergefour$OR_bin)), drop=FALSE)
ggsave(g, width=6, height=4, filename=paste("OR_continentalmap_S",i,".png", sep=''))
}
############# check that the maps are drawing the same thing ############
mergethree[mergethree$zip3=='331',] # Miami, check that bins and colors and legend seem to match
mergethree[mergethree$zip3=='900',] # LA
mergethree[mergethree$zip3=='770',] # Houston
# test with a few cities since there are many different OR bins
Houston<-mergethree[(mergethree$zip3=='770' | mergethree$zip3=='945' | mergethree$zip3=='200' | mergethree$zip3=='900' | mergethree$zip3=='600' | mergethree$zip3=='331'),] # Houston & Norcal & DC & LA & Chicago
for (i in 1:5){
Sdat<-Houston[Houston$season==as.character(i),]
g <- ggplot(data=Sdat, aes(size=popstat))
g <- g + labs(title = paste("Odds Ratio, Season", i))
g <- g + scale_size_continuous(range=c(9,10))
g <- g + scale_size("population size")
g <- g + geom_point(aes(x=longitude, y=latitude, color=OR_bin))
g <- g + labs(x=NULL, y=NULL)
g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
g <- g + scale_color_brewer("odds ratio", type="div", palette=7, labels=sort(unique(mergethree$OR_bin)), drop=FALSE)
}
Houston[Houston$season=="5",]
############ end checks ################
# 7/19/13 plots, labels were wrong
# for (i in 1:10){
# Sdat<-mergetwo[mergetwo$season==as.character(i),]
# g <- ggplot(data=Sdat)
# g <- g + geom_point(aes(x=longitude, y=latitude, color=OR_legend), size=1)
# g <- g + labs(x=NULL, y=NULL)
# g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
# g <- g + scale_color_brewer(type="div", palette=7, labels=sort(unique(mergeddata$OR_bin), decreasing=TRUE))
# # ggsave(g, width=6, height=4, filename=paste("OR_map_S",i,".png", sep=''))
# }
########################################################################################
# 1a) Normalized OR maps by season
#communities file should have a list of nodes and data (nodes = zipcodes, data = OR or incidence)
setwd('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/mapping_code/cleanedmapdata')
communities <- read.csv('zip3_OR_season.txt', header=F, sep=",", colClasses='character') # includes zip3s that are present for all 10 seasons
names(communities)<-c('season','zip3','OR')
communities$OR<-as.numeric(communities$OR)
latlong <- read.csv('zip3_ll.txt', header=F, sep=',', colClasses='character') # file for source of lat/longs
names(latlong)<-c('zip3', 'latitude', 'longitude')
latlong$latitude<-as.numeric(latlong$latitude)
latlong$longitude<-as.numeric(latlong$longitude)
# import reference dataset that has season ORs -- use for normalizing zip3 ORs
setwd('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/Reference_datasets')
seasOR <- read.csv('pk6OR-allzip3_season.csv', header = TRUE, sep = ',', colClasses = 'character')
mergeddata = merge(communities, latlong, by.x = 'zip3', by.y = 'zip3')
mergetwo <- merge(mergeddata, seasOR, by.x = 'season', by.y = 'season') # add ref OR to dataset
mergetwo$pk6_OR <- as.numeric(mergetwo$pk6_OR)
mergetwo$OR_norm <- mergetwo$OR/mergetwo$pk6_OR
# ORs are floats, so they need to be binned
# how many bins should there be?
hist(mergetwo$OR_norm, breaks=50, freq=FALSE)
hist(mergetwo$OR_norm, breaks=50, freq=FALSE,xlim=c(0,10))
hist(mergetwo$OR_norm, breaks=100, freq=FALSE,xlim=c(0,4))
quantile(mergetwo$OR_norm) # 0% 0.0615112 25% 0.5976017 50% 0.8529960 75% 1.2638488 100% 19.3109002
mergetwo$ORnorm_bin<-cut(mergetwo$OR_norm, breaks=c(seq(0, 2.2, by = 0.3), 3, 4, 20)) # bin the ORs
# bubble size = popsize
popstat<-read.csv('zip3_incid_season.txt', header=T, sep=",", colClasses='character')
popstat6<-popstat[popstat$season=='6',] # use popstat values from season 6 since it is in the middle of the dataset
# are all zip3s from mergeddata present in popstat10?
sum(unique(mergetwo$zip3) %in% popstat6$zip3) # 545 zip3s
length(unique(mergetwo$zip3)) # 545 zip3s - all zip3s from mergeddata are present in rucc
mergethree <- merge(mergetwo, popstat6[,2:4], by = 'zip3')
mergethree$popstat<-as.numeric(mergethree$popstat)
mergethree$ORnorm_bin<-factor(mergethree$ORnorm_bin, rev(levels(mergethree$ORnorm_bin)))
## Continental US only ##
# remove Alaska and Hawaii dots - continental US only
AKHI<-c('995', '996', '997', '998', '999', '967', '968')
mergefour<-mergethree[!(mergethree$zip3 %in% AKHI),]
setwd('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/mapping_code/cleanedmapdata/mapoutputs')
for (i in 1:10){
Sdat<-mergefour[mergefour$season==as.character(i),]
g <- ggplot(data=Sdat, aes(size=popstat))
g <- g + labs(title = paste("Odds Ratio, Season", i))
g <- g + scale_size_continuous(range=c(1,5))
g <- g + scale_size("population size")
g <- g + geom_point(aes(x=longitude, y=latitude, color=ORnorm_bin))
g <- g + labs(x=NULL, y=NULL)
g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
g <- g + scale_color_brewer("normalized OR", type="div", palette=7, labels=sort(unique(mergefour$ORnorm_bin)), drop=FALSE)
ggsave(g, width=6, height=4, filename=paste("ORnorm_continentalmap_S0",i,".png", sep=''))
}
####################################################################################
# 1b) log OR maps by season
#communities file should have a list of nodes and data (nodes = zipcodes, data = OR or incidence)
setwd('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/mapping_code/cleanedmapdata')
communities <- read.csv('zip3_OR_season.txt', header=F, sep=",", colClasses='character') # includes zip3s that are present for all 10 seasons
names(communities)<-c('season','zip3','OR')
communities$OR<-as.numeric(communities$OR)
communities$logOR<-log(communities$OR)
latlong <- read.csv('zip3_ll.txt', header=F, sep=',', colClasses='character') # file for source of lat/longs
names(latlong)<-c('zip3', 'latitude', 'longitude')
latlong$latitude<-as.numeric(latlong$latitude)
latlong$longitude<-as.numeric(latlong$longitude)
mergeddata = merge(communities, latlong, by.x='zip3', by.y='zip3')
# ORs are continuous, so they need to be binned
# how many bins should there be?
hist(communities$logOR, breaks=50, freq=FALSE)
quantile(communities$logOR) # 0% (-1.1891212) 25% (0.8083344) 50% (1.2375569) 75% (1.6965425) 100% (4.1635060)
# explore the large ORs
highOR<-mergeddata[mergeddata$logOR>3,] # seem to be mostly rural areas
mergeddata$logOR_bin<-cut(mergeddata$logOR, breaks=c(seq(-1.5,3.5, by=0.5), 4.5)) # bin the ORs
popstat<-read.csv('zip3_incid_season.txt', header=T, sep=",", colClasses='character')
popstat6<-popstat[popstat$season=='6',] # use popstat values from season 6 since it is in the middle of the dataset
# are all zip3s from mergeddata present in popstat10?
sum(unique(mergeddata$zip3) %in% popstat6$zip3) # 843 zip3s
length(unique(mergeddata$zip3)) # 843 zip3s - all zip3s from mergeddata are present in rucc
mergethree <- merge(mergeddata, popstat6[,2:4], by = 'zip3')
mergethree$popstat<-as.numeric(mergethree$popstat)
mergethree$logOR_bin<-factor(mergethree$logOR_bin, levels=c("(-1.5,-1]", "(-1,-0.5]", "(-0.5,0]", "(0,0.5]", "(0.5,1]", "(1,1.5]", "(1.5,2]", "(2,2.5]", "(2.5,3]", "(3,3.5]", "(3.5,4.5]"))
mergethree$logOR_bin<-factor(mergethree$logOR_bin, levels=rev(levels(mergethree$logOR_bin)))
for (i in 1:10){
Sdat<-mergethree[mergethree$season==as.character(i),]
g <- ggplot(data=Sdat, aes(size=popstat))
g <- g + labs(title = paste("Log Odds Ratio, Season", i))
g <- g + scale_size_continuous(range=c(1,5))
g <- g + scale_size("population size")
g <- g + geom_point(aes(x=longitude, y=latitude, color=logOR_bin))
g <- g + labs(x=NULL, y=NULL)
g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
g <- g + scale_color_brewer("log odds ratio", type="div", palette=7, labels=sort(unique(mergethree$logOR_bin)), drop=FALSE)
# ggsave(g, width=6, height=4, filename=paste("logOR_map_S",i,".png", sep=''))
}
## Continental US only ##
# remove Alaska and Hawaii dots - continental US only
AKHI<-c('995', '996', '997', '998', '999', '967', '968')
mergefour<-mergethree[!(mergethree$zip3 %in% AKHI),]
for (i in 1:10){
Sdat<-mergefour[mergefour$season==as.character(i),]
g <- ggplot(data=Sdat, aes(size=popstat))
g <- g + labs(title = paste("Log Odds Ratio, Season", i))
g <- g + scale_size_continuous(range=c(1,5))
g <- g + scale_size("population size")
g <- g + geom_point(aes(x=longitude, y=latitude, color=logOR_bin))
g <- g + labs(x=NULL, y=NULL)
g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
g <- g + scale_color_brewer("log odds ratio", type="div", palette=7, labels=sort(unique(mergethree$logOR_bin)), drop=FALSE)
ggsave(g, width=6, height=4, filename=paste("logOR_continentalmap_S",i,".png", sep=''))
}
#############################################################################################
# 1c. draw OR map per season, incidence as bubble size
#communities file should have a list of nodes and data (nodes = zipcodes, data = OR or incidence)
setwd('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/mapping_code/cleanedmapdata')
communities <- read.csv('zip3_OR_season.txt', header=F, sep=",", colClasses='character') # includes zip3s that are present for all 10 seasons
names(communities)<-c('season','zip3','OR')
communities$OR<-as.numeric(communities$OR)
latlong <- read.csv('zip3_ll.txt', header=F, sep=',', colClasses='character') # file for source of lat/longs
names(latlong)<-c('zip3', 'latitude', 'longitude')
latlong$latitude<-as.numeric(latlong$latitude)
latlong$longitude<-as.numeric(latlong$longitude)
mergeddata = merge(communities, latlong, by.x='zip3', by.y='zip3')
# ORs are floats, so they need to be binned
# how many bins should there be?
hist(communities$OR, breaks=50, freq=FALSE)
hist(communities$OR, breaks=50, freq=FALSE,xlim=c(0,30))
hist(communities$OR, breaks=50, freq=FALSE,xlim=c(15,65), ylim=c(0, 0.03))
quantile(communities$OR) # 0% (0.3044887) 25% (2.2441 670) 50% (3.4471814) 75% (5.4550541) 100% (64.2965544)
# explore the large ORs
highOR<-communities[communities$OR>20,] # seems to include both urban and rural communities
mergeddata$OR_bin<-cut(mergeddata$OR, breaks=c(seq(0,16, by=2), 20, 30, 65)) # bin the ORs
popstat<-read.csv('zip3_incid_season.txt', header=T, sep=",", colClasses='character')
# 9/13/13 attack rate was only shown for season6 but we want to show different attack rates by season
# create a uq ID combining season number and zip3 - this will be used to merge the dataset with the ORs
popstat$uqid <- paste(popstat$season, popstat$zip3, sep = '')
mergeddata$uqid <- paste(mergeddata$season, mergeddata$zip3, sep = '')
# are all of the zip3s in mergeddata also in popstat? - check before merging
# there are a greater number of zip3s in popstat than in mergeddata, so
sum(unique(mergeddata$zip3) %in% popstat$zip3) # 545 zip3s
length(unique(mergeddata$zip3)) # 545 zip3s - all zip3s from mergeddata are present in rucc
# create attack rate variable in popstat
popstat$AR1000 <- as.numeric(popstat$ILI)/as.numeric(popstat$popstat)*1000
mergethree <- merge(mergeddata, popstat[,5:6], by = 'uqid')
mergethree$OR_bin<-factor(mergethree$OR_bin, rev(levels(mergethree$OR_bin)))
# 7/29/13 unused factors are not dropped
for (i in 1:10){
Sdat<-mergethree[mergethree$season==as.character(i),]
g <- ggplot(data=Sdat, aes(size=AR1000))
g <- g + labs(title = paste("Odds Ratio, Season", i))
g <- g + scale_size_continuous(range=c(1,5))
g <- g + scale_size("attack rate per 1000")
g <- g + geom_point(aes(x=longitude, y=latitude, color=OR_bin))
g <- g + labs(x=NULL, y=NULL)
g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
g <- g + scale_color_brewer("odds ratio", type="div", palette=7, labels=sort(unique(mergethree$OR_bin)), drop=FALSE)
ggsave(g, width=6, height=4, filename=paste("OR_map_S0",i,"_ARsize.png", sep=''))
}
## Continental US only ##
# remove Alaska and Hawaii dots - continental US only
AKHI<-c('995', '996', '997', '998', '999', '967', '968')
mergefour<-mergethree[!(mergethree$zip3 %in% AKHI),]
for (i in 1:10){
Sdat<-mergefour[mergefour$season==as.character(i),]
g <- ggplot(data=Sdat, aes(size=AR1000))
g <- g + labs(title = paste("Odds Ratio, Season", i))
g <- g + scale_size_continuous(range=c(1,5))
g <- g + scale_size("attack rate per 1000")
g <- g + geom_point(aes(x=longitude, y=latitude, color=OR_bin))
g <- g + labs(x=NULL, y=NULL)
g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
g <- g + scale_color_brewer("odds ratio", type="div", palette=7, labels=sort(unique(mergefour$OR_bin)), drop=FALSE)
ggsave(g, width=6, height=4, filename=paste("OR_continentalmap_S0",i,"_ARsize.png", sep=''))
}
#############################################################################################
# 1d) normalized OR by season, attack rate as bubble size
#communities file should have a list of nodes and data (nodes = zipcodes, data = OR or incidence)
setwd('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/mapping_code/cleanedmapdata')
communities <- read.csv('zip3_OR_season.txt', header=F, sep=",", colClasses='character') # includes zip3s that are present for all 10 seasons
names(communities)<-c('season','zip3','OR')
communities$OR<-as.numeric(communities$OR)
latlong <- read.csv('zip3_ll.txt', header=F, sep=',', colClasses='character') # file for source of lat/longs
names(latlong)<-c('zip3', 'latitude', 'longitude')
latlong$latitude<-as.numeric(latlong$latitude)
latlong$longitude<-as.numeric(latlong$longitude)
# import reference dataset that has season ORs -- use for normalizing zip3 ORs
setwd('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/Reference_datasets')
seasOR <- read.csv('pk6OR-allzip3_season.csv', header = TRUE, sep = ',', colClasses = 'character')
mergeddata = merge(communities, latlong, by.x = 'zip3', by.y = 'zip3')
mergetwo <- merge(mergeddata, seasOR, by.x = 'season', by.y = 'season') # add ref OR to dataset
mergetwo$pk6_OR <- as.numeric(mergetwo$pk6_OR)
mergetwo$OR_norm <- mergetwo$OR/mergetwo$pk6_OR
# ORs are floats, so they need to be binned
# how many bins should there be?
hist(mergetwo$OR_norm, breaks=50, freq=FALSE)
hist(mergetwo$OR_norm, breaks=50, freq=FALSE,xlim=c(0,10))
hist(mergetwo$OR_norm, breaks=100, freq=FALSE,xlim=c(0,4))
quantile(mergetwo$OR_norm) # 0% 0.0615112 25% 0.5976017 50% 0.8529960 75% 1.2638488 100% 19.3109002
mergetwo$ORnorm_bin<-cut(mergetwo$OR_norm, breaks=c(seq(0, 2.2, by = 0.3), 3, 4, 20)) # bin the ORs
popstat<-read.csv('zip3_incid_season.txt', header=T, sep=",", colClasses='character')
# create a uq ID combining season number and zip3 - this will be used to merge the dataset with the ORs
popstat$uqid <- paste(popstat$season, popstat$zip3, sep = '')
mergetwo$uqid <- paste(mergetwo$season, mergetwo$zip3, sep = '')
# are all of the zip3s in mergeddata also in popstat? - check before merging
# there are a greater number of zip3s in popstat than in mergeddata, so
sum(unique(mergetwo$zip3) %in% popstat$zip3) # 545 zip3s
length(unique(mergetwo$zip3)) # 545 zip3s - all zip3s from mergeddata are present in rucc
# create attack rate variable in popstat
popstat$AR1000 <- as.numeric(popstat$ILI)/as.numeric(popstat$popstat)*1000
mergethree <- merge(mergetwo, popstat[,5:6], by = 'uqid')
mergethree$ORnorm_bin<-factor(mergethree$ORnorm_bin, rev(levels(mergethree$ORnorm_bin)))
## Continental US only ##
# remove Alaska and Hawaii dots - continental US only
AKHI<-c('995', '996', '997', '998', '999', '967', '968')
mergefour<-mergethree[!(mergethree$zip3 %in% AKHI),]
setwd('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/mapping_code/cleanedmapdata/mapoutputs')
for (i in 1:10){
Sdat<-mergefour[mergefour$season==as.character(i),]
g <- ggplot(data=Sdat, aes(size=AR1000))
g <- g + labs(title = paste("Odds Ratio, Season", i))
g <- g + scale_size_continuous(range=c(1,5))
g <- g + scale_size("attack rate per 1000")
g <- g + geom_point(aes(x=longitude, y=latitude, color=ORnorm_bin))
g <- g + labs(x=NULL, y=NULL)
g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
g <- g + scale_color_brewer("normalized OR", type="div", palette=7, labels=sort(unique(mergefour$ORnorm_bin)), drop=FALSE)
ggsave(g, width=6, height=4, filename=paste("ORnorm_continentalmap_S0",i,"_ARsize.png", sep=''))
}
#############################################################################################
# 1e) normalized OR by season, normalized attack rate as bubble size
#communities file should have a list of nodes and data (nodes = zipcodes, data = OR or incidence)
setwd('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/mapping_code/cleanedmapdata')
communities <- read.csv('zip3_OR_season.txt', header=F, sep=",", colClasses='character') # includes zip3s that are present for all 10 seasons
names(communities)<-c('season','zip3','OR')
communities$OR<-as.numeric(communities$OR)
latlong <- read.csv('zip3_ll.txt', header=F, sep=',', colClasses='character') # file for source of lat/longs
names(latlong)<-c('zip3', 'latitude', 'longitude')
latlong$latitude<-as.numeric(latlong$latitude)
latlong$longitude<-as.numeric(latlong$longitude)
# import reference dataset that has season ORs -- use for normalizing zip3 ORs
setwd('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/Reference_datasets')
seasOR <- read.csv('pk6OR-allzip3_season.csv', header = TRUE, sep = ',', colClasses = 'character')
mergeddata = merge(communities, latlong, by.x = 'zip3', by.y = 'zip3')
mergetwo <- merge(mergeddata, seasOR, by.x = 'season', by.y = 'season') # add ref OR to dataset
mergetwo$pk6_OR <- as.numeric(mergetwo$pk6_OR)
mergetwo$OR_norm <- mergetwo$OR/mergetwo$pk6_OR
# ORs are floats, so they need to be binned
# how many bins should there be?
hist(mergetwo$OR_norm, breaks=50, freq=FALSE)
hist(mergetwo$OR_norm, breaks=50, freq=FALSE,xlim=c(0,10))
hist(mergetwo$OR_norm, breaks=100, freq=FALSE,xlim=c(0,4))
quantile(mergetwo$OR_norm) # 0% 0.0615112 25% 0.5976017 50% 0.8529960 75% 1.2638488 100% 19.3109002
mergetwo$ORnorm_bin<-cut(mergetwo$OR_norm, breaks=c(seq(0, 2.2, by = 0.3), 3, 4, 20)) # bin the ORs
# import attack rate for bubble size
popstat<-read.csv('zip3_incid_season.txt', header=T, sep=",", colClasses='character')
# create a uq ID combining season number and zip3 - this will be used to merge the dataset with the ORs
popstat$uqid <- paste(popstat$season, popstat$zip3, sep = '')
mergetwo$uqid <- paste(mergetwo$season, mergetwo$zip3, sep = '')
# are all of the zip3s in mergeddata also in popstat? - check before merging
# there are a greater number of zip3s in popstat than in mergeddata, so
sum(unique(mergetwo$zip3) %in% popstat$zip3) # 545 zip3s
length(unique(mergetwo$zip3)) # 545 zip3s - all zip3s from mergeddata are present in rucc
# create attack rate variable in popstat
popstat$AR <- as.numeric(popstat$ILI)/as.numeric(popstat$popstat)
mergethree <- merge(mergetwo, popstat[,5:6], by = 'uqid')
mergethree$ORnorm_bin<-factor(mergethree$ORnorm_bin, rev(levels(mergethree$ORnorm_bin)))
# import seasonal attack rate reference
setwd('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/Reference_datasets')
AR_ref <- read.csv('AR-allzip3_season.csv', header = TRUE, colClasses = 'character')
mergethree <- merge(mergethree, AR_ref, by = 'season')
mergethree$attackrate <- as.numeric(mergethree$attackrate)
mergethree$AR_norm <- mergethree$AR / mergethree$attackrate
# bin normalized attack rates bc they are floats
# how many bins should there be?
hist(mergethree$AR_norm, breaks=50, freq=FALSE)
quantile(mergethree$AR_norm) # 0.02399209 0.45435468 0.76870995 1.26884483 6.74975292
mergethree$ARnorm_bin<-cut(mergethree$AR_norm, breaks=c(seq(0, 2.2, by = 0.3), 3, 4, 7)) # bin the ORs
## Continental US only ##
# remove Alaska and Hawaii dots - continental US only
AKHI<-c('995', '996', '997', '998', '999', '967', '968')
mergefour<-mergethree[!(mergethree$zip3 %in% AKHI),]
setwd('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/mapping_code/cleanedmapdata/mapoutputs')
for (i in 1:10){
Sdat<-mergefour[mergefour$season==as.character(i),]
g <- ggplot(data=Sdat, aes(size=AR_norm))
g <- g + labs(title = paste("Odds Ratio, Season", i))
g <- g + scale_size_continuous(range=c(1,5))
g <- g + scale_size("normalized attack rate")
g <- g + geom_point(aes(x=longitude, y=latitude, color=ORnorm_bin))
g <- g + labs(x=NULL, y=NULL)
g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
g <- g + scale_color_brewer("normalized OR", type="div", palette=7, labels=sort(unique(mergefour$ORnorm_bin)), drop=FALSE)
ggsave(g, width=6, height=4, filename=paste("ORnorm_continentalmap_S0",i,"_ARnorm.png", sep=''))
}
#############################################################################################
# 2) incidence maps by season
setwd('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/mapping_code/cleanedmapdata')
communities <- read.csv('zip3_incid_season.txt', header=T, sep=",", colClasses='character') # includes zip3s that are present for all 10 seasons
communities$ILI<-as.numeric(communities$ILI)
communities$popstat<-as.numeric(communities$popstat)
communities$attack1000<- communities$ILI/communities$popstat*1000 # attack rate per 1000
latlong <- read.csv('zip3_ll.txt', header=F, sep=',', colClasses='character') # file for source of lat/longs
names(latlong)<-c('zip3', 'latitude', 'longitude')
latlong$latitude<-as.numeric(latlong$latitude)
latlong$longitude<-as.numeric(latlong$longitude)
mergeddata = merge(communities, latlong, by.x='zip3', by.y='zip3')
# attack1000 are floats, so they need to be binned
# how many bins should there be?
hist(communities$attack1000, breaks=50, freq=FALSE)
hist(communities$attack1000, breaks=50, freq=FALSE,xlim=c(0,30))
hist(communities$attack1000, breaks=50, freq=FALSE,xlim=c(15,65), ylim=c(0, 0.03))
quantile(communities$attack1000) # 0% (0.000000) 25% (1.087103) 50% (2.913078) 75% (6.270440) 100% (57.018699)
# explore the large attack1000s
highattack1000<-communities[communities$attack1000>30,] # seems to include both urban and rural communities
mergeddata$attack1000_bin<-cut(mergeddata$attack1000, breaks=c(seq(0,20, by=2), 60), right=FALSE) # bin the attack1000s
popstat<-read.csv('zip3_incid_season.txt', header=T, sep=",", colClasses='character')
popstat6<-popstat[popstat$season=='6',]
# are all zip3s from mergeddata present in popstat10?
sum(unique(mergeddata$zip3) %in% popstat6$zip3) # 843 zip3s
length(unique(mergeddata$zip3)) # 843 zip3s - all zip3s from mergeddata are present in rucc
mergethree <- merge(mergeddata, popstat6[,2:4], by = 'zip3')
mergethree$popstat.y<-as.numeric(mergethree$popstat.y) # when popstat dataset was merged, popstat.y represents the popstat value in season 6.
mergethree$attack1000_bin<-factor(mergethree$attack1000_bin, levels=rev(levels(mergethree$attack1000_bin)))
for (i in 1:10){
Sdat<-mergethree[mergethree$season==as.character(i),]
g <- ggplot(data=Sdat, aes(size=popstat.y))
g <- g + labs(title = paste("Incidence per 1000, Season", i))
g <- g + scale_size_continuous(range=c(1,5))
g <- g + scale_size("population size")
g <- g + geom_point(aes(x=longitude, y=latitude, color=attack1000_bin))
g <- g + labs(x=NULL, y=NULL)
g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
g <- g + scale_color_brewer("incidence", type="div", palette=7, labels=levels(mergethree$attack1000_bin), drop=FALSE)
ggsave(g, width=6, height=,4 filename=paste("Incid_map_S",i,".png", sep=''))
}
## Continental US only ##
# remove Alaska and Hawaii dots - continental US only
AKHI<-c('995', '996', '997', '998', '999', '967', '968')
mergefour<-mergethree[!(mergethree$zip3 %in% AKHI),]
for (i in 1:10){
Sdat<-mergefour[mergefour$season==as.character(i),]
g <- ggplot(data=Sdat, aes(size=popstat.y))
g <- g + labs(title = paste("Incidence per 1000, Season", i))
g <- g + scale_size_continuous(range=c(1,5))
g <- g + scale_size("population size")
g <- g + geom_point(aes(x=longitude, y=latitude, color=attack1000_bin))
g <- g + labs(x=NULL, y=NULL)
g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
g <- g + scale_color_brewer("incidence", type="div", palette=7, labels=levels(mergethree$attack1000_bin), drop=FALSE)
ggsave(g, width=6, height=4, filename=paste("Incid_continentalmap_S0",i,".png", sep=''))
}
############# check that the maps are drawing the same thing ############
mergethree[mergethree$zip3=='331',] # Miami, check that bins and colors and legend seem to match
mergethree[mergethree$zip3=='900',] # LA
mergethree[mergethree$zip3=='770',] # Houston
# test with a few cities since there are many different OR bins
Houston<-mergethree[(mergethree$zip3=='770' | mergethree$zip3=='945' | mergethree$zip3=='200' | mergethree$zip3=='900' | mergethree$zip3=='600' | mergethree$zip3=='331'),] # Houston & Norcal & DC & LA & Chicago
for (i in 1:3){
Sdat<-Houston[Houston$season==as.character(i),]
g <- ggplot(data=Sdat, aes(size=popstat.y))
g <- g + labs(title = paste("Incidence, Season", i))
g <- g + scale_size_continuous(range=c(9,10))
g <- g + scale_size("population size")
g <- g + geom_point(aes(x=longitude, y=latitude, color=attack1000_bin))
g <- g + labs(x=NULL, y=NULL)
g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
g <- g + scale_color_brewer("incidence", type="div", palette=7, labels=levels(mergethree$attack1000_bin), drop=FALSE)
}
Houston[Houston$season=="3",]
############ end checks ################
##############################################################################################
# 3) incidence maps by week 7/31/13
setwd('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/mapping_code/cleanedmapdata')
d<-read.csv('zip3_incid_week_cl.txt', header=FALSE, colClasses='character')
names(d)<-c('season','zip3','week','attack') # attack rate per 10,000 individuals
d$week<-as.Date(d$week, format="%Y-%m-%d")
d$attack<-as.numeric(d$attack)
dfsumm(d)
latlong <- read.csv('zip3_ll.txt', header=F, sep=',', colClasses='character') # file for source of lat/longs
names(latlong)<-c('zip3', 'latitude', 'longitude')
latlong$latitude<-as.numeric(latlong$latitude)
latlong$longitude<-as.numeric(latlong$longitude)
mergeddata <- merge(d, latlong, by.x='zip3', by.y='zip3')
# attack are floats, so they need to be binned
# how many bins should there be?
hist(mergeddata$attack, breaks=1000, freq=FALSE)
hist(mergeddata$attack, breaks=1000, freq=FALSE,xlim=c(0,4), ylim=c(0, .1))
hist(mergeddata$attack, breaks=50, freq=FALSE,xlim=c(15,65), ylim=c(0, 0.03))
quantile(mergeddata$attack) # 0% (0.000000) 25% (0.000000) 50% (0.000000) 75% (0.000000) 100% (1074.533)
# explore the large attack10000s
highattack<-mergeddata[mergeddata$attack>8,] # relatively few instances and most of them fall during the 2008-2009 seasons, 786
hist(highattack$attack, freq=FALSE)
mergeddata$attack_bin<-cut(mergeddata$attack, breaks=c(-Inf, seq(0,2, by=0.25), 5, 30, 110), right=TRUE) # bin the attack rates
mergeddata[(mergeddata$attack_bin=='(-Inf,0]' & mergeddata$attack != 0),] # examine new bins, all of the incidences for the first bin are 0.
uqwk <- sort(unique(mergeddata$week))
### change marker size based on size of urban area ### 7/24/13
# # approach 1: use RUCC bin means
# rucc<-read.csv('zip3_RUCC2013avg_crosswalk.csv', header=T, colClasses='character')
# # are all zip3s from mergeddata present in rucc?
# sum(unique(mergeddata$zip3) %in% rucc$zip3) # 843 zip3s
# length(unique(mergeddata$zip3)) # 843 zip3s - all zip3s from mergeddata are present in rucc
# mergethree <- merge(mergeddata, rucc, by.x = 'zip3', by.y = 'zip3') # RUCCavg_m: 1 = metro urban, 2 = nonmetro urban, 3, rural
# mergethree$RUCCavg_m<-as.numeric(mergethree$RUCCavg_m)
# approach 2: use popstat values in season 6 (2005)
popstat<-read.csv('zip3_incid_season.txt', header=T, sep=",", colClasses='character')
popstat6<-popstat[popstat$season=='6',]
# are all zip3s from mergeddata present in popstat10?
sum(unique(mergeddata$zip3) %in% popstat6$zip3) # 843 zip3s
length(unique(mergeddata$zip3)) # 843 zip3s - all zip3s from mergeddata are present in rucc
mergethree <- merge(mergeddata, popstat6, by.x = 'zip3', by.y = 'zip3')
mergethree$popstat<-as.numeric(mergethree$popstat)
mergethree[mergethree$attack_bin=="(-Inf,0]",]$attack_bin<-NA
mergethree$attack_bin<-factor(mergethree$attack_bin) # drop (-Inf,0] level since it no longer occurs
mergethree$attack_bin<-factor(mergethree$attack_bin, levels=rev(levels(mergethree$attack_bin))) # reversed so low values are blue and high values are red
for (i in 1:length(uqwk)){ # length(uqwk)
Wdat<-mergethree[mergethree$week==uqwk[i],]
g <- ggplot(data=Wdat, aes(size=popstat))
g <- g + labs(title = paste("Incidence per 10,000:", uqwk[i]))
g <- g + scale_size_continuous(range=c(1,5))
g <- g + scale_size("population size")
g <- g + geom_point(aes(x=longitude, y=latitude, color=attack_bin)) #, size=RUCCavg_m
g <- g + labs(x=NULL, y=NULL)
g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
g<- g + scale_color_brewer("incidence", type="div", palette=7, labels=levels(mergethree$attack_bin), drop=FALSE, na.value="grey85")
ggsave(g, width=6, height=4, filename=paste("Incid_map_",uqwk[i],".png", sep=''))
print(i)
}
## Continental US only ##
# remove Alaska and Hawaii dots - continental US only
AKHI<-c('995', '996', '997', '998', '999', '967', '968')
mergefour<-mergethree[!(mergethree$zip3 %in% AKHI),]
for (i in 1:length(uqwk)){ # length(uqwk)
Wdat<-mergefour[mergefour$week==uqwk[i],]
g <- ggplot(data=Wdat, aes(size=popstat))
g <- g + labs(title = paste("Incidence per 10,000:", uqwk[i]))
g <- g + scale_size_continuous(range=c(1,5))
g <- g + scale_size("population size")
g <- g + geom_point(aes(x=longitude, y=latitude, color=attack_bin)) #, size=RUCCavg_m
g <- g + labs(x=NULL, y=NULL)
g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
g<- g + scale_color_brewer("incidence", type="div", palette=7, labels=levels(mergefour$attack_bin), drop=FALSE, na.value="grey85")
ggsave(g, width=6, height=4, filename=paste("Incid_continental_map_",uqwk[i],".png", sep=''))
print(i)
}
############# check that the maps are drawing the same thing ############
mergethree[mergethree$zip3=='331',] # Miami, check that bins and colors and legend seem to match
mergethree[mergethree$zip3=='900',] # LA
mergethree[mergethree$zip3=='770',] # Houston
# test with a few cities since there are many different OR bins
Houston<-mergethree[(mergethree$zip3=='770' | mergethree$zip3=='945' | mergethree$zip3=='200' | mergethree$zip3=='900' | mergethree$zip3=='600' | mergethree$zip3=='331'),] # Houston & Norcal & DC & LA & Chicago
for (i in 1:10){
Sdat<-Houston[Houston$week==uqwk[i],]
g <- ggplot(data=Sdat, aes(size=popstat))
g <- g + labs(title = paste("Incidence, Week", uqwk[i]))
g <- g + scale_size_continuous(range=c(9,10))
g <- g + scale_size("population size")
g <- g + geom_point(aes(x=longitude, y=latitude, color=attack_bin))
g <- g + labs(x=NULL, y=NULL)
g <- g + theme(panel.background = element_blank(),panel.grid.major = element_blank(), panel.grid.minor = element_blank(), axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
g <- g + scale_color_brewer("incidence", type="div", palette=7, labels=sort(unique(mergethree$attack_bin)), drop=FALSE)
}
Houston[Houston$week==uqwk[i],]
############ end check on maps ################
############ checks that attack rates seem reasonable #############
setwd('/home/elee/Dropbox/Elizabeth_Bansal_Lab/SDI_Data/explore/mapping_code/cleanedmapdata')
d2<-read.csv('zip3_incid_week.txt', header=TRUE, colClasses='character')
d2$ILI<-as.numeric(d2$ILI)
d2$popstat<-as.numeric(d2$popstat)
d2$week<-as.Date(d2$week)
AR <- rep(0,10)
for (i in 1:10){
ili<-sum(d2[d2$season==as.character(i),]$ILI)
pstat<-303615090
print(ili)
print(pstat)
AR[i]<-ili/pstat*100
}
# compare AR in week and season data
d3 <- read.csv('zip3_incid_season.txt', header=T, sep=",", colClasses='character') # includes zip3s that are present for all 10 seasons
d3$ILI<-as.numeric(d3$ILI)
d3$popstat<-as.numeric(d3$popstat)
ARs <- rep(0,10)
for (i in 1:10){
ili <-sum(d3[d3$season==as.character(i),]$ILI)
pstat<-sum(d3[d3$season==as.character(i),]$popstat)
ARs[i]<-ili/pstat*100
}
############## end checks on attack rates ###############
#### pre-existing snippets of code, saved for syntax reference ####
# b <- c(0,1,2,3,5,6,7,8,10,15,16,17,18,28) # test set of data values (previously called community ids)
# b <- scan('zipcode_unique_commid.txt') # list of unique data values
# g = g + labs(x=NULL, y=NULL)
# g = g + theme(panel.background = element_blank(), panel.grid.major = element_blank(), panel.grid.minor = element_blank(), legend.position = "top right", axis.ticks = element_blank(), axis.text.y = element_blank(), axis.text.x = element_blank())
# g = g + scale_color_brewer(type="div", palette=7, labels=sort(unique(mergeddata$OR_bin))
# ggsave(g, width=6, height=4, filename="zipcode_weighted_S1.png")
#b <- c(0,1,2,3,5,6,7,8,10,15,16,17,18,28)
#g = ggplot(data=mergeddata) + geom_point(aes(x=longitude, y=latitude, colour=V2, group=V2))
# g = g + theme_bw() + scale_x_continuous(limits = c(-125, -66), breaks=NA)
# g = g + scale_y_continuous(limits=c(25,50), breaks=NA)
# r <- scan('colors.txt', what="")
# r <- c("#FF0000","#FFFFFF","#00FFFF","#C0C0C0","#0000FF","#808080","#0000A0","#000000","#FF0080","#FFA500","#800080","#A52A2A","#FFF00","#800000","#00FF00","#008000","#FF00FF","#808000","#56A5EC")
# g = g + scale_colour_manual(values=r, breaks=b)
# g = g + scale_colour_manual(values=r)
# g = g + scale_colour_brewer(palette="Spectral", breaks=b)
# g = g + scale_colour_gradientn(breaks=b, labels=format(b), colours=rainbow(40))
# g = g + labs(x=NULL, y=NULL)
# ggsave(g, width=6, height=4, filename="zips.png")
| 42,043 | mit |
a3b9adf94893b3719f72a2540819286d0145e061 | nextgenusfs/amptk | amptk/check_version.R | #!/usr/bin/env Rscript
is.installed <- function(mypkg){
is.element(mypkg, installed.packages()[,1])
}
Rversion <- R.Version()$version.string
if (!is.installed("dada2")){
dadaversion <- '0.0.0'
} else {
dadaversion <- packageVersion("dada2")
}
if (!is.installed("phyloseq")){
phyloseqversion <- '0.0.0'
} else {
phyloseqversion <- packageVersion("phyloseq")
}
if (!is.installed("lulu")){
luluversion <- '0.0.0'
} else {
luluversion <- packageVersion("lulu")
}
parts <- strsplit(Rversion, ' ')
Rvers <- parts[[1]][3]
output <- paste(Rvers, dadaversion, phyloseqversion, luluversion, sep=',')
cat(output,"\n")
| 645 | bsd-2-clause |
e18dbca9e8c5d29c051cdf7f720c4babd14c660a | Tutuchan/morrisjs | R/morrisjs.R | #' morris.js plot
#'
#' This function prepares the widget to be drawn.
#'
#' In the case of a \code{data.frame} or a \code{tbl_df}, the first column must
#' be a object that can be interpreted as a \code{Data}, the other columns being
#' the data values.
#'
#' @param data the data to be drawn, can be a \code{ts}, \code{mts}, \code{xts},
#' \code{data.frame} or \code{tbl_df} object.
#' @param width the width of the widget (in pixels),
#' @param height the height of the widget (in pixels).
#'
#' @importFrom htmlwidgets createWidget shinyWidgetOutput shinyRenderWidget
#' @export
morrisjs <- function(data, width = NULL, height = NULL) {
# forward options using x
x = list(
data = data,
resize = TRUE,
hideHover = TRUE
)
# create widget
createWidget(
name = 'morrisjs',
x,
width = width,
height = height,
package = 'morrisjs'
)
}
#' Widget output function for use in Shiny
#'
#' @param outputId a character, the output variable to read from
#' @param width the width of the widget (must be valid CSS),
#' @param height the height of the widget (must be valid CSS)
#' @export
morrisjsOutput <- function(outputId, width = '100%', height = '400px'){
shinyWidgetOutput(outputId, 'morrisjs', width, height, package = 'morrisjs')
}
#' Widget render function for use in Shiny
#'
#' @param expr an R expression that evaluates to a \code{\link{morrisjs}} object,
#' @param env the environment in which to evaluate \code{expr},
#' @param quoted a logical: is \code{expr} a quoted expression ?
#'
#' @export
renderMorrisjs <- function(expr, env = parent.frame(), quoted = FALSE) {
if (!quoted) { expr <- substitute(expr) } # force quoted
shinyRenderWidget(expr, morrisjsOutput, env, quoted = TRUE)
}
| 1,751 | mit |
a3b9adf94893b3719f72a2540819286d0145e061 | nextgenusfs/ufits | amptk/check_version.R | #!/usr/bin/env Rscript
is.installed <- function(mypkg){
is.element(mypkg, installed.packages()[,1])
}
Rversion <- R.Version()$version.string
if (!is.installed("dada2")){
dadaversion <- '0.0.0'
} else {
dadaversion <- packageVersion("dada2")
}
if (!is.installed("phyloseq")){
phyloseqversion <- '0.0.0'
} else {
phyloseqversion <- packageVersion("phyloseq")
}
if (!is.installed("lulu")){
luluversion <- '0.0.0'
} else {
luluversion <- packageVersion("lulu")
}
parts <- strsplit(Rversion, ' ')
Rvers <- parts[[1]][3]
output <- paste(Rvers, dadaversion, phyloseqversion, luluversion, sep=',')
cat(output,"\n")
| 645 | bsd-2-clause |
c0900916ad10eaaf2acb8707ce3fde8d6294d5c9 | andymememe/datasciencecoursera | R Programming/makepower.R | make.power <- function(n) {
pow <- function (x) {
x ^ n
}
pow
} | 73 | gpl-2.0 |
74a3a14eb41cec2ddaf4fcc310849e749244c614 | SMHendryx/quantifyBiomassFromPointClouds | R/watershedSegmentTrees.R | # Script segments a point cloud into clusters using watershed segmentation on rasterized point cloud
# Clear workspace:
rm(list=ls())
library(lidR)
library(feather)
library(data.table)
#terminal output coloring
library(crayon)
error <- red $ bold
warn <- magenta $ underline
note <- cyan
#cat(error("Error: subscript out of bounds!\n"))
#cat(warn("Warning: shorter argument was recycled.\n"))
#cat(note("Note: no such directory.\n"))
#bug in lasnormalize as of 11/2/17 related to :Error: 546 points were not normalizable because the DTM contained NA values. Process aborded
# no NAs in dtm
# so load an old version:
source("~/githublocal/quantifyBiomassFromPointClouds/quantifyBiomassFromPointClouds/R/lasNormalize.R")
#library(lidR, lib.loc = "/Users/seanmhendryx/githublocal/lidR/")
#read in las file
setwd("/Users/seanmhendryx/Data/thesis/Processed_Data/A-lidar/rerunWatershed/")
las = readLAS("Rectangular_UTMAZ_Tucson_2011_000564.las")
# get header:
oheader = las@header
#groundPoints = las %>% lasfilter(Classification == 2)
#plot(groundPoints)
#then change working directory for writing output:
setwd("/Users/seanmhendryx/Data/thesis/Processed_Data/A-lidar/rerunWatershed/output_20171103")
#make dtm:
dtm = grid_terrain(las, res = .1, method = "knnidw")
dtmRaster = raster::as.raster(dtm)
raster::plot(dtmRaster)
#lasRaster = raster::as.raster(las)
lasnorm = lasNormalizeR(las, dtm)
# compute a canopy image
chm = grid_canopy(lasnorm, res = 0.1, na.fill = "knnidw", k = 8)
chm = raster::as.raster(chm)
dev.new()
raster::plot(chm)
dev.off()
# smoothing post-process (e.g. 2x mean)
kernel = matrix(1,3,3)
schm = raster::focal(chm, w = kernel, fun = mean)
#schm = raster::focal(chm, w = kernel, fun = mean)
dev.new()
raster::plot(schm, col = height.colors(50)) # check the image
quartz.save("A-lidar_SCHM.png")
# save smoothed canopy height model as tif
raster::writeRaster(schm, "A-lidar_OPTICS_Outliers_Removed_Smoothed_CHM_no_edge_stretch.tif", format = "GTiff", overwrite = TRUE)
# tree segmentation
# 'th' Numeric. Number value below which a pixel cannot be a crown.
#Default 2
crowns = lastrees(lasnorm, "watershed", schm, th = 1, extra = TRUE)
# Plotting point cloud of trees only:
# without rendering points that are not assigned to a tree
tree = lasfilter(lasnorm, !is.na(treeID))
# this would be a good plot to play on rotate using ImageMagick:
plot(tree, color = "treeID", colorPalette = pastel.colors(100))
#save tree point cloud (clustered point cloud):
writeLAS(tree, "A-lidar_Clustered_By_Watershed_Segmentation.las")
#write.csv(tree@data, "all20TilesGroundClassified_and_Clustered_By_Watershed_Segmentation.csv")
write_feather(tree@data, "A-lidar_Clustered_By_Watershed_Segmentation.feather")
# Plotting raster with delineated crowns:
library(raster)
contour = rasterToPolygons(crowns, dissolve = TRUE)
dev.new()
plot(schm, col = height.colors(50))
plot(contour, add = T)
quartz.save("A-lidar Segmented SCHM - MCC-Lidar Classing & KNN-IDW Rasterization.png")
#dev.off()
| 3,011 | gpl-3.0 |
dd2bd46f4e6d1172285b0e9f0bfe588705613428 | andrewdefries/andrewdefries.github.io | FDA_Pesticide_Glossary/CMU.R | library("knitr")
library("rgl")
#knit("CMU.Rmd")
#markdownToHTML('CMU.md', 'CMU.html', options=c("use_xhml"))
#system("pandoc -s CMU.html -o CMU.pdf")
knit2html('CMU.Rmd')
| 174 | mit |
263ffbd199b804c501306857ec77c01624ef8651 | amschwinn/data_mining_lab | Lab 1/Schwinn_DataMining_Lab_1_Ex2.R | #############################
#Data Mining Practical Session
#Lab 1 Exercise 2
#
#Subject: Clustering with Iris Dataset.
#K-Means & Heirarchial Clustering
#
#Author: Austin Schwinn
#
#Jan 17, 2017
#############################
#install.packages('rstudioapi')
library(rstudioapi)
#Set working directory
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
#Load in the data
data("iris")
irisFeat <- iris[1:4]
irisLabel <- as.matrix(iris[5])
####
#Data Preparation
#Normalize data with z-score transformation
normalize <- function(row) { (row - mean(row))/ sd(row)}
iris_zs <- data.frame(apply(irisFeat,2,normalize))
####
#K-Means
#Unprocessed Cluster
cl <- kmeans(irisFeat, 3)
print(cl)
plot(irisFeat[3:4], col = cl$cluster)
#Normalizaed Cluster
cl_norm <- kmeans(iris_zs, 3)
print(cl_norm)
plot(iris_zs[3:4], col = cl_norm$cluster)
#The results seem to be less stable with normalized data than
#with non-preprocessed data. This is due to additional noise
#between the distance between the first two feature columns
####
#Heirarchical Clustering
#Using euclidean distance and average for linkage criteria
hc <- hclust(dist(irisFeat, method="euclidean"), "ave")
print(hc)
plot(hc)
#Cluster with ward linkage criteria and manhattan distance
hc2 <- hclust(dist(irisFeat, method="manhattan"), "ward")
plot(hc2)
#Manhattan distance with ward linkage performed better for this
#use case. This H.Clus dendrogram has a clear 3 way split that
#matches the 3 plant species present in this use case
| 1,510 | mit |
cadfe7ab0699d8f30e3e85674ab4e70336aef4e2 | PFgimenez/PhD | R-files/data_renault_small_header.R | library(ggplot2)
#--------------------------------------------------------------------------------------------
#Parametres globaux
dataset_name = "renault_small_header"
taille_img_x = 1024/2
taille_img_y = 720/2
#fin parametres globaux
#--------------------------------------------------------------------------------------------
#--------------------------------------------------------------------------------------------
#data
#result
oracle = c(0.68502658003544,0.7502584170112226,0.7979548139397519,0.8242395156526875,0.8485307147076196,0.8646264028352038,0.8746308328411104,0.8875886001181335,0.8910956881275842,0.8964855286473715,0.9063053750738335,0.91313496751329,0.912322799763733,0.9178972238629651,0.9199276432368576,0.9201122268163024,0.926055818074424,0.9288245717660957,0.9296736562315416,0.9353957471943296,0.9353588304784406,0.9369462492616657,0.940711754282339,0.9426683402244537,0.9481320141760189,0.9475782634376846,0.9487595983461311,0.9501624335499114,0.9549985233313645,0.9559583579444773,0.9571766095688128,0.9594654459539279,0.9613851151801536,0.9631571175428234,0.9637847017129356,0.9664796219728293,0.966738038984052,0.9675871234494979,0.9679562906083875,0.9702820437093916,0.9718694624926166,0.9729031305375074,0.9752658003544005,0.9743428824571766,0.9768532191376255,0.978920555227407,0.9788098050797401,0.9800649734199646)
Naif = c(0.6878322504430006,0.7516612522150029,0.7948168930891908,0.8258269344359126,0.8426609568812758,0.8545112226816303,0.8633712344949793,0.8685764914353219,0.8756275841701122,0.8799468399291199,0.8792823390431187,0.8850782634376846,0.88559509746013,0.8845614294152392,0.8867764323685765,0.8880316007088009,0.8918340224453633,0.8910956881275842,0.8911326048434731,0.8922770230360307,0.8948981098641465,0.8963378617838157,0.8986636148848198,0.8929784406379209,0.897777613703485,0.8962640283520378,0.9004725339633786,0.8990696987595983,0.9011739515652688,0.9020968694624926,0.9001033668044891,0.9034627879503839,0.9013954518606024,0.9042011222681631,0.9020599527466037,0.9008786178381571,0.9043487891317188,0.9037950383933845,0.9027982870643827,0.9052347903130538,0.9051609568812758,0.9054193738924985,0.9071175428233904,0.9035366213821618,0.9091848789131719,0.9049025398700532,0.9078927938570585,0.90748670998228)
jointree = c(0.6878322504430006,0.7526580035440047,0.7941893089190786,0.8277835203780272,0.8470171293561725,0.8625590667454224,0.8761444181925576,0.8808697578263438,0.8924616066154755,0.8967808623744832,0.9006940342587123,0.9083727111636148,0.9097386296515062,0.9083727111636148,0.912322799763733,0.9146485528647371,0.9214412285883048,0.9216627288836385,0.9231024808033077,0.9257235676314235,0.9273479031305375,0.9287507383343178,0.9312241582988777,0.931814825753101,0.9340667454223273,0.9353588304784406,0.9365770821027761,0.9389028352037803,0.9375,0.9397519196692262,0.9406010041346722,0.9424468399291199,0.9441450088600118,0.9435174246898996,0.9455109273479031,0.9453632604843473,0.9486857649143532,0.948058180744241,0.9498301831069108,0.9525989367985824,0.9511591848789132,0.952931187241583,0.9543709391612523,0.9520451860602481,0.9551092734790313,0.9554415239220319,0.956179858239811,0.9568074424099232)
wmv = c(0.5945067926757236,0.7494093325457767,0.7923434731246308,0.8279681039574719,0.8467217956290608,0.8623744831659775,0.8753322504430006,0.8807959243945659,0.8900251033668045,0.8955995274660367,0.9003987005316008,0.9068591258121678,0.9080404607206143,0.9065637920850561,0.9089633786178382,0.9133933845245127,0.9174911399881867,0.9165682220909628,0.9196323095097461,0.9231024808033077,0.9227333136444182,0.9259081512108683,0.9279385705847608,0.9265357353809806,0.9298582398109864,0.9296736562315416,0.931814825753101,0.9323316597755463,0.9346204961606616,0.9357279976373302,0.9343620791494389,0.938312167749557,0.9372784997046663,0.9390135853514472,0.9396780862374483,0.9395673360897815,0.9434435912581217,0.9434435912581217,0.9425945067926758,0.9445510927347903,0.9440711754282339,0.9436650915534555,0.9462492616656822,0.9441450088600118,0.9460646780862374,0.9465445953927939,0.9479843473124631,0.9473198464264619)
vpop = c(0.6563792085056114,0.7331659775546367,0.7830035440047254,0.8160809214412286,0.8404459539279385,0.8577968103957472,0.8686134081512109,0.875849084465446,0.8849305965741288,0.8914648552864737,0.8955995274660367,0.9011739515652688,0.9044226225634967,0.9072652096869462,0.9088157117542823,0.9107722976963969,0.9135779681039575,0.9173803898405198,0.918820141760189,0.923693148257531,0.9219949793266391,0.9268310691080921,0.930190490253987,0.927790903721205,0.9305965741287655,0.9303012404016539,0.9348050797401063,0.9357649143532192,0.9384967513290018,0.9380537507383343,0.9374261665682221,0.9419669226225635,0.9418192557590077,0.9427790903721205,0.9432959243945659,0.9438865918487891,0.9457693443591259,0.9466553455404607,0.9487965150620201,0.9499040165386887,0.9484642646190194,0.9510853514471352,0.9507531010041347,0.9492395156526875,0.9530419373892498,0.9518975191966923,0.9546662728883638,0.9532634376845835)
vnaif = c(0.6740992321323095,0.7423582398109864,0.7871751329001772,0.8200679267572357,0.8422917897223863,0.8615623154164206,0.871788245717661,0.8802052569403426,0.8884746012994684,0.8947873597164796,0.8981836975782634,0.9059362079149439,0.9070806261075015,0.9101447135262847,0.9121382161842883,0.9143901358535145,0.918007974010632,0.9190785587714116,0.9221426461901949,0.9272002362669817,0.925317483756645,0.9302274069698759,0.9307442409923213,0.9324424099232133,0.9342144122858831,0.9352849970466627,0.9372784997046663,0.9390135853514472,0.9407855877141169,0.9408225044300059,0.9418561724748966,0.9451048434731246,0.9440342587123449,0.9461754282339043,0.9462123449497932,0.9476890135853514,0.9478366804489072,0.9492395156526875,0.9522666863555818,0.9531157708210277,0.9514914353219137,0.9530788541051388,0.9547401063201417,0.9528573538098051,0.9564382752510336,0.9560691080921441,0.9566966922622564,0.9572504430005907)
lextree = c(0.5280197873597164, 0.6412433549911399, 0.7050723567631424, 0.7468989958653278, 0.783261961015948, 0.8031231541642055, 0.8203263437684584, 0.8330995274660367, 0.846574128765505, 0.850708800945068, 0.8615623154164206, 0.8674689899586533, 0.8723419964559953, 0.8771042528056704, 0.8828632604843473, 0.8862965150620201, 0.8887699350265801, 0.8901727702303603, 0.8942336089781453, 0.8995865327820437, 0.902613703484938, 0.9030567040756055, 0.9059731246308328, 0.9053824571766096, 0.9110676314235086, 0.9092587123449498, 0.9129503839338452, 0.9157929710572947, 0.9184878913171884, 0.9184878913171884, 0.9205183106910809, 0.9215150620200827, 0.922917897223863, 0.923693148257531, 0.9270525694034258, 0.9264249852333136, 0.930153573538098, 0.9315564087418783, 0.9322209096278795, 0.9321470761961016, 0.9330699940933255, 0.9338083284111045, 0.935100413467218, 0.9380906674542233, 0.9377953337271117, 0.9392720023626698, 0.9392720023626698, 0.9418561724748966)
# MEDIUM
oracle = c(0.7603138103611524,0.7950764236439876,0.8167861490599215,0.8414716623833356,0.8583119166779386,0.8778574327066143,0.8894224266197754,0.9013932097930475,0.9117408359258758,0.9216826727985933,0.9276342486135534,0.9362234546192344,0.9372379277695116,0.9435276613012309,0.9493439740294873,0.9523873934803192,0.9559718652779656,0.9586094954686866,0.9601650209657785,0.964087650480184,0.9654402813472204,0.9662518598674422,0.9686189638847559,0.9705802786419586,0.9692952793182741,0.9717300148789395,0.9709184363587177,0.9730150142026242,0.9708508048153659,0.9744352766130123,0.9759231705667524,0.9736913296361422,0.9767347490869742,0.9753144866765859,0.9769376437170296,0.9772758014337887,0.9773434329771405,0.9776139591505478,0.9801163262545651,0.9798458000811578,0.9806573786013797,0.977140538347085,0.9796429054511024,0.979034221560936)
Naif = c(0.7603138103611524,0.7944677397538212,0.8170566752333288,0.8389016637359664,0.8511429730826457,0.8691329636142296,0.8769782226430407,0.8863790071689436,0.8961855809549574,0.9049776815906939,0.9145137292033004,0.9193832003246314,0.919518463411335,0.9237116190991479,0.9309481942377925,0.9306776680643852,0.9373055593128635,0.9371702962261599,0.936020559989179,0.9375084539429189,0.9422426619775464,0.9433247666711755,0.9454889760584336,0.9458947653185446,0.9440687136480455,0.9454213445150819,0.9461652914919518,0.9471121330988773,0.9452184498850263,0.9498173948329501,0.9515758149600974,0.951711078046801,0.9502231840930611,0.951372920330042,0.951711078046801,0.9511700256999864,0.9518463411335046,0.9510347626132828,0.9506289733531719,0.9557689706479102,0.9571892330582984,0.9521844988502638,0.9519139726768565,0.9546868659542811)
jointree = c(0.7603138103611524,0.794873529013932,0.8178682537535507,0.8404571892330583,0.8554713918571621,0.8743405924523198,0.8861084809955363,0.8957797916948465,0.9066008386311376,0.9147842553767077,0.9223589882321115,0.9274313539834979,0.930407141890978,0.9350060868389016,0.9423102935208981,0.9433923982145273,0.9496145002028946,0.9498173948329501,0.9490058163127283,0.9534018666305966,0.9542810766941702,0.9571892330582984,0.9586094954686866,0.9579331800351684,0.9576626538617611,0.9617205464628703,0.9600973894224266,0.9612471256594075,0.9597592317056676,0.9613823887461111,0.9664547544974976,0.964425808196943,0.962193967266333,0.9642905451102394,0.9665900175842013,0.9648315974570539,0.9648315974570539,0.9640200189368321,0.9652373867171649,0.9674015961044231,0.9676044907344785,0.9635465981333694,0.9664547544974976,0.9667252806709049)
wmv = c(0.6979575273907751,0.7939266874070067,0.8170566752333288,0.8351819288516164,0.854389287163533,0.8700121736778034,0.8816447991343163,0.8905721628567564,0.899702421209252,0.9056539970242121,0.9149871500067631,0.9184363587177059,0.9215474097118896,0.9254700392262951,0.9314892465846071,0.9313539834979034,0.9352766130123089,0.9385905586365481,0.9368997700527526,0.94312187204112,0.9402137156769917,0.9440010821046936,0.9454889760584336,0.9470445015555254,0.9469092384688219,0.94758555390234,0.9462329230353037,0.9492087109427837,0.9464358176653591,0.950967131069931,0.9513052887866901,0.9491410793994319,0.9485323955092655,0.9505613418098201,0.9517787095901529,0.9503584471797646,0.9514405518733937,0.9532666035438929,0.9545516028675775,0.9549573921276884,0.953604761260652,0.9508318679832274,0.9534018666305966,0.9517787095901529)
vpop = c(0.7324496145002029,0.7777627485459219,0.8017719464358176,0.8291627214933045,0.8490463952387394,0.8655484918165832,0.8830650615447044,0.8893547950764237,0.902340051399973,0.910929257405654,0.9199918842147978,0.9272960908967942,0.930407141890978,0.9358176653591235,0.9419721358041391,0.9437981874746382,0.9499526579196538,0.9517787095901529,0.9510347626132828,0.9548221290409847,0.9569187068848911,0.9592858109022048,0.9600973894224266,0.9615852833761667,0.9617881780062221,0.9636142296767212,0.9638171243067767,0.9634789665900176,0.9632760719599621,0.9672663330177195,0.9686189638847559,0.9650344920871095,0.9660489652373867,0.9649668605437576,0.968213174624645,0.9663871229541459,0.9684837007980522,0.9686865954281076,0.9698363316650886,0.9729473826592723,0.9706479101853104,0.9677397538211822,0.9696334370350331,0.9699039632084404)
vnaif = c(0.7487488164479913,0.7824293250371973,0.8092114162045178,0.8332206140944136,0.8528337616664412,0.8722440146084134,0.8844853239550926,0.8928040037873665,0.9056539970242121,0.9155282023535777,0.9216826727985933,0.930745299607737,0.9320979304747734,0.9373055593128635,0.9424455566076018,0.9452860814283782,0.94907344785608,0.950967131069931,0.9520492357635602,0.9559042337346139,0.958068443121872,0.9579331800351684,0.9603679155958339,0.9626673880697958,0.961855809549574,0.9642905451102394,0.9642905451102394,0.9652373867171649,0.9632084404166104,0.9653726498038685,0.9679426484512377,0.9657784390639794,0.9663871229541459,0.9660489652373867,0.9689571216015149,0.9669958068443122,0.9691600162315704,0.9691600162315704,0.9705802786419586,0.9728121195725686,0.972676856485865,0.968213174624645,0.969701068578385,0.9706479101853104)
lextree = c(0.5476126065196808, 0.6316786149059922, 0.6855133234140403, 0.7189909373731909, 0.7560530231299878, 0.7674827539564453, 0.7875693223319357, 0.8029893142161504, 0.8101582578114432, 0.8223319356147707, 0.8269308805626945, 0.8285540376031381, 0.8424861355336128, 0.8464087650480184, 0.8439740294873529, 0.8531042878398485, 0.8537806032733667, 0.8601379683484377, 0.8594616529149195, 0.8649398079264169, 0.8680508589206005, 0.8718382253483025, 0.8766400649262817, 0.8745434870823752, 0.8815095360476126, 0.8856350601920736, 0.8885432165562018, 0.8909779521168673, 0.8863790071689436, 0.8932097930474774, 0.8923982145272555, 0.9001758420127147, 0.898214527255512, 0.902678209116732, 0.9055187339375085, 0.9074124171513593, 0.9050453131340457, 0.9114026782091167, 0.9087650480183957, 0.9168808332206141, 0.9190450426078723, 0.921750304341945, 0.919180305694576, 0.927025564723387)
# BIG
oracle = c(0.8348566914917626,0.8585533739562176,0.8612615662378695,0.8746896863010607,0.888004965019183,0.8962423832092079,0.9022793951703905,0.9117580681561724,0.9126607989167231,0.920503272399007,0.9255247122545701,0.929981945384789,0.9330850823741819,0.9390656736628301,0.9395170390431054,0.9383886255924171,0.9461182577296321,0.9457797336944256,0.9480929812683367,0.9497856014443692,0.9514218009478673,0.950575490859851,0.9551455653351388,0.9552019860076733,0.9588693297224103,0.9575152335815843,0.9621417287294065,0.9614646806589935,0.9648499210110585,0.9666553825321598,0.9664296998420221,0.9657526517716091,0.9686865267433988,0.9704355675919657,0.9693071541412773,0.9721846084405326,0.9707176709546378,0.9743850146693749,0.976980365605958,0.9752877454299256,0.9755698487925976,0.9757955314827352,0.9781651997291808,0.9795192958700067,0.9804220266305574,0.981437598736177,0.9803091852854886,0.9836380049650192,0.9827352742044685,0.9807041299932295,0.9852742044685172,0.9853306251410516,0.9866283006093433,0.9849356804333108,0.9869104039720153,0.9865718799368088,0.9867411419544121,0.9872489280072219,0.9895621755811329,0.988772286165651,0.9893929135635297,0.9892236515459264,0.9892800722184608,0.9897878582712706,0.9902392236515459,0.9917061611374408,0.9914804784473031,0.9896750169262017,0.9914240577747687,0.9919882645001128,0.9918190024825095,0.992552471225457,0.9922703678627849,0.9926088918979914,0.9940194087113519,0.99322951929587,0.9933423606409388,0.9938501466937486,0.9940194087113519,0.9946400361092305,0.9939629880388174,0.9941886707289551,0.9942450914014895,0.9950914014895057,0.9946400361092305,0.9954863461972466,0.994583615436696)
Naif = c(0.8348566914917626,0.8585533739562176,0.8613744075829384,0.8726585420898217,0.8860302414804785,0.8930828255472806,0.8965809072444143,0.9057210561949899,0.9040848566914917,0.9109681787406906,0.9151433085082374,0.9193184382757843,0.920108327691266,0.9219137892123674,0.9189799142405778,0.9174565560821485,0.9268223877228616,0.9205596930715414,0.9233807266982622,0.9211238997968856,0.9203904310539381,0.9170051907018731,0.9243398781313473,0.920108327691266,0.9258632362897766,0.9185849695328369,0.923493568043331,0.9231550440081245,0.9247348228390883,0.9224779959377116,0.923888512751072,0.9223651545926428,0.9229293613179869,0.9223651545926428,0.9207853757616791,0.9206725344166102,0.9226472579553149,0.9223651545926428,0.9233243060257278,0.9250169262017603,0.9209546377792823,0.9170051907018731,0.9212931618144888,0.9250733468742948,0.9232678853531934,0.9259760776348455,0.922534416610246,0.9282893252087565,0.9208417964342135,0.9208982171067479,0.9237756714060031,0.9224215752651772,0.9273865944482058,0.9223651545926428,0.92118032046942,0.9225908372827805,0.9248476641841571,0.9249040848566915,0.9208417964342135,0.9227600993003836,0.9276686978108779,0.9250733468742948,0.925242608891898,0.9258068156172422,0.9281764838636877,0.9243398781313473,0.9268223877228616,0.925919656962311,0.9271044910855337,0.9255811329271045,0.9258068156172422,0.9251297675468292,0.9300947867298578,0.9268223877228616,0.9278943805010156,0.9251861882193636,0.9273301737756714,0.9268223877228616,0.9285150078988942,0.9276686978108779,0.9275558564658091,0.9229293613179869,0.9270480704129993,0.9293613179869104,0.9281200631911533,0.9260324983073798,0.9251861882193636)
jointree = c(0.8348566914917626,0.8549988715865493,0.8540397201534642,0.8636876551568494,0.8755924170616114,0.8810652222974498,0.8837734145791017,0.8911081020085759,0.8937598736176935,0.8960731211916046,0.903577070638682,0.9057774768675243,0.9092191378921237,0.9108553373956217,0.9113631234484315,0.9102347099977431,0.9174001354096141,0.9143534190927556,0.919826224328594,0.9146355224554277,0.9152561498533063,0.9146919431279621,0.9203340103814037,0.917795080117355,0.9240577747686752,0.9212367411419544,0.9251861882193636,0.9237192507334687,0.9261453396524486,0.9273301737756714,0.9251861882193636,0.9246784021665538,0.9271044910855337,0.9300947867298578,0.9273301737756714,0.9287406905890319,0.9284585872263598,0.9318438275784248,0.9338749717896637,0.9309410968178741,0.9304333107650643,0.9291356352967728,0.9320695102685624,0.9360753780185059,0.9316745655608215,0.9372037914691943,0.9306025727826676,0.9382193635748138,0.9361882193635748,0.9350033852403521,0.9365267433987813,0.9354547506206274,0.9405890318212593,0.9365267433987813,0.9409275558564658,0.9377679981945385,0.9414353419092756,0.9400248250959151,0.9386707289550892,0.9368088467614534,0.9410403972015347,0.940419769803656,0.9398555630783119,0.9423380726698263,0.9418867072895509,0.9429587000677048,0.9393477770255021,0.9443127962085308,0.9461746784021665,0.9457797336944256,0.9430151207402392,0.9459489957120288,0.9453847889866848,0.9448205822613406,0.9513089596027985,0.9448205822613406,0.9457233130218913,0.9459489957120288,0.9439178515007899,0.9447641615888062,0.9470774091627172,0.9480365605958023,0.9473030918528549,0.949221394719025,0.9470209884901828,0.9477544572331302,0.9487136086662153)
wmv = c(0.7950236966824644,0.8583276912660799,0.8601895734597157,0.8716993906567366,0.8851275107199278,0.8905438952832317,0.8966373279169487,0.9034078086210787,0.9054953735048522,0.909388399909727,0.9153125705258407,0.9190363349131122,0.920503272399007,0.9225908372827805,0.9206161137440758,0.9208417964342135,0.9276686978108779,0.9282893252087565,0.9278379598284812,0.9271609117580681,0.9289099526066351,0.9254118709095013,0.9317874069058903,0.9286842699164974,0.9334236064093884,0.9291920559693072,0.9347777025502144,0.9334800270819228,0.9343263371699391,0.9359625366734371,0.9335928684269916,0.933649289099526,0.9346648612051456,0.9378244188670729,0.9341006544798014,0.9368088467614534,0.9372037914691943,0.9390656736628301,0.9395734597156398,0.9385578876100203,0.9393477770255021,0.935793274655834,0.9402505077860528,0.939742721733243,0.9403633491311216,0.9422816519972919,0.9396298803881742,0.9422252313247574,0.9375987361769352,0.9379372602121417,0.9412096592191379,0.9369781087790566,0.9432972241029113,0.9391220943353645,0.943522906793049,0.9430715414127736,0.9443127962085308,0.943522906793049,0.9422252313247574,0.9403069284585872,0.9463439404197698,0.9417738659444821,0.9434664861205145,0.9436921688106522,0.9479237192507335,0.942168810652223,0.9401940871135184,0.9473030918528549,0.9460618370570977,0.9466260437824419,0.9441435341909276,0.9454412096592192,0.9449334236064094,0.945554051004288,0.950293387497179,0.9457233130218913,0.9466260437824419,0.9464003610923042,0.944877002933875,0.9451026856240127,0.9433536447754457,0.9469645678176484,0.9448205822613406,0.9486007673211465,0.9461746784021665,0.9473030918528549,0.9466824644549763)
vpop = c(0.806872037914692,0.8334461746784022,0.8447867298578199,0.8617129316181449,0.8754231550440081,0.8833220491988264,0.8934777702550214,0.9020537124802528,0.9027871812232002,0.910347551342812,0.913055743624464,0.9170616113744076,0.9228729406454524,0.9276686978108779,0.9272173324306026,0.9255247122545701,0.9312796208530806,0.9338185511171293,0.9344955991875423,0.9351162265854209,0.9371473707966599,0.935793274655834,0.940814714511397,0.9402505077860528,0.9433536447754457,0.9429587000677048,0.9449334236064094,0.9478672985781991,0.9474723538704581,0.9486571879936809,0.9523809523809523,0.9488264500112842,0.9493906567366283,0.9537914691943128,0.9487700293387498,0.9534529451591063,0.9549763033175356,0.9549198826450012,0.955991875423155,0.9567817648386369,0.955991875423155,0.9552584066802077,0.9570074475287745,0.9602234258632363,0.9589257503949447,0.9619160460392688,0.9614646806589935,0.9642857142857143,0.9581922816519973,0.9585872263597383,0.9615211013315279,0.9614082599864591,0.9658090724441435,0.9624238320920785,0.9637215075603701,0.9628187767998194,0.9654141277364027,0.9662040171518844,0.9663168584969533,0.962762356127285,0.9652448657187994,0.96614759647935,0.9650191830286617,0.964116452268111,0.9669939065673663,0.9663732791694877,0.9663168584969533,0.9680094786729858,0.968855788761002,0.9689122094335364,0.967219589257504,0.9669939065673663,0.9674452719476416,0.9669939065673663,0.9714511396975852,0.9679530580004514,0.9681223200180546,0.9686301060708644,0.9689122094335364,0.9678402166553826,0.9670503272399007,0.9699277815391559,0.9699842022116903,0.9683480027081923,0.9691943127962085,0.9694199954863462,0.9669374858948319)
vnaif = c(0.813247573911081,0.8426991649740465,0.8523470999774317,0.8663958474385015,0.8825885804558791,0.8895283231776123,0.8969194312796208,0.9077522004062288,0.9070751523358158,0.915086887835703,0.9195441209659219,0.9218009478672986,0.9260889189799142,0.9322387722861657,0.9314488828706838,0.9304897314375987,0.9373730534867976,0.9369781087790566,0.9391785150078988,0.938106522229745,0.9409839765290002,0.9377115775220041,0.9435793274655834,0.9396863010607086,0.9457233130218913,0.9444820582261341,0.9478672985781991,0.9474159331979237,0.9484315053035433,0.9498420221169036,0.9503498081697134,0.9480365605958023,0.950970435567592,0.9533965244865719,0.9496163394267659,0.9517603249830738,0.9523809523809523,0.9555969307154141,0.9552019860076733,0.9537914691943128,0.9539043105393816,0.9545813586097947,0.954355675919657,0.9561047167682238,0.9568946061837057,0.9586436470322727,0.956668923493568,0.9605055292259084,0.9558226134055517,0.9571767095463778,0.9596592191378921,0.9576844955991876,0.9623674114195441,0.9594335364477544,0.9623109907470097,0.9609568946061837,0.9621417287294065,0.9622545700744752,0.9609004739336493,0.9590950124125479,0.9640036109230422,0.9610133152787181,0.9618032046942,0.9620853080568721,0.9654141277364027,0.9628751974723538,0.9632137215075603,0.9643985556307831,0.9658090724441435,0.9669374858948319,0.9638907695779734,0.9650756037011962,0.9631008801624915,0.9645678176483864,0.9686301060708644,0.9650756037011962,0.9658654931166779,0.9655833897540058,0.9655833897540058,0.9648499210110585,0.9646242383209208,0.9649063416835929,0.9653012863913338,0.9670503272399007,0.9660911758068156,0.9666553825321598,0.9646242383209208)
lextree = c(0.7424611910810048, 0.765379621789444, 0.7834942139429861, 0.8010668924640135, 0.8163872424499012, 0.8279762912785775, 0.8401749929438329, 0.8500141123341801, 0.8590008467400508, 0.8656675134067174, 0.8728760937058989, 0.8791419700818516, 0.8845554614733276, 0.8876319503245836, 0.8940728196443691, 0.8959074230877787, 0.8986226361840248, 0.9025063505503811, 0.9032853513971211, 0.9054925204628845, 0.9074174428450466, 0.9084165961049958, 0.9105108664973186, 0.9119051651143099, 0.912125317527519, 0.9132317245272368, 0.9145695738075078, 0.9151679367767429, 0.9163985323172452, 0.9175726785210274, 0.918650860852385, 0.917888794806661, 0.9189556872706746, 0.9199040361275755, 0.9213773638159751, 0.9213096246119108, 0.9213265594129268, 0.9214451030200396, 0.9231329381879763, 0.9231216483206323, 0.9250014112334181, 0.9257239627434377, 0.9262094270392323, 0.9265707027942421, 0.9276601749929438, 0.9275246965848152, 0.9280045159469377, 0.9283657917019476, 0.9296528365791702, 0.929427039232289, 0.9302229748800451, 0.9295455828394016, 0.9308439175839683, 0.9294552639006491, 0.931927744848998, 0.93193338978267, 0.9328252893028507, 0.9330285069150438, 0.9328027095681626, 0.9351566469093988, 0.9336325148179508, 0.9352977702511995, 0.9361332204346599, 0.9349026248941575, 0.9370251199548405, 0.9373525261078183, 0.9368557719446796, 0.9378267005362687, 0.9378323454699408, 0.9387806943268416, 0.937894439740333, 0.9395032458368614, 0.9404346598927462, 0.9399040361275754, 0.9416991250352809, 0.94152977702512, 0.9420604007902907, 0.941930567315834, 0.9419700818515383, 0.942303132938188, 0.9430200395145357, 0.9435393734123624, 0.9445611064069998, 0.9447699689528648, 0.944990121366074, 0.9449336720293536, 0.9460795935647757)
#temps
Naiftemps = c(6.130709539279385E-4,0.0010267396264028352,0.0013801202008269344,0.0017326179858239811,0.0020518761444181925,0.002346206364441819,0.002692112743650325,0.002958922474896633,0.003319325125516834,0.003587738038984052,0.003918995643827525,0.004165597903130537,0.0044631892350856465,0.0047999383490844654,0.0050834096647962195,0.005496392166272888,0.005642942336089782,0.005919015468103957,0.00625843687241583,0.006549908446544596,0.006807933069994093,0.007017995976077968,0.007500659111045482,0.007785269750443,0.007988596204961607,0.008440687869167159,0.008594035624630833,0.00897847844063792,0.00915021902687537,0.009574535513880685,0.00982102030419374,0.010038620016243355,0.010323273922031896,0.010534935727997637,0.011071919115475488,0.011099380094506792,0.011406020230360307,0.011662656083874779,0.01210107704518606,0.012279355212640284,0.01246057553160071,0.01273974667749557,0.013162413319551093,0.013605502362669816,0.013554199940933254,0.0139077325753101,0.014163541088304784,0.014468727148552865)
jointreetemps = c(0.05651038696101595,0.05548537341258122,0.06120626594802126,0.0623701068738925,0.062498095688127586,0.06209152920112227,0.061362323464264616,0.061881492247489664,0.059686154865623155,0.058089586200531604,0.056820131681925574,0.05545843233165978,0.0545152713747785,0.052729507567926756,0.05129026760927348,0.050216916014471355,0.04846936488481984,0.04752081940342587,0.0458392634746013,0.0454242981024808,0.0435369152023036,0.042790418266391024,0.0409652832250443,0.03991381951417602,0.03865888249409333,0.037593355286473715,0.03649868366066155,0.03593367609273479,0.0345449454001772,0.03359148778056704,0.03271498050797401,0.03201600616509155,0.031172961237448317,0.030205463046367394,0.02980450838009451,0.0286410023257531,0.02801563363851152,0.02784097995422327,0.026706283298877732,0.0259410680744241,0.02541740527170703,0.024615321249261666,0.024441794853809803,0.023971850634967512,0.02294020736119315,0.02211592062906084,0.021499690231836975,0.020839556445658595)
wmvtemps = c(1.4945923339855287,1.5503172643975192,1.5912161551978736,1.6307620040977555,1.6681299061946249,1.7010002079887774,1.731601563792085,1.757977097164796,1.7833442033003544,1.8081031587049616,1.8335790233682812,1.8605553988112817,1.8899077695289428,1.9132010174985232,1.9398820778942705,1.9662830562979918,1.9924716027392204,2.0200019507900175,2.0456657402170704,2.071098103440638,2.097055232944477,2.122521191523922,2.1478210756054343,2.1732904908446544,2.198280694735676,2.223008907892794,2.247929881792676,2.2736685642350856,2.2997701271411697,2.3253274643384523,2.351896904348789,2.3767740933254577,2.4029979824276433,2.4299604074497934,2.456764699461016,2.483868777945954,2.5118990184214414,2.5411084656305376,2.571386206733609,2.603331608239811,2.6376037483387478,2.676942267018606,2.722561480249557,2.7757107274808033,2.8423695671145897,2.9231620128101006,3.0207718459465447,3.132521652281453)
vpoptemps = c(0.619880177753987,0.6692052204666273,0.7317778304415239,0.7835428034554046,0.8393094951269935,0.8925847076934436,0.9401803382309509,0.9840903001698169,1.026910106024808,1.0680262242321323,1.1092238419595393,1.1498626991656822,1.1903069023552866,1.2316474228440637,1.2740687191376254,1.316035523405198,1.3584633255685175,1.400294085757531,1.4422439237669817,1.4846440511665682,1.5258952243797992,1.568353883601595,1.6096364962714116,1.6515207696396927,1.6928072715224454,1.7338529835720615,1.774978728440638,1.8153042948538098,1.8561382867321323,1.8965240490992321,1.9361281432737745,1.9757038995126994,2.0158091659775548,2.0561014703558773,2.094314386961016,2.1337520829149437,2.172147336163615,2.2094566018163024,2.246534808992912,2.282568659664796,2.318733150361784,2.35474384476521,2.3906763707914944,2.4295996256645007,2.4761857712640283,2.536152407966627,2.6127072540977556,2.7319425257678676)
vnaiftemps = c(0.5654878922031896,0.6056752266317188,0.6490572558697578,0.6829557048139397,0.720100048471648,0.7555922484494979,0.7874808443591258,0.8166435704370939,0.8435650142498523,0.8696579058254578,0.8955631147002363,0.919717621492912,0.9444845379134672,0.9698594909184879,0.9959814455478441,1.0217668153425872,1.048007879023922,1.0745154691007088,1.1007386338230951,1.1269935481024809,1.15379970492469,1.1801322384819846,1.2061039145747194,1.2331453213600119,1.2602134606836977,1.287519607722977,1.3146178301092735,1.3419053928307738,1.3691115496898996,1.3972928465002954,1.4253422753987006,1.4536974013216184,1.4830541429415238,1.513018030936208,1.542581987263733,1.57262709757088,1.6032094773331365,1.6335512685321913,1.6641784893310692,1.6960786059878914,1.729621013511518,1.7641430136961016,1.8012120921441228,1.8432790326343769,1.8957278415534553,1.962086357981394,2.0506174140209685,2.171628945658594)
lextreetemps = c(9.385951491435322E-4, 9.206999003248672E-4, 9.574053750738335E-4, 0.0010206393532191376, 0.0010126803049320733, 0.0010660335240696987, 0.0010511686909332545, 0.0011193464153868872, 0.0011249905973124631, 0.0011314190527170703, 0.001175395976077968, 0.0011822279976373303, 0.0012078975413467219, 0.0012309438275251033, 0.0012884719137625518, 0.0013359795407560542, 0.0013247912655050206, 0.0013227320326343768, 0.001407098006497342, 0.0013673426055818075, 0.0013887386001181334, 0.0014351453189604252, 0.0014999887588600118, 0.001494079758564678, 0.0014659799320732427, 0.0014828400472533963, 0.001497552425428234, 0.001513701391760189, 0.0015271906453041936, 0.0015380687020082693, 0.001590135713230951, 0.0015552598272297697, 0.0016029215667454223, 0.0015638766870939161, 0.0016160766723272298, 0.00157890957250443, 0.0016145971020378026, 0.0015807919706142942, 0.0015811648663614885, 0.0016260900915534553, 0.0016257978108387477, 0.0015790943738924986, 0.0015788565305670408, 0.0015757875738334319, 0.0016151606024808033, 0.0015604985639397519, 0.0015971071544595393, 0.001537642295481394)
# MEDIUM
Naiftemps = c(0.0010116810496415528,0.0016883997700527526,0.0023949896523738673,0.0029658426213986203,0.0036375064926281618,0.004223179629379142,0.004630473285540376,0.005313823278777221,0.005876314892465846,0.006559031719193832,0.00682051251183552,0.007690403422156093,0.008060764439334506,0.008814894968213175,0.009339008318679832,0.009729382524009197,0.010218030907615312,0.010800554646287028,0.011279527728932775,0.01216870681725957,0.012532031786825375,0.013121461179494117,0.013982032530772352,0.014095038617611255,0.014546872987961585,0.01565805593128635,0.015851718652779657,0.01617400730420668,0.01710188137427296,0.017532312525361828,0.018411986744217502,0.019141338090085214,0.01930081678614906,0.019518399837684296,0.01986956134180982,0.0209797400919789,0.021716014878939538,0.022102245502502366,0.022544349925605302,0.022829389625321248,0.023375756932233194,0.024719914581360747,0.02521486602191262,0.02549994609765995)
jointreetemps = c(0.0691693280806168,0.06654608068443121,0.07256938495874476,0.07377797687001217,0.07320432787772217,0.0722793575679697,0.07092746354659814,0.06932008832679562,0.06753988286216692,0.0655458321385094,0.06349193764371704,0.06123165345597187,0.05893382436088192,0.056715938996347894,0.05464607669417016,0.052414928310564046,0.050042244690923846,0.048058093128635196,0.04610830853510077,0.04415676281617747,0.04236206627891249,0.04499164405518734,0.03902247227106723,0.037351015622886515,0.03585822920330042,0.034600085215744626,0.03333552772893277,0.03199651021236304,0.03092518605437576,0.02984158014337887,0.028999750642499662,0.028218356824022725,0.027235291965372648,0.02678806763154335,0.026055907953469497,0.02523585979981063,0.024701852022183148,0.02511995157581496,0.023732737454348708,0.023295820167726227,0.022987125659407547,0.02264744406871365,0.0223533163803598,0.02221581962667388)
wmvtemps = c(0.7965478627755985,0.8160240042607873,0.8311722452996078,0.8465396813877992,0.8619417899364263,0.8776536955227918,0.8927007136480455,0.9082907774922224,0.9244003205735155,0.9405550520086569,0.9563681658325442,0.9733636394562424,0.9900202305559312,1.0068131076017854,1.0233010451102393,1.039834390707426,1.0561597244014609,1.0720394964155282,1.0884614358852969,1.1044725541728662,1.1198347618017044,1.1354672159475179,1.1509304223589882,1.1660183666305965,1.181659499864737,1.1970076608954416,1.2124630060868389,1.227697067969701,1.2432045641823346,1.2584507239956715,1.2742634885702693,1.2899736402001893,1.3053130770999595,1.3215953077911538,1.3380518186798322,1.3556662739077505,1.374397483565535,1.3950147795211687,1.419355865075071,1.4481907822940618,1.484407602799946,1.5242677865548493,1.5660133616258622,1.6091389751792236)
vpoptemps = c(0.3373159754497498,0.35954324266197757,0.3859007524685513,0.4125853442445557,0.4421256462870283,0.471702110036521,0.500916622480725,0.530880220816989,0.5615572399567158,0.5926065827133775,0.6239073823211145,0.6555718758284864,0.6879136757067497,0.719780246584607,0.7520238882726904,0.7841105075071013,0.8152354380495063,0.8460459151224131,0.876229896320844,0.9068226852427972,0.9363751338428243,0.9659165105505207,0.9933383679832274,1.0202956827404301,1.046768951711078,1.0735229916136886,1.099179509333153,1.1252547484782902,1.1511916317462465,1.1774401381712432,1.2030660683754903,1.2285443556066549,1.25452294609766,1.280623670160963,1.3069319787636955,1.3323488160422021,1.3577788343027188,1.383842335452455,1.4113812024212093,1.4397572673474908,1.4700707158798865,1.5061081802380631,1.5506332132422562,1.6056343209793047)
vnaiftemps = c(0.28934941850399026,0.3064006830109563,0.3251501990396321,0.34224332693088055,0.35937942066819967,0.37544259786284323,0.39022054964155284,0.40448112538888137,0.4178912758014338,0.43131828635195457,0.44431559008521576,0.45747393473556064,0.4703594849181658,0.48379601271473016,0.4974150645881239,0.5110497538888138,0.5242245560665494,0.5376566951846341,0.5510735487623427,0.5647517916948465,0.5781106949141079,0.5918209430542405,0.6054222003922629,0.6188148186798322,0.6324439959421074,0.6463513863790071,0.6603340891383741,0.6741525128499932,0.6881400547139186,0.7022769139726769,0.7166760831867983,0.7312503485729744,0.7452351604220209,0.759776839307453,0.7747295884620587,0.7892993313945624,0.8029099446773975,0.8174296370891384,0.8327835777762749,0.8494901621804409,0.8676641988367374,0.8881704997971054,0.9103823529013932,0.9354209683484377)
lextreetemps = c(9.871808940890032E-4, 0.0010919204247260923, 0.0012270306370891384, 0.0012618103543892872, 0.0013648988570269173, 0.001442163539834979, 0.0016064685783849589, 0.0016502073786013797, 0.0017350571757067496, 0.0018341723319356149, 0.0018537329974300013, 0.001952052380630326, 0.002101698146895712, 0.0022774710536994456, 0.0024094375557960233, 0.0025170279183010956, 0.0026160373123224672, 0.0026916030434194506, 0.0028298945421344514, 0.0030196141147030976, 0.0030911308196943056, 0.0034702625388881372, 0.0035230289124847827, 0.003624732307588259, 0.0037039085824428514, 0.003917542986608955, 0.003986748248343028, 0.00413833606790207, 0.00439140528878669, 0.004361716184228324, 0.004411312586230218, 0.004512773583119167, 0.0046960397538211825, 0.00472514135668876, 0.004590834113350466, 0.004897660739889084, 0.0047370618490463956, 0.004694337772216962, 0.004398824624644935, 0.004273979230353037, 0.0038618103002840526, 0.0034346460503178683, 0.0029147185919112676, 0.0021245620925199513)
# BIG
Naiftemps = c(0.00469632012866091,0.00678952480108346,0.010033462953557925,0.013950615597313922,0.013854764178093787,0.016783919361209865,0.01984493064725467,0.022964014954009366,0.02519751498222448,0.026734815868178996,0.026873487613565825,0.031001877941425428,0.03304656119857796,0.03416763122848598,0.03846027137294735,0.039743153208058234,0.042773104339484225,0.04369320518029456,0.042934489024321426,0.04974415800462728,0.05624536854579313,0.0549238879860053,0.055812429095423506,0.057765659951470004,0.056513454376163876,0.05996653975509283,0.07009525111449692,0.06365193798318379,0.06876009203769538,0.0780441651148355,0.07275697449353874,0.08198136843293267,0.07704852389819987,0.08212766198295807,0.09007219005699453,0.08353381299023757,0.095925197731505,0.08518363077704419,0.09295438237119802,0.09361875887365273,0.09468717346650866,0.10357683099147903,0.10507326956718019,0.1009855371028723,0.1132588661475086,0.10426615811748773,0.12378699255121042,0.10007425297669431,0.1178453370012979,0.12116236595000282,0.11260484481688392,0.11937027504091191,0.11974064996332036,0.129627940804695,0.13540990141639864,0.12586783059646747,0.13246467857344393,0.14363830370746572,0.13832812194571412,0.13938311116754135,0.1345764880925508,0.14589631591422123,0.14171031202031603,0.15190489057562076,0.16036516416478555,0.15490840411963883,0.15825513888261852,0.1580144130925508,0.1575681183972912,0.16545660536117382,0.15969180874717834,0.16350425163656884,0.16294880428893904,0.17905278132054175,0.158539725,0.1891270586343115,0.174996566986456,0.18032123572234762,0.18605601224604967,0.17935054232505643,0.18371200090293455,0.18591498634311512,0.19241401495485327,0.1880498059255079,0.19844988448081263,0.20547052731376975,0.210128034255079)
jointreetemps = c(27.246312220077872,27.102715229783872,32.85797541239208,34.416307678234865,34.413268514192204,33.77221092274702,32.76229998685176,31.542794389932848,30.23325599983071,28.915683370859433,27.645367995993453,26.341602487444277,25.11493569775972,23.9426225814006,22.81615690158569,21.702456376051014,20.634195804017832,19.642536831950792,18.752658712149426,17.880941349641667,17.045190713616613,16.28752611319903,15.576991844816884,14.853247893459738,14.230431429264714,13.644606318266463,13.042544451216072,12.510861039219005,12.026990894362621,11.568933852886406,11.155899998645674,10.729652745838271,10.343556190790588,9.991670337791321,9.651479521189549,9.334602300547374,9.040392692906721,8.76525572315332,8.494856722589018,8.259694301619547,8.041163151966593,7.837130728852774,7.646287331188985,7.458310030867333,7.291952925963546,7.143948537215732,6.9897277505784094,6.848951528807629,6.718358433891993,6.589039963376784,6.46887727193725,6.353449732577168,6.24240912606512,6.12952212595226,6.029689841036059,5.932614609051408,5.8386968129902375,5.756244473110998,5.6623857901924275,5.573599088821172,5.492725137020316,5.40615928476298,5.327414508239277,5.2520847597065465,5.17176913244921,5.091933485835215,5.0233337465575625,4.9437326619074495,4.867635777765237,4.79375961506772,4.718916469638827,4.636837774435666,4.567317421726862,4.489804258295711,4.420138081038375,4.354781099379233,4.29003522037246,4.231350004232506,4.201858342155756,4.138456707223476,4.096267666873589,4.0839125694695255,4.0599902200338605,4.057317436173815,4.076606144300226,4.125554272799097,4.224577781376976)
wmvtemps = c(1.3014854312232003,1.4293006351839315,1.5217993793726021,1.6177837793387497,1.7165966678515008,1.7916713598510494,1.8508638076055066,1.8927339502933875,1.9215107408034304,1.940394192281652,1.9544777582374182,1.9648255922477995,1.9731129533401037,1.9775470077296322,1.983538067197021,1.987533917964342,1.995052105958023,2.0031658032046944,2.0091116354660348,2.0185100530918527,2.028649178345746,2.036527794403069,2.0443198671857368,2.054498832035658,2.0618487954186415,2.071772400304672,2.082963361938614,2.092457092360641,2.1021747085872264,2.11278116108102,2.1230016150417512,2.131670333728278,2.141553279282329,2.153808752369668,2.1659780175468293,2.177783284134507,2.1910185012976755,2.203252730309185,2.2150114293048975,2.2289482340893705,2.244422028436019,2.256098636425186,2.270281563924622,2.284246749097269,2.298065818381855,2.3114004930038368,2.3264456029113068,2.3389780284924395,2.355831651602347,2.3709314108553374,2.3871641346197245,2.402832263258858,2.419853930038366,2.436817791469194,2.4559093885691716,2.4738666230534867,2.4910949904649065,2.5098773295531482,2.527000736007673,2.5417984347777027,2.5597529294741594,2.580133362107876,2.5969212523132477,2.616967046659896,2.6356342306477094,2.654149471394719,2.673957175863236,2.692568846422929,2.7145501565109456,2.7330755097043555,2.751333355958023,2.770747666666667,2.7902277879711126,2.8138241220379148,2.835876202606635,2.861596143308508,2.88782152014218,2.913498345802302,2.9430133494696458,2.9720352645565336,3.0073289522681113,3.0449059916497405,3.0781286727036785,3.11233659732566,3.1506251038140376,3.1928383696682463,3.2362516150417515)
vpoptemps = c(0.7227277617919206,0.8176607521439856,0.8685920144436922,0.9502131319115323,1.0216973851275106,1.0768979904084857,1.122970468291582,1.160496698149402,1.1933421155495374,1.2239136979237193,1.252892573403295,1.281925575829384,1.311307916779508,1.340418865436696,1.3704302575603702,1.4022050484653577,1.4339764114759648,1.4657812242157526,1.4993304166666668,1.5340441478785827,1.570551124746107,1.6053883865380276,1.6435179111938614,1.6811516784585872,1.7186142176709547,1.7574324353419093,1.7949052927104492,1.8314419151997292,1.8706251108102008,1.90894174413225,1.9504140219476416,1.9909565009591514,2.032009888907696,2.071109803373956,2.111297498984428,2.152150255359964,2.192158244470774,2.234125353531934,2.273793709489957,2.316473826957797,2.3571149058338974,2.397940707289551,2.4398795717670954,2.480520919036335,2.5215542206612502,2.5621895197472355,2.6030560216091176,2.6435434206161137,2.68447965690589,2.7264281204581358,2.767640745147822,2.8107752989731436,2.8542455574362444,2.8974845194087115,2.941577401320244,2.983495113179869,3.027405131121643,3.0708076930151207,3.1148969090498757,3.1577836491762583,3.203265552189122,3.2486963406680207,3.296698244865719,3.343202899176258,3.392217123674114,3.4391654427330174,3.4891256319115325,3.5382426043218236,3.589984524994358,3.6454421313473255,3.7022196170728954,3.760034158824193,3.8207523094673888,3.8792767903972014,3.946767140769578,4.013047620232453,4.087033631798691,4.160871990972693,4.244349295982848,4.329059756149853,4.425155779056646,4.510295066463552,4.615544396468066,4.701517446118258,4.805407352572782,4.852121004062289,4.838807259252991)
vnaiftemps = c(0.6451137929361318,0.7004251516023471,0.7402862512412548,0.7941943547731889,0.8436578763258858,0.8850182477431731,0.9191662471789663,0.9456509149176259,0.9681622384337621,0.9869423571428572,1.0011106430828256,1.0154165848566914,1.0262460703565786,1.0352890938275785,1.0451006760324983,1.053796864421124,1.0625801736064093,1.073303820300158,1.0817336954412096,1.0911937024937937,1.1003672994809297,1.109127040340781,1.11878846812232,1.129006776686978,1.1406527800722184,1.1524109413789212,1.162298409896186,1.172779033795983,1.1848031659896185,1.1972309004739337,1.209998938670729,1.2215383002708193,1.2339877545136537,1.2478261321936357,1.262392099413225,1.2763035444030693,1.2883153586097946,1.302996368539833,1.3156883779620854,1.3307283744640037,1.3441463018505981,1.3648075778605282,1.373427721902505,1.3884467777589709,1.4039782082487022,1.418676180546152,1.434322146129542,1.4494948827578424,1.4646719453283683,1.4792495922477995,1.4947454961069735,1.5097882015910629,1.5263681480478448,1.54355282046942,1.5574965721620402,1.57437514596028,1.5904318558451818,1.6071270486910405,1.624394095971564,1.642454921575265,1.6590645144436922,1.6750880820920786,1.6930401014443692,1.7099707239900699,1.7283097175581132,1.7450942695779734,1.7636017050891446,1.7834564677273752,1.8007157356127286,1.8210072708756488,1.8392085387045813,1.8621039884901829,1.8897202618483413,1.905506202775897,1.9295180107199277,1.9544357783795983,1.9819774249605056,2.0094258825885802,2.040351750507786,2.072305510212142,2.1026803915594674,2.139019198995712,2.173030381516588,2.2094696697698035,2.2442522798465356,2.2808345163055743,2.3180854916497404)
lextreetemps = c(0.0016982109850409257, 0.0016183629805249788, 0.0016514960824160316, 0.0016693256223539374, 0.001678907248094835, 0.0016918056562235393, 0.001712892734970364, 0.0017309370702794243, 0.0017356804403048263, 0.0017490602314422805, 0.0017630764775613886, 0.001768132633361558, 0.001769494541349139, 0.0017885119390347163, 0.00179574688681908, 0.0017999977533163986, 0.001802400344340954, 0.0018416144510302005, 0.001827193355913068, 0.001834829844764324, 0.0018491389048828676, 0.0018589804064352243, 0.0018688644538526673, 0.001878152204346599, 0.0018913192040643523, 0.0019033213491391476, 0.0019160837764606265, 0.001925194405870731, 0.0019385509060118543, 0.0019486479424216765, 0.0019615007112616426, 0.0019732338131526954, 0.0019885149364944964, 0.001999172876093706, 0.002052725475585662, 0.0020244470505221563, 0.0020302198927462604, 0.0020494604346598926, 0.0020594874682472483, 0.0020678437256562237, 0.0020803426192492237, 0.0020900380976573525, 0.0020992857239627433, 0.0021098250127011007, 0.00211570282811177, 0.002121823838554897, 0.0021366507479537115, 0.0021429323736946093, 0.002146472548687553, 0.002155329156082416, 0.0021833488060965284, 0.0021642386113463166, 0.002166257888794807, 0.0021760188202088627, 0.002174500208862546, 0.002175848190798758, 0.0021818443240191926, 0.002179670657634773, 0.0021839889923793397, 0.002183961343494214, 0.002182636150155236, 0.0021819025740897544, 0.0021802319559695174, 0.0021853985661868473, 0.0021834517979113744, 0.00218234516511431, 0.002184271769686706, 0.0021765833135760655, 0.00217332661021733, 0.002173064578041208, 0.002174775591306802, 0.0021725151453570422, 0.0021662781484617557, 0.002163636748518205, 0.002160738729889924, 0.002160683974033305, 0.002159173096246119, 0.0021577892915608243, 0.002167361501552357, 0.002146954541349139, 0.0021496048941574935, 0.0021383544679650012, 0.0021277644707874683, 0.0021259769291560823, 0.0021188804233700253, 0.0021153694270392323, 0.0020956159243578887)
#--------------------------------------------------------------------------------------------
#parametres graphes
# -- manuels
x_pas_erreur = 4
y_pas_erreur = 3
x_legend_erreur = 0
y_legend_erreur = 50
y_padding_erreur = 1
x_pas_time = 4
y_pas_time = 3
x_legend_time = 0
y_legend_time = 0.013
y_padding_time = 0.01
# -- auto calcul
#MAJ VERS ERROR
oracle = 100-100*oracle
Naif = 100-100*Naif
jointree = 100-100*jointree
wmv = 100-100*wmv
vpop = 100-100*vpop
vnaif = 100-100*vnaif
lextree = 100-100*lextree
c_oracle = 100*c_oracle
c_Naif = 100*c_Naif
c_jointree = 100*c_jointree
c_wmv = 100*c_wmv
c_vpop = 100*c_vpop
c_vnaif = 100*c_vnaif
#FIN MAJ VERS ERROR
nb_val = length(oracle)
nb_val = length(Naif)
nb_val = length(jointree)
nb_val = length(wmv)
nb_val = length(vpop)
nb_val = length(vnaif)
min_val_erreur = 30000
min_val_erreur = min(min_val_erreur,100-100*oracle)
min_val_erreur = min(min_val_erreur,100-100*Naif)
min_val_erreur = min(min_val_erreur,100-100*jointree)
min_val_erreur = min(min_val_erreur,100-100*wmv)
min_val_erreur = min(min_val_erreur,100-100*vpop)
min_val_erreur = min(min_val_erreur,100-100*vnaif)
min_val_erreur = ceiling(min_val_erreur)
max_val_erreur = 30000
max_val_erreur = max(max_val_erreur,100-100*oracle)
max_val_erreur = max(max_val_erreur,100-100*Naif)
max_val_erreur = max(max_val_erreur,100-100*jointree)
max_val_erreur = max(max_val_erreur,100-100*wmv)
max_val_erreur = max(max_val_erreur,100-100*vpop)
max_val_erreur = max(max_val_erreur,100-100*vnaif)
max_val_erreur = floor(max_val_erreur)
size = 0:(nb_val-1)
x_lim_erreur = c(0,(nb_val-1))
if(min_val_erreur-y_padding_erreur <= 0){
min_val_erreur = min_val_erreur+y_padding_erreur+0.00001
}
y_lim_erreur = c((min_val_erreur-y_padding_erreur),(max_val_erreur+y_padding_erreur))
x_axp_erreur = c(0, (nb_val-1), x_pas_erreur)
y_axp_erreur = c((min_val_erreur-y_padding_erreur),(max_val_erreur+y_padding_erreur),y_pas_erreur)
min_val_time = 30000
min_val_time = min(min_val_erreur,100-100*Naiftemps)
min_val_time = min(min_val_erreur,100-100*jointreetemps)
min_val_time = min(min_val_erreur,100-100*wmvtemps)
min_val_time = min(min_val_erreur,100-100*vpoptemps)
min_val_time = min(min_val_erreur,100-100*vnaiftemps)
min_val_time = ceiling(min_val_erreur)
max_val_time = 30000
max_val_time = max(max_val_time,Naiftemps)
max_val_time = max(max_val_time,jointreetemps)
max_val_time = max(max_val_time,wmvtemps)
max_val_time = max(max_val_time,vpoptemps)
max_val_time = max(max_val_time,vnaiftemps)
max_val_time = floor(max_val_time)
x_lim_time = c(0,(nb_val-1))
if(min_val_time-y_padding_time <= 0){
min_val_time = min_val_time+y_padding_time+0.00001
}
size = 0:(nb_val-1)
y_lim_time = c((min_val_time-y_padding_time),(max_val_time+y_padding_time))
x_axp_time = c(0, (nb_val-1), x_pas_erreur)
y_axp_time = c((min_val_time-y_padding_time),(max_val_time+y_padding_time),y_pas_time)
#fin parametres graphes
#--------------------------------------------------------------------------------------------
(ggplot(NULL, aes(size)) + #scale_y_log10(breaks = round(seq(0, 100, by = 5),1)) + annotation_logticks(sides="l") +
ylab("Error rate (%)") + xlab("Number of configurated attributes") + theme_bw() #+ theme(legend.position="bottom")
+geom_line(aes(y=Naif, colour="Naive Bayes"), colour="turquoise2", linetype = "dotted") + geom_point(aes(y=Naif, shape="Naive Bayes"), colour="turquoise2", fill="turquoise2")
+geom_line(aes(y=wmv, colour="Weighted Majority Voter"), colour="deeppink2", linetype = "dotted") + geom_point(aes(y=wmv, shape="Weighted Majority Voter"), colour="deeppink2", fill="deeppink2")
+geom_line(aes(y=vpop, colour="Most Popular Choice"), colour="gold2", linetype = "dotted") + geom_point(aes(y=vpop, shape="Most Popular Choice"), colour="gold2", fill="gold2")
+geom_line(aes(y=vnaif, colour="Naive Bayes Voter"), colour="firebrick3", linetype = "dotted") + geom_point(aes(y=vnaif, shape="Naive Bayes Voter"), colour="firebrick3", fill="firebrick3")
+geom_line(aes(y=jointree, colour="Classical Bayes"), colour="springgreen4", linetype = "dotted") + geom_point(aes(y=jointree, shape="Classical Bayes"), colour="springgreen4", fill="springgreen4")
+geom_line(aes(y=lextree, colour="2-LP-tree (3 cl.)"), colour="dodgerblue4", linetype = "dotted") + geom_point(aes(y=lextree, shape="2-LP-tree (3 cl.)"), colour="dodgerblue4", fill="dodgerblue4")
+geom_line(aes(y=oracle, colour="Oracle"), colour="black", linetype = "dotted") + geom_point(aes(y=oracle, shape="Oracle"), colour="black", fill="black")
# + theme(legend.position=c(0.75,0.65), legend.background = element_rect(fill=alpha('blue', 0)))
+ theme(legend.position=c(0.75,0.72), legend.background = element_rect(fill=alpha('blue', 0)))
+ scale_colour_manual(name = 'Legend', guide = 'legend',
limits = c(NULL
,'Classical Bayes' #jointree
,'Naive Bayes' #Naif
,'Weighted Majority Voter' #wmv
,'Most Popular Choice' #vpop
,'Naive Bayes Voter' #vnaif
,'2-LP-tree (3 cl.)'
,'Oracle' #oracle
),
values =c(NULL
,'Classical Bayes'='springgreen' #jointree
,'Naive Bayes'='turquoise2' #Naif
,'Weighted Majority Voter'='deeppink2' #wmv
,'Most Popular Choice'='gold2' #vpop
,'Naive Bayes Voter'='firebrick3' #vnaif
,'2-LP-tree (3 cl.)'='dodgerblue4'
,'Oracle'='black' #oracle
))
+ scale_shape_manual(name = 'Legend', guide = 'legend',
limits = c(NULL
,'Classical Bayes' #jointree
,'Naive Bayes' #Naif
,'Weighted Majority Voter' #wmv
,'Most Popular Choice' #vpop
,'Naive Bayes Voter' #vnaif
,'2-LP-tree (3 cl.)'
,'Oracle' #oracle
),
values =c(NULL
,'Classical Bayes'=21 #jointree
,'Naive Bayes'=24 #Naif
,'Weighted Majority Voter'=25 #wmv
,'Most Popular Choice'=22 #vpop
,'Naive Bayes Voter'=23 #vnaif
,'2-LP-tree (3 cl.)'=1
,'Oracle'=4 #oracle
))
+ guides(shape = guide_legend(override.aes = list(colour = c(NULL
,'Classical Bayes'='springgreen' #jointree
,'Naive Bayes'='turquoise2' #Naif
,'Weighted Majority Voter'='deeppink2' #wmv
,'Most Popular Choice'='gold2' #vpop
,'Naive Bayes Voter'='firebrick3' #vnaif
,'2-LP-tree (3 cl.)'='dodgerblue4'
,'Oracle'='black' #oracle
),
fill = c(NULL
,'Classical Bayes'='springgreen' #jointree
,'Naive Bayes'='turquoise2' #Naif
,'Weighted Majority Voter'='deeppink2' #wmv
,'Most Popular Choice'='gold2' #vpop
,'Naive Bayes Voter'='firebrick3' #vnaif
,'2-LP-tree (3 cl.)'='dodgerblue4'
,'Oracle'='black' #oracle
))))
)
(ggplot(NULL, aes(size))
+ scale_y_log10(
breaks = scales::trans_breaks("log10", function(x) 10^x),
labels = scales::trans_format("log10", function(x) round(10^x,3)))
+ annotation_logticks(sides="l")
+ theme_bw() +
ylab("Recommendation time (ms)") + xlab("Number of configurated attributes") #+ theme(legend.position="bottom")
+geom_line(aes(y=jointreetemps, colour="Classical Bayes"), colour="springgreen4", linetype = "dotted") + geom_point(aes(y=jointreetemps, shape="Classical Bayes"), colour="springgreen4", fill="springgreen4")
+geom_line(aes(y=Naiftemps, colour="Naive Bayes"), colour="turquoise2", linetype = "dotted") + geom_point(aes(y=Naiftemps, shape="Naive Bayes"), colour="turquoise2", fill="turquoise2")
+geom_line(aes(y=wmvtemps, colour="Weighted Majority Voter"), colour="deeppink2", linetype = "dotted") + geom_point(aes(y=wmvtemps, shape="Weighted Majority Voter"), colour="deeppink2", fill="deeppink2")
+geom_line(aes(y=vpoptemps, colour="Most Popular Choice"), colour="gold2", linetype = "dotted") + geom_point(aes(y=vpoptemps, shape="Most Popular Choice"), colour="gold2", fill="gold2")
+geom_line(aes(y=vnaiftemps, colour="Naive Bayes Voter"), colour="firebrick3", linetype = "dotted") + geom_point(aes(y=vnaiftemps, shape="Naive Bayes Voter"), colour="firebrick3", fill="firebrick3")
+geom_line(aes(y=lextreetemps, colour="2-LP-tree (3 cl.)"), colour="dodgerblue4", linetype = "dotted") + geom_point(aes(y=lextreetemps, shape="2-LP-tree (3 cl.)"), colour="dodgerblue4", fill="dodgerblue4")
# + theme(legend.position=c(0.79,0.66), legend.background = element_rect(fill=alpha('blue', 0)))
# + theme(legend.position=c(0.79,0.2), legend.background = element_rect(fill=alpha('blue', 0)))
+ theme(legend.position="bottom")
+ scale_colour_manual(name = 'Legend', guide = 'legend',
limits = c(NULL
,'Classical Bayes' #jointree
,'Naive Bayes' #Naif
,'Weighted Majority Voter' #wmv
,'Most Popular Choice' #vpop
,'Naive Bayes Voter' #vnaif
,'2-LP-tree (3 cl.)'
),
values =c(NULL
,'Classical Bayes'='springgreen' #jointree
,'Naive Bayes'='turquoise2' #Naif
,'Weighted Majority Voter'='deeppink2' #wmv
,'Most Popular Choice'='gold2' #vpop
,'Naive Bayes Voter'='firebrick3' #vnaif
,'2-LP-tree (3 cl.)'='dodgerblue4'
))
+ scale_shape_manual(name = 'Legend', guide = 'legend',
limits = c(NULL
,'Classical Bayes' #jointree
,'Naive Bayes' #Naif
,'Weighted Majority Voter' #wmv
,'Most Popular Choice' #vpop
,'Naive Bayes Voter' #vnaif
,'2-LP-tree (3 cl.)'
),
values =c(NULL
,'Classical Bayes'=21 #jointree
,'Naive Bayes'=24 #Naif
,'Weighted Majority Voter'=25 #wmv
,'Most Popular Choice'=22 #vpop
,'Naive Bayes Voter'=23 #vnaif
,'2-LP-tree (3 cl.)'=1
))
+ guides(shape = guide_legend(override.aes = list(colour = c(NULL
,'Classical Bayes'='springgreen' #jointree
,'Naive Bayes'='turquoise2' #Naif
,'Weighted Majority Voter'='deeppink2' #wmv
,'Most Popular Choice'='gold2' #vpop
,'Naive Bayes Voter'='firebrick3' #vnaif
,'2-LP-tree (3 cl.)'='dodgerblue4'
),
fill = c(NULL
,'Classical Bayes'='springgreen' #jointree
,'Naive Bayes'='turquoise2' #Naif
,'Weighted Majority Voter'='deeppink2' #wmv
,'Most Popular Choice'='gold2' #vpop
,'Naive Bayes Voter'='firebrick3' #vnaif
,'2-LP-tree (3 cl.)'='dodgerblue4'
))))
)
| 58,938 | gpl-3.0 |
cadfe7ab0699d8f30e3e85674ab4e70336aef4e2 | PFgimenez/thesis | R-files/data_renault_small_header.R | library(ggplot2)
#--------------------------------------------------------------------------------------------
#Parametres globaux
dataset_name = "renault_small_header"
taille_img_x = 1024/2
taille_img_y = 720/2
#fin parametres globaux
#--------------------------------------------------------------------------------------------
#--------------------------------------------------------------------------------------------
#data
#result
oracle = c(0.68502658003544,0.7502584170112226,0.7979548139397519,0.8242395156526875,0.8485307147076196,0.8646264028352038,0.8746308328411104,0.8875886001181335,0.8910956881275842,0.8964855286473715,0.9063053750738335,0.91313496751329,0.912322799763733,0.9178972238629651,0.9199276432368576,0.9201122268163024,0.926055818074424,0.9288245717660957,0.9296736562315416,0.9353957471943296,0.9353588304784406,0.9369462492616657,0.940711754282339,0.9426683402244537,0.9481320141760189,0.9475782634376846,0.9487595983461311,0.9501624335499114,0.9549985233313645,0.9559583579444773,0.9571766095688128,0.9594654459539279,0.9613851151801536,0.9631571175428234,0.9637847017129356,0.9664796219728293,0.966738038984052,0.9675871234494979,0.9679562906083875,0.9702820437093916,0.9718694624926166,0.9729031305375074,0.9752658003544005,0.9743428824571766,0.9768532191376255,0.978920555227407,0.9788098050797401,0.9800649734199646)
Naif = c(0.6878322504430006,0.7516612522150029,0.7948168930891908,0.8258269344359126,0.8426609568812758,0.8545112226816303,0.8633712344949793,0.8685764914353219,0.8756275841701122,0.8799468399291199,0.8792823390431187,0.8850782634376846,0.88559509746013,0.8845614294152392,0.8867764323685765,0.8880316007088009,0.8918340224453633,0.8910956881275842,0.8911326048434731,0.8922770230360307,0.8948981098641465,0.8963378617838157,0.8986636148848198,0.8929784406379209,0.897777613703485,0.8962640283520378,0.9004725339633786,0.8990696987595983,0.9011739515652688,0.9020968694624926,0.9001033668044891,0.9034627879503839,0.9013954518606024,0.9042011222681631,0.9020599527466037,0.9008786178381571,0.9043487891317188,0.9037950383933845,0.9027982870643827,0.9052347903130538,0.9051609568812758,0.9054193738924985,0.9071175428233904,0.9035366213821618,0.9091848789131719,0.9049025398700532,0.9078927938570585,0.90748670998228)
jointree = c(0.6878322504430006,0.7526580035440047,0.7941893089190786,0.8277835203780272,0.8470171293561725,0.8625590667454224,0.8761444181925576,0.8808697578263438,0.8924616066154755,0.8967808623744832,0.9006940342587123,0.9083727111636148,0.9097386296515062,0.9083727111636148,0.912322799763733,0.9146485528647371,0.9214412285883048,0.9216627288836385,0.9231024808033077,0.9257235676314235,0.9273479031305375,0.9287507383343178,0.9312241582988777,0.931814825753101,0.9340667454223273,0.9353588304784406,0.9365770821027761,0.9389028352037803,0.9375,0.9397519196692262,0.9406010041346722,0.9424468399291199,0.9441450088600118,0.9435174246898996,0.9455109273479031,0.9453632604843473,0.9486857649143532,0.948058180744241,0.9498301831069108,0.9525989367985824,0.9511591848789132,0.952931187241583,0.9543709391612523,0.9520451860602481,0.9551092734790313,0.9554415239220319,0.956179858239811,0.9568074424099232)
wmv = c(0.5945067926757236,0.7494093325457767,0.7923434731246308,0.8279681039574719,0.8467217956290608,0.8623744831659775,0.8753322504430006,0.8807959243945659,0.8900251033668045,0.8955995274660367,0.9003987005316008,0.9068591258121678,0.9080404607206143,0.9065637920850561,0.9089633786178382,0.9133933845245127,0.9174911399881867,0.9165682220909628,0.9196323095097461,0.9231024808033077,0.9227333136444182,0.9259081512108683,0.9279385705847608,0.9265357353809806,0.9298582398109864,0.9296736562315416,0.931814825753101,0.9323316597755463,0.9346204961606616,0.9357279976373302,0.9343620791494389,0.938312167749557,0.9372784997046663,0.9390135853514472,0.9396780862374483,0.9395673360897815,0.9434435912581217,0.9434435912581217,0.9425945067926758,0.9445510927347903,0.9440711754282339,0.9436650915534555,0.9462492616656822,0.9441450088600118,0.9460646780862374,0.9465445953927939,0.9479843473124631,0.9473198464264619)
vpop = c(0.6563792085056114,0.7331659775546367,0.7830035440047254,0.8160809214412286,0.8404459539279385,0.8577968103957472,0.8686134081512109,0.875849084465446,0.8849305965741288,0.8914648552864737,0.8955995274660367,0.9011739515652688,0.9044226225634967,0.9072652096869462,0.9088157117542823,0.9107722976963969,0.9135779681039575,0.9173803898405198,0.918820141760189,0.923693148257531,0.9219949793266391,0.9268310691080921,0.930190490253987,0.927790903721205,0.9305965741287655,0.9303012404016539,0.9348050797401063,0.9357649143532192,0.9384967513290018,0.9380537507383343,0.9374261665682221,0.9419669226225635,0.9418192557590077,0.9427790903721205,0.9432959243945659,0.9438865918487891,0.9457693443591259,0.9466553455404607,0.9487965150620201,0.9499040165386887,0.9484642646190194,0.9510853514471352,0.9507531010041347,0.9492395156526875,0.9530419373892498,0.9518975191966923,0.9546662728883638,0.9532634376845835)
vnaif = c(0.6740992321323095,0.7423582398109864,0.7871751329001772,0.8200679267572357,0.8422917897223863,0.8615623154164206,0.871788245717661,0.8802052569403426,0.8884746012994684,0.8947873597164796,0.8981836975782634,0.9059362079149439,0.9070806261075015,0.9101447135262847,0.9121382161842883,0.9143901358535145,0.918007974010632,0.9190785587714116,0.9221426461901949,0.9272002362669817,0.925317483756645,0.9302274069698759,0.9307442409923213,0.9324424099232133,0.9342144122858831,0.9352849970466627,0.9372784997046663,0.9390135853514472,0.9407855877141169,0.9408225044300059,0.9418561724748966,0.9451048434731246,0.9440342587123449,0.9461754282339043,0.9462123449497932,0.9476890135853514,0.9478366804489072,0.9492395156526875,0.9522666863555818,0.9531157708210277,0.9514914353219137,0.9530788541051388,0.9547401063201417,0.9528573538098051,0.9564382752510336,0.9560691080921441,0.9566966922622564,0.9572504430005907)
lextree = c(0.5280197873597164, 0.6412433549911399, 0.7050723567631424, 0.7468989958653278, 0.783261961015948, 0.8031231541642055, 0.8203263437684584, 0.8330995274660367, 0.846574128765505, 0.850708800945068, 0.8615623154164206, 0.8674689899586533, 0.8723419964559953, 0.8771042528056704, 0.8828632604843473, 0.8862965150620201, 0.8887699350265801, 0.8901727702303603, 0.8942336089781453, 0.8995865327820437, 0.902613703484938, 0.9030567040756055, 0.9059731246308328, 0.9053824571766096, 0.9110676314235086, 0.9092587123449498, 0.9129503839338452, 0.9157929710572947, 0.9184878913171884, 0.9184878913171884, 0.9205183106910809, 0.9215150620200827, 0.922917897223863, 0.923693148257531, 0.9270525694034258, 0.9264249852333136, 0.930153573538098, 0.9315564087418783, 0.9322209096278795, 0.9321470761961016, 0.9330699940933255, 0.9338083284111045, 0.935100413467218, 0.9380906674542233, 0.9377953337271117, 0.9392720023626698, 0.9392720023626698, 0.9418561724748966)
# MEDIUM
oracle = c(0.7603138103611524,0.7950764236439876,0.8167861490599215,0.8414716623833356,0.8583119166779386,0.8778574327066143,0.8894224266197754,0.9013932097930475,0.9117408359258758,0.9216826727985933,0.9276342486135534,0.9362234546192344,0.9372379277695116,0.9435276613012309,0.9493439740294873,0.9523873934803192,0.9559718652779656,0.9586094954686866,0.9601650209657785,0.964087650480184,0.9654402813472204,0.9662518598674422,0.9686189638847559,0.9705802786419586,0.9692952793182741,0.9717300148789395,0.9709184363587177,0.9730150142026242,0.9708508048153659,0.9744352766130123,0.9759231705667524,0.9736913296361422,0.9767347490869742,0.9753144866765859,0.9769376437170296,0.9772758014337887,0.9773434329771405,0.9776139591505478,0.9801163262545651,0.9798458000811578,0.9806573786013797,0.977140538347085,0.9796429054511024,0.979034221560936)
Naif = c(0.7603138103611524,0.7944677397538212,0.8170566752333288,0.8389016637359664,0.8511429730826457,0.8691329636142296,0.8769782226430407,0.8863790071689436,0.8961855809549574,0.9049776815906939,0.9145137292033004,0.9193832003246314,0.919518463411335,0.9237116190991479,0.9309481942377925,0.9306776680643852,0.9373055593128635,0.9371702962261599,0.936020559989179,0.9375084539429189,0.9422426619775464,0.9433247666711755,0.9454889760584336,0.9458947653185446,0.9440687136480455,0.9454213445150819,0.9461652914919518,0.9471121330988773,0.9452184498850263,0.9498173948329501,0.9515758149600974,0.951711078046801,0.9502231840930611,0.951372920330042,0.951711078046801,0.9511700256999864,0.9518463411335046,0.9510347626132828,0.9506289733531719,0.9557689706479102,0.9571892330582984,0.9521844988502638,0.9519139726768565,0.9546868659542811)
jointree = c(0.7603138103611524,0.794873529013932,0.8178682537535507,0.8404571892330583,0.8554713918571621,0.8743405924523198,0.8861084809955363,0.8957797916948465,0.9066008386311376,0.9147842553767077,0.9223589882321115,0.9274313539834979,0.930407141890978,0.9350060868389016,0.9423102935208981,0.9433923982145273,0.9496145002028946,0.9498173948329501,0.9490058163127283,0.9534018666305966,0.9542810766941702,0.9571892330582984,0.9586094954686866,0.9579331800351684,0.9576626538617611,0.9617205464628703,0.9600973894224266,0.9612471256594075,0.9597592317056676,0.9613823887461111,0.9664547544974976,0.964425808196943,0.962193967266333,0.9642905451102394,0.9665900175842013,0.9648315974570539,0.9648315974570539,0.9640200189368321,0.9652373867171649,0.9674015961044231,0.9676044907344785,0.9635465981333694,0.9664547544974976,0.9667252806709049)
wmv = c(0.6979575273907751,0.7939266874070067,0.8170566752333288,0.8351819288516164,0.854389287163533,0.8700121736778034,0.8816447991343163,0.8905721628567564,0.899702421209252,0.9056539970242121,0.9149871500067631,0.9184363587177059,0.9215474097118896,0.9254700392262951,0.9314892465846071,0.9313539834979034,0.9352766130123089,0.9385905586365481,0.9368997700527526,0.94312187204112,0.9402137156769917,0.9440010821046936,0.9454889760584336,0.9470445015555254,0.9469092384688219,0.94758555390234,0.9462329230353037,0.9492087109427837,0.9464358176653591,0.950967131069931,0.9513052887866901,0.9491410793994319,0.9485323955092655,0.9505613418098201,0.9517787095901529,0.9503584471797646,0.9514405518733937,0.9532666035438929,0.9545516028675775,0.9549573921276884,0.953604761260652,0.9508318679832274,0.9534018666305966,0.9517787095901529)
vpop = c(0.7324496145002029,0.7777627485459219,0.8017719464358176,0.8291627214933045,0.8490463952387394,0.8655484918165832,0.8830650615447044,0.8893547950764237,0.902340051399973,0.910929257405654,0.9199918842147978,0.9272960908967942,0.930407141890978,0.9358176653591235,0.9419721358041391,0.9437981874746382,0.9499526579196538,0.9517787095901529,0.9510347626132828,0.9548221290409847,0.9569187068848911,0.9592858109022048,0.9600973894224266,0.9615852833761667,0.9617881780062221,0.9636142296767212,0.9638171243067767,0.9634789665900176,0.9632760719599621,0.9672663330177195,0.9686189638847559,0.9650344920871095,0.9660489652373867,0.9649668605437576,0.968213174624645,0.9663871229541459,0.9684837007980522,0.9686865954281076,0.9698363316650886,0.9729473826592723,0.9706479101853104,0.9677397538211822,0.9696334370350331,0.9699039632084404)
vnaif = c(0.7487488164479913,0.7824293250371973,0.8092114162045178,0.8332206140944136,0.8528337616664412,0.8722440146084134,0.8844853239550926,0.8928040037873665,0.9056539970242121,0.9155282023535777,0.9216826727985933,0.930745299607737,0.9320979304747734,0.9373055593128635,0.9424455566076018,0.9452860814283782,0.94907344785608,0.950967131069931,0.9520492357635602,0.9559042337346139,0.958068443121872,0.9579331800351684,0.9603679155958339,0.9626673880697958,0.961855809549574,0.9642905451102394,0.9642905451102394,0.9652373867171649,0.9632084404166104,0.9653726498038685,0.9679426484512377,0.9657784390639794,0.9663871229541459,0.9660489652373867,0.9689571216015149,0.9669958068443122,0.9691600162315704,0.9691600162315704,0.9705802786419586,0.9728121195725686,0.972676856485865,0.968213174624645,0.969701068578385,0.9706479101853104)
lextree = c(0.5476126065196808, 0.6316786149059922, 0.6855133234140403, 0.7189909373731909, 0.7560530231299878, 0.7674827539564453, 0.7875693223319357, 0.8029893142161504, 0.8101582578114432, 0.8223319356147707, 0.8269308805626945, 0.8285540376031381, 0.8424861355336128, 0.8464087650480184, 0.8439740294873529, 0.8531042878398485, 0.8537806032733667, 0.8601379683484377, 0.8594616529149195, 0.8649398079264169, 0.8680508589206005, 0.8718382253483025, 0.8766400649262817, 0.8745434870823752, 0.8815095360476126, 0.8856350601920736, 0.8885432165562018, 0.8909779521168673, 0.8863790071689436, 0.8932097930474774, 0.8923982145272555, 0.9001758420127147, 0.898214527255512, 0.902678209116732, 0.9055187339375085, 0.9074124171513593, 0.9050453131340457, 0.9114026782091167, 0.9087650480183957, 0.9168808332206141, 0.9190450426078723, 0.921750304341945, 0.919180305694576, 0.927025564723387)
# BIG
oracle = c(0.8348566914917626,0.8585533739562176,0.8612615662378695,0.8746896863010607,0.888004965019183,0.8962423832092079,0.9022793951703905,0.9117580681561724,0.9126607989167231,0.920503272399007,0.9255247122545701,0.929981945384789,0.9330850823741819,0.9390656736628301,0.9395170390431054,0.9383886255924171,0.9461182577296321,0.9457797336944256,0.9480929812683367,0.9497856014443692,0.9514218009478673,0.950575490859851,0.9551455653351388,0.9552019860076733,0.9588693297224103,0.9575152335815843,0.9621417287294065,0.9614646806589935,0.9648499210110585,0.9666553825321598,0.9664296998420221,0.9657526517716091,0.9686865267433988,0.9704355675919657,0.9693071541412773,0.9721846084405326,0.9707176709546378,0.9743850146693749,0.976980365605958,0.9752877454299256,0.9755698487925976,0.9757955314827352,0.9781651997291808,0.9795192958700067,0.9804220266305574,0.981437598736177,0.9803091852854886,0.9836380049650192,0.9827352742044685,0.9807041299932295,0.9852742044685172,0.9853306251410516,0.9866283006093433,0.9849356804333108,0.9869104039720153,0.9865718799368088,0.9867411419544121,0.9872489280072219,0.9895621755811329,0.988772286165651,0.9893929135635297,0.9892236515459264,0.9892800722184608,0.9897878582712706,0.9902392236515459,0.9917061611374408,0.9914804784473031,0.9896750169262017,0.9914240577747687,0.9919882645001128,0.9918190024825095,0.992552471225457,0.9922703678627849,0.9926088918979914,0.9940194087113519,0.99322951929587,0.9933423606409388,0.9938501466937486,0.9940194087113519,0.9946400361092305,0.9939629880388174,0.9941886707289551,0.9942450914014895,0.9950914014895057,0.9946400361092305,0.9954863461972466,0.994583615436696)
Naif = c(0.8348566914917626,0.8585533739562176,0.8613744075829384,0.8726585420898217,0.8860302414804785,0.8930828255472806,0.8965809072444143,0.9057210561949899,0.9040848566914917,0.9109681787406906,0.9151433085082374,0.9193184382757843,0.920108327691266,0.9219137892123674,0.9189799142405778,0.9174565560821485,0.9268223877228616,0.9205596930715414,0.9233807266982622,0.9211238997968856,0.9203904310539381,0.9170051907018731,0.9243398781313473,0.920108327691266,0.9258632362897766,0.9185849695328369,0.923493568043331,0.9231550440081245,0.9247348228390883,0.9224779959377116,0.923888512751072,0.9223651545926428,0.9229293613179869,0.9223651545926428,0.9207853757616791,0.9206725344166102,0.9226472579553149,0.9223651545926428,0.9233243060257278,0.9250169262017603,0.9209546377792823,0.9170051907018731,0.9212931618144888,0.9250733468742948,0.9232678853531934,0.9259760776348455,0.922534416610246,0.9282893252087565,0.9208417964342135,0.9208982171067479,0.9237756714060031,0.9224215752651772,0.9273865944482058,0.9223651545926428,0.92118032046942,0.9225908372827805,0.9248476641841571,0.9249040848566915,0.9208417964342135,0.9227600993003836,0.9276686978108779,0.9250733468742948,0.925242608891898,0.9258068156172422,0.9281764838636877,0.9243398781313473,0.9268223877228616,0.925919656962311,0.9271044910855337,0.9255811329271045,0.9258068156172422,0.9251297675468292,0.9300947867298578,0.9268223877228616,0.9278943805010156,0.9251861882193636,0.9273301737756714,0.9268223877228616,0.9285150078988942,0.9276686978108779,0.9275558564658091,0.9229293613179869,0.9270480704129993,0.9293613179869104,0.9281200631911533,0.9260324983073798,0.9251861882193636)
jointree = c(0.8348566914917626,0.8549988715865493,0.8540397201534642,0.8636876551568494,0.8755924170616114,0.8810652222974498,0.8837734145791017,0.8911081020085759,0.8937598736176935,0.8960731211916046,0.903577070638682,0.9057774768675243,0.9092191378921237,0.9108553373956217,0.9113631234484315,0.9102347099977431,0.9174001354096141,0.9143534190927556,0.919826224328594,0.9146355224554277,0.9152561498533063,0.9146919431279621,0.9203340103814037,0.917795080117355,0.9240577747686752,0.9212367411419544,0.9251861882193636,0.9237192507334687,0.9261453396524486,0.9273301737756714,0.9251861882193636,0.9246784021665538,0.9271044910855337,0.9300947867298578,0.9273301737756714,0.9287406905890319,0.9284585872263598,0.9318438275784248,0.9338749717896637,0.9309410968178741,0.9304333107650643,0.9291356352967728,0.9320695102685624,0.9360753780185059,0.9316745655608215,0.9372037914691943,0.9306025727826676,0.9382193635748138,0.9361882193635748,0.9350033852403521,0.9365267433987813,0.9354547506206274,0.9405890318212593,0.9365267433987813,0.9409275558564658,0.9377679981945385,0.9414353419092756,0.9400248250959151,0.9386707289550892,0.9368088467614534,0.9410403972015347,0.940419769803656,0.9398555630783119,0.9423380726698263,0.9418867072895509,0.9429587000677048,0.9393477770255021,0.9443127962085308,0.9461746784021665,0.9457797336944256,0.9430151207402392,0.9459489957120288,0.9453847889866848,0.9448205822613406,0.9513089596027985,0.9448205822613406,0.9457233130218913,0.9459489957120288,0.9439178515007899,0.9447641615888062,0.9470774091627172,0.9480365605958023,0.9473030918528549,0.949221394719025,0.9470209884901828,0.9477544572331302,0.9487136086662153)
wmv = c(0.7950236966824644,0.8583276912660799,0.8601895734597157,0.8716993906567366,0.8851275107199278,0.8905438952832317,0.8966373279169487,0.9034078086210787,0.9054953735048522,0.909388399909727,0.9153125705258407,0.9190363349131122,0.920503272399007,0.9225908372827805,0.9206161137440758,0.9208417964342135,0.9276686978108779,0.9282893252087565,0.9278379598284812,0.9271609117580681,0.9289099526066351,0.9254118709095013,0.9317874069058903,0.9286842699164974,0.9334236064093884,0.9291920559693072,0.9347777025502144,0.9334800270819228,0.9343263371699391,0.9359625366734371,0.9335928684269916,0.933649289099526,0.9346648612051456,0.9378244188670729,0.9341006544798014,0.9368088467614534,0.9372037914691943,0.9390656736628301,0.9395734597156398,0.9385578876100203,0.9393477770255021,0.935793274655834,0.9402505077860528,0.939742721733243,0.9403633491311216,0.9422816519972919,0.9396298803881742,0.9422252313247574,0.9375987361769352,0.9379372602121417,0.9412096592191379,0.9369781087790566,0.9432972241029113,0.9391220943353645,0.943522906793049,0.9430715414127736,0.9443127962085308,0.943522906793049,0.9422252313247574,0.9403069284585872,0.9463439404197698,0.9417738659444821,0.9434664861205145,0.9436921688106522,0.9479237192507335,0.942168810652223,0.9401940871135184,0.9473030918528549,0.9460618370570977,0.9466260437824419,0.9441435341909276,0.9454412096592192,0.9449334236064094,0.945554051004288,0.950293387497179,0.9457233130218913,0.9466260437824419,0.9464003610923042,0.944877002933875,0.9451026856240127,0.9433536447754457,0.9469645678176484,0.9448205822613406,0.9486007673211465,0.9461746784021665,0.9473030918528549,0.9466824644549763)
vpop = c(0.806872037914692,0.8334461746784022,0.8447867298578199,0.8617129316181449,0.8754231550440081,0.8833220491988264,0.8934777702550214,0.9020537124802528,0.9027871812232002,0.910347551342812,0.913055743624464,0.9170616113744076,0.9228729406454524,0.9276686978108779,0.9272173324306026,0.9255247122545701,0.9312796208530806,0.9338185511171293,0.9344955991875423,0.9351162265854209,0.9371473707966599,0.935793274655834,0.940814714511397,0.9402505077860528,0.9433536447754457,0.9429587000677048,0.9449334236064094,0.9478672985781991,0.9474723538704581,0.9486571879936809,0.9523809523809523,0.9488264500112842,0.9493906567366283,0.9537914691943128,0.9487700293387498,0.9534529451591063,0.9549763033175356,0.9549198826450012,0.955991875423155,0.9567817648386369,0.955991875423155,0.9552584066802077,0.9570074475287745,0.9602234258632363,0.9589257503949447,0.9619160460392688,0.9614646806589935,0.9642857142857143,0.9581922816519973,0.9585872263597383,0.9615211013315279,0.9614082599864591,0.9658090724441435,0.9624238320920785,0.9637215075603701,0.9628187767998194,0.9654141277364027,0.9662040171518844,0.9663168584969533,0.962762356127285,0.9652448657187994,0.96614759647935,0.9650191830286617,0.964116452268111,0.9669939065673663,0.9663732791694877,0.9663168584969533,0.9680094786729858,0.968855788761002,0.9689122094335364,0.967219589257504,0.9669939065673663,0.9674452719476416,0.9669939065673663,0.9714511396975852,0.9679530580004514,0.9681223200180546,0.9686301060708644,0.9689122094335364,0.9678402166553826,0.9670503272399007,0.9699277815391559,0.9699842022116903,0.9683480027081923,0.9691943127962085,0.9694199954863462,0.9669374858948319)
vnaif = c(0.813247573911081,0.8426991649740465,0.8523470999774317,0.8663958474385015,0.8825885804558791,0.8895283231776123,0.8969194312796208,0.9077522004062288,0.9070751523358158,0.915086887835703,0.9195441209659219,0.9218009478672986,0.9260889189799142,0.9322387722861657,0.9314488828706838,0.9304897314375987,0.9373730534867976,0.9369781087790566,0.9391785150078988,0.938106522229745,0.9409839765290002,0.9377115775220041,0.9435793274655834,0.9396863010607086,0.9457233130218913,0.9444820582261341,0.9478672985781991,0.9474159331979237,0.9484315053035433,0.9498420221169036,0.9503498081697134,0.9480365605958023,0.950970435567592,0.9533965244865719,0.9496163394267659,0.9517603249830738,0.9523809523809523,0.9555969307154141,0.9552019860076733,0.9537914691943128,0.9539043105393816,0.9545813586097947,0.954355675919657,0.9561047167682238,0.9568946061837057,0.9586436470322727,0.956668923493568,0.9605055292259084,0.9558226134055517,0.9571767095463778,0.9596592191378921,0.9576844955991876,0.9623674114195441,0.9594335364477544,0.9623109907470097,0.9609568946061837,0.9621417287294065,0.9622545700744752,0.9609004739336493,0.9590950124125479,0.9640036109230422,0.9610133152787181,0.9618032046942,0.9620853080568721,0.9654141277364027,0.9628751974723538,0.9632137215075603,0.9643985556307831,0.9658090724441435,0.9669374858948319,0.9638907695779734,0.9650756037011962,0.9631008801624915,0.9645678176483864,0.9686301060708644,0.9650756037011962,0.9658654931166779,0.9655833897540058,0.9655833897540058,0.9648499210110585,0.9646242383209208,0.9649063416835929,0.9653012863913338,0.9670503272399007,0.9660911758068156,0.9666553825321598,0.9646242383209208)
lextree = c(0.7424611910810048, 0.765379621789444, 0.7834942139429861, 0.8010668924640135, 0.8163872424499012, 0.8279762912785775, 0.8401749929438329, 0.8500141123341801, 0.8590008467400508, 0.8656675134067174, 0.8728760937058989, 0.8791419700818516, 0.8845554614733276, 0.8876319503245836, 0.8940728196443691, 0.8959074230877787, 0.8986226361840248, 0.9025063505503811, 0.9032853513971211, 0.9054925204628845, 0.9074174428450466, 0.9084165961049958, 0.9105108664973186, 0.9119051651143099, 0.912125317527519, 0.9132317245272368, 0.9145695738075078, 0.9151679367767429, 0.9163985323172452, 0.9175726785210274, 0.918650860852385, 0.917888794806661, 0.9189556872706746, 0.9199040361275755, 0.9213773638159751, 0.9213096246119108, 0.9213265594129268, 0.9214451030200396, 0.9231329381879763, 0.9231216483206323, 0.9250014112334181, 0.9257239627434377, 0.9262094270392323, 0.9265707027942421, 0.9276601749929438, 0.9275246965848152, 0.9280045159469377, 0.9283657917019476, 0.9296528365791702, 0.929427039232289, 0.9302229748800451, 0.9295455828394016, 0.9308439175839683, 0.9294552639006491, 0.931927744848998, 0.93193338978267, 0.9328252893028507, 0.9330285069150438, 0.9328027095681626, 0.9351566469093988, 0.9336325148179508, 0.9352977702511995, 0.9361332204346599, 0.9349026248941575, 0.9370251199548405, 0.9373525261078183, 0.9368557719446796, 0.9378267005362687, 0.9378323454699408, 0.9387806943268416, 0.937894439740333, 0.9395032458368614, 0.9404346598927462, 0.9399040361275754, 0.9416991250352809, 0.94152977702512, 0.9420604007902907, 0.941930567315834, 0.9419700818515383, 0.942303132938188, 0.9430200395145357, 0.9435393734123624, 0.9445611064069998, 0.9447699689528648, 0.944990121366074, 0.9449336720293536, 0.9460795935647757)
#temps
Naiftemps = c(6.130709539279385E-4,0.0010267396264028352,0.0013801202008269344,0.0017326179858239811,0.0020518761444181925,0.002346206364441819,0.002692112743650325,0.002958922474896633,0.003319325125516834,0.003587738038984052,0.003918995643827525,0.004165597903130537,0.0044631892350856465,0.0047999383490844654,0.0050834096647962195,0.005496392166272888,0.005642942336089782,0.005919015468103957,0.00625843687241583,0.006549908446544596,0.006807933069994093,0.007017995976077968,0.007500659111045482,0.007785269750443,0.007988596204961607,0.008440687869167159,0.008594035624630833,0.00897847844063792,0.00915021902687537,0.009574535513880685,0.00982102030419374,0.010038620016243355,0.010323273922031896,0.010534935727997637,0.011071919115475488,0.011099380094506792,0.011406020230360307,0.011662656083874779,0.01210107704518606,0.012279355212640284,0.01246057553160071,0.01273974667749557,0.013162413319551093,0.013605502362669816,0.013554199940933254,0.0139077325753101,0.014163541088304784,0.014468727148552865)
jointreetemps = c(0.05651038696101595,0.05548537341258122,0.06120626594802126,0.0623701068738925,0.062498095688127586,0.06209152920112227,0.061362323464264616,0.061881492247489664,0.059686154865623155,0.058089586200531604,0.056820131681925574,0.05545843233165978,0.0545152713747785,0.052729507567926756,0.05129026760927348,0.050216916014471355,0.04846936488481984,0.04752081940342587,0.0458392634746013,0.0454242981024808,0.0435369152023036,0.042790418266391024,0.0409652832250443,0.03991381951417602,0.03865888249409333,0.037593355286473715,0.03649868366066155,0.03593367609273479,0.0345449454001772,0.03359148778056704,0.03271498050797401,0.03201600616509155,0.031172961237448317,0.030205463046367394,0.02980450838009451,0.0286410023257531,0.02801563363851152,0.02784097995422327,0.026706283298877732,0.0259410680744241,0.02541740527170703,0.024615321249261666,0.024441794853809803,0.023971850634967512,0.02294020736119315,0.02211592062906084,0.021499690231836975,0.020839556445658595)
wmvtemps = c(1.4945923339855287,1.5503172643975192,1.5912161551978736,1.6307620040977555,1.6681299061946249,1.7010002079887774,1.731601563792085,1.757977097164796,1.7833442033003544,1.8081031587049616,1.8335790233682812,1.8605553988112817,1.8899077695289428,1.9132010174985232,1.9398820778942705,1.9662830562979918,1.9924716027392204,2.0200019507900175,2.0456657402170704,2.071098103440638,2.097055232944477,2.122521191523922,2.1478210756054343,2.1732904908446544,2.198280694735676,2.223008907892794,2.247929881792676,2.2736685642350856,2.2997701271411697,2.3253274643384523,2.351896904348789,2.3767740933254577,2.4029979824276433,2.4299604074497934,2.456764699461016,2.483868777945954,2.5118990184214414,2.5411084656305376,2.571386206733609,2.603331608239811,2.6376037483387478,2.676942267018606,2.722561480249557,2.7757107274808033,2.8423695671145897,2.9231620128101006,3.0207718459465447,3.132521652281453)
vpoptemps = c(0.619880177753987,0.6692052204666273,0.7317778304415239,0.7835428034554046,0.8393094951269935,0.8925847076934436,0.9401803382309509,0.9840903001698169,1.026910106024808,1.0680262242321323,1.1092238419595393,1.1498626991656822,1.1903069023552866,1.2316474228440637,1.2740687191376254,1.316035523405198,1.3584633255685175,1.400294085757531,1.4422439237669817,1.4846440511665682,1.5258952243797992,1.568353883601595,1.6096364962714116,1.6515207696396927,1.6928072715224454,1.7338529835720615,1.774978728440638,1.8153042948538098,1.8561382867321323,1.8965240490992321,1.9361281432737745,1.9757038995126994,2.0158091659775548,2.0561014703558773,2.094314386961016,2.1337520829149437,2.172147336163615,2.2094566018163024,2.246534808992912,2.282568659664796,2.318733150361784,2.35474384476521,2.3906763707914944,2.4295996256645007,2.4761857712640283,2.536152407966627,2.6127072540977556,2.7319425257678676)
vnaiftemps = c(0.5654878922031896,0.6056752266317188,0.6490572558697578,0.6829557048139397,0.720100048471648,0.7555922484494979,0.7874808443591258,0.8166435704370939,0.8435650142498523,0.8696579058254578,0.8955631147002363,0.919717621492912,0.9444845379134672,0.9698594909184879,0.9959814455478441,1.0217668153425872,1.048007879023922,1.0745154691007088,1.1007386338230951,1.1269935481024809,1.15379970492469,1.1801322384819846,1.2061039145747194,1.2331453213600119,1.2602134606836977,1.287519607722977,1.3146178301092735,1.3419053928307738,1.3691115496898996,1.3972928465002954,1.4253422753987006,1.4536974013216184,1.4830541429415238,1.513018030936208,1.542581987263733,1.57262709757088,1.6032094773331365,1.6335512685321913,1.6641784893310692,1.6960786059878914,1.729621013511518,1.7641430136961016,1.8012120921441228,1.8432790326343769,1.8957278415534553,1.962086357981394,2.0506174140209685,2.171628945658594)
lextreetemps = c(9.385951491435322E-4, 9.206999003248672E-4, 9.574053750738335E-4, 0.0010206393532191376, 0.0010126803049320733, 0.0010660335240696987, 0.0010511686909332545, 0.0011193464153868872, 0.0011249905973124631, 0.0011314190527170703, 0.001175395976077968, 0.0011822279976373303, 0.0012078975413467219, 0.0012309438275251033, 0.0012884719137625518, 0.0013359795407560542, 0.0013247912655050206, 0.0013227320326343768, 0.001407098006497342, 0.0013673426055818075, 0.0013887386001181334, 0.0014351453189604252, 0.0014999887588600118, 0.001494079758564678, 0.0014659799320732427, 0.0014828400472533963, 0.001497552425428234, 0.001513701391760189, 0.0015271906453041936, 0.0015380687020082693, 0.001590135713230951, 0.0015552598272297697, 0.0016029215667454223, 0.0015638766870939161, 0.0016160766723272298, 0.00157890957250443, 0.0016145971020378026, 0.0015807919706142942, 0.0015811648663614885, 0.0016260900915534553, 0.0016257978108387477, 0.0015790943738924986, 0.0015788565305670408, 0.0015757875738334319, 0.0016151606024808033, 0.0015604985639397519, 0.0015971071544595393, 0.001537642295481394)
# MEDIUM
Naiftemps = c(0.0010116810496415528,0.0016883997700527526,0.0023949896523738673,0.0029658426213986203,0.0036375064926281618,0.004223179629379142,0.004630473285540376,0.005313823278777221,0.005876314892465846,0.006559031719193832,0.00682051251183552,0.007690403422156093,0.008060764439334506,0.008814894968213175,0.009339008318679832,0.009729382524009197,0.010218030907615312,0.010800554646287028,0.011279527728932775,0.01216870681725957,0.012532031786825375,0.013121461179494117,0.013982032530772352,0.014095038617611255,0.014546872987961585,0.01565805593128635,0.015851718652779657,0.01617400730420668,0.01710188137427296,0.017532312525361828,0.018411986744217502,0.019141338090085214,0.01930081678614906,0.019518399837684296,0.01986956134180982,0.0209797400919789,0.021716014878939538,0.022102245502502366,0.022544349925605302,0.022829389625321248,0.023375756932233194,0.024719914581360747,0.02521486602191262,0.02549994609765995)
jointreetemps = c(0.0691693280806168,0.06654608068443121,0.07256938495874476,0.07377797687001217,0.07320432787772217,0.0722793575679697,0.07092746354659814,0.06932008832679562,0.06753988286216692,0.0655458321385094,0.06349193764371704,0.06123165345597187,0.05893382436088192,0.056715938996347894,0.05464607669417016,0.052414928310564046,0.050042244690923846,0.048058093128635196,0.04610830853510077,0.04415676281617747,0.04236206627891249,0.04499164405518734,0.03902247227106723,0.037351015622886515,0.03585822920330042,0.034600085215744626,0.03333552772893277,0.03199651021236304,0.03092518605437576,0.02984158014337887,0.028999750642499662,0.028218356824022725,0.027235291965372648,0.02678806763154335,0.026055907953469497,0.02523585979981063,0.024701852022183148,0.02511995157581496,0.023732737454348708,0.023295820167726227,0.022987125659407547,0.02264744406871365,0.0223533163803598,0.02221581962667388)
wmvtemps = c(0.7965478627755985,0.8160240042607873,0.8311722452996078,0.8465396813877992,0.8619417899364263,0.8776536955227918,0.8927007136480455,0.9082907774922224,0.9244003205735155,0.9405550520086569,0.9563681658325442,0.9733636394562424,0.9900202305559312,1.0068131076017854,1.0233010451102393,1.039834390707426,1.0561597244014609,1.0720394964155282,1.0884614358852969,1.1044725541728662,1.1198347618017044,1.1354672159475179,1.1509304223589882,1.1660183666305965,1.181659499864737,1.1970076608954416,1.2124630060868389,1.227697067969701,1.2432045641823346,1.2584507239956715,1.2742634885702693,1.2899736402001893,1.3053130770999595,1.3215953077911538,1.3380518186798322,1.3556662739077505,1.374397483565535,1.3950147795211687,1.419355865075071,1.4481907822940618,1.484407602799946,1.5242677865548493,1.5660133616258622,1.6091389751792236)
vpoptemps = c(0.3373159754497498,0.35954324266197757,0.3859007524685513,0.4125853442445557,0.4421256462870283,0.471702110036521,0.500916622480725,0.530880220816989,0.5615572399567158,0.5926065827133775,0.6239073823211145,0.6555718758284864,0.6879136757067497,0.719780246584607,0.7520238882726904,0.7841105075071013,0.8152354380495063,0.8460459151224131,0.876229896320844,0.9068226852427972,0.9363751338428243,0.9659165105505207,0.9933383679832274,1.0202956827404301,1.046768951711078,1.0735229916136886,1.099179509333153,1.1252547484782902,1.1511916317462465,1.1774401381712432,1.2030660683754903,1.2285443556066549,1.25452294609766,1.280623670160963,1.3069319787636955,1.3323488160422021,1.3577788343027188,1.383842335452455,1.4113812024212093,1.4397572673474908,1.4700707158798865,1.5061081802380631,1.5506332132422562,1.6056343209793047)
vnaiftemps = c(0.28934941850399026,0.3064006830109563,0.3251501990396321,0.34224332693088055,0.35937942066819967,0.37544259786284323,0.39022054964155284,0.40448112538888137,0.4178912758014338,0.43131828635195457,0.44431559008521576,0.45747393473556064,0.4703594849181658,0.48379601271473016,0.4974150645881239,0.5110497538888138,0.5242245560665494,0.5376566951846341,0.5510735487623427,0.5647517916948465,0.5781106949141079,0.5918209430542405,0.6054222003922629,0.6188148186798322,0.6324439959421074,0.6463513863790071,0.6603340891383741,0.6741525128499932,0.6881400547139186,0.7022769139726769,0.7166760831867983,0.7312503485729744,0.7452351604220209,0.759776839307453,0.7747295884620587,0.7892993313945624,0.8029099446773975,0.8174296370891384,0.8327835777762749,0.8494901621804409,0.8676641988367374,0.8881704997971054,0.9103823529013932,0.9354209683484377)
lextreetemps = c(9.871808940890032E-4, 0.0010919204247260923, 0.0012270306370891384, 0.0012618103543892872, 0.0013648988570269173, 0.001442163539834979, 0.0016064685783849589, 0.0016502073786013797, 0.0017350571757067496, 0.0018341723319356149, 0.0018537329974300013, 0.001952052380630326, 0.002101698146895712, 0.0022774710536994456, 0.0024094375557960233, 0.0025170279183010956, 0.0026160373123224672, 0.0026916030434194506, 0.0028298945421344514, 0.0030196141147030976, 0.0030911308196943056, 0.0034702625388881372, 0.0035230289124847827, 0.003624732307588259, 0.0037039085824428514, 0.003917542986608955, 0.003986748248343028, 0.00413833606790207, 0.00439140528878669, 0.004361716184228324, 0.004411312586230218, 0.004512773583119167, 0.0046960397538211825, 0.00472514135668876, 0.004590834113350466, 0.004897660739889084, 0.0047370618490463956, 0.004694337772216962, 0.004398824624644935, 0.004273979230353037, 0.0038618103002840526, 0.0034346460503178683, 0.0029147185919112676, 0.0021245620925199513)
# BIG
Naiftemps = c(0.00469632012866091,0.00678952480108346,0.010033462953557925,0.013950615597313922,0.013854764178093787,0.016783919361209865,0.01984493064725467,0.022964014954009366,0.02519751498222448,0.026734815868178996,0.026873487613565825,0.031001877941425428,0.03304656119857796,0.03416763122848598,0.03846027137294735,0.039743153208058234,0.042773104339484225,0.04369320518029456,0.042934489024321426,0.04974415800462728,0.05624536854579313,0.0549238879860053,0.055812429095423506,0.057765659951470004,0.056513454376163876,0.05996653975509283,0.07009525111449692,0.06365193798318379,0.06876009203769538,0.0780441651148355,0.07275697449353874,0.08198136843293267,0.07704852389819987,0.08212766198295807,0.09007219005699453,0.08353381299023757,0.095925197731505,0.08518363077704419,0.09295438237119802,0.09361875887365273,0.09468717346650866,0.10357683099147903,0.10507326956718019,0.1009855371028723,0.1132588661475086,0.10426615811748773,0.12378699255121042,0.10007425297669431,0.1178453370012979,0.12116236595000282,0.11260484481688392,0.11937027504091191,0.11974064996332036,0.129627940804695,0.13540990141639864,0.12586783059646747,0.13246467857344393,0.14363830370746572,0.13832812194571412,0.13938311116754135,0.1345764880925508,0.14589631591422123,0.14171031202031603,0.15190489057562076,0.16036516416478555,0.15490840411963883,0.15825513888261852,0.1580144130925508,0.1575681183972912,0.16545660536117382,0.15969180874717834,0.16350425163656884,0.16294880428893904,0.17905278132054175,0.158539725,0.1891270586343115,0.174996566986456,0.18032123572234762,0.18605601224604967,0.17935054232505643,0.18371200090293455,0.18591498634311512,0.19241401495485327,0.1880498059255079,0.19844988448081263,0.20547052731376975,0.210128034255079)
jointreetemps = c(27.246312220077872,27.102715229783872,32.85797541239208,34.416307678234865,34.413268514192204,33.77221092274702,32.76229998685176,31.542794389932848,30.23325599983071,28.915683370859433,27.645367995993453,26.341602487444277,25.11493569775972,23.9426225814006,22.81615690158569,21.702456376051014,20.634195804017832,19.642536831950792,18.752658712149426,17.880941349641667,17.045190713616613,16.28752611319903,15.576991844816884,14.853247893459738,14.230431429264714,13.644606318266463,13.042544451216072,12.510861039219005,12.026990894362621,11.568933852886406,11.155899998645674,10.729652745838271,10.343556190790588,9.991670337791321,9.651479521189549,9.334602300547374,9.040392692906721,8.76525572315332,8.494856722589018,8.259694301619547,8.041163151966593,7.837130728852774,7.646287331188985,7.458310030867333,7.291952925963546,7.143948537215732,6.9897277505784094,6.848951528807629,6.718358433891993,6.589039963376784,6.46887727193725,6.353449732577168,6.24240912606512,6.12952212595226,6.029689841036059,5.932614609051408,5.8386968129902375,5.756244473110998,5.6623857901924275,5.573599088821172,5.492725137020316,5.40615928476298,5.327414508239277,5.2520847597065465,5.17176913244921,5.091933485835215,5.0233337465575625,4.9437326619074495,4.867635777765237,4.79375961506772,4.718916469638827,4.636837774435666,4.567317421726862,4.489804258295711,4.420138081038375,4.354781099379233,4.29003522037246,4.231350004232506,4.201858342155756,4.138456707223476,4.096267666873589,4.0839125694695255,4.0599902200338605,4.057317436173815,4.076606144300226,4.125554272799097,4.224577781376976)
wmvtemps = c(1.3014854312232003,1.4293006351839315,1.5217993793726021,1.6177837793387497,1.7165966678515008,1.7916713598510494,1.8508638076055066,1.8927339502933875,1.9215107408034304,1.940394192281652,1.9544777582374182,1.9648255922477995,1.9731129533401037,1.9775470077296322,1.983538067197021,1.987533917964342,1.995052105958023,2.0031658032046944,2.0091116354660348,2.0185100530918527,2.028649178345746,2.036527794403069,2.0443198671857368,2.054498832035658,2.0618487954186415,2.071772400304672,2.082963361938614,2.092457092360641,2.1021747085872264,2.11278116108102,2.1230016150417512,2.131670333728278,2.141553279282329,2.153808752369668,2.1659780175468293,2.177783284134507,2.1910185012976755,2.203252730309185,2.2150114293048975,2.2289482340893705,2.244422028436019,2.256098636425186,2.270281563924622,2.284246749097269,2.298065818381855,2.3114004930038368,2.3264456029113068,2.3389780284924395,2.355831651602347,2.3709314108553374,2.3871641346197245,2.402832263258858,2.419853930038366,2.436817791469194,2.4559093885691716,2.4738666230534867,2.4910949904649065,2.5098773295531482,2.527000736007673,2.5417984347777027,2.5597529294741594,2.580133362107876,2.5969212523132477,2.616967046659896,2.6356342306477094,2.654149471394719,2.673957175863236,2.692568846422929,2.7145501565109456,2.7330755097043555,2.751333355958023,2.770747666666667,2.7902277879711126,2.8138241220379148,2.835876202606635,2.861596143308508,2.88782152014218,2.913498345802302,2.9430133494696458,2.9720352645565336,3.0073289522681113,3.0449059916497405,3.0781286727036785,3.11233659732566,3.1506251038140376,3.1928383696682463,3.2362516150417515)
vpoptemps = c(0.7227277617919206,0.8176607521439856,0.8685920144436922,0.9502131319115323,1.0216973851275106,1.0768979904084857,1.122970468291582,1.160496698149402,1.1933421155495374,1.2239136979237193,1.252892573403295,1.281925575829384,1.311307916779508,1.340418865436696,1.3704302575603702,1.4022050484653577,1.4339764114759648,1.4657812242157526,1.4993304166666668,1.5340441478785827,1.570551124746107,1.6053883865380276,1.6435179111938614,1.6811516784585872,1.7186142176709547,1.7574324353419093,1.7949052927104492,1.8314419151997292,1.8706251108102008,1.90894174413225,1.9504140219476416,1.9909565009591514,2.032009888907696,2.071109803373956,2.111297498984428,2.152150255359964,2.192158244470774,2.234125353531934,2.273793709489957,2.316473826957797,2.3571149058338974,2.397940707289551,2.4398795717670954,2.480520919036335,2.5215542206612502,2.5621895197472355,2.6030560216091176,2.6435434206161137,2.68447965690589,2.7264281204581358,2.767640745147822,2.8107752989731436,2.8542455574362444,2.8974845194087115,2.941577401320244,2.983495113179869,3.027405131121643,3.0708076930151207,3.1148969090498757,3.1577836491762583,3.203265552189122,3.2486963406680207,3.296698244865719,3.343202899176258,3.392217123674114,3.4391654427330174,3.4891256319115325,3.5382426043218236,3.589984524994358,3.6454421313473255,3.7022196170728954,3.760034158824193,3.8207523094673888,3.8792767903972014,3.946767140769578,4.013047620232453,4.087033631798691,4.160871990972693,4.244349295982848,4.329059756149853,4.425155779056646,4.510295066463552,4.615544396468066,4.701517446118258,4.805407352572782,4.852121004062289,4.838807259252991)
vnaiftemps = c(0.6451137929361318,0.7004251516023471,0.7402862512412548,0.7941943547731889,0.8436578763258858,0.8850182477431731,0.9191662471789663,0.9456509149176259,0.9681622384337621,0.9869423571428572,1.0011106430828256,1.0154165848566914,1.0262460703565786,1.0352890938275785,1.0451006760324983,1.053796864421124,1.0625801736064093,1.073303820300158,1.0817336954412096,1.0911937024937937,1.1003672994809297,1.109127040340781,1.11878846812232,1.129006776686978,1.1406527800722184,1.1524109413789212,1.162298409896186,1.172779033795983,1.1848031659896185,1.1972309004739337,1.209998938670729,1.2215383002708193,1.2339877545136537,1.2478261321936357,1.262392099413225,1.2763035444030693,1.2883153586097946,1.302996368539833,1.3156883779620854,1.3307283744640037,1.3441463018505981,1.3648075778605282,1.373427721902505,1.3884467777589709,1.4039782082487022,1.418676180546152,1.434322146129542,1.4494948827578424,1.4646719453283683,1.4792495922477995,1.4947454961069735,1.5097882015910629,1.5263681480478448,1.54355282046942,1.5574965721620402,1.57437514596028,1.5904318558451818,1.6071270486910405,1.624394095971564,1.642454921575265,1.6590645144436922,1.6750880820920786,1.6930401014443692,1.7099707239900699,1.7283097175581132,1.7450942695779734,1.7636017050891446,1.7834564677273752,1.8007157356127286,1.8210072708756488,1.8392085387045813,1.8621039884901829,1.8897202618483413,1.905506202775897,1.9295180107199277,1.9544357783795983,1.9819774249605056,2.0094258825885802,2.040351750507786,2.072305510212142,2.1026803915594674,2.139019198995712,2.173030381516588,2.2094696697698035,2.2442522798465356,2.2808345163055743,2.3180854916497404)
lextreetemps = c(0.0016982109850409257, 0.0016183629805249788, 0.0016514960824160316, 0.0016693256223539374, 0.001678907248094835, 0.0016918056562235393, 0.001712892734970364, 0.0017309370702794243, 0.0017356804403048263, 0.0017490602314422805, 0.0017630764775613886, 0.001768132633361558, 0.001769494541349139, 0.0017885119390347163, 0.00179574688681908, 0.0017999977533163986, 0.001802400344340954, 0.0018416144510302005, 0.001827193355913068, 0.001834829844764324, 0.0018491389048828676, 0.0018589804064352243, 0.0018688644538526673, 0.001878152204346599, 0.0018913192040643523, 0.0019033213491391476, 0.0019160837764606265, 0.001925194405870731, 0.0019385509060118543, 0.0019486479424216765, 0.0019615007112616426, 0.0019732338131526954, 0.0019885149364944964, 0.001999172876093706, 0.002052725475585662, 0.0020244470505221563, 0.0020302198927462604, 0.0020494604346598926, 0.0020594874682472483, 0.0020678437256562237, 0.0020803426192492237, 0.0020900380976573525, 0.0020992857239627433, 0.0021098250127011007, 0.00211570282811177, 0.002121823838554897, 0.0021366507479537115, 0.0021429323736946093, 0.002146472548687553, 0.002155329156082416, 0.0021833488060965284, 0.0021642386113463166, 0.002166257888794807, 0.0021760188202088627, 0.002174500208862546, 0.002175848190798758, 0.0021818443240191926, 0.002179670657634773, 0.0021839889923793397, 0.002183961343494214, 0.002182636150155236, 0.0021819025740897544, 0.0021802319559695174, 0.0021853985661868473, 0.0021834517979113744, 0.00218234516511431, 0.002184271769686706, 0.0021765833135760655, 0.00217332661021733, 0.002173064578041208, 0.002174775591306802, 0.0021725151453570422, 0.0021662781484617557, 0.002163636748518205, 0.002160738729889924, 0.002160683974033305, 0.002159173096246119, 0.0021577892915608243, 0.002167361501552357, 0.002146954541349139, 0.0021496048941574935, 0.0021383544679650012, 0.0021277644707874683, 0.0021259769291560823, 0.0021188804233700253, 0.0021153694270392323, 0.0020956159243578887)
#--------------------------------------------------------------------------------------------
#parametres graphes
# -- manuels
x_pas_erreur = 4
y_pas_erreur = 3
x_legend_erreur = 0
y_legend_erreur = 50
y_padding_erreur = 1
x_pas_time = 4
y_pas_time = 3
x_legend_time = 0
y_legend_time = 0.013
y_padding_time = 0.01
# -- auto calcul
#MAJ VERS ERROR
oracle = 100-100*oracle
Naif = 100-100*Naif
jointree = 100-100*jointree
wmv = 100-100*wmv
vpop = 100-100*vpop
vnaif = 100-100*vnaif
lextree = 100-100*lextree
c_oracle = 100*c_oracle
c_Naif = 100*c_Naif
c_jointree = 100*c_jointree
c_wmv = 100*c_wmv
c_vpop = 100*c_vpop
c_vnaif = 100*c_vnaif
#FIN MAJ VERS ERROR
nb_val = length(oracle)
nb_val = length(Naif)
nb_val = length(jointree)
nb_val = length(wmv)
nb_val = length(vpop)
nb_val = length(vnaif)
min_val_erreur = 30000
min_val_erreur = min(min_val_erreur,100-100*oracle)
min_val_erreur = min(min_val_erreur,100-100*Naif)
min_val_erreur = min(min_val_erreur,100-100*jointree)
min_val_erreur = min(min_val_erreur,100-100*wmv)
min_val_erreur = min(min_val_erreur,100-100*vpop)
min_val_erreur = min(min_val_erreur,100-100*vnaif)
min_val_erreur = ceiling(min_val_erreur)
max_val_erreur = 30000
max_val_erreur = max(max_val_erreur,100-100*oracle)
max_val_erreur = max(max_val_erreur,100-100*Naif)
max_val_erreur = max(max_val_erreur,100-100*jointree)
max_val_erreur = max(max_val_erreur,100-100*wmv)
max_val_erreur = max(max_val_erreur,100-100*vpop)
max_val_erreur = max(max_val_erreur,100-100*vnaif)
max_val_erreur = floor(max_val_erreur)
size = 0:(nb_val-1)
x_lim_erreur = c(0,(nb_val-1))
if(min_val_erreur-y_padding_erreur <= 0){
min_val_erreur = min_val_erreur+y_padding_erreur+0.00001
}
y_lim_erreur = c((min_val_erreur-y_padding_erreur),(max_val_erreur+y_padding_erreur))
x_axp_erreur = c(0, (nb_val-1), x_pas_erreur)
y_axp_erreur = c((min_val_erreur-y_padding_erreur),(max_val_erreur+y_padding_erreur),y_pas_erreur)
min_val_time = 30000
min_val_time = min(min_val_erreur,100-100*Naiftemps)
min_val_time = min(min_val_erreur,100-100*jointreetemps)
min_val_time = min(min_val_erreur,100-100*wmvtemps)
min_val_time = min(min_val_erreur,100-100*vpoptemps)
min_val_time = min(min_val_erreur,100-100*vnaiftemps)
min_val_time = ceiling(min_val_erreur)
max_val_time = 30000
max_val_time = max(max_val_time,Naiftemps)
max_val_time = max(max_val_time,jointreetemps)
max_val_time = max(max_val_time,wmvtemps)
max_val_time = max(max_val_time,vpoptemps)
max_val_time = max(max_val_time,vnaiftemps)
max_val_time = floor(max_val_time)
x_lim_time = c(0,(nb_val-1))
if(min_val_time-y_padding_time <= 0){
min_val_time = min_val_time+y_padding_time+0.00001
}
size = 0:(nb_val-1)
y_lim_time = c((min_val_time-y_padding_time),(max_val_time+y_padding_time))
x_axp_time = c(0, (nb_val-1), x_pas_erreur)
y_axp_time = c((min_val_time-y_padding_time),(max_val_time+y_padding_time),y_pas_time)
#fin parametres graphes
#--------------------------------------------------------------------------------------------
(ggplot(NULL, aes(size)) + #scale_y_log10(breaks = round(seq(0, 100, by = 5),1)) + annotation_logticks(sides="l") +
ylab("Error rate (%)") + xlab("Number of configurated attributes") + theme_bw() #+ theme(legend.position="bottom")
+geom_line(aes(y=Naif, colour="Naive Bayes"), colour="turquoise2", linetype = "dotted") + geom_point(aes(y=Naif, shape="Naive Bayes"), colour="turquoise2", fill="turquoise2")
+geom_line(aes(y=wmv, colour="Weighted Majority Voter"), colour="deeppink2", linetype = "dotted") + geom_point(aes(y=wmv, shape="Weighted Majority Voter"), colour="deeppink2", fill="deeppink2")
+geom_line(aes(y=vpop, colour="Most Popular Choice"), colour="gold2", linetype = "dotted") + geom_point(aes(y=vpop, shape="Most Popular Choice"), colour="gold2", fill="gold2")
+geom_line(aes(y=vnaif, colour="Naive Bayes Voter"), colour="firebrick3", linetype = "dotted") + geom_point(aes(y=vnaif, shape="Naive Bayes Voter"), colour="firebrick3", fill="firebrick3")
+geom_line(aes(y=jointree, colour="Classical Bayes"), colour="springgreen4", linetype = "dotted") + geom_point(aes(y=jointree, shape="Classical Bayes"), colour="springgreen4", fill="springgreen4")
+geom_line(aes(y=lextree, colour="2-LP-tree (3 cl.)"), colour="dodgerblue4", linetype = "dotted") + geom_point(aes(y=lextree, shape="2-LP-tree (3 cl.)"), colour="dodgerblue4", fill="dodgerblue4")
+geom_line(aes(y=oracle, colour="Oracle"), colour="black", linetype = "dotted") + geom_point(aes(y=oracle, shape="Oracle"), colour="black", fill="black")
# + theme(legend.position=c(0.75,0.65), legend.background = element_rect(fill=alpha('blue', 0)))
+ theme(legend.position=c(0.75,0.72), legend.background = element_rect(fill=alpha('blue', 0)))
+ scale_colour_manual(name = 'Legend', guide = 'legend',
limits = c(NULL
,'Classical Bayes' #jointree
,'Naive Bayes' #Naif
,'Weighted Majority Voter' #wmv
,'Most Popular Choice' #vpop
,'Naive Bayes Voter' #vnaif
,'2-LP-tree (3 cl.)'
,'Oracle' #oracle
),
values =c(NULL
,'Classical Bayes'='springgreen' #jointree
,'Naive Bayes'='turquoise2' #Naif
,'Weighted Majority Voter'='deeppink2' #wmv
,'Most Popular Choice'='gold2' #vpop
,'Naive Bayes Voter'='firebrick3' #vnaif
,'2-LP-tree (3 cl.)'='dodgerblue4'
,'Oracle'='black' #oracle
))
+ scale_shape_manual(name = 'Legend', guide = 'legend',
limits = c(NULL
,'Classical Bayes' #jointree
,'Naive Bayes' #Naif
,'Weighted Majority Voter' #wmv
,'Most Popular Choice' #vpop
,'Naive Bayes Voter' #vnaif
,'2-LP-tree (3 cl.)'
,'Oracle' #oracle
),
values =c(NULL
,'Classical Bayes'=21 #jointree
,'Naive Bayes'=24 #Naif
,'Weighted Majority Voter'=25 #wmv
,'Most Popular Choice'=22 #vpop
,'Naive Bayes Voter'=23 #vnaif
,'2-LP-tree (3 cl.)'=1
,'Oracle'=4 #oracle
))
+ guides(shape = guide_legend(override.aes = list(colour = c(NULL
,'Classical Bayes'='springgreen' #jointree
,'Naive Bayes'='turquoise2' #Naif
,'Weighted Majority Voter'='deeppink2' #wmv
,'Most Popular Choice'='gold2' #vpop
,'Naive Bayes Voter'='firebrick3' #vnaif
,'2-LP-tree (3 cl.)'='dodgerblue4'
,'Oracle'='black' #oracle
),
fill = c(NULL
,'Classical Bayes'='springgreen' #jointree
,'Naive Bayes'='turquoise2' #Naif
,'Weighted Majority Voter'='deeppink2' #wmv
,'Most Popular Choice'='gold2' #vpop
,'Naive Bayes Voter'='firebrick3' #vnaif
,'2-LP-tree (3 cl.)'='dodgerblue4'
,'Oracle'='black' #oracle
))))
)
(ggplot(NULL, aes(size))
+ scale_y_log10(
breaks = scales::trans_breaks("log10", function(x) 10^x),
labels = scales::trans_format("log10", function(x) round(10^x,3)))
+ annotation_logticks(sides="l")
+ theme_bw() +
ylab("Recommendation time (ms)") + xlab("Number of configurated attributes") #+ theme(legend.position="bottom")
+geom_line(aes(y=jointreetemps, colour="Classical Bayes"), colour="springgreen4", linetype = "dotted") + geom_point(aes(y=jointreetemps, shape="Classical Bayes"), colour="springgreen4", fill="springgreen4")
+geom_line(aes(y=Naiftemps, colour="Naive Bayes"), colour="turquoise2", linetype = "dotted") + geom_point(aes(y=Naiftemps, shape="Naive Bayes"), colour="turquoise2", fill="turquoise2")
+geom_line(aes(y=wmvtemps, colour="Weighted Majority Voter"), colour="deeppink2", linetype = "dotted") + geom_point(aes(y=wmvtemps, shape="Weighted Majority Voter"), colour="deeppink2", fill="deeppink2")
+geom_line(aes(y=vpoptemps, colour="Most Popular Choice"), colour="gold2", linetype = "dotted") + geom_point(aes(y=vpoptemps, shape="Most Popular Choice"), colour="gold2", fill="gold2")
+geom_line(aes(y=vnaiftemps, colour="Naive Bayes Voter"), colour="firebrick3", linetype = "dotted") + geom_point(aes(y=vnaiftemps, shape="Naive Bayes Voter"), colour="firebrick3", fill="firebrick3")
+geom_line(aes(y=lextreetemps, colour="2-LP-tree (3 cl.)"), colour="dodgerblue4", linetype = "dotted") + geom_point(aes(y=lextreetemps, shape="2-LP-tree (3 cl.)"), colour="dodgerblue4", fill="dodgerblue4")
# + theme(legend.position=c(0.79,0.66), legend.background = element_rect(fill=alpha('blue', 0)))
# + theme(legend.position=c(0.79,0.2), legend.background = element_rect(fill=alpha('blue', 0)))
+ theme(legend.position="bottom")
+ scale_colour_manual(name = 'Legend', guide = 'legend',
limits = c(NULL
,'Classical Bayes' #jointree
,'Naive Bayes' #Naif
,'Weighted Majority Voter' #wmv
,'Most Popular Choice' #vpop
,'Naive Bayes Voter' #vnaif
,'2-LP-tree (3 cl.)'
),
values =c(NULL
,'Classical Bayes'='springgreen' #jointree
,'Naive Bayes'='turquoise2' #Naif
,'Weighted Majority Voter'='deeppink2' #wmv
,'Most Popular Choice'='gold2' #vpop
,'Naive Bayes Voter'='firebrick3' #vnaif
,'2-LP-tree (3 cl.)'='dodgerblue4'
))
+ scale_shape_manual(name = 'Legend', guide = 'legend',
limits = c(NULL
,'Classical Bayes' #jointree
,'Naive Bayes' #Naif
,'Weighted Majority Voter' #wmv
,'Most Popular Choice' #vpop
,'Naive Bayes Voter' #vnaif
,'2-LP-tree (3 cl.)'
),
values =c(NULL
,'Classical Bayes'=21 #jointree
,'Naive Bayes'=24 #Naif
,'Weighted Majority Voter'=25 #wmv
,'Most Popular Choice'=22 #vpop
,'Naive Bayes Voter'=23 #vnaif
,'2-LP-tree (3 cl.)'=1
))
+ guides(shape = guide_legend(override.aes = list(colour = c(NULL
,'Classical Bayes'='springgreen' #jointree
,'Naive Bayes'='turquoise2' #Naif
,'Weighted Majority Voter'='deeppink2' #wmv
,'Most Popular Choice'='gold2' #vpop
,'Naive Bayes Voter'='firebrick3' #vnaif
,'2-LP-tree (3 cl.)'='dodgerblue4'
),
fill = c(NULL
,'Classical Bayes'='springgreen' #jointree
,'Naive Bayes'='turquoise2' #Naif
,'Weighted Majority Voter'='deeppink2' #wmv
,'Most Popular Choice'='gold2' #vpop
,'Naive Bayes Voter'='firebrick3' #vnaif
,'2-LP-tree (3 cl.)'='dodgerblue4'
))))
)
| 58,938 | gpl-3.0 |
29c062e99ea01825f3faf03a4bc83ed93dbb4827 | rho-devel/rho | src/extra/testr/filtered-test-suite/format/tc_format_34.R | expected <- eval(parse(text="structure(c(\"213198964\", \" 652425\"), .Names = c(\"null.deviance\", \"deviance\"))"));
test(id=0, code={
argv <- eval(parse(text="list(structure(c(213198964, 652424.52183908), .Names = c(\"null.deviance\", \"deviance\")), FALSE, 5L, 0L, NULL, 3L, TRUE, NA)"));
.Internal(format(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]], argv[[7]], argv[[8]]));
}, o=expected);
| 479 | gpl-2.0 |
c710fd01f5b72f465ccba907066bc88f2fd967de | realviacauchy/shiny-court-grapher | reports/TDO_Qtrly_Long_FY08-FY15_PLOT.R | ##################
# Draws quarterly graph of adult TDOs from eMagistrate data
# One line, with fiscal quarters on the x axis and counts on the y axis
##################
#source("reports/emagistrate_prep.R")
library(dplyr)
library(pander)
library(ggplot2)
TDO <-
emags %>%
filter(Type=="TDO", FYear>2007)
TDO_Qtrly <- TDO %>%
group_by(FQtr, FYear) %>%
summarise(count = sum(Process.Count))
TDO_Qtrly$FQtr <- factor(TDO_Qtrly$FQtr)
TDO_Qtrly_Long<-
unite(TDO_Qtrly, Fyear_FQtr, FYear, FQtr, sep="-")
TDO_Qtrly_Long_Plot <-
ggplot(TDO_Qtrly_Long, aes(x=Fyear_FQtr, y=count, group=1)) + geom_line() +
ylab("Number of TDOs") + xlab("Fiscal Quarter")
#TDO_Qtrly_Long_Plot + ylim(1000,max(TDO_Qtrly_Long$count)) + geom_line(size=1.2) + ggtitle("Quarterly TDO Trends (Adults Only), FY2008-FY2015") + scale_x_discrete(labels=c("08-1", "08-2", "08-3", "08-4", "09-1", "09-2", "09-3", "09-4", "10-1", "10-2", "10-3", "10-4", "11-1", "11-2", "11-3", "11-4", "12-1", "12-2", "12-3", "12-4", "13-1", "13-2", "13-3", "13-4", "14-1", "14-2", "14-3", "14-4", "15-1", "15-2","15-3", "15-4")) + theme(axis.text.x = element_text(angle=90))
| 1,149 | mit |
29c062e99ea01825f3faf03a4bc83ed93dbb4827 | cxxr-devel/cxxr | src/extra/testr/filtered-test-suite/format/tc_format_34.R | expected <- eval(parse(text="structure(c(\"213198964\", \" 652425\"), .Names = c(\"null.deviance\", \"deviance\"))"));
test(id=0, code={
argv <- eval(parse(text="list(structure(c(213198964, 652424.52183908), .Names = c(\"null.deviance\", \"deviance\")), FALSE, 5L, 0L, NULL, 3L, TRUE, NA)"));
.Internal(format(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]], argv[[7]], argv[[8]]));
}, o=expected);
| 479 | gpl-2.0 |
c710fd01f5b72f465ccba907066bc88f2fd967de | zhuoaprilfu/demo_fork | reports/TDO_Qtrly_Long_FY08-FY15_PLOT.R | ##################
# Draws quarterly graph of adult TDOs from eMagistrate data
# One line, with fiscal quarters on the x axis and counts on the y axis
##################
#source("reports/emagistrate_prep.R")
library(dplyr)
library(pander)
library(ggplot2)
TDO <-
emags %>%
filter(Type=="TDO", FYear>2007)
TDO_Qtrly <- TDO %>%
group_by(FQtr, FYear) %>%
summarise(count = sum(Process.Count))
TDO_Qtrly$FQtr <- factor(TDO_Qtrly$FQtr)
TDO_Qtrly_Long<-
unite(TDO_Qtrly, Fyear_FQtr, FYear, FQtr, sep="-")
TDO_Qtrly_Long_Plot <-
ggplot(TDO_Qtrly_Long, aes(x=Fyear_FQtr, y=count, group=1)) + geom_line() +
ylab("Number of TDOs") + xlab("Fiscal Quarter")
#TDO_Qtrly_Long_Plot + ylim(1000,max(TDO_Qtrly_Long$count)) + geom_line(size=1.2) + ggtitle("Quarterly TDO Trends (Adults Only), FY2008-FY2015") + scale_x_discrete(labels=c("08-1", "08-2", "08-3", "08-4", "09-1", "09-2", "09-3", "09-4", "10-1", "10-2", "10-3", "10-4", "11-1", "11-2", "11-3", "11-4", "12-1", "12-2", "12-3", "12-4", "13-1", "13-2", "13-3", "13-4", "14-1", "14-2", "14-3", "14-4", "15-1", "15-2","15-3", "15-4")) + theme(axis.text.x = element_text(angle=90))
| 1,149 | mit |
c710fd01f5b72f465ccba907066bc88f2fd967de | zhuoaprilfu/shiny-court-grapher | reports/TDO_Qtrly_Long_FY08-FY15_PLOT.R | ##################
# Draws quarterly graph of adult TDOs from eMagistrate data
# One line, with fiscal quarters on the x axis and counts on the y axis
##################
#source("reports/emagistrate_prep.R")
library(dplyr)
library(pander)
library(ggplot2)
TDO <-
emags %>%
filter(Type=="TDO", FYear>2007)
TDO_Qtrly <- TDO %>%
group_by(FQtr, FYear) %>%
summarise(count = sum(Process.Count))
TDO_Qtrly$FQtr <- factor(TDO_Qtrly$FQtr)
TDO_Qtrly_Long<-
unite(TDO_Qtrly, Fyear_FQtr, FYear, FQtr, sep="-")
TDO_Qtrly_Long_Plot <-
ggplot(TDO_Qtrly_Long, aes(x=Fyear_FQtr, y=count, group=1)) + geom_line() +
ylab("Number of TDOs") + xlab("Fiscal Quarter")
#TDO_Qtrly_Long_Plot + ylim(1000,max(TDO_Qtrly_Long$count)) + geom_line(size=1.2) + ggtitle("Quarterly TDO Trends (Adults Only), FY2008-FY2015") + scale_x_discrete(labels=c("08-1", "08-2", "08-3", "08-4", "09-1", "09-2", "09-3", "09-4", "10-1", "10-2", "10-3", "10-4", "11-1", "11-2", "11-3", "11-4", "12-1", "12-2", "12-3", "12-4", "13-1", "13-2", "13-3", "13-4", "14-1", "14-2", "14-3", "14-4", "15-1", "15-2","15-3", "15-4")) + theme(axis.text.x = element_text(angle=90))
| 1,149 | mit |
29c062e99ea01825f3faf03a4bc83ed93dbb4827 | kmillar/cxxr | src/extra/testr/filtered-test-suite/format/tc_format_34.R | expected <- eval(parse(text="structure(c(\"213198964\", \" 652425\"), .Names = c(\"null.deviance\", \"deviance\"))"));
test(id=0, code={
argv <- eval(parse(text="list(structure(c(213198964, 652424.52183908), .Names = c(\"null.deviance\", \"deviance\")), FALSE, 5L, 0L, NULL, 3L, TRUE, NA)"));
.Internal(format(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]], argv[[7]], argv[[8]]));
}, o=expected);
| 479 | gpl-2.0 |
8a4578e2cbad84471373f96e3bb8e75bfca317a9 | ADIRSE/maddata | app/global_functions.R |
#######################
# GLOBAL FUNCS
#######################
# load air quality measure points
fixStationCodes <- function(code) {
# code <- as.character(code)
if (code<10) {
station_code <- paste('2807900',
code, sep='')
}
else {
station_code <- paste('280790',
code, sep='')
}
station_code
}
# BOA
getBOAData <- function(url){
temp <- getURL(URLencode(url), ssl.verifypeer = FALSE)
data <- fromJSON(temp, simplifyVector=FALSE)
}
# IMPALA
connectImpala <- function(){
rimpala.init(libs ="lib/impala/impala-jdbc-0.5-2/")
# connect
rimpala.connect("54.171.4.239", port = "21050", principal = "user=guest;password=maddata")
rimpala.usedatabase("bod_pro")
}
disconnectImpala <- function(){
rimpala.close()
}
# identif <- 'PM20742'
# "SELECT * FROM md_trafico_madrid WHERE identif = \"PM20742\" AND fecha > \"2014-09-15\" LIMIT 100 LIMIT 100 LIMIT 100"
getImpalaQuery <- function(identif = 0, date_start = 0, date_end = 0){
limit <- 100
query <- "SELECT * FROM md_trafico_madrid "
if (identif != 0) {
query <- paste(query, "WHERE identif = ",
"\"",
identif,
"\"",
sep = '')
}
if (date_start != 0) {
query <- paste(query,
" AND fecha > ",
"\"",
date_start,
"\"",
sep = '')
}
if (date_end != 0) {
query <- paste(query,
" AND fecha < ",
"\"",
date_end,
"\"",
sep = '')
}
query <- paste(query, " ORDER BY fecha", sep = '')
if (limit != 0) {
query <- paste(query, " LIMIT ", as.character(limit) ,sep = '')
}
query
}
getImpalaData <- function(query){
data <- rimpala.query(query)
data
}
getSUMsDataTable <- function(date) {
month_start <- as.Date(date)
day(month_start) <- 1
month_end <- as.Date(date)
day(month_end) <- 1
month(month_end) <- month(month_end) + 1
# month_name <- strptime(date, format = "%M")
# print(month_name)
# sums_data <- rimpala.query("SELECT identif, sum(vmed) as vmed, sum(intensidad) as intensidad FROM md_trafico_madrid WHERE fecha >= \"2014-06-20\" and fecha < \"2014-06-23\" group by identif order by intensidad desc")
query <- paste("SELECT identif, avg(vmed) as velocidad_media, avg(carga) as carga_media, sum(intensidad) as intensidad_total FROM md_trafico_madrid WHERE fecha >= \"",
month_start,
"\" and fecha < \"",
month_end,
"\" group by identif order by carga_media desc",
sep = '')
sums_data <- rimpala.query(query)
sums_data
}
getTrafficPointsChoicesImpala <- function(limit = 0) {
choices <- rimpala.query("SELECT DISTINCT identif FROM md_trafico_madrid")
choices
}
getIDTrafPoint <- function(name){
code <- df_traffic_measure_points[df_traffic_measure_points$name == name, 3]
code
}
getAirQualityPoints <- function() {
num_decimals <- 3
# load air quality measure points
l_airq_measure_points <- read.csv2('data/est_airq_madrid.csv')
df_airq_measure_points <- as.data.frame(l_airq_measure_points)
df_airq_measure_points$Long2 <- as.numeric(as.character(df_airq_measure_points$Long2))
df_airq_measure_points$Lat2 <- as.numeric(as.character(df_airq_measure_points$Lat2))
df_airq_measure_points$Long2 <- round(df_airq_measure_points$Long2, digits = num_decimals)
df_airq_measure_points$Lat2 <- round(df_airq_measure_points$Lat2, digits = num_decimals)
return (df_airq_measure_points)
}
getKMLData <- function () {
kml_url = 'http://datos.madrid.es/egob/catalogo/202088-0-trafico-camaras.kml'
kml_file = 'data/202088-0-trafico-camaras.kml'
if (file.exists(kml_file)) {
download(url=kml_url, destfile = kml_file)
}
# print(toGeoJSON(kml_file))
# toGeoJSON(data=quakes, name="quakes", dest=tempdir(), lat.lon=c(1,2))
# return (toGeoJSON(kml_file))
return (kml_file)
}
addColVis <- function(data) {
nrows <- nrow(data)
data$fillColor <- rgb(runif(nrows),runif(nrows),runif(nrows))
return (data)
}
getCenter <- function(nm, networks){
net_ = networks[[nm]]
lat = as.numeric(net_$lat)/10^6;
lng = as.numeric(net_$lng)/10^6;
return(list(lat = lat, lng = lng))
}
plotMap <- function(num_measure_points = nrow(df_traffic_measure_points),
width = 1600,
height = 800) {
map <- Leaflet$new()
map$tileLayer(provide='Stamen.TonerLite')
# init map
# map$setView(c(40.41, -3.70), zoom = 12, size = c(20, 20))
map$setView(c(40.41, -3.70), zoom = 12)
# filter data points
sub_traffic_measure_points <- df_traffic_measure_points[1:num_measure_points,]
data_ <- sub_traffic_measure_points[,c("lat", "long")]
data_ <- addColVis(data_)
colnames(data_) <- c('lat', 'lng', 'fillColor')
output_geofile <- paste(getwd(), '/data/', sep='')
map$geoJson(
leafletR::toGeoJSON(data_,
lat.lon = c('lat', 'lng'),
dest=output_geofile),
pointToLayer = "#! function(feature, latlng){
return L.circleMarker(latlng, {
radius: 6,
fillColor: 'green',
color: '#333',
weight: 1,
fillOpacity: 0.8
})
} !#"
)
# append markers and popup texts
for(i in 1:num_measure_points) {
html_text <- paste("<h6> Punto de medida del tráfico </h6>")
html_text <- paste(html_text, "<p>", sub_traffic_measure_points$name[i]," </p>")
map$marker(c(sub_traffic_measure_points$lat[i],
sub_traffic_measure_points$long[i]),
bindPopup = html_text)
}
# append markers and popup texts
for(i in 1:nrow(df_airq_measure_points)) {
html_text <- paste("<h6> Estación de calidad del Aire </h6>")
html_text <- paste(html_text, "<p>", df_airq_measure_points$Estacion[i]," </p>")
map$marker(c(df_airq_measure_points$Lat2[i],
df_airq_measure_points$Long2[i]),
bindPopup = html_text)
}
map$enablePopover(TRUE)
map$fullScreen(TRUE)
return(map)
}
# SERIES CHART FOR ONE TRAFFIC MEASURE POINT
getTrafficSeriesChart <- function (traf_point = 'PM20742', date_start, date_end) {
# print(traf_point)
# print(date_start)
# print(date_end)
# print("===========")
query <- getImpalaQuery(traf_point, date_start, date_end)
# get data from impala
data <- getImpalaData(query)
data
} | 7,213 | mit |
29c062e99ea01825f3faf03a4bc83ed93dbb4827 | ArunChauhan/cxxr | src/extra/testr/filtered-test-suite/format/tc_format_34.R | expected <- eval(parse(text="structure(c(\"213198964\", \" 652425\"), .Names = c(\"null.deviance\", \"deviance\"))"));
test(id=0, code={
argv <- eval(parse(text="list(structure(c(213198964, 652424.52183908), .Names = c(\"null.deviance\", \"deviance\")), FALSE, 5L, 0L, NULL, 3L, TRUE, NA)"));
.Internal(format(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]], argv[[7]], argv[[8]]));
}, o=expected);
| 479 | gpl-2.0 |
29c062e99ea01825f3faf03a4bc83ed93dbb4827 | kmillar/rho | src/extra/testr/filtered-test-suite/format/tc_format_34.R | expected <- eval(parse(text="structure(c(\"213198964\", \" 652425\"), .Names = c(\"null.deviance\", \"deviance\"))"));
test(id=0, code={
argv <- eval(parse(text="list(structure(c(213198964, 652424.52183908), .Names = c(\"null.deviance\", \"deviance\")), FALSE, 5L, 0L, NULL, 3L, TRUE, NA)"));
.Internal(format(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]], argv[[7]], argv[[8]]));
}, o=expected);
| 479 | gpl-2.0 |
5d622a1e4f8df46cbb031e94bf5701f6dbf5edc7 | chichinabo/popyramids_shiny_apps | apps/resources/auto_check_and_install.R | #A short script to help installing packages on the go
#Most useful if you are distributing a set of script files to people who may not be aware that the needed packages are not installed
#Also useful if you use many packages and want to organise their loading at the beginning of a script
need<-c("shiny", "shinydashboard","leaflet","RJSONIO","epade","png","grid","RPostgreSQL") #needed packages
ins<-installed.packages()[,1] #find out which packages are installed
(Get<-need[which(is.na(match(need,ins)))]) # check if the needed packages are installed
if(length(Get)>0){install.packages(Get,repos='https://cran.rstudio.com/')} #install the needed packages if they are not-installed
eval(parse(text=paste("library(",need,")")))#load the needed packages
| 754 | gpl-3.0 |
5d622a1e4f8df46cbb031e94bf5701f6dbf5edc7 | chichinabo/shiny_popyramids | apps/resources/auto_check_and_install.R | #A short script to help installing packages on the go
#Most useful if you are distributing a set of script files to people who may not be aware that the needed packages are not installed
#Also useful if you use many packages and want to organise their loading at the beginning of a script
need<-c("shiny", "shinydashboard","leaflet","RJSONIO","epade","png","grid","RPostgreSQL") #needed packages
ins<-installed.packages()[,1] #find out which packages are installed
(Get<-need[which(is.na(match(need,ins)))]) # check if the needed packages are installed
if(length(Get)>0){install.packages(Get,repos='https://cran.rstudio.com/')} #install the needed packages if they are not-installed
eval(parse(text=paste("library(",need,")")))#load the needed packages
| 754 | gpl-3.0 |
29c062e99ea01825f3faf03a4bc83ed93dbb4827 | krlmlr/cxxr | src/extra/testr/filtered-test-suite/format/tc_format_34.R | expected <- eval(parse(text="structure(c(\"213198964\", \" 652425\"), .Names = c(\"null.deviance\", \"deviance\"))"));
test(id=0, code={
argv <- eval(parse(text="list(structure(c(213198964, 652424.52183908), .Names = c(\"null.deviance\", \"deviance\")), FALSE, 5L, 0L, NULL, 3L, TRUE, NA)"));
.Internal(format(argv[[1]], argv[[2]], argv[[3]], argv[[4]], argv[[5]], argv[[6]], argv[[7]], argv[[8]]));
}, o=expected);
| 479 | gpl-2.0 |
End of preview. Expand
in Dataset Viewer.
GitHub R repositories dataset
R source files from GitHub.
This dataset has been created using the public GitHub datasets from Google BigQuery. This is the actual query that has been used to export the data:
EXPORT DATA
OPTIONS (
uri = 'gs://your-bucket/gh-r/*.parquet',
format = 'PARQUET') as
(
select
f.id, f.repo_name, f.path,
c.content, c.size
from (
SELECT distinct
id, repo_name, path
FROM `bigquery-public-data.github_repos.files`
where ends_with(path, ".R")
) as f
left join `bigquery-public-data.github_repos.contents` as c on f.id = c.id
)
EXPORT_DATA
OPTIONS (
uri = 'gs://your-bucket/licenses.parquet',
format = 'PARQUET') as
(select * from `bigquery-public-data.github_repos.licenses`)
Files were then exported and processed locally with files in the root of this repository. Datasets in this repository contain data from reositories with different licenses.
The data schema is:
id: string
repo_name: string
path: string
content: string
size: int32
license: string
Last updated: Jun 6th 2023
- Downloads last month
- 50