Commit 892c6eb0 authored by matbuoro's avatar matbuoro
Browse files

Mise à jour 2016

parent 5c1f5009
......@@ -12,14 +12,15 @@ library(mcmcplots)
##-----------------------------INFO ----------------------------------##
year <- "2015"
site <- "Oir"
stade <- "tacon"
# year <- "2016"
# site <- "Oir"
# stade <- "tacon"
## WORKING DIRECTORY:
work.dir<-paste("/media/ORE/Abundance",site,stade,sep="/")
setwd(work.dir)
# work.dir<-paste("/media/ORE/Abundance",site,stade,sep="/")
# setwd(work.dir)
##-----------------------------DATA ----------------------------------##
......@@ -32,21 +33,29 @@ source(paste('parameters_',stade,'.R',sep="")) # chargement des paramètres
#------------------------INITS----------------------------------##
source(paste('inits/inits_',stade,'.R',sep="")) # création des inits des données
load(paste('inits/inits_',stade,'.Rdata',sep="")) # chargement des inits
if(site == "Bresle" && stade == "adult") {inits <- list(read.bugsdata(paste("inits/init-",site,"-",stade,year,".txt",sep="")))}
if(site == "Nivelle") {inits <- list(read.bugsdata(paste("inits/init-",site,"-",stade,year,".txt",sep="")))}
#if(!file.exists(paste('inits/inits_',stade,year,'.Rdata',sep=""))){
if(!file.exists(paste("inits/init-",site,"-",stade,year,".txt",sep=""))){
source(paste('inits/inits_',stade,'.R',sep="")) # création des inits des données
#load(paste('inits/inits_',stade,year,'.Rdata',sep=""))
}
#load(paste('inits/inits_',stade,'.Rdata',sep="")) # chargement des inits
#if(site == "Bresle" && stade == "adult") {inits <- list(read.bugsdata(paste("inits/init-",site,"-",stade,year,".txt",sep="")))}
#if(site == "Nivelle") {inits <- list(read.bugsdata(paste("inits/init-",site,"-",stade,year,".txt",sep="")))}
inits <- list(read.bugsdata(paste("inits/init-",site,"-",stade,year,".txt",sep="")))
#------------------------MODEL----------------------------------##
model <- paste("model/",stade,"-",site,".R",sep="") # path of the model
model <- paste("model/model_",stade,"-",site,".R",sep="") # path of the model
if(site == "Scorff" && stade == "smolt") {model <- paste("model/",stade,"-",site,"_",year,".R",sep="")} # le modèle Scorrf pour les smolt peut changer tous les ans suivant conditions
model
filename <- file.path(work.dir, model)
#system(paste("cp",model,paste(stade,"-",site,".txt",sep=""),sep=""))
#---------------------------ANALYSIS-----------------------------##
nChains = length(inits) # Number of chains to run.
adaptSteps = 1000 # Number of steps to "tune" the samplers.
nburnin=5000 # Number of steps to "burn-in" the samplers.
nstore=50000 # Total number of steps in chains to save.
nburnin=500 # Number of steps to "burn-in" the samplers.
nstore=1000 # Total number of steps in chains to save.
nthin=1 # Number of steps to "thin" (1=keep every step).
#nPerChain = ceiling( ( numSavedSteps * thinSteps ) / nChains ) # Steps per chain.
......@@ -57,40 +66,23 @@ start.time = Sys.time(); cat("Start of the run\n");
fit <- bugs(
data
,inits
,model.file = model
,model.file = filename
,parameters
,n.chains = nChains, n.iter = nstore + nburnin, n.burnin = nburnin, n.thin = nthin
,DIC=FALSE
,codaPkg = FALSE, clearWD=TRUE
,codaPkg = FALSE, clearWD=FALSE
#,debug=TRUE
,working.directory=work.dir
,working.directory=paste(work.dir,"bugs",sep="/")
)
## cleaning
system("rm bugs/CODA*")
######### JAGS ##########
## Compile & adapt
#Create, initialize, and adapt the model:
# fit <- jags.model(
# model,
# data,inits,
# n.chains=nChains,
# n.adapt = adaptSteps)
# # Run JAGS in parallel. Each Chain is sent to a seperate core.
# cl <- makeSOCKcluster(nChains) # Request 3 cores. /!\ Need to check how many core your computer has
# fit.mcmc <- jags.parfit(cl,
# data,
# parameters,
# model.dir,
# inits,
# n.chains=nChains,n.adapt=adaptSteps,n.update=nburnin,n.iter=nstore*nthin, thin=nthin
# )
# stopCluster(cl) #### /!\ Really important to do!
# save last values for inits
#inits <- fit$last.values
#if(site == "Nivelle") {save(inits,file=paste('inits/inits_',stade,year,'.Rdata',sep=""))}
#bugs.inits(inits, n.chains=1,digits=3, inits.files = paste('inits/init-',site,'-',stade,year,'.txt',sep=""))
# duration of the run
end.time = Sys.time()
elapsed.time = difftime(end.time, start.time, units='mins')
cat("Sample analyzed after ", elapsed.time, ' minutes\n')
## BACKUP
......
This diff is collapsed.
This diff is collapsed.
OpenBUGS version 3.2.3 rev 1012
model is syntactically correct
data loaded
model compiled
model is initialized
model is already initialized
500 updates took 14 s
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
monitor set
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
inference can not be made when sampler is in adaptive phase
1000 updates took 28 s
CODA files written
no monitors set
modelCheck('/home/basp-meco88/Documents/RESEARCH/PROJECTS/ORE/Abundance/Oir/tacon/bugs/model_tacon-Oir.R.txt')
modelData('/home/basp-meco88/Documents/RESEARCH/PROJECTS/ORE/Abundance/Oir/tacon/bugs/data.txt')
modelCompile(1)
modelSetRN(1)
modelInits('/home/basp-meco88/Documents/RESEARCH/PROJECTS/ORE/Abundance/Oir/tacon/bugs/inits1.txt',1)
modelGenInits()
modelUpdate(500,1,500)
samplesSet(sd_prem)
samplesSet(mup_rem)
samplesSet(int_width)
samplesSet(width_coef)
samplesSet(rate_lcpu)
samplesSet(sigma_dOir)
samplesSet(mu_ydOir)
samplesSet(sigma_yOir)
samplesSet(year_dOir)
samplesSet(sigma_gryrOir)
samplesSet(test)
samplesSet(k_cpuOir)
samplesSet(coef_PC)
samplesSet(dRR_Oir)
samplesSet(dIA_Oir)
samplesSet(lambda_ynOir_gr)
samplesSet(lambda_ynMB)
samplesSet(lambda_ynPL)
samplesSet(lambda_ynLR)
samplesSet(n_Oir_gr)
samplesSet(n_Oir)
samplesSet(n_MB)
samplesSet(n_PL)
samplesSet(n_LR)
samplesSet(ntot_Oir)
summarySet(sd_prem)
summarySet(mup_rem)
summarySet(int_width)
summarySet(width_coef)
summarySet(rate_lcpu)
summarySet(sigma_dOir)
summarySet(mu_ydOir)
summarySet(sigma_yOir)
summarySet(year_dOir)
summarySet(sigma_gryrOir)
summarySet(test)
summarySet(k_cpuOir)
summarySet(coef_PC)
summarySet(dRR_Oir)
summarySet(dIA_Oir)
summarySet(lambda_ynOir_gr)
summarySet(lambda_ynMB)
summarySet(lambda_ynPL)
summarySet(lambda_ynLR)
summarySet(n_Oir_gr)
summarySet(n_Oir)
summarySet(n_MB)
summarySet(n_PL)
summarySet(n_LR)
summarySet(ntot_Oir)
modelUpdate(1000,1,1000)
samplesCoda('*', '/home/basp-meco88/Documents/RESEARCH/PROJECTS/ORE/Abundance/Oir/tacon/bugs//')
summaryStats('*')
modelQuit('y')
......@@ -54,4 +54,9 @@ Year_IA[] CPUE_IAno[] Site_IA[] IAno_num[] Srr_IA[] Group_IA[]
29 48 61 4 4.056 7 # IAS07
29 56 59 2 3.3564 9 # IAS09
29 17 62 5 4 10 # IAS10
30 6 58 1 6.9439 2 # IAS03
30 26 60 3 3.563 6 # IAS06
30 29 61 4 4.056 7 # IAS07
30 48 59 2 3.3564 9 # IAS09
30 10 62 5 4 10 # IAS10
#END
......@@ -133,4 +133,10 @@ Year_IAinter[] CPUE_inter[] IAinter_num[] Site_IAinter[] Srr_IAinter[] Lieu_IAin
29 66 9 66 3.5545 1 8 # IAS08
29 26 10 67 1.4016 3 12 # IAS11
29 38 11 68 2.27715 2 13 # IAS12
30 15 6 63 3.1039 1 3 # IAS04
30 14 7 64 4.6718 1 6 # IAS05
30 14 8 65 3.1943 1 1 # IAS02
30 41 9 66 3.5545 1 8 # IAS08
30 14 10 67 1.4016 3 12 # IAS11
30 7 11 68 2.27715 2 13 # IAS12
#END
......@@ -1009,4 +1009,27 @@ Year[] C1[] C2[] Site[] Group[] Lieu[] Srr[] Spl[]
29 18 2 55 2 1 1.0288 0.7259 # PTE03
29 12 7 56 3 1 1.3285 2.292 # PTE04
29 55 6 57 9 1 1.1205 0.6624 # PTE05
30 7 NA 35 13 2 0.832 0.1872 # RR01
30 7 NA 36 13 2 1.5496 0.34866 # RR02
30 5 0 37 13 2 0.6656 0.14976 # RR03
30 14 NA 38 13 2 1.5864 0.35694 # RR04
30 27 NA 39 13 2 1.432 0.3222 # RR05
30 34 8 40 13 2 1.9456 0.43776 # RR06
30 13 NA 41 13 2 1.9312 0.43452 # RR07
30 9 NA 42 13 2 1.5696 0.35316 # RR08
30 14 NA 43 13 2 2.152 0.4842 # RR09
30 3 NA 44 13 2 1.9648 0.44208 # RR10
30 8 17 45 13 2 1.4016 0.31536 # RR11
30 1 NA 46 13 2 1.9032 0.42822 # RR12
30 1 NA 47 13 2 1.2848 0.28908 # RR13
30 0 NA 48 13 2 1.7488 0.39348 # RR14
30 0 NA 49 13 2 1.3352 0.30042 # RR15
30 0 NA 50 13 2 1.3816 0.31086 # RR16
30 0 NA 51 13 2 0.5632 0.12672 # RR17
30 0 6 52 13 2 1.3784 0.31014 # RR18
30 0 NA 53 13 2 1.1952 0.26892 # RR19
30 0 NA 54 13 2 0.6816 0.15336 # RR20
30 4 1 55 2 1 1.0288 0.7259 # PTE03
30 6 2 56 3 1 1.3285 2.292 # PTE04
30 27 6 57 9 1 1.1205 0.6624 # PTE05
#END
......@@ -2,21 +2,21 @@ list(
### Nombre d'ann?es de suivi
## Devra ?tre mis ? jour
Nyear = 29,
Nyear = 30,
## Nombre de donn?es (nombre de lignes) pour les pr?l?vements successifs (soit PE ou PTE)
## Devra ?tre mis ? jour
NPE1 = 995,
# NPE1 = 995, # fait dans le script data_tacon.R
## Nombre de donn?es (nombre de lignes) pour les IA sur les sites qui ne servent pas pour la relation d'intercalibration
## IA concern?s: IAS03, IAS09, IAS06, IAS07, IAS10
## Devra ?tre mis ? jour
NIAno = 39,
# NIAno = 39, # fait dans le script data_tacon.R
## Nombre de donn?es (nombre de lignes) pour les IA sur les sites servant pour la relation d'intercalibration
## IA concern?s: IAS04, IAS05, IAS02,IAS08,IAS11,IAS12
## Devra ?tre mis ? jour
NIAinter = 117,
# NIAinter = 117, # fait dans le script data_tacon.R
## Nombre de groupes (secteurs regroupant diff?rentes stations)
## Pas de mise ? jour
......
......@@ -33,6 +33,12 @@ Srr_IA <- tmp[,5]
Group_IA <- tmp[,6]
## Nombre de donn?es (nombre de lignes) pour les IA sur les sites qui ne servent pas pour la relation d'intercalibration
## IA concern?s: IAS03, IAS09, IAS06, IAS07, IAS10
## Devra ?tre mis ? jour
NIAno = nrow(tmp) # fait dans le script data_tacon.R
##################################################################################################################################################
## Il s'agit ici des tacons captur?s par enl?vements successifs
## Depuis 2009 (Year = 23), seuls les stations de type PTE et celles du ruisseau de la roche (RR...) sont encore suivies par enl?vement successifs
......@@ -59,6 +65,10 @@ Lieu <- tmp[,6]
Srr <- tmp[,7]
Spl <- tmp[,8]
## Nombre de donn?es (nombre de lignes) pour les pr?l?vements successifs (soit PE ou PTE)
## Devra ?tre mis ? jour
NPE1 = nrow(tmp) # fait dans le script data_tacon.R
......@@ -90,6 +100,15 @@ Lieu_IAinter <- tmp[,6]
Group_IAinter <- tmp[,7]
## Nombre de donn?es (nombre de lignes) pour les IA sur les sites servant pour la relation d'intercalibration
## IA concern?s: IAS04, IAS05, IAS02,IAS08,IAS11,IAS12
## Devra ?tre mis ? jour
NIAinter = nrow(tmp) # fait dans le script data_tacon.R
############################################################
# Ce fichier n'a pas besoin d'?tre mis ? jour
# W_Oir est la largeur moyenne en m?tre des stations suivies par IAS
......@@ -117,7 +136,11 @@ StotPC <- tmp[,1]
StotRR <- tmp[,2]
data <- c( fish, list(Year_IA=Year_IA, CPUE_IAno=CPUE_IAno,Site_IA=Site_IA,IAno_num=IAno_num,Srr_IA=Srr_IA,Group_IA=Group_IA
data <- c( fish, list(NIAno=NIAno,NIAinter=NIAinter,NPE1=NPE1,
Year_IA=Year_IA,
CPUE_IAno=CPUE_IAno,Site_IA=Site_IA,IAno_num=IAno_num,Srr_IA=Srr_IA,Group_IA=Group_IA
,Year=Year,C1=C1,C2=C2,Site=Site,Group=Group,Lieu=Lieu,Srr=Srr,Spl=Spl
,Year_IAinter=Year_IAinter,CPUE_inter=CPUE_inter,IAinter_num=IAinter_num,Site_IAinter=Site_IAinter,Srr_IAinter=Srr_IAinter,Lieu_IAinter=Lieu_IAinter
,Group_IAinter=Group_IAinter
......
This diff is collapsed.
This diff is collapsed.
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