sbiopredictionci with bootstrap method dealing with data with NaN

3 views (last 30 days)
Hello team,
I asked a question yesterday considering using the sbiopredictionci. (plz find in the following link)
I am kind of resolve the probelm but not completely.
After applying the code for passing user defined function to the parellel computing and rerun the code as below.
addAttachedFiles(gcp,"calculate_P_A2B_factor.m")
ciPred = sbiopredictionci(fitWeightFunction, 'Alpha', 0.1, 'Type', 'bootstrap', 'NumSamples', 1000, 'UseParallel', true,'Display','final')
I got another warning, and the code ran forever nonstop. (warning and code shown as below)
ciPred = sbiopredictionci(fitWeightFunction, 'Alpha', 0.1, 'Type', 'bootstrap', 'NumSamples', 3, 'UseParallel', true,'Display','final');
Warning: Observation data contains NaN. This may cause the computation of 'bootstrap' confidence intervals to error.
> In SimBiology.fit/LeastSquaresResults/validateDataForBootstrapping (line 2685)
In SimBiology.fit/LeastSquaresResults/validatePredictionCIInput (line 2633)
In SimBiology.fit/LeastSquaresResults/predictionci (line 1052)
In sbiopredictionci (line 68)
Computing 90% bootstrap prediction confidence intervals
-------------------------------------------------------
Warning: You have passed PARTICLESWARM options to LSQNONLIN. LSQNONLIN will use the common options and ignore the PARTICLESWARM options that do not apply.
To avoid this warning, convert the PARTICLESWARM options using OPTIMOPTIONS.
> In optim.options/SolverOptions/convertForSolver (line 777)
In SimBiology.fit.internal.validateOptions>convertOptionsForMethod (line 167)
In SimBiology.fit.internal.validateOptions (line 15)
In SimBiology.fit.internal/FitObject/initializeReRun (line 376)
In SimBiology.fit.internal/FitObject/rerunFit (line 314)
In SimBiology.fit.LeastSquaresResults.createBootFun/getBootstrapSample (line 1806)
In SimBiology.fit.LeastSquaresResults>@(x)getBootstrapSample(x,numGroups,groupIdx,groupSize,resampleWeights,refIdx,obj.Data,obj.Weights,obj.ConfidenceIntervalData.EstimInfo,restartData,obj.Beta.Estimate,exitFlag,fcn) (line 1764)
In bootci (line 146)
In SimBiology.fit/LeastSquaresResults/predCIBootstrap (line 1576)
In SimBiology.fit.LeastSquaresResults>@(obj)predCIBootstrap(obj,alpha,numSamples,useParallel) (line 1060)
In SimBiology.fit/LeastSquaresResults/dispatchConfidenceIntervalComputation (line 1880)
In SimBiology.fit/LeastSquaresResults/predictionci (line 1068)
In sbiopredictionci (line 68)
Warning: You have passed PARTICLESWARM options to LSQNONLIN. LSQNONLIN will use the common options and ignore the PARTICLESWARM options that do not apply.
To avoid this warning, convert the PARTICLESWARM options using OPTIMOPTIONS.
> In optim.options/SolverOptions/convertForSolver (line 777)
In SimBiology.fit.internal.validateOptions>convertOptionsForMethod (line 167)
In SimBiology.fit.internal.validateOptions (line 15)
In SimBiology.fit.internal/FitObject/initializeReRun (line 376)
In SimBiology.fit.internal/FitObject/rerunFit (line 314)
In SimBiology.fit.LeastSquaresResults.createBootFun/getBootstrapSample (line 1806)
In SimBiology.fit.LeastSquaresResults>@(x)getBootstrapSample(x,numGroups,groupIdx,groupSize,resampleWeights,refIdx,obj.Data,obj.Weights,obj.ConfidenceIntervalData.EstimInfo,restartData,obj.Beta.Estimate,exitFlag,fcn) (line 1764)
In bootstrp (line 178)
In bootci>bootper (line 207)
In bootci (line 167)
In SimBiology.fit/LeastSquaresResults/predCIBootstrap (line 1576)
In SimBiology.fit.LeastSquaresResults>@(obj)predCIBootstrap(obj,alpha,numSamples,useParallel) (line 1060)
In SimBiology.fit/LeastSquaresResults/dispatchConfidenceIntervalComputation (line 1880)
In SimBiology.fit/LeastSquaresResults/predictionci (line 1068)
In sbiopredictionci (line 68)
From the warning, I suspect that it is the observation data contains NaN which caused the problem.
Is there anyway to resolve it?
In addition to that, I also found that the bootci() function has more options could be accessed such as define different bootfun or types of confident interval. Is there anyway I couid change the settign for the sbiopredictionci ?
Thank you in advance.
Best,
Jesse

Answers (1)

Florian Augustin
Florian Augustin on 25 Oct 2022
Hi Jesse,
It looks like you used optimization options for particle swarm optimization when you used lsqnonlin to estimate the parameters. The bootstrap method for computing confidence intervals re-runs the original parameter fit for resampled data (here are a few more details). You can silence this warning as follows:
% Mute warning
origWarnState = warning("off", "MATLAB:optimfun:options:SolverOptions:WrongSolverOptions");
% Restore warning state when leaving current scope (i.e. restoreWarning is deleted)
restoreWarning = onCleanup(@() warning(origWarnState));
Your output also shows another warning about the data containing NaN values. This means that re-running the parameter estimation for bootstrapping the confidence intervals is probably less constrained by data than the original parameter fit. This can either cause the estimation to fail (as mentioned in the warning), or take a long time (if the optimization takes longer to converge). In many cases, optimization options (for lsqnonlin) for convergece tolerances can be tweaked / loosened without compromising the final parameter estimation. This could help speeding up the computation.
Best,
Florian

Communities

More Answers in the  SimBiology Community

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!