All-
I want to run a script that runs a bivariate fit and save the predicteds to a vector. Also I want to avoid showing the bivariate window.
I am going to use the predicteds in additional computation and I don't want to save them to the data table.
Here is what I have so far and it is not working:
dt = Current Data Table();
kernelSmoother = Bivariate( Y( :Gas Rate ), X( :Days ), Kernel Smoother( 1, 1, 0.1, 4 ) );
data = kernelSmoother << curve[1] << Get values;
kernelSmoother << Close();Please help me with this issue.
Thanks.
-Alvaro
Hi Alvaro,
Here is a functional option to achieve your goal but it uses the "Save Predicts" command to create a column that is delete at the end of the script: not the most elegant way to code but it works
Names Default to Here (1);
dt = New Table( "SMOOTHER", //DUMMY TABLE
Add Rows( 100 ),
New Column( "X",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values(
[1.67141067952957, -0.76185849552488, -0.603569458585827,
-0.756591674648757, 1.67340127655787, 0.0724575048740926,
0.159151730633123, -0.142889975446617, -0.874252989365011,
2.20294936082557, 0.18772074392043, -1.95789244934657,
0.0565106299651629, -0.605593026877751, 0.215613648250195,
2.3340049358012, -1.45888459127005, 0.583985564786941,
-0.317617101142023, -1.01947851069745, -0.700371328441461,
-1.76311244328458, 1.27998808300495, -1.04925859492911,
0.0615589538740275, 0.462341043767196, -0.364022756931157,
1.02591441155842, -0.961981489749384, -1.39888051775824,
-0.865484355080553, 0.0575924079013767, 2.67743272934693,
0.4895074706041, -0.353930652223919, 1.20197971417602, -1.94239723119073,
-1.80497764170637, 0.25322439936394, -0.803259183745682,
0.39877828050007, -1.39955079023924, -0.563270821962345,
1.00706367759649, -0.920919695429428, 0.595171257889085,
-0.785001186597782, 0.208610084917619, -1.365985295334, 1.3245192372372,
-1.137335505516, 0.380940775706916, 0.20277798167723, 2.7906587946415,
-0.474281058783615, 0.83128552480405, 1.06220976388948, -1.0783438678021,
-0.328722058193142, -1.22317459147617, 0.333615959204505,
-0.724960155164842, -2.10379798294336, 1.25945379498795,
1.39315374582064, 0.555402221964133, 0.0260943614927882,
-1.26262871377769, 0.905999353008783, -1.22971363040978,
-0.0835673126007406, 1.15329782793192, -1.31994532927163,
-1.09423235562862, 0.917365400223469, 1.65907130186835,
-1.61042285504848, -0.591548656921071, 0.131205378825393,
0.032797267621596, 0.87921466697569, 2.0586778387245, 0.562803054567428,
0.615792486119142, -0.118419312940292, -1.04518110416241,
-0.787515369931859, -0.627189651196433, 2.15324102656227,
0.83620623786038, -0.012097864616955, -0.311798951269388,
-2.59148801545045, 1.04832591823423, -0.586188226264991,
0.939584870287117, -0.545152048029061, -0.475765043667705,
-0.732494093426154, 0.926602866805675]
)
),
New Column( "Y",
Numeric,
"Continuous",
Format( "Best", 12 ),
Formula( Sine( :X ) ),
Set Selected
)
);
biv = Bivariate( Y( :Y ), X( :X ), invisible); //Set the basic bivariate plot in invisible mode
biv << Kernel Smoother( 1, 1, 0.1, 4 , {Save predicteds}); // calls the Smoother with the option to save predicted
biv << Close window;
vect = [];
vect = Column (dt, "Predicted Y") << get values; //captures the predicted Y into a list
Show (vect);
dt << Delete Columns (:Predicted Y); //removes the Predicted Y column
Maybe other JMP Forum members will have a more elegant way to get this done.
Best,
TS
Thanks for this suggestion @Thierry_S
I want to avoid placing the resulting values in the data table because my plan is to iterate the bivariate function to various "cases," and, after that, place the resulting vector in the column. Would there be a better solution for this?
My data has the structure below so I want to create a final column with all the fitted values by case.
-Alvaro