Skip to content

Instantly share code, notes, and snippets.

@moritzpschwarz
Last active December 11, 2023 20:30
Show Gist options
  • Save moritzpschwarz/35fc5be900b99a1a593ab5dd7018ff7b to your computer and use it in GitHub Desktop.
Save moritzpschwarz/35fc5be900b99a1a593ab5dd7018ff7b to your computer and use it in GitHub Desktop.
logLik.plm function
logLik.plm <- function(object){
out <- -plm::nobs(object) * log(2 * var(object$residuals) * pi)/2 - deviance(object)/(2 * var(object$residuals))
attr(out,"df") <- nobs(object) - object$df.residual
attr(out,"nobs") <- plm::nobs(object)
return(out)
}
Copy link

ghost commented Jan 28, 2021

Shouldn't plm::nobs(summary(object)) read plm::nobs(object)?

@moritzpschwarz
Copy link
Author

Spot on, thanks @Helix123!
I'll change it! It should, of course, give the same result!

@saviorand
Copy link

This is great! Thanks for coming up with this!

@enarhetali
Copy link

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment