AlgoMan
AlgoMan

Reputation: 2935

Logistic regression in R

I have two matrix one X with all the feature values with 300000 rows and 14 columns, where columns represent the feature ids. for each I have another variable which defines labels Y which is of dimension 300000 x 1 either 0 or 1.

How do I calculate logistic regression from this matrix ?

Upvotes: 1

Views: 4039

Answers (2)

floodking
floodking

Reputation: 277

glmnet will also be ok for your problem

glm1=cv.glmnet(x,y,family="binomial",alpha=0)

prglm=predict(glm1,newx,type="response")

Upvotes: 0

John
John

Reputation: 23758

This is surprisingly easy.

m <- glm(Y ~ X, family = 'binomial')
summary(m)

In the future just try typing what seems obvious first. You'll learn much faster if you're not afraid of making mistakes.

Upvotes: 7

Related Questions