Skip to content

Instantly share code, notes, and snippets.

@tanerumit
Last active January 16, 2021 13:44
Show Gist options
  • Save tanerumit/b6435e2c6ea4f24f26a4acdb874355f2 to your computer and use it in GitHub Desktop.
Save tanerumit/b6435e2c6ea4f24f26a4acdb874355f2 to your computer and use it in GitHub Desktop.
#R #function to extract p-value from a linear model
lmp <- function (modelobject) {
if (class(modelobject) != "lm") stop("Not an object of class 'lm' ")
f <- summary(modelobject)$fstatistic
p <- pf(f[1],f[2],f[3],lower.tail=F)
attributes(p) <- NULL
return(p)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment