s-news
[Top] [All Lists]

Re: [S] ordinal outcomes

To: Frank E Harrell Jr <fharrell@virginia.edu>
Subject: Re: [S] ordinal outcomes
From: Hui-Lin Hu <huilin@u.washington.edu>
Date: Sun, 29 Mar 1998 12:56:52 -0800 (PST)
Cc: s-news <s-news@wubios.wustl.edu>
In-reply-to: <01bd5b13$f4a1e9c0$4a1a85ce@feh3kpc>
Sender: owner-s-news@wubios.wustl.edu

Hi, Dr Harrell,

> lrm(response~cheese)
Error in dim<-: Invalid value for dimension 1: dim=c(0, ..)
Dumped

I have dropped as.factor() off of the cheese variable, but the error
message is still the same. I have asked several people here (U of Washington,
Seattle) about this, but none of them have ever used it before. If you
don't mind, could you please show us how you would analyze the cheese
data using your lrm(). I hope I do not ask too much. Many s-new
subscribers would like to know as well, my guess. At least, many people
here (U of Washington) are very interested in knowing how to use your
lrm() function to analyse ordinal response. 

Thanks in advance. Hui-lin Hu



On Sun, 29 Mar 1998, Frank E Harrell Jr wrote:

> Dear Hui-Lin,
> 
> I have been in town and did not receive any further message from you.  It is
> appropriate to contact authors rather than s-news about add-on libraries
> concerning problems unless the question is of some general interest.
> Also, please read the Overview help entry carefully, which would have
> pinpointed
> your error: leave the as.factor() off of the cheese variable.  cheese can be a
> factor or
> character variable.
> 
> -Frank Harrell
> 
> -----Original Message-----
> From: Hui-Lin Hu <huilin@u.washington.edu>
> To: Frank E Harrell Jr <fharrell@virginia.edu>
> Cc: s-news@wubios.wustl.edu <s-news@wubios.wustl.edu>
> Date: Sunday, March 29, 1998 1:08 AM
> Subject: Re: [S] ordinal outcomes
> 
> 
> >
> >Well, I still can not get Prof. Harrell's lrm() work for my ordinal data.
> >I am not sure what went wrong. I emailed Dr Harrell 3 days ago. I guess
> >he is out of town, since I have not been able to reach him. I would
> >highly appreciate it very much if any of you can point out what mistake I
> >made in my S code. I really feel so helpless here. I chceked his help
> >library of lrm, but was not able to locate the data set he illustrates
> >there. So for simplicity, let us see the cheese data (see the bottom of
> >this message or page 175 of McCullagha and Nelder)
> >
> >My understanding to Prof Harrell's message is to create 2 variables as
> >follows:
> >
> >> response
> >[1] 1 2 3 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7
> >    7 7
> >[38] 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 9 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 3 3
> >     3 3 3
> >[75] 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 6 6 6 6 6 6 7 8 9
> >     1 2 3
> >[112] 3 3 3 3 3 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
> >      5 5 6
> >[149] 6 6 6 6 6 6 7 7 7 7 7 8 9 1 2 3 4 5 5 5 6 6 6 6 6 6 6 7 7 7 7 7 7 7
> >      7 7 7
> >[186] 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9
> >
> >>  cheese
> >  [1] "A" "A" "A" "A" "A" "A" "A" "A" "A" "B" "B" "B" "B" "B" "B" "B" "B"
> >      "B"
> >  [19] "C" "C" "C" "C" "C" "C" "C" "C" "C" "D" "D" "D" "D" "D" "D" "D" "D"
> >       "D"
> > [37] "A" "A" "A" "A" "A" "A" "A" "A" "A" "B" "B" "B" "B" "B" "B" "B" "B"
> >       "B"
> > [55] "C" "C" "C" "C" "C" "C" "C" "C" "C" "D" "D" "D" "D" "D" "D" "D" "D"
> >      "D"
> > [73] "A" "A" "A" "A" "A" "A" "A" "A" "A" "B" "B" "B" "B" "B" "B" "B" "B"
> >      "B"
> > [91] "C" "C" "C" "C" "C" "C" "C" "C" "C" "D" "D" "D" "D" "D" "D" "D" "D"
> >      "D"
> >[109] "A" "A" "A" "A" "A" "A" "A" "A" "A" "B" "B" "B" "B" "B" "B" "B" "B"
> >      "B"
> >[127] "C" "C" "C" "C" "C" "C" "C" "C" "C" "D" "D" "D" "D" "D" "D" "D" "D"
> >      "D"
> >[145] "A" "A" "A" "A" "A" "A" "A" "A" "A" "B" "B" "B" "B" "B" "B" "B" "B"
> >       "B"
> >[163] "C" "C" "C" "C" "C" "C" "C" "C" "C" "D" "D" "D" "D" "D" "D" "D" "D"
> >      "D"
> >[181] "A" "A" "A" "A" "A" "A" "A" "A" "A" "B" "B" "B" "B" "B" "B" "B" "B"
> >      "B"
> >[199] "C" "C" "C" "C" "C" "C" "C" "C" "C" "D" "D" "D" "D" "D" "D" "D" "D"
> >      "D"
> >
> >> lrm(response~as.factor(cheese))
> >Error in dim<-: Invalid value for dimension 1: dim=c(0, ..)
> >Dumped
> >
> >
> >Well, something wrong here, but I cannot figure out what.
> >
> >With a lot of thanks...
> >
> >
> >
> >
> >
> >On Mon, 23 Mar 1998, Frank E Harrell Jr wrote:
> >
> >> Dear Hui-Lin,
> >>
> >> S-news asks subscribers to try contacting the author of the add-on
> >> library first.  -Thanks
> >>
> >> lrm does not accept a frequency weight at present.
> >> Be sure to give modeling functions the basic categorical predictors instead
> >> of deriving dummy variables yourself.  So the answer to your question is
> >> to build a data frame that repeats each row of your data up to the needed
> >> frequency, then do lrm(response ~ cheese, data=newdataframe). I'll leave
> >> it to someone else to devise an elegant way to expand the data frame
> >> by the frequency variable.  Something along the lines of
> >>
> >>   newdataframe <- original.data.frame[s,]
> >>
> >> will do it once a very long vector s is created (using rep) that has
> duplicate
> >> row
> >> numbers.  The length of s will equal the sum of the frequencies.
> >>
> >> lrm does not handle frequency weights because all of my datasets have at
> least
> >> one continuous variable in them.
> >>
> >> -Frank Harrell
> >>
> >>
> >> -----Original Message-----
> >> From: Hui-Lin Hu <huilin@u.washington.edu>
> >> To: s-news@wubios.wustl.edu <s-news@wubios.wustl.edu>
> >> Date: Monday, March 23, 1998 9:19 PM
> >> Subject: [S] ordinal outcomes
> >>
> >>
> >> >
> >> >
> >> >Hi there,
> >> >
> >> >This should be easy for those who has ever used Harrell's lrm function.
> >> >It is the first time for me to use this function, but I have not been able
> >> >to make it work. I am not sure what went wrong. Could any of you help me?
> >> >What exactly should be written in () of lrm()?
> >> >
> >> >Here is the cheese data from page 175 of McCullagha and Nelder.
> >> >How to use lrm() to get the logistic treatment effects on page 176 of this
> >> >book?
> >> >
> >> >col 1 (x1) = 1 if Cheese = A
> >> >col 2 (x2) = 1 if Cheese = B
> >> >col 3 (x3) = 1 if Cheese = C
> >> >col 4 (y)  : Response category
> >> >col 5 (wt) : Count in each cell of the crosstable "Cheese * Categorical
> >> >                                                           Response"
> >> >
> >> > 1 0  0 1  0
> >> > 1 0  0 2  0
> >> > 1 0  0 3  1
> >> > 1 0  0 4  7
> >> > 1 0  0 5  8
> >> > 1 0  0 6  8
> >> > 1 0  0 7 19
> >> > 1 0  0 8  8
> >> > 1 0  0 9  1
> >> > 0 1  0 1  6
> >> > 0 1  0 2  9
> >> > 0 1  0 3 12
> >> > 0 1  0 4 11
> >> > 0 1  0 5  7
> >> > 0 1  0 6  6
> >> > 0 1  0 7  1
> >> > 0 1  0 8  0
> >> > 0 1  0 9  0
> >> > 0 0  1 1  1
> >> > 0 0  1 2  1
> >> > 0 0  1 3  6
> >> > 0 0  1 4  8
> >> > 0 0  1 5 23
> >> > 0 0  1 6  7
> >> > 0 0  1 7  5
> >> > 0 0  1 8  1
> >> > 0 0  1 9  0
> >> > 0 0  0 1  0
> >> > 0 0  0 2  0
> >> > 0 0  0 3  0
> >> > 0 0  0 4  1
> >> > 0 0  0 5  3
> >> > 0 0  0 6  7
> >> > 0 0  0 7 14
> >> > 0 0  0 8 16
> >> > 0 0  0 9 11
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >-----------------------------------------------------------------------
> >> >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
> >> >
> >>
> >>
> >
> >
> >-----------------------------------------------------------------------
> >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
> >
> 
> 

-----------------------------------------------------------------------
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

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