Page 1 of 1

apollo_searchStart Test2 Conditions?

Posted: 02 Oct 2025, 21:32
by johnathan
I am not sure if test2 is applying its conditions properly in apollo_searchStart. This is it's description from the beginning of the code:
Tolerance for test 2. A candidate is discarded if the norm of its gradient is smaller than \code{gTest} AND its LL is further than \code{llTest} from a better 
This is the code: 

Code: Select all

# Apply tests only if it hasn't converged and is not the best LL of the stage if(length(betterLLRows)>0 & !converged[j]){ # Test 1: Distance in parameter space to a better one betterParams <- candidates[[s+1]][betterLLRows,] if(length(betterLLRows)==1) betterParams <- matrix(betterParams, nrow=1) distParam <- apply(betterParams, MARGIN=1, function(x) sqrt(sum((x-candParam)^2)) ) failedT1Rows <- betterLLRows[ distParam<dTest ] # Test 2: small gradient norm and close to another browser() distLL <- abs(as.vector(LL[betterLLRows,s+1] - candLL)) failedT2Rows <- betterLLRows[ gradientNorm[betterLLRows]<gTest & distLL>=llTest ]
If I am understanding this correctly,  for test 2 the gradient norm should be for the focal candidate (gradientNorm[j]), not on the better candidate (graidentNorm[betterLLRows]).

Please let me know if that is a proper assessment, or if I am incorrect. Thank you for your attention and hard work in putting together Apollo.

Re: apollo_searchStart Test2 Conditions?

Posted: 23 Oct 2025, 17:15
by stephanehess
Hi

thanks for spotting this. This will be fixed in version 0.3.7

We may make a development version online in the next few days on the apollo website, prior to the CRAN release later this year

Best wishes

David & Stephane