Commit a585733d authored by de Freitas Costa, Eduardo's avatar de Freitas Costa, Eduardo
Browse files

New_dynamic model

parent 7c935dd1
......@@ -2,7 +2,7 @@
model<-function(iteraction,times,flocks,simtable){
set.seed(13)
#Organizing the output directory
......@@ -247,9 +247,9 @@ set.seed(13)
ifelse(amu[[t]]!=1,
r9[[t]]<-ifelse(time_flock[[t]]==1,(1-exp(-beta_ch[j]*prev3)),(1-exp(-beta_ch[j]*flock[[t-1]]))),
r9[[t]]<-ifelse(time_flock[[t]]==1,(1-exp(-beta_ch[j]*prev3)),(1-exp(-beta_ch[j]*flock[[t-1]]))),
r9[[t]]<-ifelse(time_flock[[t]]==1,(1-exp(-beta_ch[j]*heavy[j]*prev3)),(1-exp(-beta_ch[j]*heavy[j]*flock[[t-1]])))
r9[[t]]<-ifelse(time_flock[[t]]==1,(1-exp(-beta_ch[j]*heavy[j]*prev3)),(1-exp(-beta_ch[j]*heavy[j]*flock[[t-1]])))
)
......@@ -438,12 +438,12 @@ tornado<-function(){
base<-cena[1]
nome2<-nome1[2:8]
nome3<-nome1[9:16]
nome3<-nome1[9:simtable]
nome4<-nome1[17:simtable]
dado1<-cbind.data.frame(cena[2:8],nome2)
dado2<-cbind.data.frame(cena[9:16],nome3)
dado2<-cbind.data.frame(cena[9:simtable],nome3)
dado3<-cbind.data.frame(cena[17:simtable],nome4)
......@@ -453,9 +453,9 @@ sorted1<-dado1[order(abs(log(cena[2:8]/base))),]
sorted2<-dado1[order(abs(((cena[2:8]-base)))),]
sorted3<-dado2[order(abs(log(cena[9:16]/base))),]
sorted3<-dado2[order(abs(log(cena[9:simtable]/base))),]
sorted4<-dado2[order(abs(((cena[9:16]-base)))),]
sorted4<-dado2[order(abs(((cena[9:simtable]-base)))),]
sorted5<-dado3[order(abs(log(cena[17:simtable]/base))),]
......@@ -474,7 +474,7 @@ saveRDS(sorted5,paste(wd,"/output/sorted5.rds",sep=""))
saveRDS(sorted6,paste(wd,"/output/sorted6.rds",sep=""))
png(file=here("Figures", "tornado1.png"), width = 465, height = 225, units='mm', res = 300)
png(file=here("Figures", "scenarios.png"), width = 465, height = 225, units='mm', res = 300)
par(mar=c(5,13,1,2))
barplot(log(sorted1$cena/base), horiz = T,
names.arg = sorted1$nome2,col = "darkgray",las=1,xlab="Log difference",
......@@ -486,7 +486,7 @@ mtext(side = 1, text = "log difference", line = 3)
dev.off()
png(file=here("Figures", "tornado2.png"), width = 465, height = 225, units='mm', res = 300)
png(file=here("Figures", "uncertainty.png"), width = 465, height = 225, units='mm', res = 300)
par(mar=c(5,13,1,2))
barplot(log(sorted3$cena/base), horiz = T,
names.arg = sorted3$nome3,col = "darkgray",las=1,xlab="Log difference",
......@@ -500,54 +500,50 @@ dev.off()
png(file=here("Figures", "tornado3.png"), width = 465, height = 225, units='mm', res = 300)
par(mar=c(5,13,1,2))
barplot(log(sorted5$cena/base), horiz = T,
names.arg = sorted5$nome4,col = "darkgray",las=1,xlab="Log difference",
ann = FALSE,xlim=c(min(log(sorted5$cena/base)),max(log(sorted5$cena/base))))
#png(file=here("Figures", "tornado3.png"), width = 465, height = 225, units='mm', res = 300)
#par(mar=c(5,13,1,2))
#barplot(log(sorted5$cena/base), horiz = T,
# names.arg = sorted5$nome4,col = "darkgray",las=1,xlab="Log difference",
# ann = FALSE,xlim=c(min(log(sorted5$cena/base)),max(log(sorted5$cena/base))))
mtext(side = 1, text = "log difference", line = 3)
#mtext(side = 1, text = "log difference", line = 3)
#mtext(side = 2, text = "Scenarios", line = 6.5)
dev.off()
#dev.off()
png(file=here("Figures", "tornado4.png"), width = 465, height = 225, units='mm', res = 300)
par(mar=c(5,13,1,2))
barplot((sorted2$cena-base), horiz = T,
names.arg = sorted2$nome2,col = "darkgray",las=1,xaxt="n",
ann = FALSE,xlim=c(min((sorted2$cena-base)),max((sorted2$cena-base))))
#png(file=here("Figures", "tornado4.png"), width = 465, height = 225, units='mm', res = 300)
#par(mar=c(5,13,1,2))
#barplot((sorted2$cena-base), horiz = T,
# names.arg = sorted2$nome2,col = "darkgray",las=1,xaxt="n",
# ann = FALSE,xlim=c(min((sorted2$cena-base)),max((sorted2$cena-base))))
#axis(side=1, at=seq(-0.002,0.032,0.001), labels = seq(-0.002,0.032,0.001))
mtext(side = 1, text = "Percentage difference", line = 3)
dev.off()
#mtext(side = 1, text = "Percentage difference", line = 3)
#dev.off()
png(file=here("Figures", "tornado5.png"), width = 465, height = 225, units='mm', res = 300)
par(mar=c(5,13,1,2))
barplot((sorted4$cena-base), horiz = T,
names.arg = sorted4$nome3,col = "darkgray",las=1,xaxt="n",
ann = FALSE,xlim=c(min((sorted4$cena-base)),max((sorted4$cena-base))))
#png(file=here("Figures", "tornado5.png"), width = 465, height = 225, units='mm', res = 300)
#par(mar=c(5,13,1,2))
#barplot((sorted4$cena-base), horiz = T,
# names.arg = sorted4$nome3,col = "darkgray",las=1,xaxt="n",
# ann = FALSE,xlim=c(min((sorted4$cena-base)),max((sorted4$cena-base))))
#axis(side=1, at=seq(-0.002,0.032,0.001), labels = seq(-0.002,0.032,0.001))
mtext(side = 1, text = "Percentage difference", line = 3)
dev.off()
#mtext(side = 1, text = "Percentage difference", line = 3)
#dev.off()
png(file=here("Figures", "tornado6.png"), width = 465, height = 225, units='mm', res = 300)
par(mar=c(5,13,1,2))
barplot((sorted6$cena-base), horiz = T,
names.arg = sorted6$nome4,col = "darkgray",las=1,xaxt="n",
ann = FALSE,xlim=c(min((sorted6$cena-base)),max((sorted6$cena-base))))
#png(file=here("Figures", "tornado6.png"), width = 465, height = 225, units='mm', res = 300)
#par(mar=c(5,13,1,2))
#barplot((sorted6$cena-base), horiz = T,
# names.arg = sorted6$nome4,col = "darkgray",las=1,xaxt="n",
# ann = FALSE,xlim=c(min((sorted6$cena-base)),max((sorted6$cena-base))))
#axis(side=1, at=seq(-0.002,0.032,0.001), labels = seq(-0.002,0.032,0.001))
mtext(side = 1, text = "Percentage difference", line = 3)
dev.off()
#mtext(side = 1, text = "Percentage difference", line = 3)
#dev.off()
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment