If I understand correctly, you will need four points (not two) for the bilinear interpolation. The grouping columns would be wasily dealt with, so for one group you could do something like:
Names Default To Here( 1 );
// Example table: Four complete observations, and one missing 'Colour' to be
// obtained by bilinear interpolation
dt = New Table( "Antman_1",
Add Rows( 5 ),
New Column( "X",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [0, 5, 3, 5, 0] )
),
New Column( "Y",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [0, 5, 2, 0, 5] ),
Set Display Width( 92 )
),
New Column( "Colour",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [255, 195, ., 100, 150] )
)
);
// Using the notation at: https://en.wikipedia.org/wiki/Bilinear_interpolation
x1 = dt[1, "X"];
x2 = dt[2, "X"];
y1 = dt[1, "Y"];
y2 = dt[2, "Y"];
q11 = dt[1, "Colour"];
q21 = dt[4, "Colour"];
q12 = dt[5, "Colour"];
q22 = dt[2, "Colour"];
x = dt[3, "X"];
y = dt[3, "Y"];
// Interpolate in the X direction
r1 = Interpolate(x, x1, q11, x2, q21);
r2 = Interpolate(x, x1, q12, x2, q22);
// Interpolate in the Y direction
p = Interpolate(y, y1, r1, y2, r2);
Wait(3);
dt[3, "Colour"] = p;
This is unlikely to be the 'best' way, but to do better some sample data (in a JMP table) would be required. You would also need to decide how to handle edge cases.