Dear R users,

I'm trying to save the results of separate logistic regression analyses of a 
dataset according to a categorical factor. For that, I first used a "by" 
function such as following : 

temp <- by( data, data$categorical.factor , function(x) summary( glm( formula = 
data$var1 ~ data$var2 , data = x , family = binomial("logit"))))

and it worked perfectly well

Next I tried to create a custom function that contains the latter syntax

regtab <- function(category, arg1, arg2 , data){

  temp <-by( data, category , function(x) summary( glm( formula= arg1 ~ arg2 , 
data=x , family = binomial("logit"))))

  temp

}

the resulting object of this function is a list with the correct subgroup 
categories as its element's names but with the results of the entire dataset 
logistic regression as its elements. 

I can't figure out what's going on. Do you have any clues ?

Many thanks in advance,
 
Vincent Chouraki,
Interne de Santé Publique,
CHRU-Lille, France.





      
_____________________________________________________________________________ 


        [[alternative HTML version deleted]]

______________________________________________
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