Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
obsmacrodynarejson
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Houtan Bastani
obsmacrodynarejson
Commits
b16a1f91
Verified
Commit
b16a1f91
authored
Jan 27, 2020
by
Houtan Bastani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
next small change, still testing the CI
parent
0fcd79b0
Changes
1
Hide whitespace changes
Inline
Sidebyside
Showing
1 changed file
with
75 additions
and
8 deletions
+75
8
dynarepreprocessorwjson.rst
dynarepreprocessorwjson.rst
+75
8
No files found.
dynarepreprocessorwjson.rst
View file @
b16a1f91
...
...
@@ 603,8 +603,9 @@ the return value, ``terms``. Each cell in the return value is comprised of a
pair of elements: the root node of the subtree representing the additive node
and the sign preceding this node (``1`` or ``1``).
Given the equation we want to estimate (shown here from
``Smets_Wouters_2007.mod`` as a reminder)
,
``Smets_Wouters_2007.mod`` as a reminder)
:
.. include:: sw2007/Smets_Wouters_2007.mod
:code:
...
...
@@ 625,13 +626,78 @@ Hence, in this case, 4 nodes of ``terms`` contain ``BinaryOpNode``'s
(
corresponding
to
the
binary
operation
``*``)
and
one
term
contains
a
``
VariableNode
``.
To
understand
how
the
terms
are
stored
,
one
need
only
look
at
the
following
output
for
the
first
term
,
``
crpiMcrpiXcrr
*
pinf
``:
..
code

block
::
text
>>
terms
terms
=
1
x5
cell
array
{
1
x2
cell
}
{
1
x2
cell
}
{
1
x2
cell
}
{
1
x2
cell
}
{
1
x2
cell
}
>>
terms
{
1
}
ans
=
1
x2
cell
array
{
1
x1
struct
}
{[
1
]}
>>
terms
{
1
}{
1
}
ans
=
struct
with
fields
:
node_type
:
'BinaryOpNode'
op
:
'*'
arg1
:
[
1
x1
struct
]
arg2
:
[
1
x1
struct
]
>>
terms
{
1
}{
1
}.
arg1
ans
=
struct
with
fields
:
node_type
:
'VariableNode'
name
:
'pinf'
type
:
'endogenous'
lag
:
0
>>
terms
{
1
}{
1
}.
arg2
ans
=
struct
with
fields
:
node_type
:
'VariableNode'
name
:
'crpiMcrpiXcrr'
type
:
'parameter'
lag
:
0
Here
,
the
second
element
of
``
terms
{
1
}``
is
``
1
``
as
it
is
not
preceded
by
a
minus
sign
.
The
node
itself
is
a
``
BinaryOpNode
``
as
it
represents
the
multiplication
of
an
endogenous
variable
(
the
first
argument
of
the
node
)
and
a
parameter
(
the
second
argument
of
the
node
).
..
note
::
The
elements
of
``
terms
``
are
not
necessarily
in
the
same
order
as
written
in
the
equation
in
the
``.
mod
``
file
.
This
is
because
,
for
efficiency
reasons
(
e
.
g
.
node
sharing
),
the
AST
created
by
the
preprocessor
does
not
guarantee
this
ordering
.
preprocessor
does
not
guarantee
this
ordering
.
By
the
same
token
,
the
elements
of
a
node
are
not
guaranteed
to
be
in
the
same
order
as
they
appear
in
the
``.
mod
``
file
,
as
you
can
see
above
where
the
first
argument
of
the
``
BinaryOpNode
``
in
``
terms
{
1
}{
1
}``
is
the
endogenous
variable
``
pinf
``
whereas
``
pinf
``
appears
second
in
the
multiplication
as
written
in
the
``.
mod
``
file
:
``
crpiMcrpiXcrr
*
pinf
``.
Now
that
we
have
``
terms
``
set
,
we
can
enter
the
loop
in
the
main
function
of
``
parse_ols_style_equation
.
m
``
that
constructs
the
regressor
matrix
``
X
``:
Now
that
we
have
``
terms
``
set
,
we
can
construct
the
regressor
matrix
``
X
``
by
entering
the
loop
on
line
75
of
``
parse_ols_style_equation
.
m
``:
..
code

block
::
MATLAB
:
linenos
:
inline
...
...
@@ 715,10 +781,11 @@ Now that we have ``terms`` set, we can enter the loop in the main function of
X = [X Xtmp];
end
When the loop starts, certain variables are set. ``Xtmp`` is where we will
construct the regressor column to be appended to ``X`` at the end of each
loop. ``node_to_parse`` and ``node_sign`` are simply the corresponding parts of
the pair stored in each ``terms`` cell, as described above.
Entering the loop, we set 3 variables: ``Xtmp``, ``node_to_parse``, and
``node_sign``. ``Xtmp`` is where we will construct the regressor column to be
appended to ``X`` at the end of each loop. ``node_to_parse`` and ``node_sign``
are simply the corresponding parts of the pair stored in each ``terms`` cell,
as described above.
With these variables set, we take different actions, depending on the type of
node encountered in ``node_to_parse``. The following subsections explain those
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment