Learn R Programming

logNormReg (version 0.5-0)

logLik.lognlm: Log Likelihood for log Normal linear regression

Description

The function returns the log-likelihood value of the log Normal linear regression model evaluated at the estimated coefficients

Usage

# S3 method for lognlm
logLik(object, full=FALSE, ...)
# S3 method for lognlm
extractAIC(fit, scale=0, k=2, ...)

Arguments

object, fit

A lognlm fit returned by lognlm()

full

If FALSE, only the kernel of the log likelihood is returned, otherwise the complete log likelihood (including terms depending on data only)

scale

Optional numeric specifying the scale parameter of the model. Currenty not used.

k

Optional numeric specifying the penalty of the edf in the AIC formula. If k<=0, the BIC is returned.

optional arguments (nothing in this method).

Value

The log likelihood (or the sum of log residuals squared) of the model fit object

Details

If object has been obtained via lognlm(.., lik=TRUE), logLik.lognlm returns the log likelihood (kernel or complete, depending on argument full), otherwise the sum of log residuals, \(\sum(\log(y_i)-\log(\hat\mu_i))^2)\). The value returned by AIC is based on the kernel log likelihood or the the sum of log residuals, while extractAIC can return the AIC (or BIC) using the full log likelihood (via extractAIC(.., full=TRUE))

See Also

lognlm

Examples

Run this code
# NOT RUN {
   
# }
# NOT RUN {
# o is the fit object, see ?lognlm
n=50
s=.4

#covariates
x<-seq(.1,10,l=n) 

#response
set.seed(1234)      #just to get reproducible results..
mu<- 10+.5*x  #linear regression function
y<-rlnorm(n, log(mu)-s^2/2, s) #data..

o<- lognlm(y~x, lik=TRUE) #the model

logLik(o) #the kernel log likelihood value
logLik(o, full=TRUE)
   
# }

Run the code above in your browser using DataLab