Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: "First numlist in weights( ...) invalid" error when using tssmooth to calculate a simple moving average


From   Aaron Kirkman <ak1795mailserv@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: "First numlist in weights( ...) invalid" error when using tssmooth to calculate a simple moving average
Date   Wed, 5 Sep 2012 20:32:54 -0500

Dear Statalist,

I'm using the -tssmooth- command to calculate a simple moving average
of stock prices, but I get a syntax error of "First numlist in
weights(1 2 3 4 <5>) invalid" when running these commands.

##

copy "http://ichart.finance.yahoo.com/table.csv?s=PNRA&a=05&b=10&c=1991&d=07&e=24&f=2012&g=d&ignore=.csv";
pnra.csv, replace
insheet using pnra.csv, comma clear
gen dateInt = date(date, "YMD")
drop date
rename dateInt date
tsset date
tssmooth ma wtma1 = adjclose, weights(1 2 3 4 <5>)

##

I also receive an error if I specify other variations of this numlist
or other weights entirely, e.g.

tssmooth ma wtma2 = adjclose, weights(1/4 <5>)
tssmooth ma wtma3 = adjclose, weights(1(1)4 <5>)


Specifying a window does work, however.

tssmooth ma wtma4 = adjclose, window(4 1)

However, this syntax works for another data set, so I'm not quite sure
about the problem with this code. For example, this code works when
using a dataset from Baum's "Introduction to Modern Econometrics Using
Stata."

##

use http://www.stata-press.com/data/imeus/grunfeld, clear
tsset
tssmooth ma wtma1 = invest, weights(1 2 3 4 <5>)
tssmooth ma wtma2 = invest, weights(1/4 <5>)
tssmooth ma wtma3 = invest, weights(1(1)4 <5>)

##

Is there a nuance to the syntax that I'm missing?

Thank you,
Aaron Kirkman
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index