logLik.lognlm: Log Likelihood for log Normal linear regression

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/logLik.lognlm.R

Description

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

Usage

1
2
3
4
## S3 method for class 'lognlm'
logLik(object, full=FALSE, ...)
## S3 method for class '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).

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)-log(mu))^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))

Value

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

Author(s)

Vito Muggeo

See Also

lognlm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
   
# 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)
   

logNormReg documentation built on Nov. 8, 2021, 5:07 p.m.