Commit e2432e37 authored by pfreon's avatar pfreon
Browse files

Major change: addition of a residual analysis plot

Addition of a third graph showing the relationship Observed CPUE vs CPUE Residual.
parent 2f2c45c5
......@@ -155,7 +155,7 @@ public class CadreMain extends JFrame {
this.setIconImage(Toolkit.getDefaultToolkit().createImage(CadreMain.class.getResource("resources/images/Climprod.jpg")));
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(new GridLayout(1, 2));
this.setTitle("Climprod 5.2 beta"); // beta version ici
this.setTitle("Climprod 5.3 beta"); // beta version ici
this.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowActivated(WindowEvent e) {
......@@ -319,8 +319,8 @@ public class CadreMain extends JFrame {
menuPlotFitted.setEnabled(false);
menuPlotFitted.setMnemonic(KeyEvent.VK_F);
menuPlotFitted.setActionCommand("Observed-fitted & residuals CPUE graphs");
menuPlotFitted.setText("Observed-fitted & residuals CPUE graphs");
menuPlotFitted.setActionCommand("CPUE residual analysis graphs");
menuPlotFitted.setText("CPUE residual analysis graphs");
menuPlotFitted.addActionListener(new java.awt.event.ActionListener() {
@Override
......
......@@ -364,7 +364,6 @@ public class Cadre_ModeleDirect extends JFrame {
void chkEVCatchability_actionPerformed(ActionEvent e) { // Case CPUE=f(E,V) effect on catchabilty.
displayList(RechercheModele.getlisteModele(2));
EnvironmentsetEnabled(true, false);
Environmentset2Enabled(true);
Global.environmental_influence = Global.influenceEnv[2];
Global.envir_preponderant = -1;
//System.out.println("Flag 3 ModeleDirect.java Global.envir_preponderant = " + Global.envir_preponderant + " Global.environmental_influence = " + Global.environmental_influence);
......
......@@ -155,8 +155,8 @@ public class Global {
//static int[] typePlot = {2, 2, 2, 2, 3, 3, 3, 3, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 2, 2,2,2,2,2};
//static Hashtable htPlot=new Hashtable();
//WARNING: NE PAS REMPLACER R2 PAR R² DANS LIGNES SUIVANTES CAR SINON NON DE FICHIER PAR RECONNU PAR HTML.
static String[] titreG = {"Y Time Plot (unlagged)", "CPUE Time Plot (unlagged)", "E Time Plot (unlagged)", "V Time Plot (unlagged)", "E Distribution (unlagged)", "V Distribution (unlagged)", "Y Distribution (unlagged)", "CPUE Distribution (unlagged)", "Y vs E (unlagged)", "Y vs V (unlagged)", "CPUE vs E (unlagged)", "CPUE vs V (unlagged)", "CPUE versus E (E weighted if relevant)", "CPUE versus V (V lagged if relevant)","E versus V (unlagged)", "Observed and Fitted CPUE (lag effect if relevant)", "Time Plot of residual CPUE (lag effect if relevant)", "Residual CPUE versus E (E weighted if relevant)", "Residual CPUE versus V (V lagged and weighted if relevant)", "a (%) Time Plot (lag effect if relevant)", "b (%) Time Plot (lag effect if relevant)", "c (%) Time Plot (lag effect if relevant)", "d (%) Time Plot (lag effect if relevant)", "R2 (%) Time Plot", "Function Y=f(V & E) (lagged if relevant)", "Function Y=f(V & E) (E weighted if relevant)", "Function CPUE=f(V & E)(E weighted if relevant)", "Function CPUE=f(V & E) (E weighted if relevant)", "MSY versus V", "MSE versus V"};
static String[] titreSx = {"Year (or single annual season)", "Year (or single annual season)", "Year (or single annual season)", "Year (or single annual season)", "Classes", "Classes", "Classes", "Classes", "Effort (E)", "Environment (V)", "Effort (E)", "Environment (V)", "Environment (V)", "Year (or single annual season)", "Year (or single annual season)", "Effort (E)", "Environment (V)", "Year (or single annual season)", "Year (or single annual season)", " Year (or single annual season)", "Year (or single annual season)", "Year (or single annual season)", "Weighted effort (E)", "Weighted effort (E)", "Weighted effort (E)", " Weighted effort (E)", "Environment (V)", "Environment (V)"};
static String[] titreG = {"Y Time Plot (unlagged)", "CPUE Time Plot (unlagged)", "E Time Plot (unlagged)", "V Time Plot (unlagged)", "E Distribution (unlagged)", "V Distribution (unlagged)", "Y Distribution (unlagged)", "CPUE Distribution (unlagged)", "Y vs E (unlagged)", "Y vs V (unlagged)", "CPUE vs E (unlagged)", "CPUE vs V (unlagged)", "CPUE versus E (E weighted if relevant)", "CPUE versus V (V lagged if relevant)","E versus V (unlagged)", "Observed and Fitted CPUE (lag effect if relevant)", "Time Plot of residual CPUE (lag effect if relevant)", "Residual CPUE vs CPUE","Residual CPUE versus E (E weighted if relevant)", "Residual CPUE versus V (V lagged and weighted if relevant)", "a (%) Time Plot (lag effect if relevant)", "b (%) Time Plot (lag effect if relevant)", "c (%) Time Plot (lag effect if relevant)", "d (%) Time Plot (lag effect if relevant)", "R2 (%) Time Plot", "Function Y=f(V & E) (lagged if relevant)", "Function Y=f(V & E) (E weighted if relevant)", "Function CPUE=f(V & E)(E weighted if relevant)", "Function CPUE=f(V & E) (E weighted if relevant)", "MSY versus V", "MSE versus V"};
static String[] titreSx = {"Year (or single annual season)", "Year (or single annual season)", "Year (or single annual season)", "Year (or single annual season)", "Classes", "Classes", "Classes", "Classes", "Effort (E)", "Environment (V)", "Effort (E)", "Environment (V)", "Environment (V)", "Year (or single annual season)", "Year (or single annual season)", "CPUE", "Effort (E)", "Environment (V)", "Year (or single annual season)", "Year (or single annual season)", " Year (or single annual season)", "Year (or single annual season)", "Year (or single annual season)", "Weighted effort (E)", "Weighted effort (E)", "Weighted effort (E)", " Weighted effort (E)", "Environment (V)", "Environment (V)"};
static String[] titreSy = {"Catches (Y)", "CPUE ", "Effort (E)", "Environment (V)", "Nb", "Nb", "Nb", "Nb", "Catches (Y)", "Catches (Y)", "CPUE", "CPUE", "CPUE", "CPUE", " Residual", "Residual", "Residual", "a (%)", "b (%)", "c (%)", "d (%)", "R² (%)", "Catches (Y)", "Catches (Y)", "CPUE", "CPUE", "MSY", "MSE"};
static Plot[] timePlot = new Plot[4];
......@@ -164,7 +164,7 @@ public class Global {
static Plot[] scatterPlot = new Plot[4];
static Plot[] lagPlot = new Plot[2];
static Plot indePlot = new Plot();
static Plot[] fittedCpuePlot = new Plot[2];
static Plot[] fittedCpuePlot = new Plot[3];
static Plot[] residualsPlot = new Plot[2];
static PlotHisto[] jackknifePlot;
static Plot[] variatePlot = new Plot[2];
......
......@@ -982,10 +982,12 @@ public class Modele {
* ********** observed, fitted & residual time series ***************
*/
double minx = Stat1.min(Data.getYears());
double maxx = Stat1.max(Data.getYears());
PlotSerie[] ps = new PlotSerie[5];
ps[0] = new PlotSerie("x", Data.getYears(), "Observed CPUE", Data.getPue());
ps[1] = new PlotSerie("x", Data.getYears(), "Fitted CPUE", fittedpue);
ps[2] = new PlotSerie("x", Data.getYears(), "Residuals", res);
ps[3] = new PlotSerie("x", Data.getPue(), "Residuals", res);
Global.fittedCpuePlot[0] = new Plot();
ps[0].setFigure(2);
......@@ -998,9 +1000,15 @@ public class Modele {
Global.fittedCpuePlot[1] = new Plot();
ps[2].setFigure(2);
Global.fittedCpuePlot[1].setValeurs(ps[2]);
Global.fittedCpuePlot[1].ajusteExtremas(false, true, false, false);
Global.fittedCpuePlot[1].ajusteExtremas(false, false, false, false);
Global.fittedCpuePlot[1].setXcutYat(0);
Global.fittedCpuePlot[2] = new Plot();
ps[2].setFigure(2);
Global.fittedCpuePlot[2].setValeurs(ps[3]);
Global.fittedCpuePlot[2].ajusteExtremas(false, false, false, false);
Global.fittedCpuePlot[2].setXcutYat(0);
for (int i = 0; i < 2; i++) {
Global.fittedCpuePlot[i].setTitreGraphique(Global.titreG[15 + i]);
Global.fittedCpuePlot[i].setTitreX(Global.titreSx[13 + i]);
......@@ -1009,8 +1017,16 @@ public class Modele {
if (Data.stat[8][1] > 100) Global.fittedCpuePlot[i].setDecimalsurY(0); // stat[8][1] = Etendue CPUE. Avant setDecimalsurX(0) -> pas de décilmale sur axe des X. Avec setDecimalsurX(1) -> décimales SI NECESSAIRE. Modif 2020
else Global.fittedCpuePlot[i].setDecimalsurY(2); // Modif 2021.
Global.fittedCpuePlot[i].setMinAxeX(minx - 1);
Global.fittedCpuePlot[i].setpasX(3.0d); // setpasX can be found in Plot.java.
Global.fittedCpuePlot[i].setpasX(StrictMath.round((maxx-minx)/20)); // setpasX can be found in Plot.java.
}
Global.fittedCpuePlot[2].setTitreGraphique(Global.titreG[17]);
Global.fittedCpuePlot[2].setTitreX(Global.titreSx[15]);
Global.fittedCpuePlot[2].setTitreY(Global.titreSy[14]);
Global.fittedCpuePlot[2].setDecimalsurX(1);
if (Data.stat[8][1] > 100) Global.fittedCpuePlot[2].setDecimalsurX(0); // stat[8][1] = Etendue CPUE. Avant setDecimalsurX(0) -> pas de décilmale sur axe des X. Avec setDecimalsurX(1) -> décimales SI NECESSAIRE. Modif 2020
else Global.fittedCpuePlot[2].setDecimalsurX(2); // Modif 2021.
Global.fittedCpuePlot[2].setMinAxeX(Data.stat[6][1]-(Data.stat[8][1] / 20));
Global.fittedCpuePlot[2].setpasX((Data.stat[8][1] / 10));
/**
* ****************** residuals plot **************************
* i = 0 pour Résidus CPUE = f(E)
......@@ -1024,8 +1040,8 @@ public class Modele {
Global.residualsPlot[0].setValeurs(new PlotSerie("", Data.getF(), "", res));
Global.residualsPlot[1].setValeurs(new PlotSerie("", Data.getV(), "", res));
for (int i = 0; i < 2; i++) {
Global.residualsPlot[i].setTitreGraphique(Global.titreG[i + 17]);
Global.residualsPlot[i].setTitreX(Global.titreSx[i + 15]);
Global.residualsPlot[i].setTitreGraphique(Global.titreG[i + 18]);
Global.residualsPlot[i].setTitreX(Global.titreSx[i + 16]);
Global.residualsPlot[i].setTitreY(Global.titreSy[i + 15]);
//System.out.println("i = " + i + " Data.stat[7][i+2] = " + Data.stat[7][i+2] + " Data.stat[6][i+2] = " + Data.stat[6][i+2] + " max = " + max);
if (Data.stat[8][i+2] >100) Global.residualsPlot[i].setDecimalsurX(0); // stat[8][i+2] = Etendue E puis V. Avant setDecimalsurX(0) -> pas de décilmale sur axe des X. Avec setDecimalsurX(1) -> décimales SI NECESSAIRE. Modif 2020.
......
......@@ -137,7 +137,7 @@ public class Plot implements Cloneable {
} else if (!serieHisto) { // Pour autres figures.
// extremasSeries[0]=extremasSeries[0]*.9;
// extremasSeries[2]=extremasSeries[2]*1.1;
pas[0] = Math.abs((extremasSeries[1] - extremasSeries[0]) / 10); // Le pas sur l'axe des X (pas[0] est égal à 1/10ème del'étendue, arondi à unité entière. Commentaire 2021
pas[0] = Math.abs((extremasSeries[1] - extremasSeries[0]) / 20); // Le pas sur l'axe des X (pas[0] est égal à 1/20ème del'étendue, arondi à unité entière. Commentaire 2021
if (pas[0] > 1) {
pas[0] = Math.round(pas[0] - 0.5);
//System.out.println("Ligne 143 Plot.java, calcul pas[0]. extremasSeries[1]= " + extremasSeries[1]+" extremasSeries[0]= " + extremasSeries[0] + " pas[0]= " + pas[0]); // test 2020
......
......@@ -175,7 +175,7 @@ public class RapportHtml extends JDialog {
"BivariatePlot.html", "FittedPlot.html", "ResidualPlot.html", "JackknifePlot.html", "VariatePlot.html",
"MS_Plot.html", "Model.html", "Validation.html","QuestionsAnswers.html", "index.html"};
String[] caption = {"Main Results", "Data", "Time graphs", "Histogram graphs",
"Bivariate plots", "Observed-fitted & residual CPUE graphs", "Residual CPUE vs E & V plots", "Jackknife bar graphs", "CPUE=f() & Y=() tri-variate graphs",
"Bivariate plots", "CPUE residual analysis graphs", "Residual CPUE vs E & V plots", "Jackknife bar graphs", "CPUE=f() & Y=() tri-variate graphs",
"MSY & MSE vs V graphs", "Modelization", "Validation", "Questions, answers & warnings"};
String folderName = "";
Hashtable listFile = new Hashtable();
......@@ -802,7 +802,7 @@ public class RapportHtml extends JDialog {
JCheckBox[] chkInclude = new JCheckBox[13];
String[] caption = {"Current known facts", "Data & statistical tables",
"Time plots", "Histogram plots", "Bivariate plots", "Observed-Fitted & Residual CPUE plots",
"Time plots", "Histogram plots", "Bivariate plots", "CPUE residual analysis graphs",
"Res f(E) vs V or Res f(V) vs E", "Jackknife plots", "CPUE=f() & Y=f() plots",
"MSY & MSE plots", "Modelization: Detailed results",
"Validation: Detailed results", "Questions, answers & warnings"};
......
......@@ -652,12 +652,14 @@ static private void makePlotJack(){
Global.jackknifePlot[i].setValeurs(ps100);
Global.jackknifePlot[i].setValeurs(ps);
//System.out.println("Validation makePlotJack ligne 636 i: " + i + " Global.Res_Test_Jackknife_Par[i]: " + Global.Res_Test_Jackknife_Par[i]);
Global.jackknifePlot[i].setTitreGraphique1(Global.titreG[i+19] + ".");
Global.jackknifePlot[i].setTitreGraphique1(Global.titreG[i+20] + ".");
Global.jackknifePlot[i].setTitreGraphique2("Jackknife t-ratio "
+ Global.Test_Jackknife_Param$[Global.Res_Test_Jackknife_Par[i]]);
Global.jackknifePlot[i].setTitreX(Global.titreSx[i+17]);
Global.jackknifePlot[i].setTitreX(Global.titreSx[i+18]);
Global.jackknifePlot[i].setTitreY(Global.titreSy[i+17]);
double minx = Stat1.min(Data.getYears());
double maxx = Stat1.max(Data.getYears());
double maxY=Global.jackknifePlot[i].getMaxAxeY();
if(maxY<150)
{
......@@ -669,7 +671,7 @@ static private void makePlotJack(){
Global.jackknifePlot[i].ajusteExtremas(false,true,false,true);
Global.jackknifePlot[i].setEtiquettes(etiq$);
Global.jackknifePlot[i].setpasX(3.d);
Global.jackknifePlot[i].setpasX(StrictMath.round((maxx-minx)/20));
Global.jackknifePlot[i].setXcutYat(0.d);
Global.jackknifePlot[i].setDecimalsurY(0);
......@@ -690,13 +692,13 @@ static private void makePlotJack(){
Global.jackknifePlot[nbre_par]=new PlotHisto();
Global.jackknifePlot[nbre_par].setValeurs(ps);
Global.jackknifePlot[nbre_par].setValeurs(ps100);
Global.jackknifePlot[nbre_par].setTitreGraphique1(Global.titreG[23]
Global.jackknifePlot[nbre_par].setTitreGraphique1(Global.titreG[24]
+ " (R2 = " + nf.format(Global.coeff_determination)
+ "; Corrected R2 = " + nf.format(Global.corrected_R2));
Global.jackknifePlot[nbre_par].setTitreGraphique2(" F test: "
+ Global.fFsignif$ + "; Jackknife R2 = "
+ nf.format(Global.r_jk) + ")");
Global.jackknifePlot[nbre_par].setTitreX(Global.titreSx[21]);
Global.jackknifePlot[nbre_par].setTitreX(Global.titreSx[22]);
Global.jackknifePlot[nbre_par].setTitreY(Global.titreSy[21]);
double maxY=Global.jackknifePlot[nbre_par].getMaxAxeY();
......
......@@ -2,6 +2,10 @@ Are there a good fit and no trend or strong autocorrelation in residuals?
Answer Yes if the comparison between the time-series of observed and
predicted values of CPUE seems acceptable and if you do not observe any
trend and/or strong autocorrelation in the bottom graph presenting
residuals versus year-index.
trend and/or strong autocorrelation in the second and third graphs presenting
residuals versus year/season and residuals versus observed CPUE.
In the bottom graph, if the dots are randomly dispersed around the horizontal
axis with a constant variability around it, then the model looks appropriate
for the data; otherwise, the shape of the model is not adapted.

\ No newline at end of file
Markdown is supported
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