A script illustrates how the CCC is calculated and added to the Bivariate report layer. Note that line 3 would be omitted, and the resulting script would be run after the real data table is opened. The X role is for the standard method and the Y role is for the test method.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Method Comparison.jmp" );
dialog = New Window( "Launch Bivariate",
<<Modal,
// require the user to select two variables before clicking OK
<<On Validate(
Show( xvar, yvar );
If( Is Missing( xvar ) | Is Missing( yvar ),
// if xvar or yvar are missing do nothing when OK is clicked
0
,
1
);
),
Text Box( " Select two numeric columns. " ),
H List Box(
Text Box( " X, Factor " ),
x = Col List Box(
dt, // data table reference
all, // display all columns from the data table
// get the name of the selected column before the window closes
xvar = (x << Get Selected)[1];
Show( xvar );
),
Text Box( "Y, Response" ),
y = Col List Box(
dt,
all,
yvar = (y << Get Selected)[1];
Show( yvar );
)
)
);
If( dialog["Button"] == 1, // if the user clicks OK...
xcol = Column( dt, xvar ); // get the columns
ycol = Column( dt, yvar );
);
obj = Bivariate(
Y( ycol ),
X( xcol ),
Density Ellipse( 0.95, {Line Color( {66, 112, 221} )} ),
Fit Line( {Line Color( {212, 73, 88} )} ),
Fit Orthogonal( Univariate Variances, {Line Color( {61, 174, 70} )} )
);
rpt = obj << Report;
// Pearson correlation r three ways
regrC = rpt["Bivariate Normal Ellipse P=0.950"][Number Col Box( "Correlation" )][1];
regrR = Sqrt( rpt["Summary of Fit"][Number Col Box( 1 )][1] );
ob = (rpt << XPath( "//OutlineBox[contains( text(), 'Orthogonal Fit Ratio')]" ))[1];
regrO = ob[Number Col Box( "Correlation" )][1];
// Lin's concordance correlation coefficient
muX = Col Mean( :Standard );
muY = Col Mean( :Method 1 );
sigmaX = Col Std Dev( :Standard );
sigmaY = Col Std Dev( :Method 1 );
ccc = regrC * (2 / ((((muY - muX) ^ 2) / (sigmaY * sigmaX)) + (sigmaY / sigmaX) + (sigmaX / sigmaY)));
Show( regrC, regrR, regrO, ccc );
ob[TableBox(1)] << Append( Number Col Box( "Lin's CCC", { ccc } ) );
See NCSS source.