[S] Help with functions

cristofer_price@abtassoc.com
Wed, 22 Apr 98 12:44:06 est


I need some help making some lines of code into a function. Below are
some lines of code to fit a glm model and print
the specific results of the fit that I want to the screen:

mod1_glm(ACNOW.6M[YRCAT==1] ~ Esite1+CCDP[YRCAT==1],
na.action=na.omit,
family=binomial(link=logit))
mod1$call
round(anova(mod1,test="Chi"),4)
round(cbind(summary(mod1)$coef,
2*(1-pnorm(abs(summary(mod1)$coef[,3]),0,1))),4)


How do I make the above into a function that has an outcome
variable as the argurment? When I try creating a fuction
called myglm() ,see below, I get errors. The problem seems
to be that the anova() function doesn't recognize OUTCOME.



myglm_function(OUTCOME){
mod1_glm(OUTCOME[YRCAT==1] ~ Esite1+CCDP[YRCAT==1],
na.action=na.omit,
family=binomial(link=logit))
print(mod1$call)
print(round(anova(mod1,test="Chi"),4))
print(round(cbind(summary(mod1)$coef,
2*(1-pnorm(abs(summary(mod1)$coef[,3]),0,1))),4))
}

myglm(ACNOW.6M)


> myglm(ACNOW.6M)
glm(formula = OUTCOME[YRCAT == 1] ~ Esite1 + CCDP[YRCAT == 1], family
= binomial(link =
logit), na.action = na.omit)
Error: Object "OUTCOME" not found
Dumped
>

Thanks for your help,

- Cris Price

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news