If it helps......
My data table is set up as follows:
datetime log_turb_pear millsR_Q_lag_6hrs pred formula log_ecoli_pear (computed)
01/04/2021 08:00 AM 1.32 50 2.64
01/04/2021 08:15 AM 1.46 45 2.72
01/04/2021 08:30 AM 1.59 50 2.90
01/04/2021 08:45 AM 2.20 50 3.7
01/04/2021 09:00 AM 2.25 58 3.19
etc
I am trying to compare the value of :pred formula log_ecoli_pred at 1/4/2021, 8 am (i.e. 2.64) to the value obtained at all the other times up to 01/12/21 at 7:45 AM. And then I need to count the number of times that each of those values is + or - 25% of 2.64. Then repeat for the next week, etc until the counting has been carried out for all weeks in the data table. (Note that, if needed, the first Monday in 2019 is on Jan 7th, the first Monday in 2020 is Jan 6, and the first Monday in 2021 is Jan 4....my data table has records from early 2019 to current.) Only one value (3.7) in the above example table is more than + or - 25% of 2.64 (i.e. <(0.75 * 2.64) or > (1.25 * 2.64)).
Hi all - I am still learning the basics of JSL and am trying to write a script that will compare how well the "point in time" predicted value compares to subsequent predicted values over the following 7 days. I am trying to get the script to do the following:
1 - perform regression on all rows in data table (each row corresponds to a 15 minute increment, so my predicted value is computed every 15 minutes).
Ex:
obj = Fit Model(
Y( :LOG_ECOLI_Pear ),
Effects( :LOG_TURB_Pear, :millsR_Q_lag6hr ),
Personality( "Standard Least Squares" ),
Emphasis( "Effect Leverage" ),
Run( :LOG_ECOLI_Pear )
);
obj << Prediction Formula;
2 - select the predicted value that occurs each Monday morning at 8 am throughout the dataset spanning 3 years.
3 - compare that value to all the other predicted values that occur during the week following that 8 am value (i.e. Mon 8:15 am to the following Mon at 7:45 am). (That is, all the values computed during the week will be compared to the Monday at 8 am value.) Then, count the number of rows in which all those predicted values are more than + or - 25% of the 8 am value for that week. Continue (repeat this process) until all the weeks are accounted for.
ex:
New Column( "count num above or below 25pct of mon 8am",
numeric,
continuous,
formula(
If( Row() == 1, x = 0 );
((If( :above or below 25pct of mon 8am == 1,
x = x + :above or below 25pct of mon 8am,
X = X + :above or below 25pct of mon 8am
)));
x;
)
);
I'm not sure how to select the week's worth of values to compare to the Mon 8 am value. And I'm not sure I'm even on the right track with this. I would greatly appreciate any help!
Thank you Stan. I will give this a try.