Post Reply 
Syntax Error with “Sn” Argument in Statistics 2Var Functions
11-15-2018, 11:32 AM
Post: #1
Syntax Error with “Sn” Argument in Statistics 2Var Functions
I am getting syntax errors for the first argument (Sn) when I call Statistics 2Var functions such as SetDepend(Sn,Cm) or Do2VStats(Sn). There were no such errors prior to the latest firmware update. Did the syntax change? The User Guide is from December, 2017, so I can’t tell if there was a change. Is there a correct syntax or work-around?

Thanks!
Find all posts by this user
Quote this message in a reply
11-15-2018, 11:52 AM
Post: #2
RE: Syntax Error with “Sn” Argument in Statistics 2Var Functions
I just tested it and it seemed to work fine here. Is your 2Var stat the active one? If not, you might need to qualify it.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
11-15-2018, 04:56 PM
Post: #3
RE: Syntax Error with “Sn” Argument in Statistics 2Var Functions
See if you have the Sn checked; an unchecked Sn won't calculate.

Syntax: CHECK(n)
Visit this user's website Find all posts by this user
Quote this message in a reply
11-16-2018, 12:21 PM
Post: #4
RE: Syntax Error with “Sn” Argument in Statistics 2Var Functions
Tim, I do not assume that the app is the current app so I always qualify the function calls and variable references. Eddie, thanks for reminding me to be sure that the S1 is enabled.

All is well for now - thanks very much!
Find all posts by this user
Quote this message in a reply
11-16-2018, 12:33 PM
Post: #5
RE: Syntax Error with “Sn” Argument in Statistics 2Var Functions
I was able to eliminate the syntax errors by changing S1 variable to a string "S1" in the function call. But now I get an invalid input error from the function call. If I remove the double quotation marks, I get a syntax error from the compiler. Here is the code:

Code:

#pragma mode( separator(.,;) integer(h32) )

EXPORT AICc(sse,n,p)
BEGIN
  IF NOT sse > 0 THEN MSGBOX("SSE must be greater than zero"); RETURN "Error"; END;
  IF NOT n > (p+2) THEN MSGBOX("n must be greater than p by 2"); RETURN "Error"; END;
  IF NOT p > 0 THEN MSGBOX("p must be greater than zero"); RETURN "Error"; END;
  // AICc for continuous, real response
  RETURN n * LN( 2 * Pi() * sse / n ) + (n + p) / (1 - (p + 2) / n);
END;

EXPORT RSqrAdj(rSqr,n,p)
BEGIN
  IF NOT rSqr > 0 AND NOT rSqr<1 THEN MSGBOX("R square must be in interval (0,1)"); RETURN "Error"; END;
  IF NOT n > 2 THEN MSGBOX("n must be greater than 2"); RETURN "Error"; END;
  IF NOT n > p THEN MSGBOX("n must be greater than p"); RETURN "Error"; END;
  IF NOT p > 0 THEN MSGBOX("p must be positive"); RETURN "Error"; END;
  // R square adjusted (penalized) for number of parameters
  RETURN 1-((n-1)*(1-rSqr)/(n-p));
END;

EXPORT FitEval(f,c)
BEGIN
  IF f < 1 OR f > 12 THEN MSGBOX("f must be index 1-12"); RETURN "Error"; END;
  IF NOT (c == 1 OR c == 2) THEN MSGBOX("c must be index 1 or 2"); RETURN "Error"; END;
  LOCAL sse,criterion,r2;
  LOCAL p := {2,2,2,2,2,2,3,3,4,5,4,2};
  Statistics_2Var.CHECK(1);
  Statistics_2Var.S1(1) := "C1";
  Statistics_2Var.S1(2) := "C2";
  Statistics_2Var.S1(4) := f;
  IF f == 7 THEN L := 0 END;
  Statistics_2Var.Do2VStats("S1");
  CASE
    IF c == 1 THEN
      sse := ΣLIST(Statistics_2Var.Resid("S1")^2);
      IF sse > 0 AND Statistics_2Var.NbItem > (p(f)+2) THEN
        criterion := AICc(sse,Statistics_2Var.NbItem,p(f));
      END;
    END;
    IF c == 2 THEN
      IFERR r2 := Statistics_2Var.CoefDet THEN
        criterion := "Error";
        BREAK;
      ELSE
        IF Statistics_2Var.NbItem > p(f) THEN
          criterion := RSqrAdj(Statistics_2Var.CoefDet,Statistics_2Var.NbItem,p(f));
        END;
      END;
    END;
  END;
  STARTAPP("Statistics 2Var");
  STARTVIEW(1,1);
  RETURN criterion;
END;
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)