Displaying 1 result from an estimated 1 matches for "subfact".
Did you mean:
setfact
2006 Jun 30
2
Passing arguments to glm()
Hi there
I want to pass arguments (i.e. the response variable and the subset
argument) in a self-made function to glm.
Here is one way I can do this:
f.myglm <- function(y,subfact,subval) {
glm(d.mydata[,y]~d.mydata[,'x1'],family=binomial,subset=d.mydata[,subfact]==subval)
}
> str(d.mydata)
`data.frame': 15806 obs. of 3 variables:
$ y : Factor w/ 2 levels "no","yes": 1 1 1 1 1 1 1 NA 1 1 ...
$ x1: Factor w/ 2 levels "no"...