s-news
[Top] [All Lists]

Re: what's the problem with this simple code?

To: Yong Wang <wang@galton.uchicago.edu>
Subject: Re: what's the problem with this simple code?
From: Spencer Graves <spencer.graves@pdf.com>
Date: Sun, 30 May 2004 17:43:55 -0700
Cc: Zhu Wang <zhuw@mail.smu.edu>, s-news@lists.biostat.wustl.edu
In-reply-to: <Pine.LNX.4.58.0405301904310.26007@aitken.uchicago.edu>
References: <Pine.LNX.4.58.0405301530050.24619@aitken.uchicago.edu> <1085950517.9215.2.camel@zwang.stat.smu.edu> <Pine.LNX.4.58.0405301904310.26007@aitken.uchicago.edu>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)
My experience with superficially similar problems suggest that this error might disappear if you insert the following before the call to garch:
     assign("xx0", xx0, frame=1)

I have so far had difficulty following what I've read on "assign" and "frames" (though I believe my understanding of this and related issues would benefit from further study of Venables and Ripley, S Programming). For your problem, I quote the following from "?assign" for S-Plus 6.2: "frame=1 means that the object is assigned to the expression frame. It will be available (from any frame) throughout the evaluation of the current expression, but will disappear when evaluation is complete. This is a useful way to create objects that are to be shared by several functions during the expression."
     hope this helps.  spencer graves

Yong Wang wrote:

On Sun, 30 May 2004, Zhu Wang wrote:

I do not have garch and the data but I suggest you to insert browser()
in the function and see what is happening. See below.

On Sun, 2004-05-30 at 15:32, Yong Wang wrote:
Dear all.
got a problem, simply can not figure out, please help me, thank you in advance:

I have following code
***********************************
modfit<-function(yir,yew, ft) {

n<-length(yew)
yew<-yew[1:(n-1)]

yy<-yir-ft
xx<-yew-ft

n<-length(xx)
xx0<-xx[2:n]
browser()

yy0 <-yy [2:n]

xx1<-xx[1:(n-1)]

fit <- garch(yy0~xx0 + xx1+var.in.mean, ~garch(1,1),cond.dist='ged')
summary(fit)
}

fs1hca<-modfit(s1hca.r, s1hca.ew, zfr)

**************error message is ***************

Problem in garch(yy0 ~ xx0 + xx1 + var.in.mean, ~ ..: Object "xx0" not found Use traceback() to see the call stack

It is really weird, I  tried step by step, the code works,
but what's the problem with xx0,I can't figure it out.

thank you for any suggestion.

best regards
yong

--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news


<Prev in Thread] Current Thread [Next in Thread>