Andra Isan
2011-Sep-07 23:12 UTC
[R] Question about model selection for glm -- how to select features based on BIC?
Hi All, After fitting a model with glm function, I would like to do the model selection and select some of the features and I am using the "step function" as follows: glm.fit <- glm (Y ~ . , data = dat, family = binomial(link=logit)) AIC_fitted = step(glm.fit, direction = "both") I was wondering is there any way to select the features based on BIC rather than AIC? is there any other function that I should use? Thanks a lot,Andra [[alternative HTML version deleted]]
Jean V Adams
2011-Sep-08 12:25 UTC
[R] Question about model selection for glm -- how to select features based on BIC?
If you read the help file on the step() function
?step
you will see a reference to BIC under the description of the k= argument.
This suggests that you could try:
BIC.fitted = step(glm.fit, k=log(dim(dat)[1]))
Jean
Andra Isan wrote on 09/07/2011 06:12:19 PM:>
> Hi All,
> After fitting a model with glm function, I would like to do the
> model selection and select some of the features and I am using the
> "step function" as follows:
> glm.fit <- glm (Y ~ . , data = dat, family = binomial
> (link=logit)) AIC_fitted = step(glm.fit, direction = "both")
> I was wondering is there any way to select the features based on BIC
> rather than AIC? is there any other function that I should use?
> Thanks a lot,Andra
>
[[alternative HTML version deleted]]
Possibly Parallel Threads
- Question about BIC of two different regression models? how should we compare two regression models?
- How to find the accuracy of the predicted glm model with family = binomial (link = logit)
- GLM question
- How to fit my data with a distribution?
- a Question regarding glm for linear regression