R : Copyright 2004, The R Foundation for Statistical Computing Version 2.0.0 (2004-10-04), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ################################################# > # # > # exemple de régression logistique "ratée" # > # # > # (gH) gilles.hunault@univ-angers.fr # > # # > ################################################# > > > > # 1. lecture des données pour lesquels on connait le groupe > # --------------------------------------------------------- > > pg <- read.table("rlf.dar",head=TRUE,row.names=1) > > print(pg) TAILLE GROUPE A01 130 0 A02 130 0 A03 132 0 A04 135 0 A05 135 0 A06 136 0 A07 136 0 A08 140 0 A09 140 0 A10 141 0 C01 160 1 C02 161 1 C03 164 1 C04 165 1 C05 165 1 C06 168 1 C07 168 1 C08 169 1 C09 170 1 C10 172 1 C11 173 1 C12 175 1 C13 175 1 C14 177 1 C15 178 1 C16 179 1 C17 180 1 C18 181 1 C19 182 1 C20 190 1 > > > # 2. tracé des données > # --------------------- > > png(file="reglogi1.png",width=800,height=600) > plot(pg$TAILLE,pg$GROUPE,col=1+pg$GROUPE,pch=16,xlim=c(130,200)) > dev.off() null device 1 > > > # 3. Essai d'utilisation de glm > # ----------------------------- > > glm(pg$GROUPE~pg$TAILLE,family=binomial) Call: glm(formula = pg$GROUPE ~ pg$TAILLE, family = binomial) Coefficients: (Intercept) pg$TAILLE -361.092 2.398 Degrees of Freedom: 29 Total (i.e. Null); 28 Residual Null Deviance: 38.19 Residual Deviance: 5.963e-10 AIC: 4 Warning messages: 1: Algorithm did not converge in: glm.fit(x = X, y = Y, weights = weights, start = start, etastart = etastart, 2: fitted probabilities numerically 0 or 1 occurred in: glm.fit(x = X, y = Y, weights = weights, start = start, etastart = etastart,