Re: [R] Re:logistic regression
Helene - In addition to some of the excellent suggestions already posited (e.g. examining AIC, pseudo R^2 in the Design package), you might want to consider another tool to assess logistic regression model accuracy: the area-under-curve (AUC) from a receiver-operating characteristic (ROC). The ROC curve describes the relationship between the number of true positives observed (sensitivity) to false positives, and also for negatives. The AUC is the probability that a model can correctly distinguish between the two. This is an appealling alternative to some of the known issues of citing only a pseudo-R^2 (like Nagelkerke's for instance) to describe 'fit'. Check out the ROC functions available at the Bioconductor website. There was also some code sent around on the list a few months back for calculating trapeziodal AUC, se's from ROC, and comparing two ROC curves...search the archives if interested, or I can probably dig them out for you offline... Cheers, Joe Quoting Frank E Harrell Jr <[EMAIL PROTECTED]>: > Vito Ricci wrote: > > Hi, > > > > I don't know if a pseudo squared R for glm exists in > > any R package, but I find some interesting functions > > in S mailing list: > > It is included in lrm in the Design package. But note that this is not > for checking fit but rather for quantifying predictive discrimination. > > . > > -- > Frank E Harrell Jr Professor and Chair School of Medicine > Department of Biostatistics Vanderbilt University > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > Joseph J. Nocera Ph.D. Candidate NB Coop. Fish & Wildlife Research Unit Biology Department - Univ. New Brunswick Fredericton, NB Canada E3B 6E1 tel: (902) 679-5733 "Why does it have to be spiders? Why can't it be 'follow the butterflies'"?! Ron Weasley, Harry Potter & The Chamber of Secrets __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problem with logistic regression
CATMOD in SAS builds log-linear glms. If you are truly trying to create logistic regressions in SAS, use PROC LOGISTIC instead. If you really meant that you are trying to create log-linear models in R - then look up the usage of the function loglin (e.g. loglin()) Cheers, Joe Quoting [EMAIL PROTECTED]: > Hi, > > we try to do a logistic regression with the function glm. > But we notice that this function don't give the same results as the SAS proc > catmod (differents estimate given). > We try to change the contrast on R system with: > > options(contrasts=c(unordered="contr.SAS",ordered="contr.poly")) > > We also try with brlr and logistf functions. > Unfortunately, the estimate aren't still the same. > > Please could someone help us. > > Thank you > > -- > This mail sent through Polytech'Lille WebMail (IMP) > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > Joseph J. Nocera Ph.D. Candidate NB Coop. Fish & Wildlife Research Unit Biology Department - Univ. New Brunswick Fredericton, NB Canada E3B 6E1 tel: (902) 679-5733 "Why does it have to be spiders? Why can't it be 'follow the butterflies'"?! Ron Weasley, Harry Potter & The Chamber of Secrets __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] behaviour of BIC and AICc code
Dear R-helpers I have generated a suite of GLMs. To select the best model for each set, I am using the meta-analysis approach of de Luna and Skouras (Scand J Statist 30:113-128). Simply put, I am calculating AIC, AICc, BIC, etc., and then using whichever criterion minimizes APE (Accumulated Prediction Error from cross-validations on all model sets) to select models. My problem arises where I have noticed my rankings from BIC and AICc are exactly inverse. I fear this behaviour is a result of my coding as follows: I calculate BIC from sample size: stepAIC (mymodel.glm, k=log(n)) I then calculate AICc by: stepAIC (mymodel.glm, k=2*sum(mymodel.glm$prior.weights)/(sum(mymodel$prior.weights) - length(coef(mymodel.glm))-1)). I base these calculations for: BIC on Venables and Ripley's MASS ("...Only k=2 gives the genuine AIC: k = log(n) is sometimes referred to as BIC or SBC."...) ; and for AICc from that AICc = AIC + ((2K*(K+1))/(n-K-1)) Is this behaviour expected? Or is the coding off? I could find no reference to this problem in the archives here, nor at S-news. Cheers, Joe Joseph J. Nocera Ph.D. Candidate Biology Department - Univ. New Brunswick Fredericton, NB Canada E3B 6E1 tel: (902) 679-5733 __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] AUC for logistic regression [was: (no subject)]
I believe that Roman is referring to AUC as the "Area Under Curve" from a Receiver Operating Characteristic. If this indeed your quantity of interest - it can be calculated in R. You can download code at: http://www.bioconductor.org/repository/release1.5/package/Win32/ and/or http://biostat.ku.dk/~bxc/SPE/library/ Check out the archives - I'm sure there is more there if you search "ROC" instead. Cheers, Joe Quoting Spencer Graves <[EMAIL PROTECTED]>: > What's AUC? If you mean AIC (Akaike Information Criterion), and > if you fit logistic regression using "glm", the help file says that glm > returns an object of class "glm", which is a list containing among other > things an attribute aic. For example, suppose you fit a model as follows: > > fit <- glm(y~x, famil=binomial()...) > > Then fit$aic returns the AIC. > > You may also wish to consider anova and anova.glm. > > hope this helps. spencer graves > > [EMAIL PROTECTED] wrote: > > >Dear R-helper, > > > >I would like to compare the AUC of two logistic regression models (same > >population). Is it possible with R ? > > > >Thank you > > > >Roman Rouzier > > [[alternative HTML version deleted]] > > > >__ > >[EMAIL PROTECTED] mailing list > >https://stat.ethz.ch/mailman/listinfo/r-help > >PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > > > > > > -- > Spencer Graves, PhD, Senior Development Engineer > O: (408)938-4420; mobile: (408)655-4567 > > __ > [EMAIL PROTECTED] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > Joseph J. Nocera Ph.D. Candidate NB Coop. Fish & Wildlife Research Unit Biology Department - Univ. New Brunswick Fredericton, NB Canada E3B 6E1 tel: (902) 679-5733 "Why does it have to be spiders? Why can't it be 'follow the butterflies'"?! Ron Weasley, Harry Potter & The Chamber of Secrets __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Receiver Operator Characteristic curve
Xiao, The Mayo Clinic website has an archive of functions written in S to plot ROC and calculate the AUC for those plots. The functions are self-extracting, and easily imported into R. http://www.mayo.edu/hsr/Sfunc.html Cheers, Joe Nocera -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of XIAO LIU Sent: March 11, 2004 2:16 PM To: [EMAIL PROTECTED] Subject: [R] Receiver Operator Characteristic curve Dear R-helpers: I want to calculate area under a Receiver Operator Characteristic curve. Where can I find related functions? Thank you in advance Xiao __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html