Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

p-values for lmodel2 are missing #570

Closed
IndrajeetPatil opened this issue Jan 5, 2019 · 4 comments
Closed

p-values for lmodel2 are missing #570

IndrajeetPatil opened this issue Jan 5, 2019 · 4 comments

Comments

@IndrajeetPatil
Copy link
Contributor

Summary for lmodel2 objects include a column corresponding to p-values ("P-perm (1-tailed)"), but they are included in the tidier output.

# setup
set.seed(123)
library(lmodel2)
data(mod2ex2)

# model
Ex2.res <-
  lmodel2::lmodel2(
    formula = Prey ~ Predators,
    data = mod2ex2,
    range.y = "relative",
    range.x = "relative",
    nperm = 99
  )

# regression results
Ex2.res$regression.results
#>   Method Intercept    Slope Angle (degrees) P-perm (1-tailed)
#> 1    OLS  20.02675 2.631527        69.19283              0.01
#> 2     MA  13.05968 3.465907        73.90584              0.01
#> 3    SMA  16.45205 3.059635        71.90073                NA
#> 4    RMA  17.25651 2.963292        71.35239              0.01

# p-values are absent
broom::tidy(Ex2.res, conf.int = TRUE)
#> # A tibble: 8 x 5
#>   method term      estimate conf.low conf.high
#>   <fct>  <chr>        <dbl>    <dbl>     <dbl>
#> 1 MA     Intercept    13.1      1.35     19.8 
#> 2 MA     Slope         3.47     2.66      4.87
#> 3 OLS    Intercept    20.0     12.5      27.6 
#> 4 OLS    Slope         2.63     1.86      3.40
#> 5 RMA    Intercept    17.3      8.96     23.8 
#> 6 RMA    Slope         2.96     2.17      3.96
#> 7 SMA    Intercept    16.5      9.20     22.1 
#> 8 SMA    Slope         3.06     2.38      3.93

Created on 2019-01-05 by the reprex package (v0.2.1)

@mattle24
Copy link
Contributor

@IndrajeetPatil I can add the p-value to the tidy.lmodel2 output. I don't know if it was a deliberate decision not to include it, so I'll have to wait on someone to weigh in on that.

@alexpghayes
Copy link
Collaborator

Yeah, adding that in would be great. The goal of broom is not to be opinionated in what gets returned, just to clean model objects up.

@mattle24
Copy link
Contributor

Great, thanks Alex!

New output looks like this:

# setup
set.seed(123)
library(lmodel2)
data(mod2ex2)

# model
Ex2.res <-
  lmodel2::lmodel2(
    formula = Prey ~ Predators,
    data = mod2ex2,
    range.y = "relative",
    range.x = "relative",
    nperm = 99
  )

# p-values are present now
broom::tidy(Ex2.res, conf.int = TRUE)
#> # A tibble: 8 x 6
#>   method term      estimate conf.low conf.high p.value
#>   <fct>  <chr>        <dbl>    <dbl>     <dbl>   <dbl>
#> 1 MA     Intercept    13.1      1.35     19.8     0.01
#> 2 MA     Slope         3.47     2.66      4.87    0.01
#> 3 OLS    Intercept    20.0     12.5      27.6     0.01
#> 4 OLS    Slope         2.63     1.86      3.40    0.01
#> 5 RMA    Intercept    17.3      8.96     23.8     0.01
#> 6 RMA    Slope         2.96     2.17      3.96    0.01
#> 7 SMA    Intercept    16.5      9.20     22.1    NA   
#> 8 SMA    Slope         3.06     2.38      3.93   NA

Created on 2019-01-22 by the reprex package (v0.2.1.9000)
**

@github-actions
Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants