Page 1 of 1

Robust models and defining intervals & list files

PostPosted: Mon Jul 19, 2010 8:26 pm
by Miguel
I was hoping someone could help me with two sintax questions about robust models RMark.

1. I’m trying to duplicate the rd_simple.inp example from Chapter 15 in RMark but I’m having difficulty specifying time intervals in the process.data statement. I was wondering what the syntax is. I tried:

rd_simple=convert.inp("C:/Users/Owner/Desktop/markdata/rd_simple1.inp")
time.intervals=c(0,0,1,0,0,1,0,0,1,0,0)
rd_simple.processed=process.data(rd_simple,model="Robust", time.intervals)

but I got the message:

Error in process.data(rd_simple, time.intervals, model = "Robust") :
ime intervals must be specified for a robust design

2. I was also wondering how I might be able to define a list such as time.intervals, or covariate with a link to a file such as (C:\Documents\time.intervals…). This would be convenient with very large data set.

Thank you for your help.

Re: Robust models and defining intervals & list files

PostPosted: Mon Jul 19, 2010 9:54 pm
by jlaake
Miguel-

You need to spend a little more time learning R. When you specify arguments to a function in R it can be done by position or by arg=value. If you do it by position you need to specify a value for each argument in their order. You can also mix order and arg=value. What is usually done is to specify the first 1 to 3 arguments by order and then the rest are done by arg=value. So in this case, what you wrote would work if time.intervals was the 3 argument but it is not so what you need is:

rd_simple.processed=process.data(rd_simple,model="Robust", time.intervals=time.intervals)

With regard to your second question, you can read the time intervals in from a file and assign to a vector and then use that vector as the value to the time.intervals argument. But you need to use a vector and not a list. vectors and lists are very different structures in R.

--jeff

Re: Robust models and defining intervals & list files

PostPosted: Tue Jul 20, 2010 8:26 pm
by Miguel
Jeff,

Thank you for your quick reply, it helped me last night. Yes you are right and I am trying to get the hang of R.

Thanks a lot once again,
Miguel