You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Users can more readily adjust what the predicted latent variable is from the outset of model simulation (e.g. provided below);
It is more transparent to the users how our latent pred_vars are calculated, and what variable they should index
The prototype I've hacked together is far from complete or perfect. Currently the general interface is something like the following:
TPM.simulation.results= FIPS_simulate(
FIPS_df=simulated.dataframe, # The FIPS_dfmodeltype="TPM", # three process modelpvec= TPM_make_pvec(), # parameter vectorformula=alertness_with_w~s+c+u+w
)
Like any big change I do want to minimize issues with legacy code. I envision that this formula argument will be optional, with the previous defaults being placed in when the user supplies no argument (that is how it currently works). However, in writing the basic logic for this feature, I have come across a few issues:
Currently, the FIPS_Simulation class is assigned after the main loop of each of the models
The issue with this approach is that attributes need to be continuously added to the object within the FIPS_Simulate function. This creates a lot of noise, and you end up changing object attributes in helper functions down the line:
Ideally, we are setting all attributes like pred_stat at the time we create the object.
What I'm thinking is that the main loops for the model functions should effectively do nothing but be similar to a model.frame whereby it returns only the essential elements for the model.
We then will need constructor functions for each model type (e.g., FIPS_simulate_TPM) and these are called in the FIPS_simulate function. These functions will take in the arguments like formula all the data etc., and then produce the required object. The added benefit is that we simplify the role of the main loops.
This will have side-effects for the plotting functions which will need to be examined, and likely also for validation.
The only issue I have is how we might add in help for the formula, given it's model depdendent.
In any case, this is my notes from late on a Friday, so when I get round to implementing this Monday I can remember what the hell I was thinking!!! @lukestrickland
The text was updated successfully, but these errors were encountered:
This commit provides the foundation of work that will address #12
- The formula interface feature is now working for the TPM
- This includes a number of new functions within the simulation_threeprocessmodel.R file that ensure the behaviour of FIPS_simulate is identical to previously. That is, if model_formula is null, then KSS and alertness outputs are automatically generated. If pvec not default, a warning is raised regarding use of KSS.
- Added tests for TPM
Currently we now have full formula support for TPM (d76aaf2) and Unified model (bc2fe36) with internal documentation (b57cd20).
You can see an internal use of the process_bmm_formula in simulation_unifiedfatiguemodel.R. This ensures backwards compatibility for when no model_formula is provided.
I've been doing some work on providing a simple formula interface to FIPS https://github.com/humanfactors/FIPS/tree/formula-proposal-interface. The logic of providing this interface is twofold:
pred_vars
are calculated, and what variable they should indexThe prototype I've hacked together is far from complete or perfect. Currently the general interface is something like the following:
Like any big change I do want to minimize issues with legacy code. I envision that this formula argument will be optional, with the previous defaults being placed in when the user supplies no argument (that is how it currently works). However, in writing the basic logic for this feature, I have come across a few issues:
FIPS_Simulation
class is assigned after the main loop of each of the modelsFIPS/R/simulation_threeprocessmodel.R
Line 300 in ab1da48
FIPS_Simulate
function. This creates a lot of noise, and you end up changing object attributes in helper functions down the line:FIPS/R/formula_interface_rlang.R
Lines 28 to 32 in 6e2ca5b
pred_stat
at the time we create the object.model.frame
whereby it returns only the essential elements for the model.FIPS_simulate_TPM
) and these are called in the FIPS_simulate function. These functions will take in the arguments likeformula
all the data etc., and then produce the required object. The added benefit is that we simplify the role of the main loops.In any case, this is my notes from late on a Friday, so when I get round to implementing this Monday I can remember what the hell I was thinking!!! @lukestrickland
The text was updated successfully, but these errors were encountered: