キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
言語を選択 翻訳バーを非表示
最初に公開されたスレッドを表示

曲線の下の面積を計算するにはどうすればいいですか?

私はJMP 7を初めて使います。
台形則を使用して、曲線の下の面積を計算したいと思います。
誰かこれをどうやってやるのか教えてもらえますか?
ありがとう ....

メッセージは pg_microbio によって編集されました

この投稿のオリジナルは 、English (US) で書かれており、ユーザビリティ向上のため自動翻訳機能を使用して表示しています。コメントを投稿すると、オリジナルの言語(English (US))やご指定の言語 でも表示されます。

1 件の受理された解決策

受理された解決策
rchertzy
Level III

Re: 曲線の下の面積を計算するにはどうすればいいですか?

私は JMP が大好きで、いつも使っています。しかし、曲線下面積のパッケージは JMP より優れたものがたくさんあります。私の意見では、Mathematica が最高です。安価な競合製品としては、MatLab の無料の兄弟である FreeMat があります。
http://freemat.sourceforge.net/
ただし、データ ポイントを線で接続して、その下の面積を計算するだけであれば、ポイント間の距離がすべて 30 単位であれば、答えは簡単です。各面積部分は水平の底辺を持つ台形であり、すべての底辺の幅は 30 だからです。各台形の下の面積は、幅 (30) と平均の高さの積になります。2 つのポイント (x1,y1)、(x2,y2) の場合、平均は (y1 + y2)/2 です。
y1を最初の点、ynを最後の点とします。プロットの下の面積は
[(y1+yn)/2 + (y2 + y3 + ... + yn-1) ]*30
最初と最後の点は面積の計算に 1 回だけ含まれるため、半分にする必要があります。他の点は 2 回含まれるため、合計するだけです。

Gompertz さん、非線形フィッティングはどれも開始値に依存します。JMP はデフォルトの開始値でうまく機能しているようですので、試してみてください。JMP の停止規則に従って収束しない可能性があります。そのため、パラメータが十分に安定している (変化しない) 場合は、現在の値を受け入れることを選択してください。または、リセットして数値導関数のオプションを選択してみてください。それが役立つ場合があります。幸運を祈ります。
12件の返信12

Re: How to calc. the area under a curve?

The JSL code below uses the trapezoid rule. You must enter the range of integration ("xmin" and "xmax"). Enter the function you want to integrate into the variable called "pdf". The trapezoid rule divides the range of integration into sevaral intervals, and approximates the area under the curve for each interval by the area of a trapezoid. But how many intervals do you use? The code approximates the area using 1 interval, then 2 intervals, so on. It keeps increasing the number of intervals until the incremental difference is less than "stop". That way you don't have to specify the number of intervals, the code just keeps going until it converges.

The example in the code is the standard normal distribution between -10 and 10. The code outputs the results into the log window: the number of intervals it used, and the answer it converged to. In this example. it takes 26 intervals, and converges to 1.00000000000001. The total area under the normal curve is 1. Pretty close I would say.

Also of interest to you may be the midpoint rule and Simpsons rule. See Wikipedia for details. The code below can be easily altered to use those other rules.

You can also use a data table to do numerical integration. The more rows you use to span the range of integration, the better the approximation.


The code is below:

Clear Globals();

xmin=-10;
xmax=10;
stop=0.0000000000001;

pdf=function( {x} , 1/(sqrt(2*pi()))*exp(-x^2/2) );

intervals=1;
last=0;
new=0;
flag=0;

while(flag==0,
 intervals=intervals+1;
 increment=(xmax-xmin)/intervals;
 total=0;
 for(i=1, i<=intervals, i++,
  if(i==1, x=xmin);
  if(i>1, x=x+increment);
  total=total + ((pdf(x)+pdf(x+increment))/2)*increment;
 );
 last=new;
 new=total;
 diff=abs(last-new);
 if(diff<=stop, flag=1);
);

show(intervals);
show(total);

Re: How to calc. the area under a curve?

dear Jonathan,

thanks for the reply. but actually i cant understand it.
i am writing down the data.
i am using, for which i want the fractional area(area under the curve)....

y-axis:(this is the Optical density)
0.2405
0.26675
0.3205
0.3635
0.401

Time(on x axis, interval is 30 mins): 0, 30, 60, 90, 120

All the data i have is in of this type, so if please help me with this one , i will be able to deal with the rest of the analysis.

Message was edited by: pg_microbio

Re: How to calc. the area under a curve?

I'm a little confused as to what you want to do. You say you want the area under the curve, but you gave me data, not the equation of a curve. Do you want to fit a model for Y as a function of X, and then integrate the model? If not, I'm afraid I don't understand what you want to do.

Re: How to calc. the area under a curve?

from this data i want to plot a graph, then calculate the area under it.
there is no equation just the data which i collected experimentally with a spectrophotometer.
the data i gave you is the growth profile(Optical density, O.D.) of a bacteria, against an antibiotic at a specific concentration in ppm.
Now after i calculate the area, under this, O.D. by time curve, at 10 different concentrations.
then i will use that data to plot a graph, Area(y-axis) by Concentration(x-axis).
then apply a modified Gompertz function to the data to analyse it.
basically i dont know what a Gompertz function is, but i know the formula and in the research paper it says a non linear fitting procedure was used in JMP.
But for all that, first i have to know how to calc. the area???

can i some how send you the JMP file of my data?
rchertzy
Level III

Re: 曲線の下の面積を計算するにはどうすればいいですか?

私は JMP が大好きで、いつも使っています。しかし、曲線下面積のパッケージは JMP より優れたものがたくさんあります。私の意見では、Mathematica が最高です。安価な競合製品としては、MatLab の無料の兄弟である FreeMat があります。
http://freemat.sourceforge.net/
ただし、データ ポイントを線で接続して、その下の面積を計算するだけであれば、ポイント間の距離がすべて 30 単位であれば、答えは簡単です。各面積部分は水平の底辺を持つ台形であり、すべての底辺の幅は 30 だからです。各台形の下の面積は、幅 (30) と平均の高さの積になります。2 つのポイント (x1,y1)、(x2,y2) の場合、平均は (y1 + y2)/2 です。
y1を最初の点、ynを最後の点とします。プロットの下の面積は
[(y1+yn)/2 + (y2 + y3 + ... + yn-1) ]*30
最初と最後の点は面積の計算に 1 回だけ含まれるため、半分にする必要があります。他の点は 2 回含まれるため、合計するだけです。

Gompertz さん、非線形フィッティングはどれも開始値に依存します。JMP はデフォルトの開始値でうまく機能しているようですので、試してみてください。JMP の停止規則に従って収束しない可能性があります。そのため、パラメータが十分に安定している (変化しない) 場合は、現在の値を受け入れることを選択してください。または、リセットして数値導関数のオプションを選択してみてください。それが役立つ場合があります。幸運を祈ります。

この投稿のオリジナルは 、English (US) で書かれており、ユーザビリティ向上のため自動翻訳機能を使用して表示しています。コメントを投稿すると、オリジナルの言語(English (US))やご指定の言語 でも表示されます。

Re: How to calc. the area under a curve?

yes i do think i want to fit y by x, then integrate it to get the area under the curve..
p.s. read the other post to for details

Re: How to calc. the area under a curve?

I am not able to recieve or send files. But, I will give instruction on using non-linear fitting in JMP, particularly the Gompertz model, then using the JSL code I provided to find the area under the fitted curve. I will use JMP 8 for the demo. You can download a free 30 day trial of JMP 8 from JMP's website.

Create a data table with the Time (x) and Optical Density (y) data. The table will have 5 rows and 2 columns. Select Analyze>Modeling>Nonlinear. Click the Model Library button. Scroll down till you find "Model H (Gompertz growth model, 3P)", and select it. Click the Make Formula button. Assign y to the Y role and x to the X role, then click OK. Move the theta1 slider to close to 0.3611. Click Make Formula. That created a new column in the table with the model and initial parameter estimates. Back on the Nonlinear window, assign Model H (Gompertz growth model, 3P) to the X, Predictor Formula role, and assign y to the Y, Response role. Click OK. Click Go a few times till the result pane give the message "Converged in Gradient". Click the Save Estimates button. If you want to save the predicted model to a column, select Save Formula>Save Prediction Formula. That is the basics of using the nonlinear platform.

Now we'll integrate that fitted model to get the area. Turn our attention to the JSL code I provided above. Copy and paste the code into an empty script window. I'm assuming you want to integrate between 0 and 120. Therefore, change the "xmin" variable to 0 and "xmax" to 120. Change the "stop" variable to 0.000000001. The line with the "pdf" variable should read:

pdf=function( {x} , 1.16929740059737 * Exp( -Exp( 0.46956698638041 - 0.00339164235623826 * x ) ) );

The pdf line contains the fitted model.

Make sure your log window is open. On the View menu, make sure Log is checked. Now run the script by selecting Edit>Run Script. It should finish in about 3 seconds.

The result shows in the log window. The variable Total gives the area. It should be about 38.161.

Good luck with trying it out. I hope this helps point you in the right direction.

Re: How to calc. the area under a curve?

Thanks a lot, for the Gompertz function thing!
the script is running fine, (its a bit like a C++ program).
this is about the area problem, what i wanted to ask was that " the interval is constant for every set of values ie. from 0 to 120, but the O.D. values(on y-axis) will change with every table, so how do i do that, so i get the area for every different set of values?"
this area which i am getting would be for the values i gave you, right?

Re: How to calc. the area under a curve?

Yes, the area result I got was for the specific optical density values (Y) values you gave.

You can repeat the process with different Y values.