Code: Select all
procedure findstep criterion N
option choice criterion 1 aic sbc hq
type integer N
if criterion == 1 {
function cT T {
type real cT T
compute cT = 2.0
}
compute criterion_lbl = "AIC"
}
else if criterion == 2 {
function cT T {
type real cT T
compute cT = 2.0 * log(T)
}
compute criterion_lbl = "SBC"
}
else if criterion == 3 {
function cT T {
type real cT T
compute cT = 2.0 * log(log(T))
}
compute criterion_lbl = "HQ"
}
/*
Iterations that change the value of T and derive
the value of the function cT(T); this function
changes with the criterion.
*/
end
For simplicity and ease of maintenance, I'd like to have one set of -if- statements that branch based on the criterion, and then be able to avoid them through the rest of the procedure. For example, if I need to add a new criterion or change the function cT, I only have to do it once in the procedure, not numerous times by adding to a slew of branching -if- statements. I don't think FRML is the way to go because those depend on an entry number (whereas the function cT only takes a value), and I can't find anything in the manuals about anonymous functions or lambda operators, which would take care of this.