Integrate를 Interpolate 또는 SplineEval과 결합하여 곡선 아래 영역을 구합니다.
@seligman 썼다 JMP를 사용하여 곡선 아래 영역 찾기 ; 다음은 일부 내장 함수에 대한 추가 정보입니다.
보간 기능은 정렬된 X 좌표 목록과 해당 Y 좌표 목록을 사용하여 "X가 42라면 Y는 무엇입니까?"라는 질문에 답합니다. 정렬된 목록에서 가장 가까운 두 X 좌표 사이의 선형 보간법을 사용합니다. 선형 보간은 곡선의 모서리에 데이터 포인트가 있는 직선 세그먼트를 생성합니다.
SplineEval 함수는 스플라인 보간을 사용하여 동일한 작업을 수행합니다(Spline Coef 함수의 도움으로). 스플라인은 뻣뻣한 정도에 따라 데이터 포인트에 가깝게 통과하는 유연하고 탄력 있는 금속 와이어입니다. 일반적으로 데이터 포인트는 스플라인 곡선에 있지 않습니다.
두 함수 모두 첫 번째 X에서 마지막 X까지 곡선의 모든 데이터 포인트를 생성합니다.
적분 기능은 "이 범위에서 이 곡선 아래에 얼마나 많은 영역이 있습니까?"라는 다른 질문에 답합니다. 보간에는 네 가지 인수가 있습니다. 처음 두 개는 곡선을 생성하는 af(x) 함수를 설명하고 마지막 두 개는 x 값의 범위를 설명합니다. Integrate( f(x), x, low, high )의 결과는 x가 낮은 곳에서 높은 곳으로 갈 때 곡선 아래 영역입니다. f(x)는 a+2*b와 같은 표현식일 수 있고 두 번째 변수는 a 또는 b가 낮음과 높음 사이의 변수인지 알려주기 때문에 처음 두 변수는 x를 반복하는 것처럼 보입니다.
이 게시물의 JSL은 Interpolate 또는 SplineEval을 Interpolate의 f(x) 값으로 사용하는 것에 관한 것입니다.일부 잡음이 있는 데이터 포인트로 정의된 곡선 아래 영역을 찾는 것이 선형 또는 스플라인 보간에 어떻게 작동하는지 이해하는 데 도움이 되는 대화형 그래프를 작성합니다. 또한 노이즈(검은색 데이터 포인트)가 데이터에 추가되기 전의 정확한 답(빨간색)도 표시됩니다. 파란색 곡선은 검은색 데이터 포인트에 맞는 스플라인입니다. 중간에 있는 막대 그래프는 세 영역 계산을 나란히 보여줍니다. 스플라인 장력이 변경되면 가운데 파란색 막대만 이동합니다. 올바른 무작위 데이터를 사용하면 모든 막대가 다른 막대보다 크거나 짧을 수 있습니다.
JSL makes a graph like this; the lambda slider changes the blue spline's tension.JSL은 다음과 같은 그래프를 만듭니다. 람다 슬라이더는 파란색 스플라인의 장력을 변경합니다.
JMP 16 필요...각각...
New Window( "Integrate Area Under Curve",
// make a function, in the window: namespace, that returns a sine wave
window:f = Function( {t},
50 + Sin( t / 10 ) * 40
);
// create the x dimension of the graph
window:xmin = 20; // integrate over this range
window:xmax = 80;
window:xcoarse = window:xmin :: window:xmax :: 4; // the coarse data is used to make random data from sin function
window:xfine = window:xmin :: window:xmax :: 0.125; // the fine data is used for outlining smooth polygons
// create the y dimension of the graph from x and function f(x) and some randomness
window:random = 10; // random variation, slider below
// this function called here, and from slider below
window:generatedata = Function( {}, // regenerate the points with new random error
window:ycoarse = window:f( window:xcoarse ) + J( 1, N Col( window:xcoarse ), Random Normal( 0, window:random ) );
// ycoarse is the y data for the points; limit it to stay on the y axis...
window:ycoarse[Loc( window:ycoarse > 99 )] = 99;
window:ycoarse[Loc( window:ycoarse < 1 )] = 1;
);
window:generatedata(); // prepare the initial data in the graph
// lambda is the tension on the spline interpolation, slider below
window:loglambda = 2;// spline tension, a nice middle value
// random patterns for filled areas. the exponents are artistically adjusted for blending the colors
// with gray drawn first, and dark, and yellow drawn last, medium, and blue between, but light.
// there are 7 overlaps with different shades.
window:patternsize = 299; // big square patch for a pattern
window:pat01 = J( window:patternsize, window:patternsize, (Random Integer( 0, 255 ) / 255) ^ 0.5 );//gray
window:pat02 = J( window:patternsize, window:patternsize, (Random Integer( 0, 255 ) / 255) ^ 3 );//blue
window:pat03 = J( window:patternsize, window:patternsize, (Random Integer( 0, 255 ) / 255) ^ 2 );//yellow
window:bar01 = 38;
window:bar02 = 44;// bar x-locations, in graph coordinates; they look good here, for this sine wave
window:bar03 = 50;
window:show = [1 1 1];
window:barwide = 5;
window:barbottom = 50;// bottom of chopped off bar
window:bartop = window:barbottom + 5;
// map values of the AUC onto the graph
window:aucMin = 1500;
window:aucMax = 4000;
window:aucToGraph = Function( {y}, // convert auc to graph Y to make bar heights; 0 is for a label
Interpolate( y, 0, window:barbottom - window:bartop, window:aucMin, 7, window:aucMax, 97 - window:bartop )
);
// draw a broken bar; x in graph units, y in auc units
window:drawAucBar = Function( {x, y},
y = window:aucToGraph( y );
Polygon(// ragged edge bottom poly below the break
x || x || x + .1 * window:barwide || x + .3 * window:barwide || x + .5 * window:barwide || x + .8 * window:barwide || x + window:barwide
|| x + window:barwide,
window:barbottom || window:barbottom + 5 || window:barbottom + 6 || window:barbottom + 4 || window:barbottom + 7 || window:barbottom + 3
|| window:barbottom + 5 || window:barbottom
);
If( y >= 0, // the bar is below the break, don't draw
Polygon(
x || x || x + .1 * window:barwide || x + .3 * window:barwide || x + .5 * window:barwide || x + .8 * window:barwide || x + window
:barwide || x + window:barwide,
window:bartop + y || window:bartop + 5 || window:bartop + 6 || window:bartop + 4 || window:bartop + 7 || window:bartop + 3 || window
:bartop + 5 || window:bartop + y
)
);
);
// make the GUI
window:g = Graph Box(
// this script runs when the graph needs to reshow, either the first time, or because a slider script uses <<RESHOW framesize=""></RESHOW>