Comments (1)
I appreciate you bringing this up, @AmeliaMN!
For now, fit.infer
just applies tidy()
to the output of each glm()
fit. We could maybe open up an interface here for passing an arbitrary model summary function? For the output you mention, folks could pass glance
, but I could also imagine folks passing augment
, summary
, or identity
. With glance
, that interface could feel something like:
library(tidymodels)
null_dist <-
gss %>%
specify(hours ~ age + college) %>%
hypothesize(null = "independence") %>%
generate(reps = 2, type = "permute")
# continue to `tidy() %>% select()` by default
null_dist %>%
fit()
#> # A tibble: 6 × 3
#> # Groups: replicate [2]
#> replicate term estimate
#> <int> <chr> <dbl>
#> 1 1 intercept 41.7
#> 2 1 age 0.00508
#> 3 1 collegedegree -1.43
#> 4 2 intercept 40.4
#> 5 2 age 0.0214
#> 6 2 collegedegree 0.328
# optional `summary` (or otherwise named) argument
null_dist %>%
fit(summary = glance)
#> # A tibble: 2 × 13
#> # Groups: replicate [2]
#> replicate r.squared adj.r.squ…¹ sigma stati…² p.value df logLik AIC BIC
#> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 0.00121 -0.00281 14.8 0.302 0.740 2 -2057. 4121. 4138.
#> 2 2 0.00275 -0.00126 14.8 0.686 0.504 2 -2056. 4121. 4137.
#> # … with 3 more variables: deviance <dbl>, df.residual <int>, nobs <int>, and
#> # abbreviated variable names ¹adj.r.squared, ²statistic
Actual code for this output:
null_dist %>%
nest() %>%
rowwise() %>%
mutate(mod = list(lm(hours ~ age + college, data = data)),
sum = list(glance(mod))) %>%
select(-data, -mod) %>%
unnest(cols = sum)
Any thoughts on this interface? This feels like a nice way of integrating broom and functions-as-arguments into teaching these pipelines, though I'm not sure if that's Astronaut Stuff Too Early.
One technical hiccup here is that glance()
doesn't output glm()
output, though glm()
is what's used under the hood in fit.infer()
right now.
Also, looping in @mine-cetinkaya-rundel. :)
from infer.
Related Issues (20)
- Residuals and expected cell counts for chi-square tests HOT 7
- issues with p-value shading HOT 1
- Variance/SD hypotesis test HOT 2
- deprecated use of `...` in `dplyr::across()` HOT 1
- hyperlink help-files in error messages HOT 1
- Tidy Chi-Squared Tests: support data that is already a contingency table HOT 3
- `t_test` errors with variables with spaces in them HOT 2
- Upkeep for infer HOT 4
- `usethis::use_testthat(3)` and upgrade to 3e, testthat 3e vignette HOT 1
- ggplot 3.4.0 `size` aesthetic deprecation HOT 1
- vdiffr 1.0.0 `path` argument deprecation HOT 1
- `rep_slice_sample()` doesn't work with integer sampling weights HOT 6
- transition `*_glue()` machinery to cli HOT 1
- rep_col_shuffle()? HOT 3
- Permutation test for paired data HOT 12
- `specify()` not capable of tidyverse programming HOT 7
- prop_test() wrapper incorrectly computing the confidence interval for differences in percents. HOT 5
- Can I get expected values from contingency tables HOT 3
- Contrast matrices are not preserved HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from infer.