[S] Convex hulls on discriminant plots

Marc R. Feldesman (feldesmanm@pdx.edu)
Tue, 19 May 1998 20:30:51 -0700


After several months of learning how to manipulate basic S objects, I'm now
trying to get a bit fancier in my understanding of the language. I've hit
a wall on the following problem.

I've computed a linear discriminant using the updated (4/30/98) VR function
lda. I have a list called lda.predicted, which is the results of applying
the predict function to the lda object. I also have a plot of LD1 vs LD2.
None of this required any hard thinking.

I would like to place convex hulls around the perimeter of points in each
group. I've tried using apply and tapply together (to get the results
repeated by group) but I get an error each time telling me that chull()
isn't a function. I'm using something like:

chull.dat<-apply(lda.predict, 2, function(x) tapply(x, lda.predict$class,
chull(lda.predict$x[,1], lda.predict$x[,2])))

I'm obviously missing something basic here in my understanding of either
how chull() works, or how it works in connection with apply and tapply on
grouped data.

Dr. Marc R. Feldesman
email: feldesmanm@pdx.edu
email: feldesman@ibm.net
pager: 503-870-2515
fax: 503-725-3905

"If ignorance is bliss then why aren't there more happy people?" Lawrence
Peter

Powered by: Monstrochoerus - the 300 MHz Pentium II
-----------------------------------------------------------------------
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