logLik.psar: Extract method log-likelihood or restricted log-likelihood...

View source: R/logLik.psar.R

logLik.psarR Documentation

Extract method log-likelihood or restricted log-likelihood from objects of class psar.

Description

Extract method log-likelihood or restricted log-likelihood from objects of class psar.

Usage

## S3 method for class 'psar'
logLik(object, REML = FALSE, ...)

Arguments

object

object of class psar.

REML

logical value indicating if the log-likelihood is restricted. Default: FALSE.

...

further arguments passed to or from other methods.

Value

An object of class logLik. Apart from the log-likelihood (or restricted log-likelihood) value, this object has some additional attributes:

nall Whole number of observations.
nobs Effective number of observations.
df Effective degrees of freedom.

See Also

  • coef.psar Extract vector of coefficients for fitted psar objects including fixed and random effects.

Examples

################################################
 ###################### Examples using a panel data of rate of
 ###################### unemployment for 103 Italian provinces in period 1996-2014.
library(sptpsar)
data(unemp_it); Wsp <- Wsp_it
 ######################  GAM pure
form1 <- unrate ~ partrate + agri + cons +
                 pspl(serv,nknots=15) +
                 pspl(empgrowth,nknots=20)
gamsar <- psar(form1,data=unemp_it,sar=TRUE,Wsp=Wsp_it)
summary(gamsar)
llik_gamsar <- logLik(gamsar)
llikreml_gamsar <- logLik(gamsar, REML = TRUE)
cat("Log-Likelihood: ",llik_gamsar,"\n")
cat("Restricted Log-Likelihood: ",llikreml_gamsar,"\n")

rominsal/sptpsar documentation built on June 1, 2022, 2:03 a.m.