logLik.lognlm {logNormReg} | R Documentation |
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 class 'lognlm'
logLik(object, full=FALSE, ...)
## S3 method for class 'lognlm'
extractAIC(fit, scale=0, k=2, ...)
Arguments
object , fit |
A |
full |
If |
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 |
... |
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_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)
)
Value
The log likelihood (or the sum of log residuals squared) of the model fit object
Author(s)
Vito Muggeo
See Also
Examples
# 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)