여기 하나의 접근 방식이 있습니다.
Names Default to Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Summarize( g = By( :sex ) );
If( N Items( g ) < 2,
biv obj = dt << Bivariate( Y( :weight ), X( :height ), Fit Line );
biv rep = biv obj << Report;
reg est = biv rep["Parameter Estimates"][NumberColBox(1)] << Get As Matrix,
// need By variable
biv obj = dt << Bivariate( Y( :weight ), X( :height ), By( :sex ), Fit Line );
biv rep = biv obj << Report;
reg est = [];
For( by = 1, by <= N Items( g ), by++,
reg est ||= (biv rep[by])["Parameter Estimates"][NumberColBox(1)] << Get As Matrix;
);
);
Show( reg est );
안녕하세요 .... 누군가가 보고서의 항목 수와 함께 다음 불일치를 설명 할 수 있는지 궁금합니다. X 플랫폼에 맞는 Y에 적용된 선형 맞춤에서 절편과 기울기를 추출하려고하는 다음 코드가 있습니다. 내가 보는 문제는 : group 열에 numplots = 2라는 항목이 하나만 있고 rp [1]에서 절편과 기울기를 추출하려고하면 오류가 발생합니다. 나는 RP [2]에서 추출해야합니다. : group 열의 항목 수가 2 이상이면 numplots = 그룹 열의 항목 수와 rp [1]에서 절편과 기울기를 추출 할 수 있습니다. 결국, x가 1에서부터 뭐든 될 수있는 x 그룹의 모든 인터셉트와 슬로프를 추출 할 수 있기를 원하지만이 "feature"는 # groups = 1과 # goups> = 2는 다릅니다.
Clear Globals();
dt = Current Data Table();
bivObj = dt << Bivariate(
Y(:this),
X(:that),
Fit Line,
By(:group),
);
rp = bivObj << Report;
numPlots = nItems(rp1);
intercept = rp[1][OutlineBox("Parameter Estimates")][Columnbox("Estimate")][1];
slope = rp[1][OutlineBox("Parameter Estimates")][Columnbox("Estimate")][1];
감사
둘 이상의 그룹이있는 경우 플랫폼 호출에서 By ()를 사용하면 결과는 플랫폼 목록이됩니다.
다음을 고려하세요:
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
dt <<
New Column( "Constant",
character,
formula( "a" )
);
bivObj1 = dt <<
Bivariate(
Y( :height ),
X( :weight ),
Fit Line,
By( :sex ),
);
bivObj2 = dt <<
Bivariate(
Y( :height ),
X( :weight ),
Fit Line,
By( :constant ),
);
Show( bivobj1, bivobj2 );
로그에 다음이 표시됩니다.
/*:
bivobj1 = {Bivariate[], Bivariate[]};
bivobj2 = Bivariate[];
따라서 bivObj 변수를 검사하여 목록인지 확인하고 그에 따라 행동하십시오. 예 :
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
dt << New Column( "Constant", character, formula( "a" ) );
bivObj1 = dt << Bivariate(
Y( :height ),
X( :weight ),
Fit Line,
By( :sex ),
);
bivObj2 = dt << Bivariate(
Y( :height ),
X( :weight ),
Fit Line,
By( :constant ),
);
Show( bivobj1, bivobj2 );
If( Is List( bivobj1 ),
//bivobj1 is a list of platform references
For( i = 1, i <= N Items( bivobj1 ), i++,
rp = bivObj1[i] << Report;
intercept = rp[Outline Box( "Parameter Estimates" )][Columnbox( "Estimate" )][1];
slope = rp[Outline Box( "Parameter Estimates" )][Columnbox( "Estimate" )][1];
Show( intercept, slope );
)
,
//bivobj1 is not a list, it's a single platform reference
rp = bivObj1 << Report;
intercept = rp[Outline Box( "Parameter Estimates" )][Columnbox( "Estimate" )][1];
slope = rp[Outline Box( "Parameter Estimates" )][Columnbox( "Estimate" )][1];
);