cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
%3CLINGO-SUB%20id%3D%22lingo-sub-418487%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%E5%A6%82%E4%BD%95%E7%8D%B2%E5%BE%97%20x%20%E5%80%BC%EF%BC%8C%E8%A9%B2%E5%80%BC%E7%B5%A6%E5%87%BA%E6%9B%B2%E7%B7%9A%E4%B8%8B%E9%9D%A2%E7%A9%8D%E7%9A%84%2050%25%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-418487%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CP%3E%E6%88%91%E6%9C%89%E4%B8%80%E4%BA%9B%E9%80%A3%E7%BA%8C%E6%95%B8%E6%93%9A%EF%BC%8C%E6%88%91%E4%BD%BF%E7%94%A8%E3%80%8C%E6%93%AC%E5%90%88%E6%A8%A1%E5%9E%8B%E3%80%8D%E6%93%AC%E5%90%88%E6%9B%B2%E7%B7%9A%EF%BC%8C%E4%B8%A6%E4%BD%BF%E7%94%A8%E5%B1%AC%E6%80%A7%E3%80%8C%E7%B5%90%E6%A8%A3%E6%A2%9D%E6%95%88%E6%87%89%E3%80%8D%E5%92%8C%2050%20%E7%AF%80%E3%80%82%E7%84%B6%E5%BE%8C%E6%88%91%E5%B0%87%E9%A0%90%E6%B8%AC%E5%85%AC%E5%BC%8F%E5%84%B2%E5%AD%98%E5%88%B0%E8%A1%A8%E4%B8%AD%E3%80%82%E6%8E%A5%E4%B8%8B%E4%BE%86%E6%88%91%E6%83%B3%E5%81%9A%E7%9A%84%E6%98%AF%E6%89%BE%E5%88%B0%E7%89%87%E6%AE%B5%E5%A4%A7%E5%B0%8F%EF%BC%88x%20%E5%80%BC%EF%BC%89%EF%BC%8C%E5%AE%83%E7%B5%A6%E4%BA%86%205%25%E3%80%8110%25%E3%80%8125%25%E3%80%8150%25%E3%80%8175%25%E3%80%8190%25%20%E5%92%8C%2095%25%20%E7%9A%84%E9%9D%A2%E7%A9%8D%E3%80%82%E6%88%91%E6%9C%89%2010%20%E5%80%8B%E6%A8%A3%E6%9C%AC%EF%BC%8C%E6%89%80%E4%BB%A5%E6%88%91%E6%9C%89%2010%20%E5%80%8B%E9%9D%9E%E5%B8%B8%E8%A4%87%E9%9B%9C%E7%9A%84%E6%96%B9%E7%A8%8B%E5%BC%8F%E3%80%82%3C%2FP%3E%3CP%3E%E5%A6%82%E4%BD%95%E7%8D%B2%E5%BE%97%E6%9B%B2%E7%B7%9A%E4%B8%8B%E4%B8%8D%E5%90%8C%E9%9D%A2%E7%A9%8D%E7%9A%84%E7%89%87%E6%AE%B5%E5%A4%A7%E5%B0%8F%EF%BC%88x%E5%80%BC%EF%BC%89%EF%BC%9F%E6%88%91%E5%B0%8D%E8%85%B3%E6%9C%AC%E4%B8%8D%E7%86%9F%E6%82%89%EF%BC%8C%E6%89%80%E4%BB%A5%E5%A6%82%E6%9E%9C%E5%8F%AF%E8%83%BD%E7%9A%84%E8%A9%B1%EF%BC%8C%E6%88%91%E6%9B%B4%E5%96%9C%E6%AD%A1%E5%AD%B8%E7%BF%92%E6%BB%91%E9%BC%A0%E9%BB%9E%E6%93%8A%E6%96%B9%E5%BC%8F%E3%80%82%3C%2FP%3E%3CP%3E%20%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202021-09-15%20161811.png%22%20style%3D%22width%3A%20414px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Screenshot%202021-09-15%20161811.png%22%20style%3D%22width%3A%20414px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F35837iAEE33E38FA310F7E%2Fimage-dimensions%2F414x636%3Fv%3Dv2%22%20width%3D%22414%22%20height%3D%22636%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-09-15%20161811.png%22%20alt%3D%22Screenshot%202021-09-15%20161811.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-418487%22%20slang%3D%22en-US%22%20mode%3D%22UPDATE%22%3E%3CLINGO-LABEL%3E%E9%80%B2%E9%9A%8E%E7%B5%B1%E8%A8%88%E5%BB%BA%E6%A8%A1%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Choose Language Hide Translation Bar
dtsang
Level I

how to get the x-value which gives me 50% of area under a curve

I have some continuous data and I fit a curve using "Fit Model" and used attributes "Knotted Spline Effect" and 50 knots. Then I save the prediction formula to the table. What I want to do next is to find the fragment size (x-value) which gives me 5%, 10%, 25%, 50%, 75%, 90% and 95% of area. I have 10 samples and so I have 10 very complicated equations.

How do I get the fragment size (x-value) with different area under the curve? I am not familiar with scripts so I prefer learning the mouse clicking way if possible.

 

Screenshot 2021-09-15 161811.png

1 REPLY 1
peng_liu
Staff

Re: how to get the x-value which gives me 50% of area under a curve

I use this example to illustrate one approach. I follow the instructions up to step 7. Then from the red triangle menu of the report, I choose "Save Columns" > "Prediction Formula". Now I get a new column, and the formula is the function of the curve. Copy the formula from the column.

Now go to Scripting Index, and find "Integrate" function.

peng_liu_1-1631762883318.png

Now paste the formula and replace the highlighted part, get this:

peng_liu_2-1631762981590.png

Now remove all the colon symbols, by replacing colon by empty string.

peng_liu_3-1631763183428.png

Also replace "x" by "age", my x variable name.

Now decide where the upper limit of the integration (100%), say 80. And the result is 69.783 for 100%.

peng_liu_5-1631763270010.png

Now the task is to find a number to replace 80, and give me 50%: 69.783/2=34.8915. I got 44.228 after maybe a dozen try and error.

peng_liu_6-1631763432932.png

It requires JSL programming, but not much, to get more precise result quickly. Mostly still copy and paste. See the following screenshot.

peng_liu_9-1631764338721.png

The key is to find the value that minimize the squared difference between integral and the target value 34.8919. So I wrap the difference between integral and the target inside of a square, then call minimize function. Check out the function documentation for the syntax. The result for 50% is 44.226900491921.