Hi
I am trying to use missing library in Splus(6) for categorical data
analysis. The data is likert type (1-5) and has 25 variables. When I run
preLoglin function it tells me that my variables are not factor. are the
variables supposed to be nonnumeric? How many variables(upper limit) I can
use with the library functions? Any help is appreciated. Thank you.
WinXP
S+(6)
Sincerely,
Ahmet TURHAN
Phone # 850 580 5802
Http://garnet.acns.fsu.edu/~att3380
_________________________
2203 West Pensacola Street J-5
Tallahassee, Florida 32304
On Thu, 2 May 2002, King, Calvin wrote:
> Within 16 hours of posting the question, I got 15 responses from the
> following individuals: Brad J. Biggerstaff, Nick Ellis, Chuck Taylor, Samuel
> Buttrey, S.D. Byers, James Holtman, Jingshan Zhang, Petr Pikal, Bert Gunter,
> Andy Liaw, Jean V. Adams, Leonid Gibiansky, David L. Lorenz, Malcolm Hawkes,
> and Sundar Dorai-Raj. Thanks to each and everyone of you.
>
> The responses fell neatly into one of three categories: (a) subscripting the
> data frame - 6, (b) using "ifelse" - 6, and (c) using "cut" - 4. Since the
> solutions in each category were similar, I chose to include only one from
> each. Since the first method seemed to be the simplest to me, I decided to
> use it in my application.
>
> (a) subscripting the data frame by Brad J. Biggerstaff
> myFrame$v11 <- rep("",nrow(myFrame)) # just to set up an empty character
> vector
> myFrame[myFrame$v1 >= 0 & myFrame$v2 >= 0 & myFrame$v2 < 60,"v11"] <- "NE1"
> myFrame[myFrame$v1 >= 0 & myFrame$v2 >= 60 & myFrame$v2 < 120,"v11"] <-
> "NE2"
> myFrame[myFrame$v1 >= 0 & myFrame$v2 >= 120,"v11"] <- "NE3"
> myFrame$v11 <- factor(myFrame$v11)
>
> (b) using "ifelse" by David L. Lorenz
> myFrame$v11 <- ifelse(myFrame$v1 >= 0.0 & myFrame$v2 >= 0.0 & myFrame$v2[i]
> < 60.0, "NE1",
> ifelse(myFrame$v1 >= 0.0 & myFrame$v2 >= 60.0 & myFrame$v2 <
> 120.0, "NE2",
> ifelse(myFrame$v1 >= 0.0 & myFrame$v2 >= 120.0, "NE3", NA)))
>
> (c) using "cut" by Jean V. Adams
> myFrame$v11 <- cut(myFrame$v2, breaks=c(0, 60, 120, max(myFrame$v2)+1),
> labels=c("NE1", "NE2", "NE3"), factor.result=T, left.include=T)
>
> The more I use S-PLUS, the more I am appreciating its versatility. Needless
> to say, this group is very helpful.
>
> > -----Original Message-----
> > From: King, Calvin
> > Sent: Wednesday, May 01, 2002 4:28 PM
> > To: 's-news@lists.biostat.wustl.edu'
> > Subject: Vectorizing 'for' loop?
> >
> > I am working with a data frame with about 100k rows and about 10 columns.
> > The following "for" loop quits after a while due to insufficient virtual
> > memory. I am running S-PLUS 6 on Windows 2000 Professional. How would I
> > vectorize this operation?
> >
> > count <- count.rows(myFrame)
> > for(i in 1:count) {
> > if(myFrame$v1[i] >= 0.0 && myFrame$v2[i] >= 0.0 && myFrame$v2[i] <
> > 60.0) { myFrame$v11[i] <- "NE1" }
> > else if(myFrame$v1[i] >= 0.0 && myFrame$v2[i] >= 60.0 &&
> > myFrame$v2[i] < 120.0) { myFrame$v11[i] <- "NE2" }
> > else if(myFrame$v1[i] >= 0.0 && myFrame$v2[i] >= 120.0) {
> > myFrame$v11[i] <- "NE3" }
> > }
> > myFrame$v11 <- factor(myFrame$v11, levels=c("NE1", "NE2", "NE3"))
> >
> > Thanks, in advance.
> >
> > Calvin King
> > cking@sandia.gov
> >
> >
>
> --------------------------------------------------------------------
> 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
>
|