[R] The logistf() function from the logistf package. (Was: "Data Package Query")

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Jul 7 08:59:33 CEST 2013


On 06/07/2013 23:01, Rolf Turner wrote:
> On 06/07/13 01:35, Yasmine Refai wrote:
>> Hello,
>>
>> When I run the below syntax:
>> *Trial<-read.table("Trial.txt",header=TRUE)*
>> *Trial*
>> *save.image(file="Trial.RData")*
>> *load("Trial.RData")
>> fit<-logistf(data=Trial, y~x1+x2)
>> summary(fit)
>> AIC(fit)*
>>
>> I am getting the below error:
>> *> AIC(fit)
>> Error in UseMethod("logLik") :
>>    no applicable method for 'logLik' applied to an object of class
>> "logistf"
>> *
>> Can you please help with that?
>
> You need to learn to crawl before you start trying to learn to walk.
>
> (1) Your convoluted code is filled with redundancies and circularity.
> Acquire some understanding of how R works before you plunge into
> a modelling exercise.
>
> (2) The logistf() function comes from the logistf package.  This needs to
> be mentioned when you are asking for help with the function.
>
> (3) The error message seems to me to be quite clear.  To calculate the AIC
> one needs the log likelihood and this cannot be calculated.  This could
> be due
> to the fact that log likelihood is not applicable to the model used by
> logistf(),

Small clarifcation: one needs the maximized log-likelihood.

More abstractly: AIC is only applicable to models fitted by maximum 
likelihood.  Biased-reduced fits (by Firth or anyone else) are not. 
This is one reason why there are many extensions to AIC to compare other 
sorts of fits.

> or simply to the fact that the package maintainer has not (yet?) written a
> method logLik.logistf().  I don't know, not being familiar with "Firth's
> bias
> reduced logistic regression" which is what the logistf package is about.
>
> It is incumbent upon ***you*** to know since you are invoking the logistf
> package.  If you don't know, do some study and find out.  You could also
> try to contact the package maintainer.
>
> (4) Your subject line is misleading.  You are simply replying to replies to
> a previous query (which has really nothing to do with the current one)
> and are apparently too lazy to start a new thread.
>
>       cheers,
>
>           Rolf Turner
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list