cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
Sherif_96
Level III

Fitting a Sharp Region

My data can be usually matched with an exponential decay function, however at some point on the curve where there is a rapid spike, then decay continues, therefore how can this sharp edge be fitted inside the exponential function?

1 ACCEPTED SOLUTION

Accepted Solutions
Victor_G
Super User

Re: Fitting a Sharp Region

Hi @Sherif_96,

 

I'm thinking about two possible analysis methods that could deal with the sharp edge in your exponential function :

  1. You could use the Nonlinear Regression platform and define piecewise functions if the profile/curve pattern always happen at defined x values/regions :
    • From X=0 to 0,08 : exponential function
    • From X=0,08 to 0,1 : linear function
    • From X=0,1 to 15 : exponential function
      Capture d'écran 2024-06-06 223724.png
      @JerryFish did an excellent blog about using this platform for complex non-linear piecewise functions : Fitting piecewise functions with JMP's Nonlinear platform
      You have to create parameters for the different regions of your curves (with random initial values) and specify the equations for each part of your curve thanks to the created parameters :
      Victor_G_0-1717707457966.png

      Since there is only one curve, I fixed the X values, but you could also add Xi parameters if the pattern is the same but happens for different ranges of X values. Using the platform Nonlinear, you can then use your formula as "X, Predictor Formula" and your measured Y as "Y, Response". Launching the platform and click on Go so that JMP determines the parameters in your piecewise equation :

      Victor_G_1-1717707598008.pngThis method is flexible, but require good equations and ranges identification, and represent strong assumptions on the patterns in your curve and their generalization/repetition across all measured curves.
  2. You could also perhaps use the Functional Data Explorer (jmp.com) to fit a P-Splines step function curve. It won't keep the exponential shape of the curve, but may be able to deal with the sharp edge you have by approximating your function with step functions. In JMP 18 there is also the possibility to identify more easily peaks, so it could also be an interesting option to test, when JMP 18 will be available... 

 

Even if there are analytical solutions to your problem in JMP, I would like to endorse the message from @statman about the "significance" of this peak in your curve. Is this really an important and practically significant pattern you have to keep in the analysis ? From a statistical point of view, there are no big differences in terms of model Sum of Squares Error (SSE) between the piecewise function (SSE=237) and the approximation by a "simple" exponential function with "Fit Curve" platform (SSE=287).

The residuals from these two analysis (piecewise vs. "simple" exponential function) look also very similar :

Victor_G_2-1717708206407.png

 

I attached the datatable with the scripts used so that you can try for yourself and analyze what make sense for you.

Hope this will help you,

Victor GUILLER
L'Oréal Data & Analytics

"It is not unusual for a well-designed experiment to analyze itself" (Box, Hunter and Hunter)

View solution in original post

9 REPLIES 9
statman
Super User

Re: Fitting a Sharp Region

What are you trying to do?  Why are you trying to fit the spike? Are you trying to explain why there is a spike?  Or predict the spike?  Are you trying to assess if this is an unusual event (e.g., special)?  What is the practical significance of that spike in real terms?

"All models are wrong, some are useful" G.E.P. Box
Sherif_96
Level III

Re: Fitting a Sharp Region

This spike is actually related to the presence of a specific chemical component in the mixture, so I'm attempting to generate a predictive model without ignoring any aspect, as ignoring the effect of this sharp edge may result in a deviation from the original data if fitted by an exponential function.

Victor_G
Super User

Re: Fitting a Sharp Region

Hi @Sherif_96,

 

I'm thinking about two possible analysis methods that could deal with the sharp edge in your exponential function :

  1. You could use the Nonlinear Regression platform and define piecewise functions if the profile/curve pattern always happen at defined x values/regions :
    • From X=0 to 0,08 : exponential function
    • From X=0,08 to 0,1 : linear function
    • From X=0,1 to 15 : exponential function
      Capture d'écran 2024-06-06 223724.png
      @JerryFish did an excellent blog about using this platform for complex non-linear piecewise functions : Fitting piecewise functions with JMP's Nonlinear platform
      You have to create parameters for the different regions of your curves (with random initial values) and specify the equations for each part of your curve thanks to the created parameters :
      Victor_G_0-1717707457966.png

      Since there is only one curve, I fixed the X values, but you could also add Xi parameters if the pattern is the same but happens for different ranges of X values. Using the platform Nonlinear, you can then use your formula as "X, Predictor Formula" and your measured Y as "Y, Response". Launching the platform and click on Go so that JMP determines the parameters in your piecewise equation :

      Victor_G_1-1717707598008.pngThis method is flexible, but require good equations and ranges identification, and represent strong assumptions on the patterns in your curve and their generalization/repetition across all measured curves.
  2. You could also perhaps use the Functional Data Explorer (jmp.com) to fit a P-Splines step function curve. It won't keep the exponential shape of the curve, but may be able to deal with the sharp edge you have by approximating your function with step functions. In JMP 18 there is also the possibility to identify more easily peaks, so it could also be an interesting option to test, when JMP 18 will be available... 

 

Even if there are analytical solutions to your problem in JMP, I would like to endorse the message from @statman about the "significance" of this peak in your curve. Is this really an important and practically significant pattern you have to keep in the analysis ? From a statistical point of view, there are no big differences in terms of model Sum of Squares Error (SSE) between the piecewise function (SSE=237) and the approximation by a "simple" exponential function with "Fit Curve" platform (SSE=287).

The residuals from these two analysis (piecewise vs. "simple" exponential function) look also very similar :

Victor_G_2-1717708206407.png

 

I attached the datatable with the scripts used so that you can try for yourself and analyze what make sense for you.

Hope this will help you,

Victor GUILLER
L'Oréal Data & Analytics

"It is not unusual for a well-designed experiment to analyze itself" (Box, Hunter and Hunter)
Sherif_96
Level III

Re: Fitting a Sharp Region

Thank you for the clear explanation and guided steps.

Sherif_96
Level III

Re: Fitting a Sharp Region

But what happens if I have multiple Y values for the same X? The Y values vary a little but follow the same pattern, and they differ owing to the existence of other factor. Could I fit the varied responses using the piecewise function, taking into account the X and other factor effects?

Victor_G
Super User

Re: Fitting a Sharp Region

I think you are referring to this dataset, with several samples (several Y for the same X values) ? : https://community.jmp.com/t5/Discussions/How-to-obtain-the-optimum-formulation/m-p/762444#M94169 

If you have identified the samples in your datatable, you can use the Nonlinear platform and use your sample ID in the "By" variable to fit the piecewise equation to each sample independently. You can press CTRL + click on "Go" to launch the estimation of parameters for all samples independently and simultaneously.

Victor_G_0-1717774160216.png


Then you can aggregate the parameters values (right-click in the panel "Solution" on the table with the parameters estimates, and click on "Make Combined Data Table"), compare them, and link/analyze them vs. your factor variable (for example by updating the generated table with the V/B ratio, splitting the data table by parameters and analyzing the correlations between the parameters values and the V/B ratio) :

Victor_G_1-1717774472006.png

 

I attach the dataset so that you can test and see the steps used in my response,

Victor GUILLER
L'Oréal Data & Analytics

"It is not unusual for a well-designed experiment to analyze itself" (Box, Hunter and Hunter)
Sherif_96
Level III

Re: Fitting a Sharp Region

Thank you as always, Victor, and if I wish to create a predictive model, I will follow the procedures you suggested in an earlier post. Is this correct in the case of the piecewise function?
And could you recommend a resource for learning about mixture design with JMP?

Victor_G
Super User

Re: Fitting a Sharp Region

Yes @Sherif_96, you could use the same methodology for a predictive model of a piecewise function. You can follow the procedure to extract parameters from each functions and link them to your original factor.

Some further recommandations/advices to help you in your project :

  • Make sure that the piecewise function is appropriate : it should have the right level of complexity regarding the number of points you have for fitting your curves.
  • Try to avoid fitting perfectly all the points of the curves, and find a general pattern or collection of functions that approximate well the general behaviour. The piecewise function should represent the behaviour/pattern present for every sample, so you should have similar SSE when fitting this piecewise function to each of your samples.
    If it's not the case for several samples, then maybe the pattern is not yet fully discovered.
    If only some samples diverge from the pattern of your piecewise function, then it may be someting to investigate : outliers ? experimental or measurement error ? etc...
  • Make sure that the range of your factor (V/B ratio) is sufficiently large and the levels explored sufficiently spaced to have a good variability in the curves response, a representative experimental sample, and facilitate the analysis. You also ensure that the piecewise function created to fit the pattern for the curves may also have good generalization properties.

 

Concerning mixture designs, there are various JMP ressources to get started :

You can also join Design of Experiments Club, a group of passionate DoE users with quarterly meetings and insightful discussions. Next meeting is planned on 11th June : https://www.jmp.com/en_gb/events/users-groups/users-group-meetings/doe-community-of-practice-multi-r... 

 

Hope these first ressources will help you,

Victor GUILLER
L'Oréal Data & Analytics

"It is not unusual for a well-designed experiment to analyze itself" (Box, Hunter and Hunter)
Sherif_96
Level III

Re: Fitting a Sharp Region

Many thanks, Victor, for your guidance.