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

including mode for the distribution in describe_distribution #160

Closed
IndrajeetPatil opened this issue Jun 3, 2021 · 8 comments
Closed

Comments

@IndrajeetPatil
Copy link
Member

Saw some discussion on Twitter about how base-R doesn't have a function to calculate mode. So was wondering if it might be a good idea for us to include this info.

library(parameters)

describe_distribution(mtcars$wt)
#> Mean |   SD |  IQR |        Range | Skewness | Kurtosis |  n | n_Missing
#> ------------------------------------------------------------------------
#> 3.22 | 0.98 | 1.19 | [1.51, 5.42] |     0.47 |     0.42 | 32 |         0

getmode <- function(v) {
  uniqv <- unique(v)
  uniqv[which.max(tabulate(match(v, uniqv)))]
}

Created on 2021-06-03 by the reprex package (v2.0.0)

@bwiernik
Copy link
Contributor

bwiernik commented Jun 3, 2021

Perhaps "modal_value()"?

@strengejacke
Copy link
Member

Makes sense for factors or character vectors

@DominiqueMakowski
Copy link
Member

For numeric vectors, the MAP estimate isprobably the closest meaningful equivalent

@bwiernik
Copy link
Contributor

bwiernik commented Jun 4, 2021

Is MAP computationally intensive at all?

@DominiqueMakowski
Copy link
Member

Main running time devoted to computing the density curve i think

@strengejacke strengejacke transferred this issue from easystats/parameters May 1, 2022
@bwiernik
Copy link
Contributor

bwiernik commented May 2, 2022

We should include the mode for categorical variables and the map for continuous

@bwiernik
Copy link
Contributor

In light of #232, I think we should add a metrics argument like in performance::model_performance() that enumerates the stats to provide, with something like the current set as the default value.

@etiennebacher
Copy link
Member

Closing in favor of #46

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

No branches or pull requests

5 participants