Does anyone know how to retrieve parameters from a formula column in a data table?
I'm using the nonlinear platform to estimate parameters for a custom equation. I want to retrieve some of those parameters so I can use them to add reference lines to a graph. How do I get the params into my script?
I've been trying to use "Get Formula", which returns the formula itself in a variable. But while it looks like a character string, it isn't. So I can't interrogate it using something like "Contains" (which gives an error).
Here's what doesn't work:
names default to here(1);
clear log();
dt=current data table();
a=column("Ypred")<<GET formula=""></GET>
Output looks like this:
a = Parameter({x2 = 43.392460252954, x3 = 99.9985293436864, b1 = 0.217052884609186, tau0 = 6.8300208159237, b2 = 13.6749994042758, b3 = 2.0025718816485, xoffset2 = 79.8284250939869, b4 = 158.586185051408, tau2 = 12.9572197347909, x1 = -0.0000000143754505748, xoffset1 = 13.8700526412164, b0 = 0.731036046206343}, If(:x < x1, b0 * (:x < x1), :x < x2, b1 * Exp((:x - xoffset1) / tau0) * (:x >= x1 & :x < x2), :x < x3, (b2 + b3 * (:x - x2)) * (:x >= x2 & :x < x3), b4 * (1 - Exp(-((:x - xoffset2) / tau2))) * (:x >= x3)));
expecting integer in access or evaluation of 'x2' , "x2" /*###*/
at line 11 in Script for Example 2
Hi Jerry,
It looks like JMP is trying to evaluate a, which it cannot, as it does not know about all the parameters in the expression (due to scoping). The NameExpr( ) function will prevent this... see if the following works:
contains(char(nameexpr(a)), "x2");
Cheers,
Brady
The column formula is a JSL expression. This might be simple or complex, depending on what model you have specified. Although you could dig out the coefficients, if the whole fitting process is in the scope of your code, it might be simpler to get them from the fit report.
Good thought, but (sadly) same error as before Brady.