This function simply calculates the product of the likelihood densities calculated using dnorm, i.e. assuming normal distribution.

The total number of estimated parameters returned with the value of the likelihood is calculated as the sum of fitted degradation model parameters and the fitted error model parameters.

For the case of unweighted least squares fitting, we calculate one constant standard deviation from the residuals using sd and add one to the number of fitted degradation model parameters.

For the case of manual weighting, we use the weight given for each observation as standard deviation in calculating its likelihood and the total number of estimated parameters is equal to the number of fitted degradation model parameters.

In the case of iterative reweighting, the variances obtained by this procedure are used in the likelihood calculations, and the number of estimated parameters is obtained by the number of degradation model parameters plus the number of variance model parameters, i.e. the number of observed variables if the reweighting method is "obs", and two if the reweighting method is "tc".

# S3 method for mkinfit
logLik(object, ...)

Arguments

object

An object of class mkinfit.

For compatibility with the generic method

Value

An object of class logLik with the number of estimated parameters (degradation model parameters plus variance model parameters) as attribute.

See also

Compare the AIC of columns of mmkin objects using AIC.mmkin.

Examples

sfo_sfo <- mkinmod( parent = mkinsub("SFO", to = "m1"), m1 = mkinsub("SFO") )
#> Error in mkinmod(parent = mkinsub("SFO", to = "m1"), m1 = mkinsub("SFO")): konnte Funktion "mkinmod" nicht finden
d_t <- FOCUS_2006_D d_t[23:24, "value"] <- c(NA, NA) # can't cope with zero values at the moment f_nw <- mkinfit(sfo_sfo, d_t, quiet = TRUE) # no weighting (weights are unity)
#> Error in mkinfit(sfo_sfo, d_t, quiet = TRUE): konnte Funktion "mkinfit" nicht finden
f_obs <- mkinfit(sfo_sfo, d_t, reweight.method = "obs", quiet = TRUE)
#> Error in mkinfit(sfo_sfo, d_t, reweight.method = "obs", quiet = TRUE): konnte Funktion "mkinfit" nicht finden
f_tc <- mkinfit(sfo_sfo, d_t, reweight.method = "tc", quiet = TRUE)
#> Error in mkinfit(sfo_sfo, d_t, reweight.method = "tc", quiet = TRUE): konnte Funktion "mkinfit" nicht finden
d_t$err <- d_t$value # Manual weighting assuming sigma ~ y f_man <- mkinfit(sfo_sfo, d_t, err = "err", quiet = TRUE)
#> Error in mkinfit(sfo_sfo, d_t, err = "err", quiet = TRUE): konnte Funktion "mkinfit" nicht finden
AIC(f_nw, f_obs, f_tc, f_man)
#> Error in AIC(f_nw, f_obs, f_tc, f_man): Objekt 'f_nw' nicht gefunden