Using the Generalized Regression platform shrinkage methods (lasso, elastic net, etc.) with lognormal distribution, I need to create a scatterplot of the tuning parameter against various fit statistics (negative log-likelihood, Generalized R2). I hoped to do so by pre-setting the values of the tuning parameter and also pre-setting the number of grid points to 1 (the number of points along the grid that JMP uses for the tuning parameter).
The script below is not recognizing the different values of the tuning parameter (^PEN^) and reports identical values for each iteration of the model estimation loop. My best guess is that it is not recognizing the needed values for these two lines in the script:
Lambda Penalty( ^PEN^ ),
Number of Grid Points( 1 ),
Any wisdom would be greatly appreciated!
//Script to retrieve parametrics negative logl and R2GEN
//Both data tables below must be open for script to run
dt = Data Table("JMP Test Data.jmp");
dt_pens = Data Table("Penalties1.jmp");
//Get copy of penalty table to store results
dt_results = dt_pens << Subset( All rows, Selected columns only( 0 ) );
dt_results << New Column("RsqGEN Training");
dt_results << New Column("RsqGEN Validation");
dt_results << New Column("RsqGEN Test");
dt_results << New Column("neglogl Training");
dt_results << New Column("neglogl Validation");
dt_results << New Column("neglogl Test");
dt_results << New Column("N Training");
dt_results << New Column("N Validation");
dt_results << New Column("N Test");
dt_results << New Column("Tuning Param");
for(i = 1, i<= N Row(dt_pens), i++,
PEN = dt_pens:Penalty[i];
str = Eval Insert("\[report = (dt << Fit Model(
Y( :Y1 ),
X( :X1, :X2, :X3, :X4),
Validation( :Name( "Train/Valid/Test" ) ),
Lambda Penalty( ^PEN^ ),
Number of Grid Points( 1 ),
Personality( "Generalized Regression" ),
Generalized Distribution( "LogNormal" ),
Run(
Fit(
Estimation Method( Lasso( Adaptive ) ),
Validation Method( Validation Column )
)
),
Go,
invisible
)) << Report;]\");
//Fit the model
Eval(Parse(str));
//Get the fit stats and insert them into the results table
Train = report["Model Summary"][NumberColBox(1)] << Get;
Valid = report["Model Summary"][NumberColBox(2)] << Get;
Test = report["Model Summary"][NumberColBox(3)] << Get;
report << Close Window;
dt_results:RsqGEN Training[i] = Train[7];
dt_results:RsqGEN Validation[i] = Valid[7];
dt_results:RsqGEN Test[i] = Test[7];
dt_results:neglogl Training[i] = Train[3];
dt_results:neglogl Validation[i] = Valid[3];
dt_results:neglogl Test[i] = Test[3];
dt_results:N Training[i] = Train[1];
dt_results:N Validation[i] = Valid[1];
dt_results:N Test[i] = Test[1];
// dt_results:Tuning Param[i] = Train[8];
);