9/21/2011

Classification(cont)

In a previous post, I wrote something about classification. The method I used from J & W was actually and linear regression approach. However, logistic regression is more commonly used for discrimination. So I made some adjustment to the previous program.



# classification using logistic regression
model = glm(factor(membership) ~ Freshwater + Marine, data = dataset.factor, family = 'quasibinomial')
bhat = model$coefficients
yhat = model$fitted.value

p = p + geom_abline(aes(intercept = -bhat[1]/bhat[3], 
  	slope = -bhat[2]/bhat[3], colour = 'Logistic Regression'), size = 1 )

Out model is logit(Membership) = 3.92484 + 0.12605*Freshwater - 0.04854*Marine.

 So the slope of the threshold is 0.12605/0.04854 and the intercept is 3.92484/0.04854.

The resultant threshold is a little bit different from the previous one:


No comments: