Hi,

I have a question about logistic regression in R.

Suppose I have a small list of proteins P1, P2, P3 that predict a two-class target T, say cancer/noncancer. Lets further say I know that I can build a simple logistic regression model in R

model <- glm(T ~ ., data=d.f(Y), family=binomial) (Y is the dataset of the Proteins).

This works fine. T is a factored vector with levels cancer, noncancer. Proteins are numeric.

Now, I want to use predict.glm to predict a new data.

predict(model, newdata=testsamples, type="response") (testsamples is a small set of new samples).

The result is a vector of the probabilites for each sample in testsamples. But probabilty WHAT for? To belong to the first level in T? To belong to second level in T?

Is this fallowing expression
factor(predict(model, newdata=testsamples, type="response") >= 0.5)
TRUE, when the new sample is classified to Cancer or when it's classified to Noncancer? And why not the other way around?

Thank you,

Peter

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to