Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: RE: RE: polynomial distributed lag models error message


From   "Keith Dear" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: polynomial distributed lag models error message
Date   Fri, 29 Oct 2010 19:16:31 +1100

Steve Rothenberg asked:

  4. Since Allen McDowell wrote the article as a tutorial instead of
providing
  polished production code, does anyone know if there is newer provision
for
  running distributed lag models in independent variables, especially
models
  with count data dependent variables? 

It makes no difference what the model is -- the process is (1) create a
set of basis variables representing the polynomial-lagged independent
variable (2) use them in whatever model you please.

This is the approach taken (among other options) in the R function
dlnm() (distributed lag nonlinear models). Ben Armstrong & co from LSHTM
pursued this work originally using Stata, then (alas?) switched to R. So
dlnm() is the standard route now for people fitting such models. It
comes with nice 3D graphics too, which is hard in Stata...

However: I have programs -dlgen- (which creates the basis variables),
and -dlplot- (which graphs the results using 2D graphics). And I do
indeed use it in Poisson (or negbin) models. It isn't "production
quality" yet so I'll only provide it on request for now (Steve: coming
separately to you).
Keith


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nick Cox
Sent: Thursday, 28 October 2010 7:23 AM
To: '[email protected]'
Subject: st: RE: RE: polynomial distributed lag models error message

I don't have that baton. It's still in mid-air. 

Nick 
[email protected] 


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Steve
Rothenberg
Sent: 27 October 2010 21:19
To: [email protected]
Subject: st: RE: polynomial distributed lag models error message

That did it!  Thanks also for the -asciiplot- tip, I had forgotten all
about
it. Your joke lightened the mood around here too.

For anyone following this thread, suggestions about questions 2-4 from
the
originating post would be most welcome.

Steve Rothenberg

>This is just the same problem. 

>First off, those are not double quotes. Those are nested single quotes.
Stata certainly has an idea of double >quotes but they are single key
characters, as in "Stata is beautifully simple and logical, despite any
and
all appearances to the contrary".  

The left and right quotes must be distinctive for local macro references
in
Stata. 

If the syntax were otherwise, Stata would have no way of disambiguating
e.g.
'a'c'd'. 
Is that local macro a followed by plain c followed by local macro d or
is it
a reference to local macro c embedded within other stuff? (NB this is
_not_
Stata syntax.) 

Your left and right quotes are identical and Stata thus has no idea what
''c'' means. You want ``c''. 

Using -asciiplot- (SSC), a splendid user-written program rich in
characterisation _and_ plot (*), I make that ` (ASCII 96) and ' (ASCII
39). 

Nick 
[email protected] 

(*) My best joke today. 


-----Mensaje original-----
De: Steve Rothenberg [mailto:[email protected]] 
Enviado el: Wednesday, October 27, 2010 2:03 PM
Para: '[email protected]'
Asunto: RE: polynomial distributed lag models error message

Thank you Nick, we now no longer get the error message with "namelist".
We
now get the error message 
	"c" not found r(111)

It's probably the use of the double quotes as found in the SJ code,
where it
appears near the end of the last matrix line just before the first
closing
bracket: matrix 'namelist'['r','c'] = (''c'')^('r' - 1).

We're systematically trying different quotes available in this Spanish
keyboard around the c's in this line, so far with no luck.  Could you
provide the ASCII codes for the proper quotes around the first and the
second c? I imagine we'll have to edit the quotes throughout the code
that
Allen provided in the SJ article.

Steve Rothenberg 



>On #1 I could reproduce your problem by copying and pasting from the
Stata
Journal archives into Stata's do->file editor under Windows. The problem
in
that circumstance was that the right quotes that appear are not the
>right
quotes that Stata uses to denote references to local macros. You should
be
able to test this by comparison with the default single quote character
(=
Stata's right quote) and the default left quote character. I'll not
elaborate because I have no idea what your keyboard looks like, but the
program looks fine to me when the correct quote characters are used. 

Having run the first very short leg of your unequal relay race, I'll
throw
the baton right up in the air. 

Nick 
[email protected] 

-----Mensaje original-----
De: Steve Rothenberg [mailto:[email protected]] 
Enviado el: Wednesday, October 27, 2010 12:38 PM
Para: '[email protected]'
Asunto: polynomial distributed lag models error message

We are trying to reproduce the analysis for using polynomial distributed
lag
models found in SJ(2004) 4, Number 2, pp. 180-189, by Allen McDowell of
StataCorp.

When we try to form the Vandermonde matrix using the supplied program
-vandermonde-, the program returns an error message: 'namelist' invalid
name
r(198); 

The issued command is:
	vandermonde V, n(0/12)
exactly as suggested in the article.

Though we are using Stata 11.1, the program -vandermonde- is stored as
an
ado file with a version control statement "version 8.2", exactly as
copied
from the SJ article.

We've tried using another name for the generated matrix instead of "V"
when
running the command, as we see that V is now defined in Mata as a
built-in
Vandermonde matrix, but we receive the same error message.

We have four questions:

1. Can anyone advise us why the program -vandermonde- returns the error
message?

2. Can we achieve the same results by running the Mata Vandermonde
command
and if so, can you provide the proper syntax to set up the matrix and
then
use the Mata generated matrix in the following Stata matrix manipulation
commands for polynomial distributed model in the SJ article?

3. Given eventual success with working through the example in the SJ
article, can we use these procedures to construct a Poisson model with
distributed lags of one of the independent variables and if so, how?

4. Since Allen McDowell wrote the article as a tutorial instead of
providing
polished production code, does anyone know if there is newer provision
for
running distributed lag models in independent variables, especially
models
with count data dependent variables?


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index