[S] How to input a subset?

Gianluca Marchi (gianluca@lunet.it)
Fri, 24 Jul 1998 13:41:11 +0000


Let's come to the problem: I would indicate a condition as an argument of a
built-by-me (I don't know if the word is grammatically correct) function,
but the variable indicated is created for the first time inside the programme.

Is the problem clear? If not please look at the following example based on
the real problem I'm dealing with:

Be TOT the total daily mortality, OBS a vector of sequential number
indicating the period (days) and MSO2 the daily value of a pollutant. I
want estimate the relation between TOT, on a side, and OBS and the
pollutant at various lags, on the other.
Moreover I want to reduce the subset used, imposing a max value for the
pollutant to exclude anomalous values.

As argument for the function
gaminq(model,pol,nlag,sbset)
I will give:
1) the core model formula (without pollutant):
model=TOT~lo(OBS,span=0.5)
2) the name of the pollutant: pol=MSO2
3) the max lag for the pollutant (if I give 2, I want to estimate
the model for lag 0,1 and 2): nlag=2
4) the subset: sbset=matinq[1:length(pol),(i+1)]<200

Where 'matinq' is the pollutant matrix, formed by the lagged values from 0
to nlag, so the first column is lag 0, the second is lag 1, and so on. And
'i' is the counter of a cicle like
for (i in 0:nlag)
{....}

Obviously I get an error message, because the program doesn't know yet the
variable 'matinq'.

I have thought to give the subset as a string and coerce it as a logical
expression after creating 'matinq', but I don't know how to do this.

What is your advice?

Thank you very much.

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