From b8ae7756ed8251cb22b379d218e28f3074334f31 Mon Sep 17 00:00:00 2001 From: Ron Date: Tue, 22 Aug 2023 22:31:02 -0400 Subject: [PATCH] More statistics mods for 1.7.4 --- MSSPM_Main/nmfMainWindow.cpp | 57 ++++++++---------------------------- 1 file changed, 13 insertions(+), 44 deletions(-) diff --git a/MSSPM_Main/nmfMainWindow.cpp b/MSSPM_Main/nmfMainWindow.cpp index 7f1b69c..fd08c26 100755 --- a/MSSPM_Main/nmfMainWindow.cpp +++ b/MSSPM_Main/nmfMainWindow.cpp @@ -9108,7 +9108,6 @@ nmfMainWindow::calculateSummaryStatisticsStruct( StatStruct& statStruct) { bool ok; - int m; double val; double aicModel; int NumYears; @@ -9130,8 +9129,6 @@ nmfMainWindow::calculateSummaryStatisticsStruct( std::vector mohnsRhoEstimatedBiomass; std::vector meanObserved; std::vector meanEstimated; -// std::vector observed; -// std::vector estimated; std::vector correlationCoeff; std::vector EstGrowthRate; std::vector EstGrowthRateShape; @@ -9143,7 +9140,6 @@ nmfMainWindow::calculateSummaryStatisticsStruct( std::vector fields; std::map > dataMap; std::string queryStr; - double meanVal; int NumEstParametersTotal = 0; int NumEstParametersTotalNonTrivial = 0; std::vector NumEstParametersPerSpecies; @@ -9159,8 +9155,8 @@ nmfMainWindow::calculateSummaryStatisticsStruct( std::vector aveOrSum; double total; std::string errorMsg; - std::vector NumYearsWithBlanks = {}; - int TotalNumYearsWithBlanks = 0; + std::vector NumYearsWithoutBlanksPerCol = {}; + int TotalNumYearsWithoutBlanks = 0; // m_Logger->logMsg(nmfConstants::Normal,"calculateSummaryStatisticsStruct from: "+m_ModelName); @@ -9193,36 +9189,14 @@ nmfMainWindow::calculateSummaryStatisticsStruct( } NumYears = ObservedBiomass.size1(); - // Missing biomass has been saved as nmfConstantsMSSPM::NoData -// for (int species=0; specieslogMsg(nmfConstants::Error,"nmfUtilsStatistics::calculateMeanOmittingBlanks divide by zero found, check matrix dimensions"); + return false; } // Get estimated data - m = 0; int NumLines = 1; Algorithms.push_back(Algorithm); Minimizers.push_back(Minimizer); @@ -9240,14 +9214,11 @@ nmfMainWindow::calculateSummaryStatisticsStruct( return false; } } - for (int species=0; specieslogMsg(nmfConstants::Error,"nmfUtilsStatistics::calculateMean divide by zero found, check matrix dimensions"); + return false; } //std::cout << "Warning: TBD nmfMainWindow::calculateSummaryStatisticsStruct: Add matrix parameters to this map" << std::endl; @@ -9311,11 +9282,9 @@ nmfMainWindow::calculateSummaryStatisticsStruct( // n = number of observations (i.e., NumYears) // sigma^2 = SSresiduals/n nmfUtilsStatistics::calculateAIC( - // NumEstParametersPerSpecies,NumYears-FirstYear,SSresiduals,aic); - NumEstParametersPerSpecies,NumYearsWithBlanks,SSresiduals,aic); + NumEstParametersPerSpecies,NumYearsWithoutBlanksPerCol,SSresiduals,aic); nmfUtilsStatistics::calculateAIC( - // NumEstParametersPerSpecies,NumYears-FirstYear,SSresiduals,aicModel); - NumEstParametersPerSpecies,TotalNumYearsWithBlanks,SSresiduals,aicModel); + NumEstParametersPerSpecies,TotalNumYearsWithoutBlanks,SSresiduals,aicModel); // Calculate r ok = nmfUtilsStatistics::calculateR(skipFirstYear,NumSpeciesOrGuilds,