Please don't quote entire messages, just the part that's relevant to a particular post.ivory4 wrote:
From this example, I can clearly tell the difference between a "Series" in Rats and a "Vector"
And "Vector" does not need declaration when it is created from functions, right?
Another question is when I declare a "Vector", when COMPUTE is used to assign value? I thought COMPUTE is used to assign a SINGLE REAL number.
COMPUTE can be used for
any calculation where the operands in the calculation are "self-contained". It can do matrices (standard linear algebra functions), scalars, strings. It can't do series because a series is a combination of data and range; the
SET instruction includes parameters to control the range. It also can't do calculations with matrices which are elementwise operations, except for a handful of basic ones (+, -, .*, ./, .^ operations, %SQRT, %LOG, %EXP and %ABS functions). For other calculations like that, you need to use
EWISE.
ivory4 wrote:For example, when we use DLM to estimate a State-SPace model, I would like to collect the states (Txk, T observations k variables)
declare vector beta(375)
set beta / = xstates(t)(1) OR compute?
You can't apply
SET to a VECTOR. You can't apply
COMPUTE because the formula needs to pull information out entry by entry. If you really need the information in a VECTOR rather than a SERIES (you might want to think that through), you would do it with
EWISE:
- Code: Select all
declare vector beta(375)
ewise beta(t)=xstates(t)(1)