Trying to setup a simple linear regression as a calculated field, but I keep getting an error message indicating an expected parens or comma is missing.
Can any one see or suggest where the gap might be in the following:
SCRIPT_REAL ("
[UHCReg] <- arg1;
[Member Age] <-arg2;
[Gdr Cd] <- arg3;
fit <- lm([UHCReg] + [Member Age] + [Gdr Cd])fit$fitted"
sum([UHCReg]),
sum([Member Age]),
sum([Gdr Cd]))
I'm using Tableau Desktop Professional Edition vs 9.3.3.
Thanks in advance for any help!
Steve
p.s., looks like there was a comma missing after fit$fitted. That's been fixed but now I get error messages that sum is being called with a string value, so I put a Float in place of the Sums, but then I get an error message that I can not mix aggregate and non aggregate arguments. Basically I just want to run linear regressions on miscellaneous variables to see how linear they are in terms of driving the target variable (# of registrations). E.g., does age correlate to higher / lower registrations, does gender, does etc, etc. Some of these data points are Integers, e.g., age, and some are strings, e.g., Gender Code = M, F, unknown.
Message was edited by: Steve Schwantes
Hi Steve,
Did you try using ATTR([Gdr Cd]) instead?
SCRIPT calculations are table calcs so all inputs need to have an aggregation associated with them. If you want it to work on disaggregate data, you can uncheck "aggregate measures" option from the Analysis menu.
For non-numeric fields you may want to use MIN, MAX or ATTR.
I hope this helps.
Bora