[R] how to adding colors to data points in scatter plot in R?

2009-05-22 Thread Tim LIU
Does anybody know how to adding colors to data points in scatter plot in R? I have the following R data frame - Voter_Name, Education_years, Income, Registered Ricky, 18, 4, Y Lisa, 20, 34000, N Jon, 10, 35000, Y ... I am doing a scatter plot in R for those data points - Income vs. Educati

[R] How to do Naive Bayes in R?

2009-05-06 Thread Tim LIU
I am wondering if anybody here have a simple example in R for Naive Bayes. For example, I can do k-means clustering on the "iris" data - data(iris) cl <- kmeans(iris[,1:4], 3) cl$cluster cbind(1:150,iris$Species) === But how to do Naive Bayes classification in the same "iris" data?

[R] Stochastic Gradient Ascent for logistic regression

2009-04-26 Thread Tim LIU
Hi. guys, I am trying to write my own Stochastic Gradient Ascent for logistic regression in R. But it seems that I am having convergence problem. Am I doing anything wrong, or just the data is off? Here is my code in R - lbw <- read.table("http://www.biostat.jhsph.edu/~ririzarr/Teaching/7