Use ctrl-M in the editor to format the jsl:
dt = Current Data Table();
//declaring and initializing variables//
lt_min = 1;
lt_max = 50;
RSquare_th = 0.9999;
count = 0;
//loop
While( count < 0.99999,
//calculate x for each y value
dt << New Column( "x", Numeric, formula( :y / (:y + :avg_num) ) );
//plot bivariate
biv = dt << Bivariate(
Y( :x ),
X( :average_temp ),
Fit Line( {Line Color( {212, 73, 88} )} )
);
Bivariate_report = biv << report;
pt = Bivariate_report[Table Box( 1 )];
pt << Make Combined Data Table();
pt = Bivariate_report[Table Box( 3 )];
pt << Make Combined Data Table();
);
//get rsquare
rsquare << Send( Bivariate Fit );
rsquare << Send( Get Gen RSquare Test );
//check Rsq
If(
rsquare < RSquare_th,
//increment light by 1
lt_min = lt_min + 1,
count = count + 1,
//update data table
dt << New Column( "light", Numeric, formula( lt_min ) ),
//exit loop if RSQ >= threshold
Print( "Search Completed. RSQ >= threshold" ),
);
The indentation will help understand what code the loop is running. In particular, notice the count=count+1 is not inside the loop, so it will not terminate.
edit: the if statement needs work too, see If Secrets
Craige