diff --git a/dev/pkgdown.yml b/dev/pkgdown.yml index 2a150205..b385f62a 100644 --- a/dev/pkgdown.yml +++ b/dev/pkgdown.yml @@ -4,7 +4,7 @@ pkgdown_sha: ~ articles: articles/marginal_tidiers: marginal_tidiers.html tidy: tidy.html -last_built: 2025-01-08T09:01Z +last_built: 2025-01-13T12:37Z urls: reference: https://larmarange.github.io/broom.helpers/reference article: https://larmarange.github.io/broom.helpers/articles diff --git a/dev/reference/model_get_terms.html b/dev/reference/model_get_terms.html index b1ec63c1..04d74391 100644 --- a/dev/reference/model_get_terms.html +++ b/dev/reference/model_get_terms.html @@ -134,7 +134,7 @@

Examples#> attr(,"response") #> [1] 1 #> attr(,".Environment") -#> <environment: 0x5639f8cb50e0> +#> <environment: 0x557632791ff0> #> attr(,"predvars") #> list(hp, mpg, factor(cyl)) #> attr(,"dataClasses") diff --git a/dev/reference/scope_tidy.html b/dev/reference/scope_tidy.html index c991247d..309921e4 100644 --- a/dev/reference/scope_tidy.html +++ b/dev/reference/scope_tidy.html @@ -132,7 +132,7 @@

Examples#> .. ..- attr(*, "order")= int [1:3] 1 1 2 #> .. ..- attr(*, "intercept")= int 1 #> .. ..- attr(*, "response")= int 1 -#> .. ..- attr(*, ".Environment")=<environment: 0x5639fe9d2938> +#> .. ..- attr(*, ".Environment")=<environment: 0x5576287f4db8> #> .. ..- attr(*, "predvars")= language list(Sepal.Length, Sepal.Width, Species) #> .. ..- attr(*, "dataClasses")= Named chr [1:3] "numeric" "numeric" "factor" #> .. .. ..- attr(*, "names")= chr [1:3] "Sepal.Length" "Sepal.Width" "Species" diff --git a/dev/search.json b/dev/search.json index 565f32c3..f8dc9cd2 100644 --- a/dev/search.json +++ b/dev/search.json @@ -1 +1 @@ -[{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"GNU General Public License","title":"GNU General Public License","text":"Version 3, 29 June 2007Copyright © 2007 Free Software Foundation, Inc.  Everyone permitted copy distribute verbatim copies license document, changing allowed.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"preamble","dir":"","previous_headings":"","what":"Preamble","title":"GNU General Public License","text":"GNU General Public License free, copyleft license software kinds works. licenses software practical works designed take away freedom share change works. contrast, GNU General Public License intended guarantee freedom share change versions program–make sure remains free software users. , Free Software Foundation, use GNU General Public License software; applies also work released way authors. can apply programs, . speak free software, referring freedom, price. General Public Licenses designed make sure freedom distribute copies free software (charge wish), receive source code can get want , can change software use pieces new free programs, know can things. protect rights, need prevent others denying rights asking surrender rights. Therefore, certain responsibilities distribute copies software, modify : responsibilities respect freedom others. example, distribute copies program, whether gratis fee, must pass recipients freedoms received. must make sure , , receive can get source code. must show terms know rights. Developers use GNU GPL protect rights two steps: (1) assert copyright software, (2) offer License giving legal permission copy, distribute /modify . developers’ authors’ protection, GPL clearly explains warranty free software. users’ authors’ sake, GPL requires modified versions marked changed, problems attributed erroneously authors previous versions. devices designed deny users access install run modified versions software inside , although manufacturer can . fundamentally incompatible aim protecting users’ freedom change software. systematic pattern abuse occurs area products individuals use, precisely unacceptable. Therefore, designed version GPL prohibit practice products. problems arise substantially domains, stand ready extend provision domains future versions GPL, needed protect freedom users. Finally, every program threatened constantly software patents. States allow patents restrict development use software general-purpose computers, , wish avoid special danger patents applied free program make effectively proprietary. prevent , GPL assures patents used render program non-free. precise terms conditions copying, distribution modification follow.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_0-definitions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"0. Definitions","title":"GNU General Public License","text":"“License” refers version 3 GNU General Public License. “Copyright” also means copyright-like laws apply kinds works, semiconductor masks. “Program” refers copyrightable work licensed License. licensee addressed “”. “Licensees” “recipients” may individuals organizations. “modify” work means copy adapt part work fashion requiring copyright permission, making exact copy. resulting work called “modified version” earlier work work “based ” earlier work. “covered work” means either unmodified Program work based Program. “propagate” work means anything , without permission, make directly secondarily liable infringement applicable copyright law, except executing computer modifying private copy. Propagation includes copying, distribution (without modification), making available public, countries activities well. “convey” work means kind propagation enables parties make receive copies. Mere interaction user computer network, transfer copy, conveying. interactive user interface displays “Appropriate Legal Notices” extent includes convenient prominently visible feature (1) displays appropriate copyright notice, (2) tells user warranty work (except extent warranties provided), licensees may convey work License, view copy License. interface presents list user commands options, menu, prominent item list meets criterion.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_1-source-code","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"1. Source Code","title":"GNU General Public License","text":"“source code” work means preferred form work making modifications . “Object code” means non-source form work. “Standard Interface” means interface either official standard defined recognized standards body, , case interfaces specified particular programming language, one widely used among developers working language. “System Libraries” executable work include anything, work whole, () included normal form packaging Major Component, part Major Component, (b) serves enable use work Major Component, implement Standard Interface implementation available public source code form. “Major Component”, context, means major essential component (kernel, window system, ) specific operating system () executable work runs, compiler used produce work, object code interpreter used run . “Corresponding Source” work object code form means source code needed generate, install, (executable work) run object code modify work, including scripts control activities. However, include work’s System Libraries, general-purpose tools generally available free programs used unmodified performing activities part work. example, Corresponding Source includes interface definition files associated source files work, source code shared libraries dynamically linked subprograms work specifically designed require, intimate data communication control flow subprograms parts work. Corresponding Source need include anything users can regenerate automatically parts Corresponding Source. Corresponding Source work source code form work.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_2-basic-permissions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"2. Basic Permissions","title":"GNU General Public License","text":"rights granted License granted term copyright Program, irrevocable provided stated conditions met. License explicitly affirms unlimited permission run unmodified Program. output running covered work covered License output, given content, constitutes covered work. License acknowledges rights fair use equivalent, provided copyright law. may make, run propagate covered works convey, without conditions long license otherwise remains force. may convey covered works others sole purpose make modifications exclusively , provide facilities running works, provided comply terms License conveying material control copyright. thus making running covered works must exclusively behalf, direction control, terms prohibit making copies copyrighted material outside relationship . Conveying circumstances permitted solely conditions stated . Sublicensing allowed; section 10 makes unnecessary.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_3-protecting-users-legal-rights-from-anti-circumvention-law","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"3. Protecting Users’ Legal Rights From Anti-Circumvention Law","title":"GNU General Public License","text":"covered work shall deemed part effective technological measure applicable law fulfilling obligations article 11 WIPO copyright treaty adopted 20 December 1996, similar laws prohibiting restricting circumvention measures. convey covered work, waive legal power forbid circumvention technological measures extent circumvention effected exercising rights License respect covered work, disclaim intention limit operation modification work means enforcing, work’s users, third parties’ legal rights forbid circumvention technological measures.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_4-conveying-verbatim-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"4. Conveying Verbatim Copies","title":"GNU General Public License","text":"may convey verbatim copies Program’s source code receive , medium, provided conspicuously appropriately publish copy appropriate copyright notice; keep intact notices stating License non-permissive terms added accord section 7 apply code; keep intact notices absence warranty; give recipients copy License along Program. may charge price price copy convey, may offer support warranty protection fee.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_5-conveying-modified-source-versions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"5. Conveying Modified Source Versions","title":"GNU General Public License","text":"may convey work based Program, modifications produce Program, form source code terms section 4, provided also meet conditions: ) work must carry prominent notices stating modified , giving relevant date. b) work must carry prominent notices stating released License conditions added section 7. requirement modifies requirement section 4 “keep intact notices”. c) must license entire work, whole, License anyone comes possession copy. License therefore apply, along applicable section 7 additional terms, whole work, parts, regardless packaged. License gives permission license work way, invalidate permission separately received . d) work interactive user interfaces, must display Appropriate Legal Notices; however, Program interactive interfaces display Appropriate Legal Notices, work need make . compilation covered work separate independent works, nature extensions covered work, combined form larger program, volume storage distribution medium, called “aggregate” compilation resulting copyright used limit access legal rights compilation’s users beyond individual works permit. Inclusion covered work aggregate cause License apply parts aggregate.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_6-conveying-non-source-forms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"6. Conveying Non-Source Forms","title":"GNU General Public License","text":"may convey covered work object code form terms sections 4 5, provided also convey machine-readable Corresponding Source terms License, one ways: ) Convey object code , embodied , physical product (including physical distribution medium), accompanied Corresponding Source fixed durable physical medium customarily used software interchange. b) Convey object code , embodied , physical product (including physical distribution medium), accompanied written offer, valid least three years valid long offer spare parts customer support product model, give anyone possesses object code either (1) copy Corresponding Source software product covered License, durable physical medium customarily used software interchange, price reasonable cost physically performing conveying source, (2) access copy Corresponding Source network server charge. c) Convey individual copies object code copy written offer provide Corresponding Source. alternative allowed occasionally noncommercially, received object code offer, accord subsection 6b. d) Convey object code offering access designated place (gratis charge), offer equivalent access Corresponding Source way place charge. need require recipients copy Corresponding Source along object code. place copy object code network server, Corresponding Source may different server (operated third party) supports equivalent copying facilities, provided maintain clear directions next object code saying find Corresponding Source. Regardless server hosts Corresponding Source, remain obligated ensure available long needed satisfy requirements. e) Convey object code using peer--peer transmission, provided inform peers object code Corresponding Source work offered general public charge subsection 6d. separable portion object code, whose source code excluded Corresponding Source System Library, need included conveying object code work. “User Product” either (1) “consumer product”, means tangible personal property normally used personal, family, household purposes, (2) anything designed sold incorporation dwelling. determining whether product consumer product, doubtful cases shall resolved favor coverage. particular product received particular user, “normally used” refers typical common use class product, regardless status particular user way particular user actually uses, expects expected use, product. product consumer product regardless whether product substantial commercial, industrial non-consumer uses, unless uses represent significant mode use product. “Installation Information” User Product means methods, procedures, authorization keys, information required install execute modified versions covered work User Product modified version Corresponding Source. information must suffice ensure continued functioning modified object code case prevented interfered solely modification made. convey object code work section , , specifically use , User Product, conveying occurs part transaction right possession use User Product transferred recipient perpetuity fixed term (regardless transaction characterized), Corresponding Source conveyed section must accompanied Installation Information. requirement apply neither third party retains ability install modified object code User Product (example, work installed ROM). requirement provide Installation Information include requirement continue provide support service, warranty, updates work modified installed recipient, User Product modified installed. Access network may denied modification materially adversely affects operation network violates rules protocols communication across network. Corresponding Source conveyed, Installation Information provided, accord section must format publicly documented (implementation available public source code form), must require special password key unpacking, reading copying.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_7-additional-terms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"7. Additional Terms","title":"GNU General Public License","text":"“Additional permissions” terms supplement terms License making exceptions one conditions. Additional permissions applicable entire Program shall treated though included License, extent valid applicable law. additional permissions apply part Program, part may used separately permissions, entire Program remains governed License without regard additional permissions. convey copy covered work, may option remove additional permissions copy, part . (Additional permissions may written require removal certain cases modify work.) may place additional permissions material, added covered work, can give appropriate copyright permission. Notwithstanding provision License, material add covered work, may (authorized copyright holders material) supplement terms License terms: ) Disclaiming warranty limiting liability differently terms sections 15 16 License; b) Requiring preservation specified reasonable legal notices author attributions material Appropriate Legal Notices displayed works containing ; c) Prohibiting misrepresentation origin material, requiring modified versions material marked reasonable ways different original version; d) Limiting use publicity purposes names licensors authors material; e) Declining grant rights trademark law use trade names, trademarks, service marks; f) Requiring indemnification licensors authors material anyone conveys material (modified versions ) contractual assumptions liability recipient, liability contractual assumptions directly impose licensors authors. non-permissive additional terms considered “restrictions” within meaning section 10. Program received , part , contains notice stating governed License along term restriction, may remove term. license document contains restriction permits relicensing conveying License, may add covered work material governed terms license document, provided restriction survive relicensing conveying. add terms covered work accord section, must place, relevant source files, statement additional terms apply files, notice indicating find applicable terms. Additional terms, permissive non-permissive, may stated form separately written license, stated exceptions; requirements apply either way.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_8-termination","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"8. Termination","title":"GNU General Public License","text":"may propagate modify covered work except expressly provided License. attempt otherwise propagate modify void, automatically terminate rights License (including patent licenses granted third paragraph section 11). However, cease violation License, license particular copyright holder reinstated () provisionally, unless copyright holder explicitly finally terminates license, (b) permanently, copyright holder fails notify violation reasonable means prior 60 days cessation. Moreover, license particular copyright holder reinstated permanently copyright holder notifies violation reasonable means, first time received notice violation License (work) copyright holder, cure violation prior 30 days receipt notice. Termination rights section terminate licenses parties received copies rights License. rights terminated permanently reinstated, qualify receive new licenses material section 10.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_9-acceptance-not-required-for-having-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"9. Acceptance Not Required for Having Copies","title":"GNU General Public License","text":"required accept License order receive run copy Program. Ancillary propagation covered work occurring solely consequence using peer--peer transmission receive copy likewise require acceptance. However, nothing License grants permission propagate modify covered work. actions infringe copyright accept License. Therefore, modifying propagating covered work, indicate acceptance License .","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_10-automatic-licensing-of-downstream-recipients","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"10. Automatic Licensing of Downstream Recipients","title":"GNU General Public License","text":"time convey covered work, recipient automatically receives license original licensors, run, modify propagate work, subject License. responsible enforcing compliance third parties License. “entity transaction” transaction transferring control organization, substantially assets one, subdividing organization, merging organizations. propagation covered work results entity transaction, party transaction receives copy work also receives whatever licenses work party’s predecessor interest give previous paragraph, plus right possession Corresponding Source work predecessor interest, predecessor can get reasonable efforts. may impose restrictions exercise rights granted affirmed License. example, may impose license fee, royalty, charge exercise rights granted License, may initiate litigation (including cross-claim counterclaim lawsuit) alleging patent claim infringed making, using, selling, offering sale, importing Program portion .","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_11-patents","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"11. Patents","title":"GNU General Public License","text":"“contributor” copyright holder authorizes use License Program work Program based. work thus licensed called contributor’s “contributor version”. contributor’s “essential patent claims” patent claims owned controlled contributor, whether already acquired hereafter acquired, infringed manner, permitted License, making, using, selling contributor version, include claims infringed consequence modification contributor version. purposes definition, “control” includes right grant patent sublicenses manner consistent requirements License. contributor grants non-exclusive, worldwide, royalty-free patent license contributor’s essential patent claims, make, use, sell, offer sale, import otherwise run, modify propagate contents contributor version. following three paragraphs, “patent license” express agreement commitment, however denominated, enforce patent (express permission practice patent covenant sue patent infringement). “grant” patent license party means make agreement commitment enforce patent party. convey covered work, knowingly relying patent license, Corresponding Source work available anyone copy, free charge terms License, publicly available network server readily accessible means, must either (1) cause Corresponding Source available, (2) arrange deprive benefit patent license particular work, (3) arrange, manner consistent requirements License, extend patent license downstream recipients. “Knowingly relying” means actual knowledge , patent license, conveying covered work country, recipient’s use covered work country, infringe one identifiable patents country reason believe valid. , pursuant connection single transaction arrangement, convey, propagate procuring conveyance , covered work, grant patent license parties receiving covered work authorizing use, propagate, modify convey specific copy covered work, patent license grant automatically extended recipients covered work works based . patent license “discriminatory” include within scope coverage, prohibits exercise , conditioned non-exercise one rights specifically granted License. may convey covered work party arrangement third party business distributing software, make payment third party based extent activity conveying work, third party grants, parties receive covered work , discriminatory patent license () connection copies covered work conveyed (copies made copies), (b) primarily connection specific products compilations contain covered work, unless entered arrangement, patent license granted, prior 28 March 2007. Nothing License shall construed excluding limiting implied license defenses infringement may otherwise available applicable patent law.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_12-no-surrender-of-others-freedom","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"12. No Surrender of Others’ Freedom","title":"GNU General Public License","text":"conditions imposed (whether court order, agreement otherwise) contradict conditions License, excuse conditions License. convey covered work satisfy simultaneously obligations License pertinent obligations, consequence may convey . example, agree terms obligate collect royalty conveying convey Program, way satisfy terms License refrain entirely conveying Program.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_13-use-with-the-gnu-affero-general-public-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"13. Use with the GNU Affero General Public License","title":"GNU General Public License","text":"Notwithstanding provision License, permission link combine covered work work licensed version 3 GNU Affero General Public License single combined work, convey resulting work. terms License continue apply part covered work, special requirements GNU Affero General Public License, section 13, concerning interaction network apply combination .","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_14-revised-versions-of-this-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"14. Revised Versions of this License","title":"GNU General Public License","text":"Free Software Foundation may publish revised /new versions GNU General Public License time time. new versions similar spirit present version, may differ detail address new problems concerns. version given distinguishing version number. Program specifies certain numbered version GNU General Public License “later version” applies , option following terms conditions either numbered version later version published Free Software Foundation. Program specify version number GNU General Public License, may choose version ever published Free Software Foundation. Program specifies proxy can decide future versions GNU General Public License can used, proxy’s public statement acceptance version permanently authorizes choose version Program. Later license versions may give additional different permissions. However, additional obligations imposed author copyright holder result choosing follow later version.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_15-disclaimer-of-warranty","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"15. Disclaimer of Warranty","title":"GNU General Public License","text":"WARRANTY PROGRAM, EXTENT PERMITTED APPLICABLE LAW. EXCEPT OTHERWISE STATED WRITING COPYRIGHT HOLDERS /PARTIES PROVIDE PROGRAM “” WITHOUT WARRANTY KIND, EITHER EXPRESSED IMPLIED, INCLUDING, LIMITED , IMPLIED WARRANTIES MERCHANTABILITY FITNESS PARTICULAR PURPOSE. ENTIRE RISK QUALITY PERFORMANCE PROGRAM . PROGRAM PROVE DEFECTIVE, ASSUME COST NECESSARY SERVICING, REPAIR CORRECTION.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_16-limitation-of-liability","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"16. Limitation of Liability","title":"GNU General Public License","text":"EVENT UNLESS REQUIRED APPLICABLE LAW AGREED WRITING COPYRIGHT HOLDER, PARTY MODIFIES /CONVEYS PROGRAM PERMITTED , LIABLE DAMAGES, INCLUDING GENERAL, SPECIAL, INCIDENTAL CONSEQUENTIAL DAMAGES ARISING USE INABILITY USE PROGRAM (INCLUDING LIMITED LOSS DATA DATA RENDERED INACCURATE LOSSES SUSTAINED THIRD PARTIES FAILURE PROGRAM OPERATE PROGRAMS), EVEN HOLDER PARTY ADVISED POSSIBILITY DAMAGES.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_17-interpretation-of-sections-15-and-16","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"17. Interpretation of Sections 15 and 16","title":"GNU General Public License","text":"disclaimer warranty limitation liability provided given local legal effect according terms, reviewing courts shall apply local law closely approximates absolute waiver civil liability connection Program, unless warranty assumption liability accompanies copy Program return fee. END TERMS CONDITIONS","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"how-to-apply-these-terms-to-your-new-programs","dir":"","previous_headings":"","what":"How to Apply These Terms to Your New Programs","title":"GNU General Public License","text":"develop new program, want greatest possible use public, best way achieve make free software everyone can redistribute change terms. , attach following notices program. safest attach start source file effectively state exclusion warranty; file least “copyright” line pointer full notice found. Also add information contact electronic paper mail. program terminal interaction, make output short notice like starts interactive mode: hypothetical commands show w show c show appropriate parts General Public License. course, program’s commands might different; GUI interface, use “box”. also get employer (work programmer) school, , sign “copyright disclaimer” program, necessary. information , apply follow GNU GPL, see . GNU General Public License permit incorporating program proprietary programs. program subroutine library, may consider useful permit linking proprietary applications library. want , use GNU Lesser General Public License instead License. first, please read .","code":" Copyright (C) 2020 Joseph Larmarange This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . broom.helpers Copyright (C) 2020 Joseph Larmarange This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details."},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"terminology","dir":"Articles","previous_headings":"","what":"Terminology","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"overall idea “marginal effects” provide tools better interpret results model estimating several quantities margins. However, implemented many different ways different ways bunch quasi-synonyms idea “marginal effects”: statistical effects, marginal effects, marginal means, contrasts, marginal slopes, conditional effects, conditional marginal effects, marginal effects mean, many similarly-named ideas. broom.helpers, tried adopt terminology consistent {marginaleffects} package, first released September 2021, Andrew Heiss’ Marginalia blog post published May 2022. Adjusted Predictions correspond outcome predicted fitted model specified scale given combination values predictor variables, observed values, means, factor levels (.k.. “reference grid”). prediction averaged according specific regressor, refer Marginal Predictions. Marginal Contrasts referring comparison (e.g. difference) outcome certain regressor, considering “meaningfully” “typical” values predictors (mean/mode, custom values, averaged observed values…). Contrasts computed categorical variables (e.g. difference two specific levels) continuous variables (change outcome certain change regressor). Marginal Effects / Slopes defined continuous variables partial derivative (slope) regression equation respect regressor interest. Put differently, marginal effect slope prediction function, measured specific value regressor interest. scientific practice, marginal effects fall toolbox marginal contrasts. Marginal Means adjusted predictions model, averaged across “reference grid” categorical predictors. similar marginal predictions, subtle differences. broom.helpers embed several custom tidiers compute quantities return tibble compatible tidy_plus_plus() others broom.helpers’s tidy_*() function. Therefore, possible produce nicely formatted tables gtsummary::tbl_regression() forest plots ggstats::ggcoef_model().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"data-preparation","dir":"Articles","previous_headings":"","what":"Data preparation","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"Let’s consider trial dataset gtsummary package build logistic regression model two categorical predictors (trt stage) two continuous predictor (marker age). include interaction trt marker polynomial terms age (.e. age age^2).","code":"library(broom.helpers) library(gtsummary) library(dplyr) d <- trial |> filter(complete.cases(response, trt, marker, grade, age)) mod <- glm( response ~ trt * marker + stage + poly(age, 2), data = d, family = binomial ) mod |> tbl_regression( exponentiate = TRUE, label = list(age = \"Age in years\") ) |> bold_labels()"},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"marginal-predictions-at-the-mean","dir":"Articles","previous_headings":"Marginal Predictions","what":"Marginal Predictions at the Mean","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"first approach better understand / interpret model consists predict value regressor, model scale, “typical values” regressors. estimates therefore easier interpret, expressed scale outcome (, binary logistic regression, probabilities). differences observed predictions different modalities depend “effect” regressor others regressors fixed “typical values”. However, packages use definition “typical values”.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"the-effectss-approach","dir":"Articles","previous_headings":"Marginal Predictions > Marginal Predictions at the Mean","what":"the {effects}’s approach","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"effects package offer effects::Effect() function compute marginal predictions typical values. Although function named Effect(), produced estimates marginal predictions according terminology presented beginning vignette. understand “typical values” used effects::Effect(), let’s look model matrix generated package used predictions. continuous regressors set observed mean categorical regressors weighted according observed proportions. Somehow, artificial “averaged” individual created, mean age mean marker level, partly receiving Drug Drug B. , predict probability response individual stage T1, T2, T3 T4. continuous variable, effects::Effect() consider several values regressor (based range observed values) estimate marginal predictions different values. effects::allEffects() build marginal predictions regressors, taking account eventual interactions within model. also possible generate similar plots ggeffects::ggeffect(). Please note ggeffects::ggeffect() consider, default, individual variables model existing interactions. generate tibble results formatted way use tidy_plus_plus() broom.helpers’s tidy_*() helpers, broom.helpers provides tidy_all_effects() tieder. therefore easy produce nicely formatted table gtsummary::tbl_regression() forest plot ggstats::ggcoef_model().","code":"library(effects, quietly = TRUE) #> lattice theme set by effectsTheme() #> See ?effectsTheme for details. e <- Effect(\"stage\", mod) e #> #> stage effect #> stage #> T1 T2 T3 T4 #> 0.3866154 0.2179846 0.3501056 0.2938566 plot(e) e$model.matrix #> (Intercept) trtDrug B marker stageT2 stageT3 stageT4 poly(age, 2)1 #> 1 1 0.5202312 0.9191792 0 0 0 -2.228704e-16 #> 2 1 0.5202312 0.9191792 1 0 0 -2.228704e-16 #> 3 1 0.5202312 0.9191792 0 1 0 -2.228704e-16 #> 4 1 0.5202312 0.9191792 0 0 1 -2.228704e-16 #> poly(age, 2)2 trtDrug B:marker #> 1 -0.05568232 0.4781857 #> 2 -0.05568232 0.4781857 #> 3 -0.05568232 0.4781857 #> 4 -0.05568232 0.4781857 #> attr(,\"assign\") #> [1] 0 1 2 3 3 3 4 4 5 #> attr(,\"contrasts\") #> attr(,\"contrasts\")$trt #> [1] \"contr.treatment\" #> #> attr(,\"contrasts\")$stage #> [1] \"contr.treatment\" e2 <- Effect(\"age\", mod) e2 #> #> age effect #> age #> 6 30 40 60 80 #> 0.1664397 0.2392447 0.2760557 0.3606351 0.4568567 plot(e2) allEffects(mod) #> model: response ~ trt * marker + stage + poly(age, 2) #> #> stage effect #> stage #> T1 T2 T3 T4 #> 0.3866154 0.2179846 0.3501056 0.2938566 #> #> age effect #> age #> 6 30 40 60 80 #> 0.1664397 0.2392447 0.2760557 0.3606351 0.4568567 #> #> trt*marker effect #> marker #> trt 0.005 1 2 3 4 #> Drug A 0.2338204 0.2776269 0.3264017 0.3792467 0.4351208 #> Drug B 0.2479065 0.3408371 0.4484189 0.5610548 0.6677329 plot(allEffects(mod)) mod |> ggeffects::ggeffect() |> lapply(plot) |> patchwork::wrap_plots() tidy_all_effects(mod) #> variable term estimate std.error conf.low conf.high #> 1 stage T1 0.3866154 0.08138561 0.24338626 0.5525749 #> 2 stage T2 0.2179846 0.06122617 0.12116925 0.3604304 #> 3 stage T3 0.3501056 0.08749758 0.20225147 0.5337316 #> 4 stage T4 0.2938566 0.07895328 0.16486445 0.4673012 #> 5 poly(age,2) 6 0.1664397 0.15368239 0.02226625 0.6364570 #> 6 poly(age,2) 30 0.2392447 0.05197357 0.15232129 0.3549982 #> 7 poly(age,2) 40 0.2760557 0.04346297 0.19934983 0.3686854 #> 8 poly(age,2) 60 0.3606351 0.05152656 0.26686307 0.4663957 #> 9 poly(age,2) 80 0.4568567 0.16663622 0.18404077 0.7582667 #> 10 trt:marker Drug A:0.005 0.2338204 0.07478345 0.11867604 0.4088555 #> 11 trt:marker Drug B:0.005 0.2479065 0.06818623 0.13864532 0.4029880 #> 12 trt:marker Drug A:1 0.2776269 0.05673207 0.18083471 0.4008740 #> 13 trt:marker Drug B:1 0.3408371 0.05901662 0.23605720 0.4638846 #> 14 trt:marker Drug A:2 0.3264017 0.08136674 0.19002540 0.5002087 #> 15 trt:marker Drug B:2 0.4484189 0.09615134 0.27508336 0.6352624 #> 16 trt:marker Drug A:3 0.3792467 0.13846045 0.16171930 0.6592599 #> 17 trt:marker Drug B:3 0.5610548 0.15197028 0.27607502 0.8107519 #> 18 trt:marker Drug A:4 0.4351208 0.20665349 0.12910815 0.8000955 #> 19 trt:marker Drug B:4 0.6677329 0.19316496 0.26727889 0.9171600 mod |> tbl_regression( tidy_fun = tidy_all_effects, estimate_fun = scales::label_percent(accuracy = .1) ) |> bold_labels() ggstats::ggcoef_model( mod, tidy_fun = tidy_all_effects, vline = FALSE )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"the-marginaleffectss-approach-at-the-mean","dir":"Articles","previous_headings":"Marginal Predictions > Marginal Predictions at the Mean","what":"the {marginaleffects}’s approach at the Mean","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"marginaleffects package allows compute marginal predictions “mean”, .e. considering mean continuous regressors mode (.e. frequent observed modality) categorical regressors. , call marginaleffects::predictions() newdata = \"mean\". Four “mean individuals” generated, just value stage different one individual , predicting probability response. continuous variable, predictions made, default, Tukey’s five numbers, .e. minimum, first quartile, median, third quartile maximum. broom.helpers provides global tidier tidy_marginal_predictions() compute marginal predictions variable combination variables stacking unique tibble. specify newdata = \"mean\" get marginal predictions mean. default, effects::allEffects(), consider higher order combinations variables (identified model_list_higher_order_variables()). Simply specify variables_list = \"no_interaction\" compute marginal predictions individual variable without considering existing interactions. broom.helpers also include plot_marginal_predictions() generate list plots visualize marginal predictions. Use patchwork::wrap_plots() combine plots together. Alternatively, can use ggstats::ggcoef_model(), using tidy_args pass arguments broom.helpers::tidy_marginal_predictions().","code":"library(marginaleffects) predictions( mod, variables = \"stage\", newdata = \"mean\", by = \"stage\" ) #> #> stage Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> T1 0.419 0.0930 4.50 <0.001 17.2 0.237 0.601 #> T2 0.242 0.0702 3.44 <0.001 10.8 0.104 0.379 #> T3 0.381 0.0977 3.90 <0.001 13.3 0.190 0.573 #> T4 0.322 0.0892 3.61 <0.001 11.7 0.148 0.497 #> #> Type: response #> Columns: stage, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high predictions( mod, variables = \"age\", newdata = \"mean\", by = \"age\" ) #> #> age Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> 6 0.127 0.1325 0.961 0.33666 1.6 -0.1324 0.387 #> 37 0.208 0.0659 3.159 0.00158 9.3 0.0790 0.337 #> 47 0.242 0.0702 3.446 < 0.001 10.8 0.1044 0.380 #> 57 0.280 0.0771 3.629 < 0.001 11.8 0.1287 0.431 #> 83 0.395 0.2104 1.878 0.06044 4.0 -0.0173 0.807 #> #> Type: response #> Columns: age, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high mod |> model_list_higher_order_variables() #> [1] \"stage\" \"age\" \"trt:marker\" mod |> tbl_regression( tidy_fun = tidy_marginal_predictions, newdata = \"mean\", estimate_fun = scales::label_percent(accuracy = .1), label = list(age = \"Age in years\") ) |> modify_column_hide(\"p.value\") |> bold_labels() mod |> tbl_regression( tidy_fun = tidy_marginal_predictions, variables_list = \"no_interaction\", newdata = \"mean\", estimate_fun = scales::label_percent(accuracy = .1), label = list(age = \"Age in years\") ) |> modify_column_hide(\"p.value\") |> bold_labels() p <- mod |> plot_marginal_predictions(newdata = \"mean\") |> patchwork::wrap_plots() & ggplot2::scale_y_continuous( labels = scales::label_percent(), limits = c(-0.2, 1) ) p[[2]] <- p[[2]] + ggplot2::xlab(\"Age in years\") p + patchwork::plot_annotation( title = \"Marginal Predictions at the Mean\" ) p <- mod |> plot_marginal_predictions( \"no_interaction\", newdata = \"mean\" ) |> patchwork::wrap_plots() & ggplot2::scale_y_continuous( labels = scales::label_percent(), limits = c(-0.2, 1) ) p[[4]] <- p[[4]] + ggplot2::xlab(\"Age in years\") p + patchwork::plot_annotation( title = \"Marginal Predictions at the Mean\" ) ggstats::ggcoef_model( mod, tidy_fun = tidy_marginal_predictions, tidy_args = list(newdata = \"mean\", variables_list = \"no_interaction\"), vline = FALSE, show_p_values = FALSE, signif_stars = FALSE, significance = NULL, variable_labels = c(age = \"Age in years\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"average-marginal-predictions","dir":"Articles","previous_headings":"Marginal Predictions","what":"Average Marginal Predictions","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"Instead averaging observed values generate “typical observations” predicting outcome, alternative consists predict outcome overall observed values averaging results. precisely, purpose adopt counterfactual approach. Let’s take example. Let’s consider d observed data used estimate model. can make copy dataset, variables identical, considering individuals received Drug . Similarly, generate dataset individuals received Drug B. can now predict outcome observations dA compute average, similarly dB. , , obtain Average Marginal Predictions trt. results computed marginaleffects::avg_predictions(). Note counterfactual approach corresponds default behavior value provided newdata. Important: since version 0.10.0 marginaleffects, add type = \"response\" get result: glm models, predictions done response scale, averaged. type specified, predictions made link scale, averaged back transformed response scale. Thus, average prediction may exactly identical average predictions. can use tidy_marginal_predictions() get average marginal predictions variables plot_marginal_predictions() visual representation.","code":"dA <- d |> mutate(trt = \"Drug A\") dB <- d |> mutate(trt = \"Drug B\") predict(mod, newdata = dA, type = \"response\") |> mean() #> [1] 0.2830866 predict(mod, newdata = dB, type = \"response\") |> mean() #> [1] 0.3431492 avg_predictions(mod, variables = \"trt\", by = \"trt\", type = \"response\") #> #> trt Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> Drug A 0.283 0.0484 5.85 <0.001 27.6 0.188 0.378 #> Drug B 0.343 0.0490 7.01 <0.001 38.6 0.247 0.439 #> #> Type: response #> Columns: trt, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high avg_predictions(mod, variables = \"trt\", by = \"trt\") #> #> trt Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> Drug A 0.283 0.0484 5.85 <0.001 27.6 0.188 0.378 #> Drug B 0.343 0.0490 7.01 <0.001 38.6 0.247 0.439 #> #> Type: response #> Columns: trt, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high b <- binomial() predict(mod, newdata = dA, type = \"link\") |> mean() |> b$linkinv() #> [1] 0.2743123 predict(mod, newdata = dB, type = \"link\") |> mean() |> b$linkinv() #> [1] 0.3331447 mod |> tbl_regression( tidy_fun = tidy_marginal_predictions, type = \"response\", variables_list = \"no_interaction\", estimate_fun = scales::label_percent(accuracy = .1), label = list(age = \"Age in years\") ) |> modify_column_hide(\"p.value\") |> bold_labels() mod |> tbl_regression( tidy_fun = tidy_marginal_predictions, type = \"response\", estimate_fun = scales::label_percent(accuracy = .1), label = list(age = \"Age in years\") ) |> modify_column_hide(\"p.value\") |> bold_labels() p <- plot_marginal_predictions(mod, type = \"response\") |> patchwork::wrap_plots(ncol = 2) & ggplot2::scale_y_continuous( labels = scales::label_percent(), limits = c(-0.2, 1) ) p[[2]] <- p[[2]] + ggplot2::xlab(\"Age in years\") p + patchwork::plot_annotation( title = \"Average Marginal Predictions\" )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"marginal-means-and-marginal-predictions-at-marginal-means","dir":"Articles","previous_headings":"Marginal Predictions","what":"Marginal Means and Marginal Predictions at Marginal Means","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"emmeans package adopted, default, another approach based marginal means estimated marginal means (.k.. emmeans). consider grid predictors combinations observed modalities categorical variables fixing continuous variables means. Let’s call marginaleffects::predictions() newdata = \"marginalmeans\". can see, pred contains 8 rows, one combination trt (2 modalities) stage (4 modalities). age fixed mean (mean(d$age)) well marker. Let’s compute average predictions value stage. can check obtain estimates emmeans::emmeans(). estimates computed, categorical variable, marginaleffects::prediction() using datagrid(grid_type = \"balanced\")1. Marginal means defined categorical variables. However, can define marginal predictions marginal means continuous categorical variables, calling tidy_marginal_predictions() option newdata = \"marginalmeans\". categorical variables, marginal predictions marginal means equal marginal means.","code":"pred <- predictions(mod, newdata = \"marginalmeans\") pred #> #> Estimate Pr(>|z|) S 2.5 % 97.5 % #> 0.353 0.11462 3.1 0.2042 0.537 #> 0.194 < 0.001 10.8 0.0969 0.351 #> 0.318 0.07405 3.8 0.1678 0.519 #> 0.265 0.01648 5.9 0.1351 0.453 #> 0.419 0.39097 1.4 0.2541 0.604 #> 0.242 0.00282 8.5 0.1308 0.403 #> 0.381 0.24194 2.0 0.2147 0.581 #> 0.322 0.06889 3.9 0.1760 0.514 #> #> Type: invlink(link) #> Columns: rowid, estimate, p.value, s.value, conf.low, conf.high, trt, marker, stage, age, response pred |> group_by(stage) |> summarise(mean(estimate)) #> # A tibble: 4 × 2 #> stage `mean(estimate)` #> #> 1 T1 0.386 #> 2 T2 0.218 #> 3 T3 0.349 #> 4 T4 0.294 emmeans::emmeans(mod, \"stage\", type = \"response\") #> stage prob SE df asymp.LCL asymp.UCL #> T1 0.385 0.0813 Inf 0.242 0.551 #> T2 0.217 0.0611 Inf 0.120 0.359 #> T3 0.349 0.0874 Inf 0.201 0.532 #> T4 0.293 0.0788 Inf 0.164 0.466 #> #> Results are averaged over the levels of: trt #> Confidence level used: 0.95 #> Intervals are back-transformed from the logit scale predictions(mod, by = \"trt\", newdata = datagrid(grid_type = \"balanced\") ) #> #> trt Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> Drug A 0.282 0.0572 4.94 <0.001 20.3 0.170 0.394 #> Drug B 0.341 0.0584 5.84 <0.001 27.5 0.227 0.455 #> #> Type: response #> Columns: trt, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high predictions(mod, by = \"stage\", newdata = datagrid(grid_type = \"balanced\") ) #> #> stage Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> T1 0.386 0.0809 4.77 <0.001 19.0 0.2272 0.544 #> T2 0.218 0.0609 3.58 <0.001 11.5 0.0985 0.337 #> T3 0.349 0.0870 4.02 <0.001 14.0 0.1789 0.520 #> T4 0.294 0.0786 3.74 <0.001 12.4 0.1395 0.447 #> #> Type: response #> Columns: stage, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high mod |> tbl_regression( tidy_fun = tidy_marginal_predictions, newdata = \"marginalmeans\", variables_list = \"no_interaction\", estimate_fun = scales::label_percent(accuracy = .1), label = list(age = \"Age in years\") ) |> modify_column_hide(\"p.value\") |> bold_labels()"},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"marginal-predictions-at-the-median","dir":"Articles","previous_headings":"Marginal Predictions > Alternative approaches","what":"Marginal Predictions at the Median","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"similar marginal predictions mean, except continuous variables fixed median observed values (categorical variables mode). Simply use newdata = \"median\".","code":"mod |> tbl_regression( tidy_fun = tidy_marginal_predictions, newdata = \"median\", variables_list = \"no_interaction\", estimate_fun = scales::label_percent(accuracy = .1), label = list(age = \"Age in years\") ) |> modify_column_hide(\"p.value\") |> bold_labels()"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"the-ggeffectsggpredicts-approach","dir":"Articles","previous_headings":"Marginal Predictions > Alternative approaches","what":"the ggeffects::ggpredict()’s approach","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"ggeffects package offers ggeffects::ggpredict() function generates marginal predictions mean continuous variables first modality (used reference) categorical variables. broom.helpers provides tidy_ggpredict() tidier.","code":"mod |> tbl_regression( tidy_fun = tidy_ggpredict, estimate_fun = scales::label_percent(accuracy = .1), label = list(age = \"Age in years\") ) |> bold_labels() #> Some of the focal terms are of type `character`. This may lead to #> unexpected results. It is recommended to convert these variables to #> factors before fitting the model. #> The following variables are of type character: `trt` mod |> ggeffects::ggpredict() |> plot() |> patchwork::wrap_plots() #> Some of the focal terms are of type `character`. This may lead to #> unexpected results. It is recommended to convert these variables to #> factors before fitting the model. #> The following variables are of type character: `trt`"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"marginal-contrasts","dir":"Articles","previous_headings":"","what":"Marginal Contrasts","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"Now way estimate marginal predictions, can easily compute marginal contrasts, .e. difference marginal predictions.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"average-marginal-contrasts","dir":"Articles","previous_headings":"Marginal Contrasts","what":"Average Marginal Contrasts","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"Let’s consider first categorical variable, e.g. stage. Average Marginal Predictions obtained marginaleffects::avg_predictions(). contrast \"T2\" \"T1\" simply difference two adjusted predictions: marginaleffects::avg_comparisons() function allows compute differences adjusted predictions. Note: fact, avg_comparisons() computed contrasts observed values averaging . construction, equivalent difference average marginal predictions. contrast averaged observed values, can call average marginal contrast. default, modality contrasted first one taken reference. types contrasts specified using variables argument. Let’s consider continuous variable: default, marginaleffects::avg_comparisons() computes, observed value, effect increasing age one unit (comparing adjusted predictions regressor equal observed value minus 0.5 observed value plus 0.5). possible compute contrast another gap, example average difference increase 10 years: Contrasts individual predictors easily obtained: noted column names consistent tidiers used broom.helpers. Therefore, comparisons object passed directly tidy_plus_plus(). Instead, use broom.helpers::tidy_avg_comparisons(). custom tidier compatible tidy_plus_plus() suit functions provided broom.helpers. nicely formatted table can therefore generated gtsummary::tbl_regression(). Similarly, forest plot produced ggstats::ggcoef_model().","code":"pred <- avg_predictions(mod, variables = \"stage\", by = \"stage\", type = \"response\") pred #> #> stage Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> T1 0.389 0.0715 5.44 <0.001 24.2 0.249 0.529 #> T2 0.225 0.0577 3.91 <0.001 13.4 0.112 0.338 #> T3 0.354 0.0786 4.51 <0.001 17.2 0.200 0.508 #> T4 0.300 0.0706 4.25 <0.001 15.5 0.161 0.438 #> #> Type: response #> Columns: stage, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high pred$estimate[2] - pred$estimate[1] #> [1] -0.1637819 comp <- avg_comparisons(mod, variables = \"stage\") comp #> #> Contrast Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> T2 - T1 -0.1638 0.0925 -1.770 0.0767 3.7 -0.345 0.0175 #> T3 - T1 -0.0351 0.1065 -0.330 0.7417 0.4 -0.244 0.1736 #> T4 - T1 -0.0895 0.1004 -0.891 0.3727 1.4 -0.286 0.1073 #> #> Term: stage #> Type: response #> Columns: term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high avg_comparisons(mod, variables = \"stage\") #> #> Contrast Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> T2 - T1 -0.1638 0.0925 -1.770 0.0767 3.7 -0.345 0.0175 #> T3 - T1 -0.0351 0.1065 -0.330 0.7417 0.4 -0.244 0.1736 #> T4 - T1 -0.0895 0.1004 -0.891 0.3727 1.4 -0.286 0.1073 #> #> Term: stage #> Type: response #> Columns: term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high avg_comparisons(mod, variables = list(stage = \"sequential\")) #> #> Contrast Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> T2 - T1 -0.1638 0.0925 -1.770 0.0767 3.7 -0.3451 0.0175 #> T3 - T2 0.1287 0.0972 1.324 0.1856 2.4 -0.0619 0.3192 #> T4 - T3 -0.0544 0.1060 -0.513 0.6081 0.7 -0.2622 0.1535 #> #> Term: stage #> Type: response #> Columns: term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high avg_comparisons(mod, variables = list(stage = \"pairwise\")) #> #> Contrast Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> T2 - T1 -0.1638 0.0925 -1.770 0.0767 3.7 -0.3451 0.0175 #> T3 - T1 -0.0351 0.1065 -0.330 0.7417 0.4 -0.2437 0.1736 #> T3 - T2 0.1287 0.0972 1.324 0.1856 2.4 -0.0619 0.3192 #> T4 - T1 -0.0895 0.1004 -0.891 0.3727 1.4 -0.2862 0.1073 #> T4 - T2 0.0743 0.0917 0.811 0.4176 1.3 -0.1054 0.2540 #> T4 - T3 -0.0544 0.1060 -0.513 0.6081 0.7 -0.2622 0.1535 #> #> Term: stage #> Type: response #> Columns: term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high avg_comparisons(mod, variables = \"age\") #> #> Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> 0.00399 0.00239 1.67 0.0954 3.4 -7e-04 0.00868 #> #> Term: age #> Type: response #> Comparison: +1 #> Columns: term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high, predicted_lo, predicted_hi, predicted avg_comparisons(mod, variables = list(age = 10)) #> #> Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> 0.0412 0.0288 1.43 0.152 2.7 -0.0152 0.0976 #> #> Term: age #> Type: response #> Comparison: +10 #> Columns: term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high, predicted_lo, predicted_hi, predicted avg_comparisons(mod) #> #> Term Contrast Estimate Std. Error z Pr(>|z|) S 2.5 % #> age +1 0.00399 0.00239 1.667 0.0954 3.4 -0.00070 #> marker +1 0.07470 0.04150 1.800 0.0719 3.8 -0.00664 #> stage T2 - T1 -0.16378 0.09252 -1.770 0.0767 3.7 -0.34511 #> stage T3 - T1 -0.03509 0.10646 -0.330 0.7417 0.4 -0.24374 #> stage T4 - T1 -0.08947 0.10037 -0.891 0.3727 1.4 -0.28620 #> trt Drug B - Drug A 0.06006 0.06893 0.871 0.3836 1.4 -0.07504 #> 97.5 % #> 0.00868 #> 0.15604 #> 0.01755 #> 0.17356 #> 0.10726 #> 0.19517 #> #> Type: response #> Columns: term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high tidy_avg_comparisons(mod) #> # A tibble: 6 × 9 #> variable term estimate std.error statistic p.value s.value conf.low conf.high #> #> 1 age +1 0.00399 0.00239 1.67 0.0954 3.39 -7.00e-4 0.00868 #> 2 marker +1 0.0747 0.0415 1.80 0.0719 3.80 -6.64e-3 0.156 #> 3 stage T2 -… -0.164 0.0925 -1.77 0.0767 3.71 -3.45e-1 0.0175 #> 4 stage T3 -… -0.0351 0.106 -0.330 0.742 0.431 -2.44e-1 0.174 #> 5 stage T4 -… -0.0895 0.100 -0.891 0.373 1.42 -2.86e-1 0.107 #> 6 trt Drug… 0.0601 0.0689 0.871 0.384 1.38 -7.50e-2 0.195 mod |> tidy_plus_plus(tidy_fun = tidy_avg_comparisons) #> # A tibble: 6 × 20 #> term variable var_label var_class var_type var_nlevels contrasts #> #> 1 +1 age age nmatrix.2 continu… NA NA #> 2 +1 marker Marker Leve… numeric continu… NA NA #> 3 T2 - T1 stage T Stage factor categor… 4 contr.tr… #> 4 T3 - T1 stage T Stage factor categor… 4 contr.tr… #> 5 T4 - T1 stage T Stage factor categor… 4 contr.tr… #> 6 Drug B - Drug A trt Chemotherap… character dichoto… 2 contr.tr… #> # ℹ 13 more variables: contrasts_type , reference_row , label , #> # n_obs , n_event , estimate , std.error , #> # statistic , p.value , s.value , conf.low , #> # conf.high , label_attr mod |> tbl_regression( tidy_fun = tidy_avg_comparisons, estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() ggstats::ggcoef_model( mod, tidy_fun = tidy_avg_comparisons, variable_labels = c(age = \"Age in years\") ) + ggplot2::scale_x_continuous( labels = scales::label_percent(style_positive = \"plus\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"marginal-contrasts-at-the-mean","dir":"Articles","previous_headings":"Marginal Contrasts","what":"Marginal Contrasts at the Mean","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"Instead computing contrasts observed values averaging, another approach consist considering hypothetical individual whose characteristics correspond “average” predicting results computing contrasts. achieved marginaleffects using newdata = \"mean\". case, consider individual continuous predictors equal mean observed values categorical predictors set mode (.e. frequent value) observed values. newdata argument can passed tidy_avg_comparisons(), tidy_plus_plus gtsummary::tbl_regression(). ggstats::ggcoef_model(), use tidy_args pass newdata = \"mean\".","code":"pred <- predictions(mod, variables = \"trt\", newdata = \"mean\") pred #> #> marker stage age trt Estimate Pr(>|z|) S 2.5 % 97.5 % #> 0.919 T2 46.9 Drug A 0.194 < 0.001 10.8 0.0969 0.351 #> 0.919 T2 46.9 Drug B 0.242 0.00282 8.5 0.1308 0.403 #> #> Type: invlink(link) #> Columns: rowid, rowidcf, estimate, p.value, s.value, conf.low, conf.high, marker, stage, age, response, trt pred$estimate[2] - pred$estimate[1] #> [1] 0.04738154 comparisons(mod, variables = \"trt\", newdata = \"mean\") #> #> Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % marker stage age #> 0.0474 0.0579 0.819 0.413 1.3 -0.066 0.161 0.919 T2 46.9 #> #> Term: trt #> Type: response #> Comparison: Drug B - Drug A #> Columns: rowid, term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high, predicted_lo, predicted_hi, predicted, trt, marker, stage, age, response mod |> tbl_regression( tidy_fun = tidy_avg_comparisons, newdata = \"mean\", estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() mod |> ggstats::ggcoef_model( tidy_fun = tidy_avg_comparisons, tidy_args = list(newdata = \"mean\"), variable_labels = c(age = \"Age in years\") ) + ggplot2::scale_x_continuous( labels = scales::label_percent(style_positive = \"plus\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"alternative-approaches-1","dir":"Articles","previous_headings":"Marginal Contrasts","what":"Alternative approaches","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"assumptions, \"marginalmeans\" \"median\", defined using newdata. See documentation marginaleffects::comparisons().","code":"mod |> tbl_regression( tidy_fun = tidy_avg_comparisons, newdata = \"marginalmeans\", estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() mod |> ggstats::ggcoef_model( tidy_fun = tidy_avg_comparisons, tidy_args = list(newdata = \"marginalmeans\"), variable_labels = c(age = \"Age in years\") ) + ggplot2::scale_x_continuous( labels = scales::label_percent(style_positive = \"plus\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"dealing-with-interactions","dir":"Articles","previous_headings":"Marginal Contrasts","what":"Dealing with interactions","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"model, defined interaction trt marker. Therefore, interested compute contrast marker value trt. Alternatively, possible compute “cross-contrasts” showing happening marker trt changing. tidier tidy_marginal_contrasts() allows compute directly several combinations variables stack results unique tibble. default, interaction, contrasts computed last variable interaction according different values first variables (one variable continuous, using Tukey’s five numbers). option variables_list = \"cross\" used get “cross-contrasts” interactions. option variables_list = \"no_interaction\" used get average marginal contrasts variable without considering interactions. , display marginal contrasts mean, indicate newdata = \"mean\". information way customize combination variables, see documentation examples tidy_marginal_contrasts().","code":"avg_comparisons( mod, variables = list(marker = 1), newdata = datagrid( trt = unique, grid_type = \"counterfactual\" ), by = \"trt\" ) #> #> Term trt Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> marker Drug A 0.0472 0.0573 0.824 0.4101 1.3 -0.0651 0.159 #> marker Drug B 0.1004 0.0590 1.703 0.0887 3.5 -0.0152 0.216 #> #> Type: response #> Comparison: +1 #> Columns: term, contrast, trt, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high avg_comparisons( mod, variables = list(marker = 1, trt = \"reference\"), cross = TRUE ) #> #> C: marker C: trt Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> +1 Drug B - Drug A 0.161 0.0959 1.67 0.0941 3.4 -0.0274 0.348 #> #> Type: response #> Columns: term, contrast_marker, contrast_trt, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high, predicted_lo, predicted_hi, predicted mod |> tbl_regression( tidy_fun = tidy_marginal_contrasts, estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() ggstats::ggcoef_model( mod, tidy_fun = tidy_marginal_contrasts, variable_labels = c(age = \"Age in years\") ) mod |> tbl_regression( tidy_fun = tidy_marginal_contrasts, variables_list = \"cross\", estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() mod |> tbl_regression( tidy_fun = tidy_marginal_contrasts, variables_list = \"no_interaction\", estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() ggstats::ggcoef_model( mod, tidy_fun = tidy_marginal_contrasts, tidy_args = list(variables_list = \"no_interaction\"), variable_labels = c(age = \"Age in years\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"marginal-effects-marginal-slopes","dir":"Articles","previous_headings":"","what":"Marginal Effects / Marginal Slopes","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"Marginal effects similar marginal contrasts subtle difference. continuous regressor, marginal contrast seen difference marginal effect partial derivative. Put differently, marginal effect continuous regressor xx slope prediction function yy, measured specific value xx, .e. ∂y/∂x{\\partial y}/{\\partial x}. Marginal effects expressed according scale model represent expected change outcome increase one unit regressor. definition, marginal effects defined categorical variables, marginal contrasts reported instead. Like marginal contrasts, several approaches exist compute marginal effects. details, see dedicated vignette marginaleffects package.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"average-marginal-effects-ame","dir":"Articles","previous_headings":"Marginal Effects / Marginal Slopes","what":"Average Marginal Effects (AME)","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"marginal effect computed observed values averaged marginaleffects::avg_slopes(). Column names consistent tidiers used broom.helpers. Use tidy_avg_slopes() instead. Please note categorical variables, marginal contrasts returned. results obtained margins::margins() function inspired Stata’s margins command. margins::margins() compatible stats::poly(), rewrite model, replacing poly(age, 2) age + age^2. broom.helpers, gtsummary ggstats, use tidy_margins().","code":"avg_slopes(mod) #> #> Term Contrast Estimate Std. Error z Pr(>|z|) S 2.5 % #> age dY/dX 0.00397 0.00237 1.679 0.0932 3.4 -0.000666 #> marker dY/dX 0.07104 0.03818 1.861 0.0628 4.0 -0.003781 #> stage T2 - T1 -0.16378 0.09252 -1.770 0.0767 3.7 -0.345109 #> stage T3 - T1 -0.03509 0.10646 -0.330 0.7417 0.4 -0.243740 #> stage T4 - T1 -0.08947 0.10037 -0.891 0.3727 1.4 -0.286204 #> trt Drug B - Drug A 0.06006 0.06893 0.871 0.3836 1.4 -0.075043 #> 97.5 % #> 0.00861 #> 0.14587 #> 0.01755 #> 0.17356 #> 0.10726 #> 0.19517 #> #> Type: response #> Columns: term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high mod |> tbl_regression( tidy_fun = tidy_avg_slopes, estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() mod |> ggstats::ggcoef_model( tidy_fun = tidy_avg_slopes, variable_labels = c(age = \"Age in years\") ) + ggplot2::scale_x_continuous( labels = scales::label_percent(style_positive = \"plus\") ) mod_alt <- glm( response ~ trt * marker + stage + age + age^2, data = d, family = binomial ) margins::margins(mod_alt) |> tidy() #> # A tibble: 6 × 5 #> term estimate std.error statistic p.value #> #> 1 age 0.00397 0.00236 1.68 0.0927 #> 2 marker 0.0710 0.0380 1.87 0.0617 #> 3 stageT2 -0.164 0.0922 -1.78 0.0754 #> 4 stageT3 -0.0351 0.106 -0.330 0.742 #> 5 stageT4 -0.0895 0.100 -0.891 0.373 #> 6 trtDrug B 0.0600 0.0689 0.871 0.384 mod_alt |> tbl_regression( tidy_fun = tidy_margins, estimate_fun = scales::label_percent(style_positive = \"plus\") ) |> bold_labels()"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"marginal-effects-at-the-mean-mem","dir":"Articles","previous_headings":"Marginal Effects / Marginal Slopes","what":"Marginal Effects at the Mean (MEM)","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"marginal effects mean2, simple use newdata = \"mean\".","code":"mod |> tbl_regression( tidy_fun = tidy_avg_slopes, newdata = \"mean\", estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() mod |> ggstats::ggcoef_model( tidy_fun = tidy_avg_slopes, tidy_args = list(newdata = \"mean\"), variable_labels = c(age = \"Age in years\") ) + ggplot2::scale_x_continuous( labels = scales::label_percent(style_positive = \"plus\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"marginal-effects-at-marginal-means","dir":"Articles","previous_headings":"Marginal Effects / Marginal Slopes","what":"Marginal Effects at Marginal Means","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"Simply use newdata = \"marginalmeans\".","code":"mod |> tbl_regression( tidy_fun = tidy_avg_slopes, newdata = \"marginalmeans\", estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() mod |> ggstats::ggcoef_model( tidy_fun = tidy_avg_slopes, tidy_args = list(newdata = \"marginalmeans\"), variable_labels = c(age = \"Age in years\") ) + ggplot2::scale_x_continuous( labels = scales::label_percent(style_positive = \"plus\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"further-readings","dir":"Articles","previous_headings":"","what":"Further readings","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"Documentation marginaleffects package Vincent Arel-Bundock Marginalia: guide figuring heck marginal effects, marginal slopes, average marginal effects, marginal effects mean, marginal things Andrew Heiss Introduction Adjusted Predictions Marginal Effects R Daniel Lüdecke Introduction margins","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"forest-plot","dir":"Articles","previous_headings":"","what":"Forest Plot","title":"Getting Started with broom.helpers","text":"create figure, ’ll need add information tidy tibble, .e. ’ll need group terms belong variable, add reference row, etc. Parsing information can difficult, broom.helper package made simple. Note: used tidy_and_attach() instead broom::tidy(). broom.helpers functions needs copy original model. avoid passing model step, easier way attach model attribute tibble tidy_attach_model(). tidy_and_attach() simply shortcut model |> broom::tidy() |> tidy_and_attach(model). now tibble every piece information need create forest plot using ggplot2. Note:: advanced nicely formatted plots model coefficients, look ggstats::ggcoef_model() dedicated vignette. ggstats::ggcoef_model() internally uses broom.helpers.","code":"tidy_forest <- model_logit |> # perform initial tidying of the model tidy_and_attach(exponentiate = TRUE, conf.int = TRUE) |> # adding in the reference row for categorical variables tidy_add_reference_rows() |> # adding a reference value to appear in plot tidy_add_estimate_to_reference_rows() |> # adding the variable labels tidy_add_term_labels() |> # removing intercept estimate from model tidy_remove_intercept() tidy_forest #> # A tibble: 5 × 16 #> term variable var_label var_class var_type var_nlevels contrasts #> #> 1 trtDrug A trt Chemotherapy Trea… character dichoto… 2 contr.tr… #> 2 trtDrug B trt Chemotherapy Trea… character dichoto… 2 contr.tr… #> 3 gradeI grade Grade factor categor… 3 contr.tr… #> 4 gradeII grade Grade factor categor… 3 contr.tr… #> 5 gradeIII grade Grade factor categor… 3 contr.tr… #> # ℹ 9 more variables: contrasts_type , reference_row , label , #> # estimate , std.error , statistic , p.value , #> # conf.low , conf.high tidy_forest |> mutate( plot_label = paste(var_label, label, sep = \":\") |> forcats::fct_inorder() |> forcats::fct_rev() ) |> ggplot(aes(x = plot_label, y = estimate, ymin = conf.low, ymax = conf.high, color = variable)) + geom_hline(yintercept = 1, linetype = 2) + geom_pointrange() + coord_flip() + theme(legend.position = \"none\") + labs( y = \"Odds Ratio\", x = \" \", title = \"Forest Plot using broom.helpers\" )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"table-summary","dir":"Articles","previous_headings":"","what":"Table Summary","title":"Getting Started with broom.helpers","text":"addition aiding figure creation, broom.helpers package can help summarize model table. example , add header reference rows, utilize existing variable labels. Let’s change labels shown summary table well. Note:: advanced nicely formatted tables model coefficients, look gtsummary::tbl_regression() dedicated vignette. gtsummary::tbl_regression() internally uses broom.helpers.","code":"tidy_table <- model_logit |> # perform initial tidying of the model tidy_and_attach(exponentiate = TRUE, conf.int = TRUE) |> # adding in the reference row for categorical variables tidy_add_reference_rows() |> # adding the variable labels tidy_add_term_labels() |> # add header row tidy_add_header_rows() |> # removing intercept estimate from model tidy_remove_intercept() # print summary table options(knitr.kable.NA = \"\") tidy_table |> # format model estimates select(label, estimate, conf.low, conf.high, p.value) |> mutate(across(all_of(c(\"estimate\", \"conf.low\", \"conf.high\")), style_ratio)) |> mutate(across(p.value, style_pvalue)) |> print_table()"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"all-in-one-function","dir":"Articles","previous_headings":"","what":"All-in-one function","title":"Getting Started with broom.helpers","text":"also handy wrapper, called tidy_plus_plus(), commonly used tidy_*() functions, can executed single line code: See documentation tidy_plus_plus() full list available options.","code":"model_logit |> tidy_plus_plus(exponentiate = TRUE) #> # A tibble: 5 × 18 #> term variable var_label var_class var_type var_nlevels contrasts #> #> 1 trtDrug A trt Chemotherapy Trea… character dichoto… 2 contr.tr… #> 2 trtDrug B trt Chemotherapy Trea… character dichoto… 2 contr.tr… #> 3 gradeI grade Grade factor categor… 3 contr.tr… #> 4 gradeII grade Grade factor categor… 3 contr.tr… #> 5 gradeIII grade Grade factor categor… 3 contr.tr… #> # ℹ 11 more variables: contrasts_type , reference_row , label , #> # n_obs , n_event , estimate , std.error , #> # statistic , p.value , conf.low , conf.high model_logit |> tidy_plus_plus(exponentiate = TRUE) |> print_table()"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"advanced-examples","dir":"Articles","previous_headings":"","what":"Advanced examples","title":"Getting Started with broom.helpers","text":"broom.helpers can also handle different contrasts categorical variables use polynomial terms continuous variables.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"polynomial-terms","dir":"Articles","previous_headings":"Advanced examples","what":"Polynomial terms","title":"Getting Started with broom.helpers","text":"polynomial terms continuous variable defined stats::poly(), broom.helpers able identify corresponding variable, create appropriate labels add header rows.","code":"model_poly <- glm(response ~ poly(age, 3) + ttdeath, na.omit(trial), family = binomial) model_poly |> tidy_plus_plus( exponentiate = TRUE, add_header_rows = TRUE, variable_labels = c(age = \"Age in years\") ) |> print_table()"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"different-type-of-contrasts","dir":"Articles","previous_headings":"Advanced examples","what":"Different type of contrasts","title":"Getting Started with broom.helpers","text":"default, categorical variables coded treatment contrasts (see stats::contr.treatment()). contrasts, model coefficients correspond effect modality compared reference modality (default, first one). tidy_add_reference_rows() allows add row reference modality tidy_add_estimate_to_reference_rows() populate estimate value references rows 0 (1 exponentiate = TRUE). tidy_add_term_labels() able retrieve label factor level associated specific model term. Using stats::contr.treatment(), possible defined alternative reference rows. properly managed broom.helpers. can also use sum contrasts (cf. stats::contr.sum()). case, model coefficient corresponds difference modality grand mean. variable 4 modalities coded 3 terms. However, value computed (using emmeans::emmeans()) last modality, corresponding difference modality grand mean equal sum coefficients multiplied -1. broom.helpers identify categorical variables coded sum contrasts retrieve estimate value reference term. types contrasts exist, like Helmert (contr.helmert()) polynomial (contr.poly()). complex modality coded combination terms. Therefore, contrasts, possible associate specific model term level original factor. broom.helpers add reference term case.","code":"model_1 <- glm( response ~ stage + grade * trt, gtsummary::trial, family = binomial ) model_1 |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_reference_rows() |> tidy_add_estimate_to_reference_rows(exponentiate = TRUE) |> tidy_add_term_labels() |> print_table() model_2 <- glm( response ~ stage + grade * trt, gtsummary::trial, family = binomial, contrasts = list( stage = contr.treatment(4, base = 3), grade = contr.treatment(3, base = 2), trt = contr.treatment(2, base = 2) ) ) model_2 |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_reference_rows() |> tidy_add_estimate_to_reference_rows(exponentiate = TRUE) |> tidy_add_term_labels() |> print_table() model_3 <- glm( response ~ stage + grade * trt, gtsummary::trial, family = binomial, contrasts = list( stage = contr.sum, grade = contr.sum, trt = contr.sum ) ) model_3 |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_reference_rows() |> tidy_add_estimate_to_reference_rows(exponentiate = TRUE) |> tidy_add_term_labels() |> print_table() model_4 <- glm( response ~ stage + grade * trt, gtsummary::trial, family = binomial, contrasts = list( stage = contr.poly, grade = contr.helmert, trt = contr.poly ) ) model_4 |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_reference_rows() |> tidy_add_estimate_to_reference_rows(exponentiate = TRUE) |> tidy_add_term_labels() |> print_table()"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"pairwise-contrasts-of-categorical-variable","dir":"Articles","previous_headings":"Advanced examples","what":"Pairwise contrasts of categorical variable","title":"Getting Started with broom.helpers","text":"Pairwise contrasts categorical variables computed tidy_add_pairwise_contrasts().","code":"model_logit <- glm(response ~ age + trt + grade, trial, family = binomial) model_logit |> tidy_and_attach() |> tidy_add_pairwise_contrasts() |> print_table() model_logit |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_pairwise_contrasts() |> print_table() model_logit |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_pairwise_contrasts(pairwise_reverse = FALSE) |> print_table() model_logit |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_pairwise_contrasts(keep_model_terms = TRUE) |> print_table()"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"column-details","dir":"Articles","previous_headings":"","what":"Column Details","title":"Getting Started with broom.helpers","text":"summary additional columns may added broom.helpers function. table includes column name, function adds column, short description information column. Note: tidy_add_estimate_to_reference_rows() create additional column; rather, populates ‘estimate’ column reference rows.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"additional-attributes","dir":"Articles","previous_headings":"","what":"Additional attributes","title":"Getting Started with broom.helpers","text":"list additional attributes broom.helpers may attached results. table includes attribute name, function adds attribute, short description.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"supported-models","dir":"Articles","previous_headings":"","what":"Supported models","title":"Getting Started with broom.helpers","text":"Note: list models tested. broom.helpers may may work properly partially types models. hesitate provide feedback GitHub.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Joseph Larmarange. Author, maintainer. Daniel D. Sjoberg. Author.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Larmarange J, Sjoberg D (2025). broom.helpers: Helpers Model Coefficients Tibbles. R package version 1.18.0.9000, https://github.com/larmarange/broom.helpers, https://larmarange.github.io/broom.helpers/.","code":"@Manual{, title = {broom.helpers: Helpers for Model Coefficients Tibbles}, author = {Joseph Larmarange and Daniel D. Sjoberg}, year = {2025}, note = {R package version 1.18.0.9000, https://github.com/larmarange/broom.helpers}, url = {https://larmarange.github.io/broom.helpers/}, }"},{"path":"https://larmarange.github.io/broom.helpers/dev/index.html","id":"broomhelpers-","dir":"","previous_headings":"","what":"Helpers for Model Coefficients Tibbles","title":"Helpers for Model Coefficients Tibbles","text":"broom.helpers package provides suite functions work regression model broom::tidy() tibbles. suite includes functions group regression model terms variable, insert reference header rows categorical variables, add variable labels, . broom.helpers used, particular, gtsummary::tbl_regression() producing nice formatted tables model coefficients ggstats::ggcoef_model() plotting model coefficients.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/index.html","id":"installation--documentation","dir":"","previous_headings":"","what":"Installation & Documentation","title":"Helpers for Model Coefficients Tibbles","text":"install stable version: Documentation stable version: https://larmarange.github.io/broom.helpers/ install development version: Documentation development version: https://larmarange.github.io/broom.helpers/dev/","code":"install.packages(\"broom.helpers\") remotes::install_github(\"larmarange/broom.helpers\")"},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/index.html","id":"all-in-one-wrapper","dir":"","previous_headings":"Examples","what":"all-in-one wrapper","title":"Helpers for Model Coefficients Tibbles","text":"","code":"mod1 <- lm(Sepal.Length ~ Sepal.Width + Species, data = iris) library(broom.helpers) ex1 <- mod1 |> tidy_plus_plus() ex1 #> # A tibble: 4 × 17 #> term variable var_label var_class var_type var_nlevels contrasts #> #> 1 Sepal.Width Sepal.Wi… Sepal.Wi… numeric continu… NA #> 2 Speciessetosa Species Species factor categor… 3 contr.tr… #> 3 Speciesversicolor Species Species factor categor… 3 contr.tr… #> 4 Speciesvirginica Species Species factor categor… 3 contr.tr… #> # ℹ 10 more variables: contrasts_type , reference_row , label , #> # n_obs , estimate , std.error , statistic , #> # p.value , conf.low , conf.high dplyr::glimpse(ex1) #> Rows: 4 #> Columns: 17 #> $ term \"Sepal.Width\", \"Speciessetosa\", \"Speciesversicolor\", \"S… #> $ variable \"Sepal.Width\", \"Species\", \"Species\", \"Species\" #> $ var_label \"Sepal.Width\", \"Species\", \"Species\", \"Species\" #> $ var_class \"numeric\", \"factor\", \"factor\", \"factor\" #> $ var_type \"continuous\", \"categorical\", \"categorical\", \"categorica… #> $ var_nlevels NA, 3, 3, 3 #> $ contrasts NA, \"contr.treatment\", \"contr.treatment\", \"contr.treatm… #> $ contrasts_type NA, \"treatment\", \"treatment\", \"treatment\" #> $ reference_row NA, TRUE, FALSE, FALSE #> $ label \"Sepal.Width\", \"setosa\", \"versicolor\", \"virginica\" #> $ n_obs 150, 50, 50, 50 #> $ estimate 0.8035609, 0.0000000, 1.4587431, 1.9468166 #> $ std.error 0.1063390, NA, 0.1121079, 0.1000150 #> $ statistic 7.556598, NA, 13.011954, 19.465255 #> $ p.value 4.187340e-12, NA, 3.478232e-26, 2.094475e-42 #> $ conf.low 0.5933983, NA, 1.2371791, 1.7491525 #> $ conf.high 1.013723, NA, 1.680307, 2.144481 mod2 <- glm( response ~ poly(age, 3) + stage + grade * trt, na.omit(gtsummary::trial), family = binomial, contrasts = list( stage = contr.treatment(4, base = 3), grade = contr.sum ) ) ex2 <- mod2 |> tidy_plus_plus( exponentiate = TRUE, variable_labels = c(age = \"Age (in years)\"), add_header_rows = TRUE, show_single_row = \"trt\" ) ex2 #> # A tibble: 17 × 19 #> term variable var_label var_class var_type var_nlevels header_row contrasts #> #> 1 age Age (in … nmatrix.3 continu… NA TRUE #> 2 poly(… age Age (in … nmatrix.3 continu… NA FALSE #> 3 poly(… age Age (in … nmatrix.3 continu… NA FALSE #> 4 poly(… age Age (in … nmatrix.3 continu… NA FALSE #> 5 stage T Stage factor categor… 4 TRUE contr.tr… #> 6 stage1 stage T Stage factor categor… 4 FALSE contr.tr… #> 7 stage2 stage T Stage factor categor… 4 FALSE contr.tr… #> 8 stage3 stage T Stage factor categor… 4 FALSE contr.tr… #> 9 stage4 stage T Stage factor categor… 4 FALSE contr.tr… #> 10 grade Grade factor categor… 3 TRUE contr.sum #> 11 grade1 grade Grade factor categor… 3 FALSE contr.sum #> 12 grade2 grade Grade factor categor… 3 FALSE contr.sum #> 13 grade3 grade Grade factor categor… 3 FALSE contr.sum #> 14 trtDr… trt Chemothe… character dichoto… 2 NA contr.tr… #> 15 grade:t… Grade * … interac… NA TRUE #> 16 grade… grade:t… Grade * … interac… NA FALSE #> 17 grade… grade:t… Grade * … interac… NA FALSE #> # ℹ 11 more variables: contrasts_type , reference_row , label , #> # n_obs , n_event , estimate , std.error , #> # statistic , p.value , conf.low , conf.high dplyr::glimpse(ex2) #> Rows: 17 #> Columns: 19 #> $ term NA, \"poly(age, 3)1\", \"poly(age, 3)2\", \"poly(age, 3)3\", … #> $ variable \"age\", \"age\", \"age\", \"age\", \"stage\", \"stage\", \"stage\", … #> $ var_label \"Age (in years)\", \"Age (in years)\", \"Age (in years)\", \"… #> $ var_class \"nmatrix.3\", \"nmatrix.3\", \"nmatrix.3\", \"nmatrix.3\", \"fa… #> $ var_type \"continuous\", \"continuous\", \"continuous\", \"continuous\",… #> $ var_nlevels NA, NA, NA, NA, 4, 4, 4, 4, 4, 3, 3, 3, 3, 2, NA, NA, NA #> $ header_row TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, F… #> $ contrasts NA, NA, NA, NA, \"contr.treatment(base=3)\", \"contr.treat… #> $ contrasts_type NA, NA, NA, NA, \"treatment\", \"treatment\", \"treatment\", … #> $ reference_row NA, NA, NA, NA, NA, FALSE, FALSE, TRUE, FALSE, NA, FALS… #> $ label \"Age (in years)\", \"Age (in years)\", \"Age (in years)²\", … #> $ n_obs NA, 173, 173, 173, NA, 46, 50, 35, 42, NA, 63, 53, 57, … #> $ n_event NA, 54, 54, 54, NA, 17, 12, 13, 12, NA, 20, 16, 18, 30,… #> $ estimate NA, 20.2416394, 1.2337899, 0.4931553, NA, 1.0047885, 0.… #> $ std.error NA, 2.3254455, 2.3512842, 2.3936657, NA, 0.4959893, 0.5… #> $ statistic NA, 1.29340459, 0.08935144, -0.29533409, NA, 0.00963137… #> $ p.value NA, 0.1958712, 0.9288026, 0.7677387, NA, 0.9923154, 0.1… #> $ conf.low NA, 0.225454425, 0.007493208, 0.004745694, NA, 0.379776… #> $ conf.high NA, 2315.587655, 100.318341, 74.226179, NA, 2.683385, 1…"},{"path":"https://larmarange.github.io/broom.helpers/dev/index.html","id":"fine-control","dir":"","previous_headings":"Examples","what":"fine control","title":"Helpers for Model Coefficients Tibbles","text":"","code":"ex3 <- mod1 |> # perform initial tidying of model tidy_and_attach() |> # add reference row tidy_add_reference_rows() |> # add term labels tidy_add_term_labels() |> # remove intercept tidy_remove_intercept() ex3 #> # A tibble: 4 × 16 #> term variable var_label var_class var_type var_nlevels contrasts #> #> 1 Sepal.Width Sepal.Wi… Sepal.Wi… numeric continu… NA #> 2 Speciessetosa Species Species factor categor… 3 contr.tr… #> 3 Speciesversicolor Species Species factor categor… 3 contr.tr… #> 4 Speciesvirginica Species Species factor categor… 3 contr.tr… #> # ℹ 9 more variables: contrasts_type , reference_row , label , #> # estimate , std.error , statistic , p.value , #> # conf.low , conf.high dplyr::glimpse(ex3) #> Rows: 4 #> Columns: 16 #> $ term \"Sepal.Width\", \"Speciessetosa\", \"Speciesversicolor\", \"S… #> $ variable \"Sepal.Width\", \"Species\", \"Species\", \"Species\" #> $ var_label \"Sepal.Width\", \"Species\", \"Species\", \"Species\" #> $ var_class \"numeric\", \"factor\", \"factor\", \"factor\" #> $ var_type \"continuous\", \"categorical\", \"categorical\", \"categorica… #> $ var_nlevels NA, 3, 3, 3 #> $ contrasts NA, \"contr.treatment\", \"contr.treatment\", \"contr.treatm… #> $ contrasts_type NA, \"treatment\", \"treatment\", \"treatment\" #> $ reference_row NA, TRUE, FALSE, FALSE #> $ label \"Sepal.Width\", \"setosa\", \"versicolor\", \"virginica\" #> $ estimate 0.8035609, NA, 1.4587431, 1.9468166 #> $ std.error 0.1063390, NA, 0.1121079, 0.1000150 #> $ statistic 7.556598, NA, 13.011954, 19.465255 #> $ p.value 4.187340e-12, NA, 3.478232e-26, 2.094475e-42 #> $ conf.low 0.5933983, NA, 1.2371791, 1.7491525 #> $ conf.high 1.013723, NA, 1.680307, 2.144481 ex4 <- mod2 |> # perform initial tidying of model tidy_and_attach(exponentiate = TRUE) |> # add variable labels, including a custom value for age tidy_add_variable_labels(labels = c(age = \"Age in years\")) |> # add reference rows for categorical variables tidy_add_reference_rows() |> # add a, estimate value of reference terms tidy_add_estimate_to_reference_rows(exponentiate = TRUE) |> # add header rows for categorical variables tidy_add_header_rows() ex4 #> # A tibble: 20 × 17 #> term variable var_label var_class var_type var_nlevels header_row contrasts #> #> 1 (Inte… (Interc… (Interce… interce… NA NA #> 2 age Age in y… nmatrix.3 continu… NA TRUE #> 3 poly(… age Age in y… nmatrix.3 continu… NA FALSE #> 4 poly(… age Age in y… nmatrix.3 continu… NA FALSE #> 5 poly(… age Age in y… nmatrix.3 continu… NA FALSE #> 6 stage T Stage factor categor… 4 TRUE contr.tr… #> 7 stage1 stage T Stage factor categor… 4 FALSE contr.tr… #> 8 stage2 stage T Stage factor categor… 4 FALSE contr.tr… #> 9 stage3 stage T Stage factor categor… 4 FALSE contr.tr… #> 10 stage4 stage T Stage factor categor… 4 FALSE contr.tr… #> 11 grade Grade factor categor… 3 TRUE contr.sum #> 12 grade1 grade Grade factor categor… 3 FALSE contr.sum #> 13 grade2 grade Grade factor categor… 3 FALSE contr.sum #> 14 grade3 grade Grade factor categor… 3 FALSE contr.sum #> 15 trt Chemothe… character dichoto… 2 TRUE contr.tr… #> 16 trtDr… trt Chemothe… character dichoto… 2 FALSE contr.tr… #> 17 trtDr… trt Chemothe… character dichoto… 2 FALSE contr.tr… #> 18 grade:t… Grade * … interac… NA TRUE #> 19 grade… grade:t… Grade * … interac… NA FALSE #> 20 grade… grade:t… Grade * … interac… NA FALSE #> # ℹ 9 more variables: contrasts_type , reference_row , label , #> # estimate , std.error , statistic , p.value , #> # conf.low , conf.high dplyr::glimpse(ex4) #> Rows: 20 #> Columns: 17 #> $ term \"(Intercept)\", NA, \"poly(age, 3)1\", \"poly(age, 3)2\", \"p… #> $ variable \"(Intercept)\", \"age\", \"age\", \"age\", \"age\", \"stage\", \"st… #> $ var_label \"(Intercept)\", \"Age in years\", \"Age in years\", \"Age in … #> $ var_class NA, \"nmatrix.3\", \"nmatrix.3\", \"nmatrix.3\", \"nmatrix.3\",… #> $ var_type \"intercept\", \"continuous\", \"continuous\", \"continuous\", … #> $ var_nlevels NA, NA, NA, NA, NA, 4, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2,… #> $ header_row NA, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALS… #> $ contrasts NA, NA, NA, NA, NA, \"contr.treatment(base=3)\", \"contr.t… #> $ contrasts_type NA, NA, NA, NA, NA, \"treatment\", \"treatment\", \"treatmen… #> $ reference_row NA, NA, NA, NA, NA, NA, FALSE, FALSE, TRUE, FALSE, NA, … #> $ label \"(Intercept)\", \"Age in years\", \"Age in years\", \"Age in … #> $ estimate 0.5266376, NA, 20.2416394, 1.2337899, 0.4931553, NA, 1.… #> $ std.error 0.4130930, NA, 2.3254455, 2.3512842, 2.3936657, NA, 0.4… #> $ statistic -1.55229592, NA, 1.29340459, 0.08935144, -0.29533409, N… #> $ p.value 0.1205914, NA, 0.1958712, 0.9288026, 0.7677387, NA, 0.9… #> $ conf.low 0.227717775, NA, 0.225454425, 0.007493208, 0.004745694,… #> $ conf.high 1.164600, NA, 2315.587655, 100.318341, 74.226179, NA, 2…"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/assert_package.html","id":null,"dir":"Reference","previous_headings":"","what":"Check a package installation status or minimum required version — assert_package","title":"Check a package installation status or minimum required version — assert_package","text":"function .assert_package() checks whether package installed returns error FALSE available. package search provided, function check whether minimum version package required. function .get_package_dependencies() returns tibble dependencies specific package. Finally, .get_min_version_required() return, , minimum version pkg required pkg_search, NULL minimum version required.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/assert_package.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check a package installation status or minimum required version — assert_package","text":"","code":".assert_package(pkg, fn = NULL, pkg_search = \"broom.helpers\", boolean = FALSE) .get_package_dependencies(pkg_search = \"broom.helpers\") .get_all_packages_dependencies( pkg_search = NULL, remove_duplicates = FALSE, lib.loc = NULL ) .get_min_version_required(pkg, pkg_search = \"broom.helpers\")"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/assert_package.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check a package installation status or minimum required version — assert_package","text":"pkg (string) Name required package. fn (string) Name calling function user perspective. Used write informative error messages. pkg_search (string) Name package function search minimum required version . boolean (logical) Whether return TRUE/FALSE, rather error package/package version available. Default FALSE, return error pkg installed. remove_duplicates (logical) several versions package installed, first one returned? lib.loc (string) Location R library trees search , see utils::installed.packages().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/assert_package.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check a package installation status or minimum required version — assert_package","text":"logical error .assert_package(), NULL character minimum version required .get_min_version_required(), tibble .get_package_dependencies().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/assert_package.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Check a package installation status or minimum required version — assert_package","text":"get_all_packages_dependencies() used get list dependencies installed packages.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/assert_package.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check a package installation status or minimum required version — assert_package","text":"","code":"if (FALSE) { # interactive() .assert_package(\"broom\", boolean = TRUE) .get_package_dependencies() .get_min_version_required(\"brms\") }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-clean_backticks.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove backticks around variable names — .clean_backticks","title":"Remove backticks around variable names — .clean_backticks","text":"Remove backticks around variable names","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-clean_backticks.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove backticks around variable names — .clean_backticks","text":"","code":".clean_backticks(x, variable_names = x)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-clean_backticks.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove backticks around variable names — .clean_backticks","text":"x (string) character vector cleaned. variable_names (string) Optional vector variable names, obtained model_list_variables(only_variable = TRUE), properly take account interaction terms/variables.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-escape_regex.html","id":null,"dir":"Reference","previous_headings":"","what":"Escapes any characters that would have special meaning in a regular expression — .escape_regex","title":"Escapes any characters that would have special meaning in a regular expression — .escape_regex","text":"functions adapted Hmisc::escapeRegex()","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-escape_regex.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Escapes any characters that would have special meaning in a regular expression — .escape_regex","text":"","code":".escape_regex(string)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-escape_regex.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Escapes any characters that would have special meaning in a regular expression — .escape_regex","text":"string (string) character vector.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-formula_list_to_named_list.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert formula selector to a named list — .formula_list_to_named_list","title":"Convert formula selector to a named list — .formula_list_to_named_list","text":"function soon removed broom.helpers. Please consider cards::process_formula_selectors() alternative.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-formula_list_to_named_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert formula selector to a named list — .formula_list_to_named_list","text":"","code":".formula_list_to_named_list( x, data = NULL, var_info = NULL, arg_name = NULL, select_single = FALSE, type_check = NULL, type_check_msg = NULL, null_allowed = TRUE )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-formula_list_to_named_list.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert formula selector to a named list — .formula_list_to_named_list","text":"x list selecting formulas data data frame select columns . Default NULL var_info data frame variable names attributes. May also pass character vector variable names. Default NULL arg_name Optional string indicating source argument name. helps error messaging. Default NULL. select_single Logical indicating whether result must single variable. Default FALSE type_check predicate function checks elements passed RHS formulas x= (element named list) satisfy function. type_check_msg type_check= fails, string provided printed error message. NULL, generic error message printed. null_allowed NULL values accepted right hand side formulas?","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-formula_list_to_named_list.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Convert formula selector to a named list — .formula_list_to_named_list","text":"Functions takes list formulas, named list, combination named elements formula elements returns named list. example, list(age = 1, starts_with(\"stage\") ~ 2).","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-formula_list_to_named_list.html","id":"shortcuts","dir":"Reference","previous_headings":"","what":"Shortcuts","title":"Convert formula selector to a named list — .formula_list_to_named_list","text":"shortcut specifying option applied columns/variables omitting LHS formula. example, list(~ 1) equivalent passing list(everything() ~ 1). Additionally, single formula may passed instead placing single formula list; e.g. everything() ~ 1 equivalent passing list(everything() ~ 1)","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-generic_selector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate a custom selector function — .generic_selector","text":"","code":".generic_selector(variable_column, select_column, select_expr, fun_name) .is_selector_scoped(variable_column, select_column)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-generic_selector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate a custom selector function — .generic_selector","text":"variable_column string indicating column variable names stored select_column character vector columns used select_expr= argument select_expr unquoted predicate command subset data frame select variables fun_name quoted name function .generic_selector() used. helps error messaging.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-generic_selector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate a custom selector function — .generic_selector","text":"custom selector functions","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-generic_selector.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Generate a custom selector function — .generic_selector","text":".is_selector_scoped() checks selector properly registered env_variable_type$df_var_info.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-select_to_varnames.html","id":null,"dir":"Reference","previous_headings":"","what":"Variable selector — .select_to_varnames","title":"Variable selector — .select_to_varnames","text":"function soon removed broom.helpers. Please consider cards::process_selectors() alternative.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-select_to_varnames.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Variable selector — .select_to_varnames","text":"","code":".select_to_varnames( select, data = NULL, var_info = NULL, arg_name = NULL, select_single = FALSE )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-select_to_varnames.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Variable selector — .select_to_varnames","text":"select single object selecting variables, e.g. c(age, stage), starts_with(\"age\") data data frame select columns . Default NULL var_info data frame variable names attributes. May also pass character vector variable names. Default NULL arg_name Optional string indicating source argument name. helps error messaging. Default NULL. select_single Logical indicating whether result must single variable. Default FALSE","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-select_to_varnames.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Variable selector — .select_to_varnames","text":"character vector variable names","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-select_to_varnames.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Variable selector — .select_to_varnames","text":"Function takes select()-like inputs converts selector character vector variable names. Functions accepts tidyselect syntax, additional selector functions defined within package","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_compute_terms_contributions.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute a matrix of terms contributions — model_compute_terms_contributions","title":"Compute a matrix of terms contributions — model_compute_terms_contributions","text":"Used model_get_n(). row term, equal 1 row taken account estimate number observations, 0 otherwise.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_compute_terms_contributions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute a matrix of terms contributions — model_compute_terms_contributions","text":"","code":"model_compute_terms_contributions(model) # Default S3 method model_compute_terms_contributions(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_compute_terms_contributions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute a matrix of terms contributions — model_compute_terms_contributions","text":"model (model object, e.g. glm) model object.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_compute_terms_contributions.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute a matrix of terms contributions — model_compute_terms_contributions","text":"function cover lavaan models (NULL returned).","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_compute_terms_contributions.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute a matrix of terms contributions — model_compute_terms_contributions","text":"","code":"if (FALSE) { # interactive() mod <- lm(Sepal.Length ~ Sepal.Width, iris) mod |> model_compute_terms_contributions() mod <- lm(hp ~ mpg + factor(cyl) + disp:hp, mtcars) mod |> model_compute_terms_contributions() mod <- glm( response ~ stage * grade + trt, gtsummary::trial, family = binomial, contrasts = list( stage = contr.sum, grade = contr.treatment(3, 2), trt = \"contr.SAS\" ) ) mod |> model_compute_terms_contributions() mod <- glm( response ~ stage * trt, gtsummary::trial, family = binomial, contrasts = list(stage = contr.poly) ) mod |> model_compute_terms_contributions() mod <- glm( Survived ~ Class * Age + Sex, data = Titanic |> as.data.frame(), weights = Freq, family = binomial ) mod |> model_compute_terms_contributions() d <- dplyr::as_tibble(Titanic) |> dplyr::group_by(Class, Sex, Age) |> dplyr::summarise( n_survived = sum(n * (Survived == \"Yes\")), n_dead = sum(n * (Survived == \"No\")) ) mod <- glm(cbind(n_survived, n_dead) ~ Class * Age + Sex, data = d, family = binomial) mod |> model_compute_terms_contributions() }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_assign.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the assign attribute of model matrix of a model — model_get_assign","title":"Get the assign attribute of model matrix of a model — model_get_assign","text":"Return assign attribute attached object returned stats::model.matrix().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_assign.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the assign attribute of model matrix of a model — model_get_assign","text":"","code":"model_get_assign(model) # Default S3 method model_get_assign(model) # S3 method for class 'vglm' model_get_assign(model) # S3 method for class 'model_fit' model_get_assign(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_assign.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the assign attribute of model matrix of a model — model_get_assign","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_assign.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the assign attribute of model matrix of a model — model_get_assign","text":"","code":"lm(hp ~ mpg + factor(cyl), mtcars) |> model_get_assign() #> [1] 0 1 2 2 #> attr(,\"model_matrix\") #> (Intercept) mpg factor(cyl)6 factor(cyl)8 #> Mazda RX4 1 21.0 1 0 #> Mazda RX4 Wag 1 21.0 1 0 #> Datsun 710 1 22.8 0 0 #> Hornet 4 Drive 1 21.4 1 0 #> Hornet Sportabout 1 18.7 0 1 #> Valiant 1 18.1 1 0 #> Duster 360 1 14.3 0 1 #> Merc 240D 1 24.4 0 0 #> Merc 230 1 22.8 0 0 #> Merc 280 1 19.2 1 0 #> Merc 280C 1 17.8 1 0 #> Merc 450SE 1 16.4 0 1 #> Merc 450SL 1 17.3 0 1 #> Merc 450SLC 1 15.2 0 1 #> Cadillac Fleetwood 1 10.4 0 1 #> Lincoln Continental 1 10.4 0 1 #> Chrysler Imperial 1 14.7 0 1 #> Fiat 128 1 32.4 0 0 #> Honda Civic 1 30.4 0 0 #> Toyota Corolla 1 33.9 0 0 #> Toyota Corona 1 21.5 0 0 #> Dodge Challenger 1 15.5 0 1 #> AMC Javelin 1 15.2 0 1 #> Camaro Z28 1 13.3 0 1 #> Pontiac Firebird 1 19.2 0 1 #> Fiat X1-9 1 27.3 0 0 #> Porsche 914-2 1 26.0 0 0 #> Lotus Europa 1 30.4 0 0 #> Ford Pantera L 1 15.8 0 1 #> Ferrari Dino 1 19.7 1 0 #> Maserati Bora 1 15.0 0 1 #> Volvo 142E 1 21.4 0 0 #> attr(,\"model_matrix\")attr(,\"assign\") #> [1] 0 1 2 2 #> attr(,\"model_matrix\")attr(,\"contrasts\") #> attr(,\"model_matrix\")attr(,\"contrasts\")$`factor(cyl)` #> [1] \"contr.treatment\" #>"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_coefficients_type.html","id":null,"dir":"Reference","previous_headings":"","what":"Get coefficient type — model_get_coefficients_type","title":"Get coefficient type — model_get_coefficients_type","text":"Indicate type coefficient among \"generic\", \"logistic\", \"poisson\", \"relative_risk\" \"prop_hazard\".","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_coefficients_type.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get coefficient type — model_get_coefficients_type","text":"","code":"model_get_coefficients_type(model) # Default S3 method model_get_coefficients_type(model) # S3 method for class 'glm' model_get_coefficients_type(model) # S3 method for class 'negbin' model_get_coefficients_type(model) # S3 method for class 'geeglm' model_get_coefficients_type(model) # S3 method for class 'fixest' model_get_coefficients_type(model) # S3 method for class 'biglm' model_get_coefficients_type(model) # S3 method for class 'glmerMod' model_get_coefficients_type(model) # S3 method for class 'clogit' model_get_coefficients_type(model) # S3 method for class 'polr' model_get_coefficients_type(model) # S3 method for class 'multinom' model_get_coefficients_type(model) # S3 method for class 'svyolr' model_get_coefficients_type(model) # S3 method for class 'clm' model_get_coefficients_type(model) # S3 method for class 'clmm' model_get_coefficients_type(model) # S3 method for class 'coxph' model_get_coefficients_type(model) # S3 method for class 'crr' model_get_coefficients_type(model) # S3 method for class 'tidycrr' model_get_coefficients_type(model) # S3 method for class 'cch' model_get_coefficients_type(model) # S3 method for class 'model_fit' model_get_coefficients_type(model) # S3 method for class 'LORgee' model_get_coefficients_type(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_coefficients_type.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get coefficient type — model_get_coefficients_type","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_coefficients_type.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get coefficient type — model_get_coefficients_type","text":"","code":"lm(hp ~ mpg + factor(cyl), mtcars) |> model_get_coefficients_type() #> [1] \"generic\" df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) glm(Survived ~ Class + Age * Sex, data = df, weights = df$n, family = binomial) |> model_get_coefficients_type() #> [1] \"logistic\""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_contrasts.html","id":null,"dir":"Reference","previous_headings":"","what":"Get contrasts used in the model — model_get_contrasts","title":"Get contrasts used in the model — model_get_contrasts","text":"Get contrasts used model","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_contrasts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get contrasts used in the model — model_get_contrasts","text":"","code":"model_get_contrasts(model) # S3 method for class 'model_fit' model_get_contrasts(model) # S3 method for class 'zeroinfl' model_get_contrasts(model) # S3 method for class 'hurdle' model_get_contrasts(model) # S3 method for class 'betareg' model_get_contrasts(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_contrasts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get contrasts used in the model — model_get_contrasts","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_contrasts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get contrasts used in the model — model_get_contrasts","text":"","code":"glm( am ~ mpg + factor(cyl), data = mtcars, family = binomial, contrasts = list(`factor(cyl)` = contr.sum) ) |> model_get_contrasts() #> $`factor(cyl)` #> [,1] [,2] #> 4 1 0 #> 6 0 1 #> 8 -1 -1 #>"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the model from model objects — model_get_model","title":"Get the model from model objects — model_get_model","text":"model objects proper R model objects. , however, model objects store proper object internally (e.g. mice models). function extracts model object cases.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the model from model objects — model_get_model","text":"","code":"model_get_model(model) # Default S3 method model_get_model(model) # S3 method for class 'mira' model_get_model(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the model from model objects — model_get_model","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the model from model objects — model_get_model","text":"","code":"lm(hp ~ mpg + factor(cyl), mtcars) |> model_get_model() #> #> Call: #> lm(formula = hp ~ mpg + factor(cyl), data = mtcars) #> #> Coefficients: #> (Intercept) mpg factor(cyl)6 factor(cyl)8 #> 171.349 -3.327 16.623 88.105 #>"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_frame.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the model frame of a model — model_get_model_frame","title":"Get the model frame of a model — model_get_model_frame","text":"structure object returned stats::model.frame() slightly differ certain types models. model_get_model_frame() always return object data structure NULL possible compute model frame model.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_frame.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the model frame of a model — model_get_model_frame","text":"","code":"model_get_model_frame(model) # Default S3 method model_get_model_frame(model) # S3 method for class 'coxph' model_get_model_frame(model) # S3 method for class 'svycoxph' model_get_model_frame(model) # S3 method for class 'survreg' model_get_model_frame(model) # S3 method for class 'biglm' model_get_model_frame(model) # S3 method for class 'model_fit' model_get_model_frame(model) # S3 method for class 'fixest' model_get_model_frame(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_frame.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the model frame of a model — model_get_model_frame","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_frame.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the model frame of a model — model_get_model_frame","text":"","code":"lm(hp ~ mpg + factor(cyl), mtcars) |> model_get_model_frame() |> head() #> hp mpg factor(cyl) #> Mazda RX4 110 21.0 6 #> Mazda RX4 Wag 110 21.0 6 #> Datsun 710 93 22.8 4 #> Hornet 4 Drive 110 21.4 6 #> Hornet Sportabout 175 18.7 8 #> Valiant 105 18.1 6"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the model matrix of a model — model_get_model_matrix","title":"Get the model matrix of a model — model_get_model_matrix","text":"structure object returned stats::model.matrix() slightly differ certain types models. model_get_model_matrix() always return object structure stats::model.matrix.default().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the model matrix of a model — model_get_model_matrix","text":"","code":"model_get_model_matrix(model, ...) # Default S3 method model_get_model_matrix(model, ...) # S3 method for class 'multinom' model_get_model_matrix(model, ...) # S3 method for class 'clm' model_get_model_matrix(model, ...) # S3 method for class 'brmsfit' model_get_model_matrix(model, ...) # S3 method for class 'glmmTMB' model_get_model_matrix(model, ...) # S3 method for class 'plm' model_get_model_matrix(model, ...) # S3 method for class 'biglm' model_get_model_matrix(model, ...) # S3 method for class 'model_fit' model_get_model_matrix(model, ...) # S3 method for class 'fixest' model_get_model_matrix(model, ...) # S3 method for class 'LORgee' model_get_model_matrix(model, ...) # S3 method for class 'betareg' model_get_model_matrix(model, ...) # S3 method for class 'cch' model_get_model_matrix(model, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the model matrix of a model — model_get_model_matrix","text":"model (model object, e.g. glm) model object. ... Additional arguments passed stats::model.matrix().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_matrix.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get the model matrix of a model — model_get_model_matrix","text":"models fitted glmmTMB::glmmTMB(), return model matrix taking account components (\"cond\", \"zi\" \"disp\"). restricted model matrix, please refer glmmTMB::model.matrix.glmmTMB(). plm::plm() models, constant columns removed. fixest models, recreate model matrix main variables instrumental variables. options, see fixest::model.matrix.fixest.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_matrix.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the model matrix of a model — model_get_model_matrix","text":"","code":"lm(hp ~ mpg + factor(cyl), mtcars) |> model_get_model_matrix() |> head() #> (Intercept) mpg factor(cyl)6 factor(cyl)8 #> Mazda RX4 1 21.0 1 0 #> Mazda RX4 Wag 1 21.0 1 0 #> Datsun 710 1 22.8 0 0 #> Hornet 4 Drive 1 21.4 1 0 #> Hornet Sportabout 1 18.7 0 1 #> Valiant 1 18.1 1 0"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_n.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the number of observations — model_get_n","title":"Get the number of observations — model_get_n","text":"binomial multinomial logistic models, also return number events.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_n.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the number of observations — model_get_n","text":"","code":"model_get_n(model) # Default S3 method model_get_n(model) # S3 method for class 'glm' model_get_n(model) # S3 method for class 'glmerMod' model_get_n(model) # S3 method for class 'multinom' model_get_n(model) # S3 method for class 'LORgee' model_get_n(model) # S3 method for class 'coxph' model_get_n(model) # S3 method for class 'survreg' model_get_n(model) # S3 method for class 'model_fit' model_get_n(model) # S3 method for class 'tidycrr' model_get_n(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_n.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the number of observations — model_get_n","text":"model (model object, e.g. glm) model object.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_n.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get the number of observations — model_get_n","text":"Poisson models, return number events exposure time (defined stats::offset()). Cox models (survival::coxph()), return number events, exposure time number individuals. competing risk regression models (tidycmprsk::crr()), n_event takes account event interest defined failcode. See tidy_add_n() details. total number observations (N_obs), individuals (N_ind), events (N_event) exposure time (Exposure) stored attributes returned tibble. function cover lavaan models (NULL returned).","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_n.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the number of observations — model_get_n","text":"","code":"lm(hp ~ mpg + factor(cyl) + disp:hp, mtcars) |> model_get_n() #> # A tibble: 6 × 2 #> term n_obs #> #> 1 (Intercept) 32 #> 2 mpg 32 #> 3 factor(cyl)6 7 #> 4 factor(cyl)8 14 #> 5 hp:disp 32 #> 6 factor(cyl)4 11 mod <- glm( response ~ stage * grade + trt, gtsummary::trial, family = binomial, contrasts = list(stage = contr.sum, grade = contr.treatment(3, 2), trt = \"contr.SAS\") ) mod |> model_get_n() #> # A tibble: 16 × 3 #> term n_obs n_event #> #> 1 (Intercept) 193 61 #> 2 stage1 52 18 #> 3 stage2 52 13 #> 4 stage3 40 15 #> 5 grade1 67 21 #> 6 grade3 63 21 #> 7 trtDrug A 95 28 #> 8 stage1:grade1 17 6 #> 9 stage2:grade1 17 4 #> 10 stage3:grade1 18 7 #> 11 stage1:grade3 13 6 #> 12 stage2:grade3 19 5 #> 13 stage3:grade3 13 4 #> 14 stage4 49 15 #> 15 grade2 63 19 #> 16 trtDrug B 98 33 if (FALSE) { # \\dontrun{ mod <- glm( Survived ~ Class * Age + Sex, data = Titanic |> as.data.frame(), weights = Freq, family = binomial ) mod |> model_get_n() d <- dplyr::as_tibble(Titanic) |> dplyr::group_by(Class, Sex, Age) |> dplyr::summarise( n_survived = sum(n * (Survived == \"Yes\")), n_dead = sum(n * (Survived == \"No\")) ) mod <- glm(cbind(n_survived, n_dead) ~ Class * Age + Sex, data = d, family = binomial) mod |> model_get_n() mod <- glm(response ~ age + grade * trt, gtsummary::trial, family = poisson) mod |> model_get_n() mod <- glm( response ~ trt * grade + offset(ttdeath), gtsummary::trial, family = poisson ) mod |> model_get_n() dont df <- survival::lung |> dplyr::mutate(sex = factor(sex)) mod <- survival::coxph(survival::Surv(time, status) ~ ph.ecog + age + sex, data = df) mod |> model_get_n() mod <- lme4::lmer(Reaction ~ Days + (Days | Subject), lme4::sleepstudy) mod |> model_get_n() mod <- lme4::glmer(response ~ trt * grade + (1 | stage), family = binomial, data = gtsummary::trial ) mod |> model_get_n() mod <- lme4::glmer(cbind(incidence, size - incidence) ~ period + (1 | herd), family = binomial, data = lme4::cbpp ) mod |> model_get_n() } # }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_nlevels.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the number of levels for each factor used in xlevels — model_get_nlevels","title":"Get the number of levels for each factor used in xlevels — model_get_nlevels","text":"Get number levels factor used xlevels","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_nlevels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the number of levels for each factor used in xlevels — model_get_nlevels","text":"","code":"model_get_nlevels(model) # Default S3 method model_get_nlevels(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_nlevels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the number of levels for each factor used in xlevels — model_get_nlevels","text":"model (model object, e.g. glm) model object.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_nlevels.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the number of levels for each factor used in xlevels — model_get_nlevels","text":"tibble two columns: \"variable\" \"var_nlevels\"","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_nlevels.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the number of levels for each factor used in xlevels — model_get_nlevels","text":"","code":"lm(hp ~ mpg + factor(cyl), mtcars) |> model_get_nlevels() #> # A tibble: 1 × 2 #> variable var_nlevels #> #> 1 factor(cyl) 3"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_offset.html","id":null,"dir":"Reference","previous_headings":"","what":"Get model offset — model_get_offset","title":"Get model offset — model_get_offset","text":"function cover lavaan models (NULL returned).","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_offset.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get model offset — model_get_offset","text":"","code":"model_get_offset(model) # Default S3 method model_get_offset(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_offset.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get model offset — model_get_offset","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_offset.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get model offset — model_get_offset","text":"","code":"mod <- glm( response ~ trt + offset(log(ttdeath)), gtsummary::trial, family = poisson ) mod |> model_get_offset() #> [1] 3.178054 3.178054 3.178054 2.870169 2.799109 2.749832 3.178054 2.913980 #> [9] 3.178054 2.354228 3.178054 3.178054 2.663053 2.556452 3.121483 2.164472 #> [17] 3.178054 2.721953 3.178054 3.178054 3.178054 3.178054 2.828496 3.173460 #> [25] 1.843719 2.758109 3.178054 3.178054 2.737609 2.858193 3.178054 3.039749 #> [33] 3.178054 3.178054 3.178054 2.527327 3.178054 2.746630 2.890372 2.891482 #> [41] 2.520113 2.493205 3.178054 2.857619 3.178054 3.178054 3.178054 2.500616 #> [49] 2.304583 2.903069 2.343727 3.178054 3.178054 2.962175 2.502255 2.671386 #> [57] 2.962175 2.318458 2.576422 2.314514 3.178054 3.125444 3.178054 3.096934 #> [65] 3.178054 3.026261 3.145445 1.998774 3.178054 3.178054 3.178054 3.178054 #> [73] 3.178054 2.955951 1.983756 3.173041 2.786861 3.178054 2.643334 3.178054 #> [81] 3.178054 3.178054 2.799717 3.170106 3.178054 2.910719 2.437116 3.041661 #> [89] 1.673351 3.132010 2.335052 3.178054 3.178054 2.676903 2.951780 3.178054 #> [97] 3.053529 2.776954 2.299581 3.178054 3.178054 2.983153 2.813611 2.414126 #> [105] 2.906354 3.178054 2.865624 2.859340 3.178054 3.129389 2.615935 3.178054 #> [113] 3.178054 2.859913 3.178054 3.178054 3.178054 3.178054 3.178054 2.564949 #> [121] 2.275214 2.750471 3.178054 1.261298 3.013081 3.153163 2.801541 3.178054 #> [129] 3.178054 2.684440 2.879760 3.178054 3.083285 3.178054 3.178054 2.540026 #> [137] 3.178054 3.178054 3.178054 3.178054 2.309561 3.178054 3.178054 3.178054 #> [145] 3.012098 3.178054 3.178054 3.060115 2.536075 2.571084 3.178054 2.714695 #> [153] 3.002708 2.356126 3.178054 3.178054 3.178054 3.178054 3.161247 3.178054 #> [161] 2.994732 2.744061 3.166319 3.109507 2.972464 2.807594 3.178054 3.178054 #> [169] 3.178054 3.086943 3.178054 2.528126 3.178054 2.695978 2.800933 3.178054 #> [177] 2.223542 2.877512 3.178054 3.178054 2.294553 2.782539 2.352327 3.035434 #> [185] 3.178054 2.799717 3.178054 3.109061 3.178054 3.072693 3.178054 2.986187 #> [193] 3.178054 #> attr(,\"label\") #> [1] \"Months to Death/Censor\""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_pairwise_contrasts.html","id":null,"dir":"Reference","previous_headings":"","what":"Get pairwise comparison of the levels of a categorical variable — model_get_pairwise_contrasts","title":"Get pairwise comparison of the levels of a categorical variable — model_get_pairwise_contrasts","text":"computed emmeans::emmeans().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_pairwise_contrasts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get pairwise comparison of the levels of a categorical variable — model_get_pairwise_contrasts","text":"","code":"model_get_pairwise_contrasts( model, variables, pairwise_reverse = TRUE, contrasts_adjust = NULL, conf.level = 0.95, emmeans_args = list() )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_pairwise_contrasts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get pairwise comparison of the levels of a categorical variable — model_get_pairwise_contrasts","text":"model (model object, e.g. glm) model object. variables (tidy-select) Variables add pairwise contrasts. pairwise_reverse (logical) Determines whether use \"pairwise\" (TRUE) \"revpairwise\" (FALSE), see emmeans::contrast(). contrasts_adjust optional adjustment method computing contrasts, see emmeans::contrast() (NULL, use emmeans default) conf.level (numeric) Level confidence confidence intervals (default: 95%). emmeans_args (logical) List additional parameter pass emmeans::emmeans() computing pairwise contrasts.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_pairwise_contrasts.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get pairwise comparison of the levels of a categorical variable — model_get_pairwise_contrasts","text":"pscl::zeroinfl() pscl::hurdle() models, pairwise contrasts computed separately component, using mode = \"count\" mode = \"zero\" (see documentation emmeans) component column added results. support still experimental.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_pairwise_contrasts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get pairwise comparison of the levels of a categorical variable — model_get_pairwise_contrasts","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"emmeans\", boolean = TRUE)) { mod <- lm(Sepal.Length ~ Species, data = iris) mod |> model_get_pairwise_contrasts(variables = \"Species\") mod |> model_get_pairwise_contrasts( variables = \"Species\", contrasts_adjust = \"none\" ) } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_response.html","id":null,"dir":"Reference","previous_headings":"","what":"Get model response — model_get_response","title":"Get model response — model_get_response","text":"function cover lavaan models (NULL returned).","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_response.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get model response — model_get_response","text":"","code":"model_get_response(model) # Default S3 method model_get_response(model) # S3 method for class 'glm' model_get_response(model) # S3 method for class 'glmerMod' model_get_response(model) # S3 method for class 'model_fit' model_get_response(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_response.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get model response — model_get_response","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_response.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get model response — model_get_response","text":"","code":"lm(hp ~ mpg + factor(cyl) + disp:hp, mtcars) |> model_get_response() #> Mazda RX4 Mazda RX4 Wag Datsun 710 Hornet 4 Drive #> 110 110 93 110 #> Hornet Sportabout Valiant Duster 360 Merc 240D #> 175 105 245 62 #> Merc 230 Merc 280 Merc 280C Merc 450SE #> 95 123 123 180 #> Merc 450SL Merc 450SLC Cadillac Fleetwood Lincoln Continental #> 180 180 205 215 #> Chrysler Imperial Fiat 128 Honda Civic Toyota Corolla #> 230 66 52 65 #> Toyota Corona Dodge Challenger AMC Javelin Camaro Z28 #> 97 150 150 245 #> Pontiac Firebird Fiat X1-9 Porsche 914-2 Lotus Europa #> 175 66 91 113 #> Ford Pantera L Ferrari Dino Maserati Bora Volvo 142E #> 264 175 335 109 mod <- glm( response ~ stage * grade + trt, gtsummary::trial, family = binomial, contrasts = list(stage = contr.sum, grade = contr.treatment(3, 2), trt = \"contr.SAS\") ) mod |> model_get_response() #> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #> 0 1 0 1 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 #> 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 #> 0 0 0 0 0 0 1 0 0 1 1 0 0 1 0 0 1 0 0 0 #> 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 #> 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 #> 62 63 64 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 #> 0 0 0 0 1 1 0 0 1 0 0 0 1 0 0 0 0 0 0 1 #> 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 #> 0 0 0 1 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 #> 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 #> 0 0 1 0 0 0 0 1 1 0 0 1 1 0 0 0 0 1 0 0 #> 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 140 141 142 143 144 #> 0 0 1 1 0 0 0 1 0 0 0 1 0 1 1 1 1 1 0 1 #> 145 146 147 148 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 #> 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 #> 166 167 168 169 170 171 172 173 174 175 176 177 178 180 181 182 183 184 185 186 #> 0 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 0 1 0 1 #> 187 188 189 190 191 192 193 194 196 197 198 199 200 #> 0 0 0 0 0 0 0 0 0 1 1 0 0 #> attr(,\"label\") #> [1] \"Tumor Response\" mod <- glm( Survived ~ Class * Age + Sex, data = Titanic |> as.data.frame(), weights = Freq, family = binomial ) mod |> model_get_response() #> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 0 1 1 #> 27 28 29 30 31 32 #> 1 1 1 1 1 1 d <- dplyr::as_tibble(Titanic) |> dplyr::group_by(Class, Sex, Age) |> dplyr::summarise( n_survived = sum(n * (Survived == \"Yes\")), n_dead = sum(n * (Survived == \"No\")) ) #> `summarise()` has grouped output by 'Class', 'Sex'. You can override using the #> `.groups` argument. mod <- glm(cbind(n_survived, n_dead) ~ Class * Age + Sex, data = d, family = binomial, y = FALSE) mod |> model_get_response() #> 1 2 3 4 5 6 7 #> 0.97222222 1.00000000 0.32571429 1.00000000 0.86021505 1.00000000 0.08333333 #> 8 9 10 11 12 13 14 #> 1.00000000 0.46060606 0.45161290 0.16233766 0.27083333 0.86956522 0.00000000 #> 15 16 #> 0.22273782 0.00000000"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_response_variable.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the name of the response variable — model_get_response_variable","title":"Get the name of the response variable — model_get_response_variable","text":"Get name response variable","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_response_variable.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the name of the response variable — model_get_response_variable","text":"","code":"model_get_response_variable(model) # Default S3 method model_get_response_variable(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_response_variable.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the name of the response variable — model_get_response_variable","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_response_variable.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the name of the response variable — model_get_response_variable","text":"","code":"lm(hp ~ mpg + factor(cyl) + disp:hp, mtcars) |> model_get_response_variable() #> [1] \"hp\" mod <- glm( response ~ stage * grade + trt, gtsummary::trial, family = binomial ) mod |> model_get_response_variable() #> [1] \"response\" mod <- glm( Survived ~ Class * Age + Sex, data = Titanic |> as.data.frame(), weights = Freq, family = binomial ) mod |> model_get_response_variable() #> [1] \"Survived\""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_terms.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the terms of a model — model_get_terms","title":"Get the terms of a model — model_get_terms","text":"Return result stats::terms() applied model NULL possible get terms model.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_terms.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the terms of a model — model_get_terms","text":"","code":"model_get_terms(model) # Default S3 method model_get_terms(model) # S3 method for class 'brmsfit' model_get_terms(model) # S3 method for class 'glmmTMB' model_get_terms(model) # S3 method for class 'model_fit' model_get_terms(model) # S3 method for class 'betareg' model_get_terms(model) # S3 method for class 'betareg' model_get_terms(model) # S3 method for class 'cch' model_get_terms(model) # S3 method for class 'fixest' model_get_terms(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_terms.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the terms of a model — model_get_terms","text":"model (model object, e.g. glm) model object.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_terms.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get the terms of a model — model_get_terms","text":"models fitted glmmTMB::glmmTMB(), return terms object taking account components (\"cond\" \"zi\"). restricted terms object, please refer glmmTMB::terms.glmmTMB(). fixest models, return term object combining main variables instrumental variables.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_terms.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the terms of a model — model_get_terms","text":"","code":"lm(hp ~ mpg + factor(cyl), mtcars) |> model_get_terms() #> hp ~ mpg + factor(cyl) #> attr(,\"variables\") #> list(hp, mpg, factor(cyl)) #> attr(,\"factors\") #> mpg factor(cyl) #> hp 0 0 #> mpg 1 0 #> factor(cyl) 0 1 #> attr(,\"term.labels\") #> [1] \"mpg\" \"factor(cyl)\" #> attr(,\"order\") #> [1] 1 1 #> attr(,\"intercept\") #> [1] 1 #> attr(,\"response\") #> [1] 1 #> attr(,\".Environment\") #> #> attr(,\"predvars\") #> list(hp, mpg, factor(cyl)) #> attr(,\"dataClasses\") #> hp mpg factor(cyl) #> \"numeric\" \"numeric\" \"factor\""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_weights.html","id":null,"dir":"Reference","previous_headings":"","what":"Get sampling weights used by a model — model_get_weights","title":"Get sampling weights used by a model — model_get_weights","text":"function cover lavaan models (NULL returned).","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_weights.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get sampling weights used by a model — model_get_weights","text":"","code":"model_get_weights(model) # Default S3 method model_get_weights(model) # S3 method for class 'svyglm' model_get_weights(model) # S3 method for class 'svrepglm' model_get_weights(model) # S3 method for class 'model_fit' model_get_weights(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_weights.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get sampling weights used by a model — model_get_weights","text":"model (model object, e.g. glm) model object.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_weights.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Get sampling weights used by a model — model_get_weights","text":"class svrepglm objects (GLM survey object replicate weights), return original sampling weights data, replicate weights.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_weights.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get sampling weights used by a model — model_get_weights","text":"","code":"mod <- lm(Sepal.Length ~ Sepal.Width, iris) mod |> model_get_weights() #> [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> [112] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> [149] 1 1 mod <- lm(hp ~ mpg + factor(cyl) + disp:hp, mtcars, weights = mtcars$gear) mod |> model_get_weights() #> [1] 4 4 4 3 3 3 3 4 4 4 4 3 3 3 3 3 3 4 4 4 3 3 3 3 3 4 5 5 5 5 5 4 mod <- glm( response ~ stage * grade + trt, gtsummary::trial, family = binomial ) mod |> model_get_weights() #> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 62 63 64 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 140 141 142 143 144 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 145 146 147 148 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 166 167 168 169 170 171 172 173 174 175 176 177 178 180 181 182 183 184 185 186 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 187 188 189 190 191 192 193 194 196 197 198 199 200 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 mod <- glm( Survived ~ Class * Age + Sex, data = Titanic |> as.data.frame(), weights = Freq, family = binomial ) mod |> model_get_weights() #> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #> 0 0 35 0 0 0 17 0 118 154 387 670 4 13 89 3 5 11 13 0 #> 21 22 23 24 25 26 27 28 29 30 31 32 #> 1 13 14 0 57 14 75 192 140 80 76 20 d <- dplyr::as_tibble(Titanic) |> dplyr::group_by(Class, Sex, Age) |> dplyr::summarise( n_survived = sum(n * (Survived == \"Yes\")), n_dead = sum(n * (Survived == \"No\")) ) #> `summarise()` has grouped output by 'Class', 'Sex'. You can override using the #> `.groups` argument. mod <- glm(cbind(n_survived, n_dead) ~ Class * Age + Sex, data = d, family = binomial) mod |> model_get_weights() #> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #> 144 1 175 5 93 13 168 11 165 31 462 48 23 0 862 0"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_xlevels.html","id":null,"dir":"Reference","previous_headings":"","what":"Get xlevels used in the model — model_get_xlevels","title":"Get xlevels used in the model — model_get_xlevels","text":"Get xlevels used model","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_xlevels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get xlevels used in the model — model_get_xlevels","text":"","code":"model_get_xlevels(model) # Default S3 method model_get_xlevels(model) # S3 method for class 'lmerMod' model_get_xlevels(model) # S3 method for class 'glmerMod' model_get_xlevels(model) # S3 method for class 'felm' model_get_xlevels(model) # S3 method for class 'brmsfit' model_get_xlevels(model) # S3 method for class 'glmmTMB' model_get_xlevels(model) # S3 method for class 'plm' model_get_xlevels(model) # S3 method for class 'model_fit' model_get_xlevels(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_xlevels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get xlevels used in the model — model_get_xlevels","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_xlevels.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get xlevels used in the model — model_get_xlevels","text":"","code":"lm(hp ~ mpg + factor(cyl), mtcars) |> model_get_xlevels() #> $`factor(cyl)` #> [1] \"4\" \"6\" \"8\" #>"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_identify_variables.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify for each coefficient of a model the corresponding variable — model_identify_variables","title":"Identify for each coefficient of a model the corresponding variable — model_identify_variables","text":"also identify interaction terms intercept(s).","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_identify_variables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify for each coefficient of a model the corresponding variable — model_identify_variables","text":"","code":"model_identify_variables(model) # Default S3 method model_identify_variables(model) # S3 method for class 'lavaan' model_identify_variables(model) # S3 method for class 'aov' model_identify_variables(model) # S3 method for class 'clm' model_identify_variables(model) # S3 method for class 'clmm' model_identify_variables(model) # S3 method for class 'gam' model_identify_variables(model) # S3 method for class 'model_fit' model_identify_variables(model) # S3 method for class 'logitr' model_identify_variables(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_identify_variables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identify for each coefficient of a model the corresponding variable — model_identify_variables","text":"model (model object, e.g. glm) model object.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_identify_variables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Identify for each coefficient of a model the corresponding variable — model_identify_variables","text":"tibble four columns: term: coefficients model variable: corresponding variable var_class: class variable (cf. stats::.MFclass()) var_type: \"continuous\", \"dichotomous\" (categorical variable 2 levels), \"categorical\" (categorical variable 3 levels), \"intercept\" \"interaction\" var_nlevels: number original levels categorical variables","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_identify_variables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Identify for each coefficient of a model the corresponding variable — model_identify_variables","text":"","code":"df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) glm( Survived ~ Class + Age * Sex, data = df, weights = df$n, family = binomial ) |> model_identify_variables() #> # A tibble: 7 × 5 #> term variable var_class var_nlevels var_type #> #> 1 (Intercept) NA NA NA intercept #> 2 Class2nd Class character 4 categorical #> 3 Class3rd Class character 4 categorical #> 4 ClassCrew Class character 4 categorical #> 5 AgeChild Age character 2 dichotomous #> 6 SexMale Sex character 2 dichotomous #> 7 AgeChild:SexMale Age:Sex NA NA interaction lm( Sepal.Length ~ poly(Sepal.Width, 2) + Species, data = iris, contrasts = list(Species = contr.sum) ) |> model_identify_variables() #> # A tibble: 5 × 5 #> term variable var_class var_nlevels var_type #> #> 1 (Intercept) NA NA NA intercept #> 2 poly(Sepal.Width, 2)1 Sepal.Width nmatrix.2 NA continuous #> 3 poly(Sepal.Width, 2)2 Sepal.Width nmatrix.2 NA continuous #> 4 Species1 Species factor 3 categorical #> 5 Species2 Species factor 3 categorical"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_contrasts.html","id":null,"dir":"Reference","previous_headings":"","what":"List contrasts used by a model — model_list_contrasts","title":"List contrasts used by a model — model_list_contrasts","text":"List contrasts used model","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_contrasts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List contrasts used by a model — model_list_contrasts","text":"","code":"model_list_contrasts(model) # Default S3 method model_list_contrasts(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_contrasts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List contrasts used by a model — model_list_contrasts","text":"model (model object, e.g. glm) model object.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_contrasts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List contrasts used by a model — model_list_contrasts","text":"tibble three columns: variable: variable name contrasts: contrasts used contrasts_type: type contrasts (\"treatment\", \"sum\", \"poly\", \"helmert\", \"sdiff, \"\" \".contrast\") reference: variables treatment, SAS sum contrasts, position reference level","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_contrasts.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"List contrasts used by a model — model_list_contrasts","text":"models intercept, contrasts applied one categorical variable. case, one dummy term returned level categorical variable.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_contrasts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List contrasts used by a model — model_list_contrasts","text":"","code":"glm( am ~ mpg + factor(cyl), data = mtcars, family = binomial, contrasts = list(`factor(cyl)` = contr.sum) ) |> model_list_contrasts() #> # A tibble: 1 × 4 #> variable contrasts reference contrasts_type #> #> 1 factor(cyl) contr.sum 3 sum"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_higher_order_variables.html","id":null,"dir":"Reference","previous_headings":"","what":"List higher order variables of a model — model_list_higher_order_variables","title":"List higher order variables of a model — model_list_higher_order_variables","text":"List higher order variables model","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_higher_order_variables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List higher order variables of a model — model_list_higher_order_variables","text":"","code":"model_list_higher_order_variables(model) # Default S3 method model_list_higher_order_variables(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_higher_order_variables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List higher order variables of a model — model_list_higher_order_variables","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_higher_order_variables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List higher order variables of a model — model_list_higher_order_variables","text":"","code":"lm(hp ~ mpg + factor(cyl) + disp:hp, mtcars) |> model_list_higher_order_variables() #> [1] \"mpg\" \"factor(cyl)\" \"hp:disp\" mod <- glm( response ~ stage * grade + trt:stage, gtsummary::trial, family = binomial ) mod |> model_list_higher_order_variables() #> [1] \"stage:grade\" \"stage:trt\" mod <- glm( Survived ~ Class * Age + Sex, data = Titanic |> as.data.frame(), weights = Freq, family = binomial ) mod |> model_list_higher_order_variables() #> [1] \"Sex\" \"Class:Age\""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_terms_levels.html","id":null,"dir":"Reference","previous_headings":"","what":"List levels of categorical terms — model_list_terms_levels","title":"List levels of categorical terms — model_list_terms_levels","text":"categorical variables treatment, SAS, sum successive differences contrasts (cf. MASS::contr.sdif()), categorical variables contrast.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_terms_levels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List levels of categorical terms — model_list_terms_levels","text":"","code":"model_list_terms_levels( model, label_pattern = \"{level}\", variable_labels = NULL, sdif_term_level = c(\"diff\", \"ratio\") ) # Default S3 method model_list_terms_levels( model, label_pattern = \"{level}\", variable_labels = NULL, sdif_term_level = c(\"diff\", \"ratio\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_terms_levels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List levels of categorical terms — model_list_terms_levels","text":"model (model object, e.g. glm) model object. label_pattern (glue pattern) glue pattern term labels (see examples). variable_labels (list string) optional named list named vector custom variable labels passed model_list_variables() sdif_term_level (string) successive differences contrasts, term levels named? \"diff\" \"B - \" (default), \"ratio\" \"B / \".","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_terms_levels.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List levels of categorical terms — model_list_terms_levels","text":"tibble ten columns: variable: variable contrasts_type: type contrasts (\"sum\" \"treatment\") term: term name level: term level level_rank: rank level reference: logical indicating term reference level reference_level: level reference term var_label: variable label obtained model_list_variables() var_nlevels: number levels variable dichotomous: logical indicating variable dichotomous label: term label (default equal term level) first nine columns can used label_pattern.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_terms_levels.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List levels of categorical terms — model_list_terms_levels","text":"","code":"glm( am ~ mpg + factor(cyl), data = mtcars, family = binomial, contrasts = list(`factor(cyl)` = contr.sum) ) |> model_list_terms_levels() #> # A tibble: 3 × 11 #> variable contrasts_type term level level_rank reference reference_level #> #> 1 factor(cyl) sum factor(… 4 1 FALSE 8 #> 2 factor(cyl) sum factor(… 6 2 FALSE 8 #> 3 factor(cyl) sum factor(… 8 3 TRUE 8 #> # ℹ 4 more variables: var_label , var_nlevels , dichotomous , #> # label df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, weights = df$n, family = binomial, contrasts = list(Age = contr.sum, Class = \"contr.helmert\") ) mod |> model_list_terms_levels() #> # A tibble: 4 × 11 #> variable contrasts_type term level level_rank reference reference_level #> #> 1 Age sum Age1 Adult 1 FALSE Child #> 2 Age sum Age2 Child 2 TRUE Child #> 3 Sex treatment SexFemale Female 1 TRUE Female #> 4 Sex treatment SexMale Male 2 FALSE Female #> # ℹ 4 more variables: var_label , var_nlevels , dichotomous , #> # label mod |> model_list_terms_levels(\"{level} vs {reference_level}\") #> # A tibble: 4 × 11 #> variable contrasts_type term level level_rank reference reference_level #> #> 1 Age sum Age1 Adult 1 FALSE Child #> 2 Age sum Age2 Child 2 TRUE Child #> 3 Sex treatment SexFemale Female 1 TRUE Female #> 4 Sex treatment SexMale Male 2 FALSE Female #> # ℹ 4 more variables: var_label , var_nlevels , dichotomous , #> # label mod |> model_list_terms_levels(\"{variable} [{level} - {reference_level}]\") #> # A tibble: 4 × 11 #> variable contrasts_type term level level_rank reference reference_level #> #> 1 Age sum Age1 Adult 1 FALSE Child #> 2 Age sum Age2 Child 2 TRUE Child #> 3 Sex treatment SexFemale Female 1 TRUE Female #> 4 Sex treatment SexMale Male 2 FALSE Female #> # ℹ 4 more variables: var_label , var_nlevels , dichotomous , #> # label mod |> model_list_terms_levels( \"{ifelse(reference, level, paste(level, '-', reference_level))}\" ) #> # A tibble: 4 × 11 #> variable contrasts_type term level level_rank reference reference_level #> #> 1 Age sum Age1 Adult 1 FALSE Child #> 2 Age sum Age2 Child 2 TRUE Child #> 3 Sex treatment SexFemale Female 1 TRUE Female #> 4 Sex treatment SexMale Male 2 FALSE Female #> # ℹ 4 more variables: var_label , var_nlevels , dichotomous , #> # label "},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_variables.html","id":null,"dir":"Reference","previous_headings":"","what":"List all the variables used in a model — model_list_variables","title":"List all the variables used in a model — model_list_variables","text":"Including variables used interaction.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_variables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List all the variables used in a model — model_list_variables","text":"","code":"model_list_variables( model, labels = NULL, only_variable = FALSE, add_var_type = FALSE, instrumental_suffix = \" (instrumental)\" ) # Default S3 method model_list_variables( model, labels = NULL, only_variable = FALSE, add_var_type = FALSE, instrumental_suffix = \" (instrumental)\" ) # S3 method for class 'lavaan' model_list_variables( model, labels = NULL, only_variable = FALSE, add_var_type = FALSE, instrumental_suffix = \" (instrumental)\" ) # S3 method for class 'logitr' model_list_variables( model, labels = NULL, only_variable = FALSE, add_var_type = FALSE, instrumental_suffix = \" (instrumental)\" )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_variables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List all the variables used in a model — model_list_variables","text":"model (model object, e.g. glm) model object. labels (list string) optional named list named vector custom variable labels. only_variable (logical) TRUE, return \"variable\" column. add_var_type (logical) TRUE, add var_nlevels var_type columns. instrumental_suffix (string) Suffix added variable labels instrumental variables (fixest models). NULL add nothing.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_variables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List all the variables used in a model — model_list_variables","text":"tibble three columns: variable: corresponding variable var_class: class variable (cf. stats::.MFclass()) label_attr: variable label defined original data frame label attribute (cf. labelled::var_label()) var_label: variable label (priority, labels defined, label_attr available, otherwise variable) add_var_type = TRUE: var_type: \"continuous\", \"dichotomous\" (categorical variable 2 levels), \"categorical\" (categorical variable 3 levels), \"intercept\" \"interaction\" var_nlevels: number original levels categorical variables","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_variables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List all the variables used in a model — model_list_variables","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"gtsummary\", boolean = TRUE)) { df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) glm( Survived ~ Class + Age:Sex, data = df, weights = df$n, family = binomial ) |> model_list_variables() lm( Sepal.Length ~ poly(Sepal.Width, 2) + Species, data = iris, contrasts = list(Species = contr.sum) ) |> model_list_variables() glm( response ~ poly(age, 3) + stage + grade * trt, na.omit(gtsummary::trial), family = binomial, ) |> model_list_variables() } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"Objects exported from other packages — reexports","title":"Objects exported from other packages — reexports","text":"objects imported packages. Follow links see documentation. dplyr all_of, any_of, contains, ends_with, everything, last_col, matches, num_range, one_of, starts_with, vars, ","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/scope_tidy.html","id":null,"dir":"Reference","previous_headings":"","what":"Scoping a tidy tibble allowing to tidy select — scope_tidy","title":"Scoping a tidy tibble allowing to tidy select — scope_tidy","text":"function uses information model tidy tibble generate data frame exposing different variables model, data frame used tidy selection. addition, columns \"var_type\", \"var_class\" \"contrasts_type\" scoped values added attributes data frame. example, var_type='continuous' variable \"age\", attribute attr(.$age, 'gtsummary.var_type') <- 'continuous' set. attribute used selector like all_continuous(). Note: attributes prefixed \"gtsummary.\" compatible selectors provided {gtsummary}.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/scope_tidy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Scoping a tidy tibble allowing to tidy select — scope_tidy","text":"","code":"scope_tidy(x, data = NULL)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/scope_tidy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Scoping a tidy tibble allowing to tidy select — scope_tidy","text":"x (data.frame) tidy tibble, \"variable\" column, returned tidy_identify_variables(). data (data.frame) optional data frame attributes added .","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/scope_tidy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Scoping a tidy tibble allowing to tidy select — scope_tidy","text":"data frame.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/scope_tidy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Scoping a tidy tibble allowing to tidy select — scope_tidy","text":"","code":"mod <- lm(Sepal.Length ~ Sepal.Width * Species, data = iris) tt <- mod |> tidy_and_attach() |> tidy_add_contrasts() scope_tidy(tt) |> str() #> tibble [1 × 4] (S3: tbl_df/tbl/data.frame) #> $ (Intercept) : logi NA #> ..- attr(*, \"gtsummary.var_type\")= chr \"intercept\" #> $ Sepal.Width : num NA #> ..- attr(*, \"gtsummary.var_type\")= chr \"continuous\" #> ..- attr(*, \"gtsummary.var_class\")= Named chr \"numeric\" #> .. ..- attr(*, \"names\")= chr \"Sepal.Width\" #> $ Species : Factor w/ 0 levels: NA #> ..- attr(*, \"gtsummary.var_type\")= chr \"categorical\" #> ..- attr(*, \"gtsummary.var_class\")= Named chr \"factor\" #> .. ..- attr(*, \"names\")= chr \"Species\" #> ..- attr(*, \"gtsummary.contrasts_type\")= chr \"treatment\" #> $ Sepal.Width:Species: logi NA #> ..- attr(*, \"gtsummary.var_type\")= chr \"interaction\" scope_tidy(tt, data = model_get_model_frame(mod)) |> str() #> 'data.frame':\t150 obs. of 3 variables: #> $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... #> $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... #> ..- attr(*, \"gtsummary.var_type\")= chr \"continuous\" #> ..- attr(*, \"gtsummary.var_class\")= Named chr \"numeric\" #> .. ..- attr(*, \"names\")= chr \"Sepal.Width\" #> $ Species : Factor w/ 3 levels \"setosa\",\"versicolor\",..: 1 1 1 1 1 1 1 1 1 1 ... #> ..- attr(*, \"gtsummary.var_type\")= chr \"categorical\" #> ..- attr(*, \"gtsummary.var_class\")= Named chr \"factor\" #> .. ..- attr(*, \"names\")= chr \"Species\" #> ..- attr(*, \"gtsummary.contrasts_type\")= chr \"treatment\" #> - attr(*, \"terms\")=Classes 'terms', 'formula' language Sepal.Length ~ Sepal.Width * Species #> .. ..- attr(*, \"variables\")= language list(Sepal.Length, Sepal.Width, Species) #> .. ..- attr(*, \"factors\")= int [1:3, 1:3] 0 1 0 0 0 1 0 1 1 #> .. .. ..- attr(*, \"dimnames\")=List of 2 #> .. .. .. ..$ : chr [1:3] \"Sepal.Length\" \"Sepal.Width\" \"Species\" #> .. .. .. ..$ : chr [1:3] \"Sepal.Width\" \"Species\" \"Sepal.Width:Species\" #> .. ..- attr(*, \"term.labels\")= chr [1:3] \"Sepal.Width\" \"Species\" \"Sepal.Width:Species\" #> .. ..- attr(*, \"order\")= int [1:3] 1 1 2 #> .. ..- attr(*, \"intercept\")= int 1 #> .. ..- attr(*, \"response\")= int 1 #> .. ..- attr(*, \".Environment\")= #> .. ..- attr(*, \"predvars\")= language list(Sepal.Length, Sepal.Width, Species) #> .. ..- attr(*, \"dataClasses\")= Named chr [1:3] \"numeric\" \"numeric\" \"factor\" #> .. .. ..- attr(*, \"names\")= chr [1:3] \"Sepal.Length\" \"Sepal.Width\" \"Species\" scope_tidy(tt) |> dplyr::select(dplyr::starts_with(\"Se\")) |> names() #> [1] \"Sepal.Width\" \"Sepal.Width:Species\" scope_tidy(tt) |> dplyr::select(where(is.factor)) |> names() #> [1] \"Species\" scope_tidy(tt) |> dplyr::select(all_continuous()) |> names() #> [1] \"Sepal.Width\" scope_tidy(tt) |> dplyr::select(all_contrasts()) |> names() #> [1] \"Species\" scope_tidy(tt) |> dplyr::select(all_interaction()) |> names() #> [1] \"Sepal.Width:Species\" scope_tidy(tt) |> dplyr::select(all_intercepts()) |> names() #> [1] \"(Intercept)\""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/select_helpers.html","id":null,"dir":"Reference","previous_headings":"","what":"Select helper functions — select_helpers","title":"Select helper functions — select_helpers","text":"Set functions supplement tidyselect set functions selecting columns data frames (items well). all_continuous() selects continuous variables all_categorical() selects categorical (including \"dichotomous\") variables all_dichotomous() selects type \"dichotomous\" all_interaction() selects interaction terms regression model all_intercepts() selects intercept terms regression model all_contrasts() selects variables regression model based type contrast all_ran_pars() all_ran_vals() random-effect parameters values mixed model (see vignette(\"broom_mixed_intro\", package = \"broom.mixed\"))","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/select_helpers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Select helper functions — select_helpers","text":"","code":"all_continuous(continuous2 = TRUE) all_categorical(dichotomous = TRUE) all_dichotomous() all_interaction() all_ran_pars() all_ran_vals() all_intercepts() all_contrasts( contrasts_type = c(\"treatment\", \"sum\", \"poly\", \"helmert\", \"sdif\", \"other\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/select_helpers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Select helper functions — select_helpers","text":"continuous2 (logical) Whether include continuous2 variables, default TRUE. compatibility {gtsummary}), see gtsummary::all_continuous2(). dichotomous (logical) Whether include dichotomous variables, default TRUE. contrasts_type (string) Type contrast select. NULL, variables contrast selected. Default NULL. Select among contrast types c(\"treatment\", \"sum\", \"poly\", \"helmert\", \"sdif\", \"\").","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/select_helpers.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Select helper functions — select_helpers","text":"character vector column names selected.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/select_helpers.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Select helper functions — select_helpers","text":"","code":"if (FALSE) { # interactive() glm(response ~ age * trt + grade, gtsummary::trial, family = binomial) |> tidy_plus_plus(exponentiate = TRUE, include = all_categorical()) glm(response ~ age + trt + grade + stage, gtsummary::trial, family = binomial, contrasts = list(trt = contr.SAS, grade = contr.sum, stage = contr.poly) ) |> tidy_plus_plus( exponentiate = TRUE, include = all_contrasts(c(\"treatment\", \"sum\")) ) }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/seq_range.html","id":null,"dir":"Reference","previous_headings":"","what":"Sequence generation between min and max — seq_range","title":"Sequence generation between min and max — seq_range","text":"Sequence generation min max","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/seq_range.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sequence generation between min and max — seq_range","text":"","code":"seq_range(x, length.out = 25)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/seq_range.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sequence generation between min and max — seq_range","text":"x (numeric) numeric vector. length.(integer) Desired length sequence (positive integer).","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/seq_range.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Sequence generation between min and max — seq_range","text":"numeric vector","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/seq_range.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Sequence generation between min and max — seq_range","text":"seq_range(x, length.) shortcut seq(min(x, na.rm = TRUE), max(x, na.rm = TRUE), length.= length.)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/seq_range.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Sequence generation between min and max — seq_range","text":"","code":"seq_range(iris$Petal.Length) #> [1] 1.000000 1.245833 1.491667 1.737500 1.983333 2.229167 2.475000 2.720833 #> [9] 2.966667 3.212500 3.458333 3.704167 3.950000 4.195833 4.441667 4.687500 #> [17] 4.933333 5.179167 5.425000 5.670833 5.916667 6.162500 6.408333 6.654167 #> [25] 6.900000"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/supported_models.html","id":null,"dir":"Reference","previous_headings":"","what":"Listing of Supported Models — supported_models","title":"Listing of Supported Models — supported_models","text":"Listing Supported Models","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/supported_models.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Listing of Supported Models — supported_models","text":"","code":"supported_models"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/supported_models.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Listing of Supported Models — supported_models","text":"data frame one row per supported model model Model notes Notes","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_coefficients_type.html","id":null,"dir":"Reference","previous_headings":"","what":"Add coefficients type and label as attributes — tidy_add_coefficients_type","title":"Add coefficients type and label as attributes — tidy_add_coefficients_type","text":"Add type coefficients (\"generic\", \"logistic\", \"poisson\", \"relative_risk\" \"prop_hazard\") corresponding coefficient labels, attributes x (respectively named coefficients_type coefficients_label).","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_coefficients_type.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add coefficients type and label as attributes — tidy_add_coefficients_type","text":"","code":"tidy_add_coefficients_type( x, exponentiate = attr(x, \"exponentiate\"), model = tidy_get_model(x) )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_coefficients_type.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add coefficients type and label as attributes — tidy_add_coefficients_type","text":"x (data.frame) tidy tibble produced tidy_*() functions. exponentiate (logical) Whether exponentiate coefficient estimates. consistent original call broom::tidy(). model (model object, e.g. glm) corresponding model, attached x.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_coefficients_type.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add coefficients type and label as attributes — tidy_add_coefficients_type","text":"","code":"ex1 <- lm(hp ~ mpg + factor(cyl), mtcars) |> tidy_and_attach() |> tidy_add_coefficients_type() attr(ex1, \"coefficients_type\") #> [1] \"generic\" attr(ex1, \"coefficients_label\") #> [1] \"Beta\" df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) ex2 <- glm( Survived ~ Class + Age * Sex, data = df, weights = df$n, family = binomial ) |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_coefficients_type() attr(ex2, \"coefficients_type\") #> [1] \"logistic\" attr(ex2, \"coefficients_label\") #> [1] \"OR\""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_contrasts.html","id":null,"dir":"Reference","previous_headings":"","what":"Add contrasts type for categorical variables — tidy_add_contrasts","title":"Add contrasts type for categorical variables — tidy_add_contrasts","text":"Add contrasts column corresponding contrasts used categorical variable contrasts_type column equal \"treatment\", \"sum\", \"poly\", \"helmert\", \"\" \".contrast\".","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_contrasts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add contrasts type for categorical variables — tidy_add_contrasts","text":"","code":"tidy_add_contrasts(x, model = tidy_get_model(x), quiet = FALSE)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_contrasts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add contrasts type for categorical variables — tidy_add_contrasts","text":"x (data.frame) tidy tibble produced tidy_*() functions. model (model object, e.g. glm) corresponding model, attached x. quiet (logical) Whether broom.helpers return message tidy_disambiguate_terms() already applied","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_contrasts.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add contrasts type for categorical variables — tidy_add_contrasts","text":"variable column yet available x, tidy_identify_variables() automatically applied.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_contrasts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add contrasts type for categorical variables — tidy_add_contrasts","text":"","code":"df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) glm( Survived ~ Class + Age + Sex, data = df, weights = df$n, family = binomial, contrasts = list(Age = contr.sum, Class = \"contr.helmert\") ) |> tidy_and_attach() |> tidy_add_contrasts() #> # A tibble: 6 × 13 #> term variable var_class var_type var_nlevels contrasts contrasts_type #> #> 1 (Intercept) (Intercep… NA interce… NA NA NA #> 2 Class1 Class character categor… 4 contr.he… helmert #> 3 Class2 Class character categor… 4 contr.he… helmert #> 4 Class3 Class character categor… 4 contr.he… helmert #> 5 Age1 Age character dichoto… 2 contr.sum sum #> 6 SexMale Sex character dichoto… 2 contr.tr… treatment #> # ℹ 6 more variables: estimate , std.error , statistic , #> # p.value , conf.low , conf.high "},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_estimate_to_reference_rows.html","id":null,"dir":"Reference","previous_headings":"","what":"Add an estimate value to references rows for categorical variables — tidy_add_estimate_to_reference_rows","title":"Add an estimate value to references rows for categorical variables — tidy_add_estimate_to_reference_rows","text":"categorical variables treatment contrast (stats::contr.treatment()) SAS contrast (stats::contr.SAS()), add estimate equal 0 (1 exponentiate = TRUE) reference row.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_estimate_to_reference_rows.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add an estimate value to references rows for categorical variables — tidy_add_estimate_to_reference_rows","text":"","code":"tidy_add_estimate_to_reference_rows( x, exponentiate = attr(x, \"exponentiate\"), conf.level = attr(x, \"conf.level\"), model = tidy_get_model(x), quiet = FALSE )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_estimate_to_reference_rows.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add an estimate value to references rows for categorical variables — tidy_add_estimate_to_reference_rows","text":"x (data.frame) tidy tibble produced tidy_*() functions. exponentiate (logical) Whether exponentiate coefficient estimates. consistent original call broom::tidy() conf.level (numeric) Confidence level, default use value indicated previously tidy_and_attach(), used sum contrasts. model (model object, e.g. glm) corresponding model, attached x. quiet (logical) Whether broom.helpers return message requested output generated. Default FALSE.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_estimate_to_reference_rows.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add an estimate value to references rows for categorical variables — tidy_add_estimate_to_reference_rows","text":"categorical variables sum contrast (stats::contr.sum()), estimate value reference row equal sum coefficients multiplied -1 (eventually exponentiated exponentiate = TRUE), obtained emmeans::emmeans(). emmeans package therefore installed. sum contrasts, model coefficient corresponds difference level grand mean. sum contrasts, confidence intervals p-values also computed added reference rows. variables, change made. reference_row column yet available x, tidy_add_reference_rows() automatically applied.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_estimate_to_reference_rows.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add an estimate value to references rows for categorical variables — tidy_add_estimate_to_reference_rows","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"gtsummary\", boolean = TRUE) && .assert_package(\"emmeans\", boolean = TRUE)) { df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(dplyr::across(where(is.character), factor)) glm( Survived ~ Class + Age + Sex, data = df, weights = df$n, family = binomial, contrasts = list(Age = contr.sum, Class = \"contr.SAS\") ) |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_reference_rows() |> tidy_add_estimate_to_reference_rows() glm( response ~ stage + grade * trt, gtsummary::trial, family = binomial, contrasts = list( stage = contr.treatment(4, base = 3), grade = contr.treatment(3, base = 2), trt = contr.treatment(2, base = 2) ) ) |> tidy_and_attach() |> tidy_add_reference_rows() |> tidy_add_estimate_to_reference_rows() } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_header_rows.html","id":null,"dir":"Reference","previous_headings":"","what":"Add header rows variables with several terms — tidy_add_header_rows","title":"Add header rows variables with several terms — tidy_add_header_rows","text":"variables several terms (usually categorical variables also case continuous variables polynomial terms splines), tidy_add_header_rows() add additional row per variable, label equal var_label. additional rows identified header_row column.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_header_rows.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add header rows variables with several terms — tidy_add_header_rows","text":"","code":"tidy_add_header_rows( x, show_single_row = NULL, model = tidy_get_model(x), quiet = FALSE, strict = FALSE )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_header_rows.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add header rows variables with several terms — tidy_add_header_rows","text":"x (data.frame) tidy tibble produced tidy_*() functions. show_single_row (tidy-select) Names dichotomous variables displayed single row. See also all_dichotomous(). model (model object, e.g. glm) corresponding model, attached x. quiet (logical) Whether broom.helpers return message requested output generated. Default FALSE. strict (logical) Whether broom.helpers return error requested output generated. Default FALSE.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_header_rows.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add header rows variables with several terms — tidy_add_header_rows","text":"show_single_row argument allows specify list dichotomous variables displayed single row instead two rows. added header_row column equal : TRUE header row; FALSE normal row variable header row; NA variables without header row. label column yet available x, tidy_add_term_labels() automatically applied.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_header_rows.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add header rows variables with several terms — tidy_add_header_rows","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"gtsummary\", boolean = TRUE)) { df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) res <- glm( Survived ~ Class + Age + Sex, data = df, weights = df$n, family = binomial, contrasts = list(Age = contr.sum, Class = \"contr.SAS\") ) |> tidy_and_attach() |> tidy_add_variable_labels(labels = list(Class = \"Custom label for Class\")) |> tidy_add_reference_rows() res |> tidy_add_header_rows() res |> tidy_add_header_rows(show_single_row = all_dichotomous()) glm( response ~ stage + grade * trt, gtsummary::trial, family = binomial, contrasts = list( stage = contr.treatment(4, base = 3), grade = contr.treatment(3, base = 2), trt = contr.treatment(2, base = 2) ) ) |> tidy_and_attach() |> tidy_add_reference_rows() |> tidy_add_header_rows() } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_n.html","id":null,"dir":"Reference","previous_headings":"","what":"Add the (weighted) number of observations — tidy_add_n","title":"Add the (weighted) number of observations — tidy_add_n","text":"Add number observations new column n_obs, taking account weights defined.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_n.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add the (weighted) number of observations — tidy_add_n","text":"","code":"tidy_add_n(x, model = tidy_get_model(x))"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_n.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add the (weighted) number of observations — tidy_add_n","text":"x (data.frame) tidy tibble produced tidy_*() functions. model (model object, e.g. glm) corresponding model, attached x.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_n.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add the (weighted) number of observations — tidy_add_n","text":"continuous variables, corresponds valid observations contributing model. categorical variables coded treatment sum contrasts, model term associated one level original categorical variable. Therefore, n_obs correspond number observations associated level. n_obs also computed reference rows. polynomial contrasts (defined stats::contr.poly()), levels contribute computation model term. Therefore, n_obs equal total number observations. Helmert custom contrasts, rows contributing positively (.e. positive contrast) computation term considered estimating n_obs. result therefore difficult interpret. better understanding observations taken account compute n_obs values, look model_compute_terms_contributions(). interaction terms, rows contributing terms interaction considered compute n_obs. binomial logistic models, tidy_add_n() also return corresponding number events (n_event) term, taking account defined weights. Observed proportions obtained n_obs / n_event. Similarly, number events computed multinomial logistic models (nnet::multinom()) level outcome (y.level), corresponding number observations equal outcome level. Poisson models, n_event equal number counts per term. addition, third column exposure computed. offset defined, exposure assumed equal 1 (eventually multiplied weights) per observation. offset defined, exposure equal (weighted) sum exponential offset (reminder, model effect x ratio y / z, Poisson model defined glm(y ~ x + offset(log(z)), family = poisson)). Observed rates obtained n_event / exposure. Cox models (survival::coxph()), individual coded several observations (several rows). n_obs correspond weighted number observations different number individuals n_ind. tidy_add_n() also compute (weighted) number events (n_event) according definition survival::Surv() object. Exposure time also returned exposure column. equal (weighted) sum time variable one variable time passed survival::Surv(), (weighted) sum time2 - time two time variables defined survival::Surv(). competing risk regression models (tidycmprsk::crr()), n_event takes account event interest defined failcode. (weighted) total number observations (N_obs), individuals (N_ind), events (N_event) exposure time (Exposure) stored attributes returned tibble.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_n.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add the (weighted) number of observations — tidy_add_n","text":"","code":"if (FALSE) { # interactive() lm(Petal.Length ~ ., data = iris) |> tidy_and_attach() |> tidy_add_n() lm(Petal.Length ~ ., data = iris, contrasts = list(Species = contr.sum)) |> tidy_and_attach() |> tidy_add_n() lm(Petal.Length ~ ., data = iris, contrasts = list(Species = contr.poly)) |> tidy_and_attach() |> tidy_add_n() lm(Petal.Length ~ poly(Sepal.Length, 2), data = iris) |> tidy_and_attach() |> tidy_add_n() df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) glm( Survived ~ Class + Age + Sex, data = df, weights = df$n, family = binomial, contrasts = list(Age = contr.sum, Class = \"contr.helmert\") ) |> tidy_and_attach() |> tidy_add_n() glm( Survived ~ Class * (Age:Sex), data = df, weights = df$n, family = binomial, contrasts = list(Age = contr.sum, Class = \"contr.helmert\") ) |> tidy_and_attach() |> tidy_add_n() glm(response ~ age + grade * trt, gtsummary::trial, family = poisson) |> tidy_and_attach() |> tidy_add_n() glm( response ~ trt * grade + offset(log(ttdeath)), gtsummary::trial, family = poisson ) |> tidy_and_attach() |> tidy_add_n() }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_pairwise_contrasts.html","id":null,"dir":"Reference","previous_headings":"","what":"Add pairwise contrasts for categorical variables — tidy_add_pairwise_contrasts","title":"Add pairwise contrasts for categorical variables — tidy_add_pairwise_contrasts","text":"Computes pairwise contrasts emmeans::emmeans() add results tibble. Works models supported emmeans, see vignette(\"models\", package = \"emmeans\").","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_pairwise_contrasts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add pairwise contrasts for categorical variables — tidy_add_pairwise_contrasts","text":"","code":"tidy_add_pairwise_contrasts( x, variables = all_categorical(), keep_model_terms = FALSE, pairwise_reverse = TRUE, contrasts_adjust = NULL, conf.level = attr(x, \"conf.level\"), emmeans_args = list(), model = tidy_get_model(x), quiet = FALSE )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_pairwise_contrasts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add pairwise contrasts for categorical variables — tidy_add_pairwise_contrasts","text":"x (data.frame) tidy tibble produced tidy_*() functions. variables include (tidy-select) Variables pairwise contrasts added. Default all_categorical(). keep_model_terms (logical) Keep terms model? pairwise_reverse (logical) Determines whether use \"pairwise\" (TRUE) \"revpairwise\" (FALSE), see emmeans::contrast(). contrasts_adjust (string) Optional adjustment method computing contrasts, see emmeans::contrast() (NULL, use emmeans default). conf.level (numeric) Confidence level, default use value indicated previously tidy_and_attach(). emmeans_args (list) List additional parameter pass emmeans::emmeans() computing pairwise contrasts. model (model object, e.g. glm) corresponding model, attached x. quiet (logical) Whether broom.helpers return message requested output generated. Default FALSE.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_pairwise_contrasts.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Add pairwise contrasts for categorical variables — tidy_add_pairwise_contrasts","text":"contrasts column yet available x, tidy_add_contrasts() automatically applied. multi-components models, zero-inflated Poisson beta regression, support pairwise contrasts still experimental.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_pairwise_contrasts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add pairwise contrasts for categorical variables — tidy_add_pairwise_contrasts","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"emmeans\", boolean = TRUE)) { mod1 <- lm(Sepal.Length ~ Species, data = iris) mod1 |> tidy_and_attach() |> tidy_add_pairwise_contrasts() mod1 |> tidy_and_attach() |> tidy_add_pairwise_contrasts(pairwise_reverse = FALSE) mod1 |> tidy_and_attach() |> tidy_add_pairwise_contrasts(keep_model_terms = TRUE) mod1 |> tidy_and_attach() |> tidy_add_pairwise_contrasts(contrasts_adjust = \"none\") if (.assert_package(\"gtsummary\", boolean = TRUE)) { mod2 <- glm( response ~ age + trt + grade, data = gtsummary::trial, family = binomial ) mod2 |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_pairwise_contrasts() } } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_reference_rows.html","id":null,"dir":"Reference","previous_headings":"","what":"Add references rows for categorical variables — tidy_add_reference_rows","title":"Add references rows for categorical variables — tidy_add_reference_rows","text":"categorical variables treatment contrast (stats::contr.treatment()), SAS contrast (stats::contr.SAS()) sum contrast (stats::contr.sum()), successive differences contrast (MASS::contr.sdif()) add reference row.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_reference_rows.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add references rows for categorical variables — tidy_add_reference_rows","text":"","code":"tidy_add_reference_rows( x, no_reference_row = NULL, model = tidy_get_model(x), quiet = FALSE )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_reference_rows.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add references rows for categorical variables — tidy_add_reference_rows","text":"x (data.frame) tidy tibble produced tidy_*() functions. no_reference_row (tidy-select) Variables reference row added. See also all_categorical() all_dichotomous(). model (model object, e.g. glm) corresponding model, attached x. quiet (logical) Whether broom.helpers return message requested output generated. Default FALSE.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_reference_rows.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add references rows for categorical variables — tidy_add_reference_rows","text":"added reference_row column equal : TRUE reference row; FALSE normal row variable reference row; NA variables without reference row. contrasts column yet available x, tidy_add_contrasts() automatically applied. tidy_add_reference_rows() populate label reference term. therefore better apply tidy_add_term_labels() tidy_add_reference_rows() rather . Similarly, better apply tidy_add_reference_rows() tidy_add_n().","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_reference_rows.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add references rows for categorical variables — tidy_add_reference_rows","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"gtsummary\", boolean = TRUE)) { df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) res <- glm( Survived ~ Class + Age + Sex, data = df, weights = df$n, family = binomial, contrasts = list(Age = contr.sum, Class = \"contr.SAS\") ) |> tidy_and_attach() res |> tidy_add_reference_rows() res |> tidy_add_reference_rows(no_reference_row = all_dichotomous()) res |> tidy_add_reference_rows(no_reference_row = \"Class\") glm( response ~ stage + grade * trt, gtsummary::trial, family = binomial, contrasts = list( stage = contr.treatment(4, base = 3), grade = contr.treatment(3, base = 2), trt = contr.treatment(2, base = 2) ) ) |> tidy_and_attach() |> tidy_add_reference_rows() } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_term_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"Add term labels — tidy_add_term_labels","title":"Add term labels — tidy_add_term_labels","text":"add term labels label column, based : labels provided labels argument provided; factor levels categorical variables coded treatment, SAS sum contrasts (label customized categorical_terms_pattern argument); variable labels one term per variable; term name otherwise.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_term_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add term labels — tidy_add_term_labels","text":"","code":"tidy_add_term_labels( x, labels = NULL, interaction_sep = \" * \", categorical_terms_pattern = \"{level}\", model = tidy_get_model(x), quiet = FALSE, strict = FALSE )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_term_labels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add term labels — tidy_add_term_labels","text":"x (data.frame) tidy tibble produced tidy_*() functions. labels (list string) optional named list named vector custom term labels. interaction_sep (string) Separator interaction terms. categorical_terms_pattern (glue pattern) glue pattern labels categorical terms treatment sum contrasts (see examples model_list_terms_levels()). model (model object, e.g. glm) corresponding model, attached x. quiet (logical) Whether broom.helpers return message requested output generated. Default FALSE. strict (logical) Whether broom.helpers return error requested output generated. Default FALSE.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_term_labels.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add term labels — tidy_add_term_labels","text":"variable_label column yet available x, tidy_add_variable_labels() automatically applied. contrasts column yet available x, tidy_add_contrasts() automatically applied. possible pass custom label term labels, including interaction terms.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_term_labels.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add term labels — tidy_add_term_labels","text":"","code":"if (FALSE) { # interactive() df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) |> labelled::set_variable_labels( Class = \"Passenger's class\", Sex = \"Sex\" ) mod <- glm(Survived ~ Class * Age * Sex, data = df, weights = df$n, family = binomial) mod |> tidy_and_attach() |> tidy_add_term_labels() mod |> tidy_and_attach() |> tidy_add_term_labels( interaction_sep = \" x \", categorical_terms_pattern = \"{level} / {reference_level}\" ) }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_variable_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"Add variable labels — tidy_add_variable_labels","title":"Add variable labels — tidy_add_variable_labels","text":"add variable labels var_label column, based : labels provided labels argument provided; variable labels defined original data frame label attribute (cf. labelled::var_label()); variable name otherwise.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_variable_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add variable labels — tidy_add_variable_labels","text":"","code":"tidy_add_variable_labels( x, labels = NULL, interaction_sep = \" * \", instrumental_suffix = \" (instrumental)\", model = tidy_get_model(x) )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_variable_labels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add variable labels — tidy_add_variable_labels","text":"x (data.frame) tidy tibble produced tidy_*() functions. labels (formula-list-selector) optional named list named vector custom variable labels. interaction_sep (string) Separator interaction terms. instrumental_suffix (string) Suffix added variable labels instrumental variables (fixest models). NULL add nothing. model (model object, e.g. glm) corresponding model, attached x.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_variable_labels.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add variable labels — tidy_add_variable_labels","text":"variable column yet available x, tidy_identify_variables() automatically applied. possible pass custom label interaction term labels (see examples).","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_variable_labels.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add variable labels — tidy_add_variable_labels","text":"","code":"df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) |> labelled::set_variable_labels( Class = \"Passenger's class\", Sex = \"Sex\" ) glm(Survived ~ Class * Age * Sex, data = df, weights = df$n, family = binomial) |> tidy_and_attach() |> tidy_add_variable_labels( labels = list( \"(Intercept)\" ~ \"Custom intercept\", Sex ~ \"Gender\", \"Class:Age\" ~ \"Custom label\" ) ) #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: collapsing to unique 'x' values #> # A tibble: 16 × 12 #> term variable var_label var_class var_type var_nlevels estimate std.error #> #> 1 (Interc… (Interc… Custom i… NA interce… NA 3.56 0.507 #> 2 Class2nd Class Passenge… character categor… 4 -1.74 0.589 #> 3 Class3rd Class Passenge… character categor… 4 -3.71 0.531 #> 4 ClassCr… Class Passenge… character categor… 4 -1.66 0.800 #> 5 AgeChild Age Age character dichoto… 2 11.0 883. #> 6 SexMale Sex Gender character dichoto… 2 -4.28 0.532 #> 7 Class2n… Class:A… Custom l… NA interac… NA 3.53 1066. #> 8 Class3r… Class:A… Custom l… NA interac… NA -11.0 883. #> 9 ClassCr… Class:A… Custom l… NA interac… NA NA NA #> 10 Class2n… Class:S… Passenge… NA interac… NA 0.0680 0.671 #> 11 Class3r… Class:S… Passenge… NA interac… NA 2.80 0.569 #> 12 ClassCr… Class:S… Passenge… NA interac… NA 1.14 0.820 #> 13 AgeChil… Age:Sex Age * Ge… NA interac… NA 5.25 1091. #> 14 Class2n… Class:A… Passenge… NA interac… NA -1.19 1383. #> 15 Class3r… Class:A… Passenge… NA interac… NA -4.57 1091. #> 16 ClassCr… Class:A… Passenge… NA interac… NA NA NA #> # ℹ 4 more variables: statistic , p.value , conf.low , #> # conf.high "},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_all_effects.html","id":null,"dir":"Reference","previous_headings":"","what":"Marginal Predictions at the mean with effects::allEffects() — tidy_all_effects","title":"Marginal Predictions at the mean with effects::allEffects() — tidy_all_effects","text":"Use effects::allEffects() estimate marginal predictions return tibble tidied way used broom.helpers functions. See vignette(\"functions-supported--effects\", package = \"effects\") list supported models.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_all_effects.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Marginal Predictions at the mean with effects::allEffects() — tidy_all_effects","text":"","code":"tidy_all_effects(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_all_effects.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Marginal Predictions at the mean with effects::allEffects() — tidy_all_effects","text":"x (model object, e.g. glm) model tidied. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed effects::allEffects().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_all_effects.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Marginal Predictions at the mean with effects::allEffects() — tidy_all_effects","text":"default, effects::allEffects() estimate marginal predictions mean observed means continuous variables weighting modalities categorical variables according observed distribution original dataset. Marginal predictions therefore computed sort averaged situation / typical values variables fixed model. information, see vignette(\"marginal_tidiers\", \"broom.helpers\").","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_all_effects.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Marginal Predictions at the mean with effects::allEffects() — tidy_all_effects","text":"model contains interactions, effects::allEffects() return marginal predictions different levels interactions.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_all_effects.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Marginal Predictions at the mean with effects::allEffects() — tidy_all_effects","text":"","code":"if (FALSE) { # interactive() df <- Titanic |> dplyr::as_tibble() |> tidyr::uncount(n) |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, family = binomial ) tidy_all_effects(mod) tidy_plus_plus(mod, tidy_fun = tidy_all_effects) }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_attach_model.html","id":null,"dir":"Reference","previous_headings":"","what":"Attach a full model to the tibble of model terms — tidy_attach_model","title":"Attach a full model to the tibble of model terms — tidy_attach_model","text":"facilitate use broom helpers pipe, recommended attach original model attribute tibble model terms generated broom::tidy().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_attach_model.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Attach a full model to the tibble of model terms — tidy_attach_model","text":"","code":"tidy_attach_model(x, model, .attributes = NULL) tidy_and_attach( model, tidy_fun = tidy_with_broom_or_parameters, conf.int = TRUE, conf.level = 0.95, exponentiate = FALSE, model_matrix_attr = TRUE, ... ) tidy_get_model(x) tidy_detach_model(x)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_attach_model.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Attach a full model to the tibble of model terms — tidy_attach_model","text":"x (data.frame) tidy tibble produced tidy_*() functions. model (model object, e.g. glm) model attached/tidied. .attributes (list) Named list additional attributes attached x. tidy_fun (function) Option specify custom tidier function. conf.int (logical) confidence intervals computed? (see broom::tidy()) conf.level (numeric) Level confidence confidence intervals (default: 95%). exponentiate (logical) Whether exponentiate coefficient estimates. typical logistic, Poisson Cox models, bad idea log logit link; defaults FALSE. model_matrix_attr (logical) Whether model frame model matrix added attributes model (respectively named \"model_frame\" \"model_matrix\") passed ... arguments passed tidy_fun().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_attach_model.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Attach a full model to the tibble of model terms — tidy_attach_model","text":"tidy_attach_model() attach model tibble already generated tidy_and_attach() apply broom::tidy() attach model. Use tidy_get_model() get model attached tibble tidy_detach_model() remove attribute containing model.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_attach_model.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Attach a full model to the tibble of model terms — tidy_attach_model","text":"","code":"mod <- lm(Sepal.Length ~ Sepal.Width + Species, data = iris) tt <- mod |> tidy_and_attach(conf.int = TRUE) tt #> # A tibble: 4 × 7 #> term estimate std.error statistic p.value conf.low conf.high #> #> 1 (Intercept) 2.25 0.370 6.09 9.57e- 9 1.52 2.98 #> 2 Sepal.Width 0.804 0.106 7.56 4.19e-12 0.593 1.01 #> 3 Speciesversicolor 1.46 0.112 13.0 3.48e-26 1.24 1.68 #> 4 Speciesvirginica 1.95 0.100 19.5 2.09e-42 1.75 2.14 tidy_get_model(tt) #> #> Call: #> lm(formula = Sepal.Length ~ Sepal.Width + Species, data = iris) #> #> Coefficients: #> (Intercept) Sepal.Width Speciesversicolor Speciesvirginica #> 2.2514 0.8036 1.4587 1.9468 #>"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_comparisons.html","id":null,"dir":"Reference","previous_headings":"","what":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_avg_comparisons","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_avg_comparisons","text":"Use marginaleffects::avg_comparisons() estimate marginal contrasts return tibble tidied way used broom.helpers functions. See marginaleffects::avg_comparisons() list supported models.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_comparisons.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_avg_comparisons","text":"","code":"tidy_avg_comparisons(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_comparisons.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_avg_comparisons","text":"x (model object, e.g. glm) model tidied. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed marginaleffects::avg_comparisons().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_comparisons.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_avg_comparisons","text":"default, marginaleffects::avg_comparisons() estimate average marginal contrasts: contrast computed observed value original dataset (counterfactual approach) averaged. Marginal Contrasts Mean computed specifying newdata = \"mean\". variables argument can used select contrasts computed. Please refer documentation page marginaleffects::avg_comparisons(). See also tidy_marginal_contrasts() taking account interactions. information, see vignette(\"marginal_tidiers\", \"broom.helpers\").","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_comparisons.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_avg_comparisons","text":"","code":"if (FALSE) { # interactive() # Average Marginal Contrasts df <- Titanic |> dplyr::as_tibble() |> tidyr::uncount(n) |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, family = binomial ) tidy_avg_comparisons(mod) tidy_plus_plus(mod, tidy_fun = tidy_avg_comparisons) mod2 <- lm(Petal.Length ~ poly(Petal.Width, 2) + Species, data = iris) tidy_avg_comparisons(mod2) # Custumizing the type of contrasts tidy_avg_comparisons( mod2, variables = list(Petal.Width = 2, Species = \"pairwise\") ) # Marginal Contrasts at the Mean tidy_avg_comparisons(mod, newdata = \"mean\") tidy_plus_plus(mod, tidy_fun = tidy_avg_comparisons, newdata = \"mean\") }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_slopes.html","id":null,"dir":"Reference","previous_headings":"","what":"Marginal Slopes / Effects with marginaleffects::avg_slopes() — tidy_avg_slopes","title":"Marginal Slopes / Effects with marginaleffects::avg_slopes() — tidy_avg_slopes","text":"Use marginaleffects::avg_slopes() estimate marginal slopes / effects return tibble tidied way used broom.helpers functions. See marginaleffects::avg_slopes() list supported models.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_slopes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Marginal Slopes / Effects with marginaleffects::avg_slopes() — tidy_avg_slopes","text":"","code":"tidy_avg_slopes(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_slopes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Marginal Slopes / Effects with marginaleffects::avg_slopes() — tidy_avg_slopes","text":"x (model object, e.g. glm) model tidied. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed marginaleffects::avg_slopes().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_slopes.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Marginal Slopes / Effects with marginaleffects::avg_slopes() — tidy_avg_slopes","text":"default, marginaleffects::avg_slopes() estimate average marginal effects (AME): effect computed observed value original dataset averaged. Marginal Effects Mean (MEM) computed specifying newdata = \"mean\". types marginal effects computed. Please refer documentation page marginaleffects::avg_slopes(). information, see vignette(\"marginal_tidiers\", \"broom.helpers\").","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_slopes.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Marginal Slopes / Effects with marginaleffects::avg_slopes() — tidy_avg_slopes","text":"","code":"if (FALSE) { # interactive() # Average Marginal Effects (AME) df <- Titanic |> dplyr::as_tibble() |> tidyr::uncount(n) |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, family = binomial ) tidy_avg_slopes(mod) tidy_plus_plus(mod, tidy_fun = tidy_avg_slopes) mod2 <- lm(Petal.Length ~ poly(Petal.Width, 2) + Species, data = iris) tidy_avg_slopes(mod2) # Marginal Effects at the Mean (MEM) tidy_avg_slopes(mod, newdata = \"mean\") tidy_plus_plus(mod, tidy_fun = tidy_avg_slopes, newdata = \"mean\") }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_broom.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy with broom::tidy() and checks that all arguments are used — tidy_broom","title":"Tidy with broom::tidy() and checks that all arguments are used — tidy_broom","text":"Tidy broom::tidy() checks arguments used","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_broom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy with broom::tidy() and checks that all arguments are used — tidy_broom","text":"","code":"tidy_broom(x, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_broom.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy with broom::tidy() and checks that all arguments are used — tidy_broom","text":"x (model object, e.g. glm) model tidied. ... Additional parameters passed broom::tidy().","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_disambiguate_terms.html","id":null,"dir":"Reference","previous_headings":"","what":"Disambiguate terms — tidy_disambiguate_terms","title":"Disambiguate terms — tidy_disambiguate_terms","text":"mixed models, term column returned broom.mixed may duplicated values random-effect parameters random-effect values. case, terms disambiguated prefixing value group column. tidy_disambiguate_terms() change term group column x. original term value kept new column original_term.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_disambiguate_terms.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Disambiguate terms — tidy_disambiguate_terms","text":"","code":"tidy_disambiguate_terms(x, sep = \".\", model = tidy_get_model(x), quiet = FALSE)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_disambiguate_terms.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Disambiguate terms — tidy_disambiguate_terms","text":"x (data.frame) tidy tibble produced tidy_*() functions. sep (string) Separator added group name term. model (model object, e.g. glm) corresponding model, attached x. quiet (logical) Whether broom.helpers return message requested output generated. Default FALSE.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_disambiguate_terms.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Disambiguate terms — tidy_disambiguate_terms","text":"","code":"if (FALSE) { # interactive() if ( .assert_package(\"lme4\", boolean = TRUE) && .assert_package(\"broom.mixed\", boolean = TRUE) && .assert_package(\"gtsummary\", boolean = TRUE) ) { mod <- lme4::lmer(marker ~ stage + (1 | grade) + (death | response), gtsummary::trial) mod |> tidy_and_attach() |> tidy_disambiguate_terms() } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_ggpredict.html","id":null,"dir":"Reference","previous_headings":"","what":"Marginal Predictions with ggeffects::ggpredict() — tidy_ggpredict","title":"Marginal Predictions with ggeffects::ggpredict() — tidy_ggpredict","text":"Use ggeffects::ggpredict() estimate marginal predictions return tibble tidied way used broom.helpers functions. See https://strengejacke.github.io/ggeffects/ list supported models.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_ggpredict.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Marginal Predictions with ggeffects::ggpredict() — tidy_ggpredict","text":"","code":"tidy_ggpredict(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_ggpredict.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Marginal Predictions with ggeffects::ggpredict() — tidy_ggpredict","text":"x (model object, e.g. glm) model tidied. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed ggeffects::ggpredict().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_ggpredict.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Marginal Predictions with ggeffects::ggpredict() — tidy_ggpredict","text":"default, ggeffects::ggpredict() estimate marginal predictions observed mean continuous variables first modality categorical variables (regardless type contrasts used model). information, see vignette(\"marginal_tidiers\", \"broom.helpers\").","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_ggpredict.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Marginal Predictions with ggeffects::ggpredict() — tidy_ggpredict","text":"default, ggeffects::ggpredict() estimates marginal predictions individual variable, regardless eventual interactions.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_ggpredict.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Marginal Predictions with ggeffects::ggpredict() — tidy_ggpredict","text":"","code":"if (FALSE) { # interactive() df <- Titanic |> dplyr::as_tibble() |> tidyr::uncount(n) |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, family = binomial ) tidy_ggpredict(mod) tidy_plus_plus(mod, tidy_fun = tidy_ggpredict) }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_identify_variables.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify the variable corresponding to each model coefficient — tidy_identify_variables","title":"Identify the variable corresponding to each model coefficient — tidy_identify_variables","text":"tidy_identify_variables() add tidy tibble three additional columns: variable, var_class, var_type var_nlevels.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_identify_variables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify the variable corresponding to each model coefficient — tidy_identify_variables","text":"","code":"tidy_identify_variables(x, model = tidy_get_model(x), quiet = FALSE)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_identify_variables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identify the variable corresponding to each model coefficient — tidy_identify_variables","text":"x (data.frame) tidy tibble produced tidy_*() functions. model (model object, e.g. glm) corresponding model, attached x. quiet (logical) Whether broom.helpers return message requested output generated. Default FALSE.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_identify_variables.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Identify the variable corresponding to each model coefficient — tidy_identify_variables","text":"also identify interaction terms intercept(s). var_type : \"continuous\", \"dichotomous\" (categorical variable 2 levels), \"categorical\" (categorical variable 3 levels ), \"intercept\" \"interaction\" \"ran_pars (random-effect parameters mixed models) \"ran_vals\" (random-effect values mixed models) \"unknown\" rare cases tidy_identify_variables() fail identify list variables dichotomous categorical variables, var_nlevels corresponds number original levels corresponding variables. fixest models, new column instrumental added indicate instrumental variables.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_identify_variables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Identify the variable corresponding to each model coefficient — tidy_identify_variables","text":"","code":"df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) glm( Survived ~ Class + Age * Sex, data = df, weights = df$n, family = binomial ) |> tidy_and_attach() |> tidy_identify_variables() #> # A tibble: 7 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 Class2nd Class character categor… 4 -1.03 0.200 -5.17 #> 3 Class3rd Class character categor… 4 -1.81 0.176 -10.3 #> 4 ClassCrew Class character categor… 4 -0.803 0.160 -5.03 #> 5 AgeChild Age character dichoto… 2 -0.110 0.335 -0.328 #> 6 SexMale Sex character dichoto… 2 -2.62 0.151 -17.3 #> 7 AgeChild… Age:Sex NA interac… NA 1.90 0.433 4.39 #> # ℹ 3 more variables: p.value , conf.low , conf.high lm( Sepal.Length ~ poly(Sepal.Width, 2) + Species, data = iris, contrasts = list(Species = contr.sum) ) |> tidy_and_attach(conf.int = TRUE) |> tidy_identify_variables() #> # A tibble: 5 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 5.84 0.0359 163. #> 2 poly(Sep… Sepal.W… nmatrix.2 continu… NA 4.27 0.568 7.52 #> 3 poly(Sep… Sepal.W… nmatrix.2 continu… NA -0.0720 0.447 -0.161 #> 4 Species1 Species factor categor… 3 -1.13 0.0647 -17.5 #> 5 Species2 Species factor categor… 3 0.324 0.0593 5.46 #> # ℹ 3 more variables: p.value , conf.low , conf.high "},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_contrasts.html","id":null,"dir":"Reference","previous_headings":"","what":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_marginal_contrasts","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_marginal_contrasts","text":"Use marginaleffects::avg_comparisons() estimate marginal contrasts variable model return tibble tidied way used broom.helpers functions. See marginaleffects::avg_comparisons() list supported models.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_contrasts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_marginal_contrasts","text":"","code":"tidy_marginal_contrasts( x, variables_list = \"auto\", conf.int = TRUE, conf.level = 0.95, ... ) variables_to_contrast( model, interactions = TRUE, cross = FALSE, var_categorical = \"reference\", var_continuous = 1, by_categorical = unique, by_continuous = stats::fivenum )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_contrasts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_marginal_contrasts","text":"x (model object, e.g. glm) model tidied. variables_list (list string) list whose elements sequentially passed variables marginaleffects::avg_comparisons() (see details ); alternatively, also string \"auto\" (default), \"cross\" \"no_interaction\" conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed marginaleffects::avg_comparisons(). model (model object, e.g. glm) model. interactions (logical) combinations variables corresponding interactions returned? cross (logical) interaction TRUE, \"cross-contrasts\" computed? (FALSE, last term interaction passed variable terms passed ) var_categorical (predictor values) Default variable value categorical variables. var_continuous (predictor values) Default variable value continuous variables. by_categorical (predictor values) Default value categorical variables. by_continuous (predictor values) Default value continuous variables.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_contrasts.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_marginal_contrasts","text":"Marginal contrasts obtained calling, variable combination variables, marginaleffects::avg_comparisons(). tidy_marginal_contrasts() compute marginal contrasts variable combination variables, stacking results unique tibble. tidy_marginal_contrasts() variables_list argument consisting list specifications passed sequentially variables argument marginaleffects::avg_comparisons(). Considering single categorical variable named cat, tidy_marginal_contrasts() call avg_comparisons(model, variables = list(cat = \"reference\")) obtain average marginal contrasts variable. Considering single continuous variable named cont, tidy_marginalcontrasts() call avg_comparisons(model, variables = list(cont = 1)) obtain average marginal contrasts increase one unit. combination variables, several possibilities. compute \"cross-contrasts\" providing simultaneously several variables variables specifying cross = TRUE marginaleffects::avg_comparisons(). Alternatively, compute contrasts first variable specified variables different values second variable specified . helper function variables_to_contrast() used automatically generate suitable list used variables_list. combination variables list two named elements: \"variables\" list named elements passed variables \"\" list named elements used creating relevant datagrid whose names passed . variables_list's default value, \"auto\", calls variables_to_contrast(interactions = TRUE, cross = FALSE) \"no_interaction\" shortcut variables_to_contrast(interactions = FALSE). \"cross\" calls variables_to_contrast(interactions = TRUE, cross = TRUE) can also provide custom specifications (see examples). default, average marginal contrasts computed: contrasts computed using counterfactual grid value variable interest, averaging results. Marginal contrasts mean obtained indicating newdata = \"mean\". assumptions possible, see help file marginaleffects::avg_comparisons(). information, see vignette(\"marginal_tidiers\", \"broom.helpers\").","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_contrasts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_marginal_contrasts","text":"","code":"if (FALSE) { # interactive() # Average Marginal Contrasts df <- Titanic |> dplyr::as_tibble() |> tidyr::uncount(n) |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, family = binomial ) tidy_marginal_contrasts(mod) tidy_plus_plus(mod, tidy_fun = tidy_marginal_contrasts) mod2 <- lm(Petal.Length ~ poly(Petal.Width, 2) + Species, data = iris) tidy_marginal_contrasts(mod2) tidy_marginal_contrasts( mod2, variables_list = variables_to_predict( mod2, continuous = 3, categorical = \"pairwise\" ) ) # Model with interactions mod3 <- glm( Survived ~ Sex * Age + Class, data = df, family = binomial ) tidy_marginal_contrasts(mod3) tidy_marginal_contrasts(mod3, \"no_interaction\") tidy_marginal_contrasts(mod3, \"cross\") tidy_marginal_contrasts( mod3, variables_list = list( list(variables = list(Class = \"pairwise\"), by = list(Sex = unique)), list(variables = list(Age = \"all\")), list(variables = list(Class = \"sequential\", Sex = \"reference\")) ) ) mod4 <- lm(Sepal.Length ~ Petal.Length * Petal.Width + Species, data = iris) tidy_marginal_contrasts(mod4) tidy_marginal_contrasts( mod4, variables_list = list( list( variables = list(Species = \"sequential\"), by = list(Petal.Length = c(2, 5)) ), list( variables = list(Petal.Length = 2), by = list(Species = unique, Petal.Width = 2:4) ) ) ) # Marginal Contrasts at the Mean tidy_marginal_contrasts(mod, newdata = \"mean\") tidy_marginal_contrasts(mod3, newdata = \"mean\") }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_means.html","id":null,"dir":"Reference","previous_headings":"","what":"Marginal Means with marginaleffects::marginal_means() — tidy_marginal_means","title":"Marginal Means with marginaleffects::marginal_means() — tidy_marginal_means","text":"function deprecated. Use instead tidy_marginal_predictions() option newdata = \"marginalmeans\".","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_means.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Marginal Means with marginaleffects::marginal_means() — tidy_marginal_means","text":"","code":"tidy_marginal_means(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_means.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Marginal Means with marginaleffects::marginal_means() — tidy_marginal_means","text":"x (model object, e.g. glm) model tidied. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed marginaleffects::marginal_means().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_means.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Marginal Means with marginaleffects::marginal_means() — tidy_marginal_means","text":"Use marginaleffects::marginal_means() estimate marginal means return tibble tidied way used broom.helpers functions. See marginaleffects::marginal_means()() list supported models. marginaleffects::marginal_means() estimate marginal means: adjusted predictions, averaged across grid categorical predictors, holding numeric predictors means. Please refer documentation page marginaleffects::marginal_means(). Marginal means defined categorical variables. information, see vignette(\"marginal_tidiers\", \"broom.helpers\").","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_means.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Marginal Means with marginaleffects::marginal_means() — tidy_marginal_means","text":"","code":"if (FALSE) { # interactive() # Average Marginal Means df <- Titanic |> dplyr::as_tibble() |> tidyr::uncount(n) |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, family = binomial ) tidy_marginal_means(mod) tidy_plus_plus(mod, tidy_fun = tidy_marginal_means) mod2 <- lm(Petal.Length ~ poly(Petal.Width, 2) + Species, data = iris) tidy_marginal_means(mod2) }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_predictions.html","id":null,"dir":"Reference","previous_headings":"","what":"Marginal Predictions with marginaleffects::avg_predictions() — tidy_marginal_predictions","title":"Marginal Predictions with marginaleffects::avg_predictions() — tidy_marginal_predictions","text":"Use marginaleffects::avg_predictions() estimate marginal predictions variable model return tibble tidied way used broom.helpers functions. See marginaleffects::avg_predictions() list supported models.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_predictions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Marginal Predictions with marginaleffects::avg_predictions() — tidy_marginal_predictions","text":"","code":"tidy_marginal_predictions( x, variables_list = \"auto\", conf.int = TRUE, conf.level = 0.95, ... ) variables_to_predict( model, interactions = TRUE, categorical = unique, continuous = stats::fivenum ) plot_marginal_predictions(x, variables_list = \"auto\", conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_predictions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Marginal Predictions with marginaleffects::avg_predictions() — tidy_marginal_predictions","text":"x (model object, e.g. glm) model tidied. variables_list (list string) list whose elements sequentially passed variables marginaleffects::avg_predictions() (see details ); alternatively, also string \"auto\" (default) \"no_interaction\". conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed marginaleffects::avg_predictions(). model (model object, e.g. glm) model. interactions (logical) combinations variables corresponding interactions returned? categorical (predictor values) Default values categorical variables. continuous (predictor values) Default values continuous variables.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_predictions.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Marginal Predictions with marginaleffects::avg_predictions() — tidy_marginal_predictions","text":"Marginal predictions obtained calling, variable, marginaleffects::avg_predictions() variable used variables argument. Considering categorical variable named cat, tidy_marginal_predictions() call avg_predictions(model, variables = list(cat = unique), = \"cat\") obtain average marginal predictions variable. Considering continuous variable named cont, tidy_marginal_predictions() call avg_predictions(model, variables = list(cont = \"fivenum\"), = \"cont\") obtain average marginal predictions variable minimum, first quartile, median, third quartile maximum observed values cont. default, average marginal predictions computed: predictions made using counterfactual grid value variable interest, averaging results. Marginal predictions mean obtained indicating newdata = \"mean\". assumptions possible, see help file marginaleffects::avg_predictions(). tidy_marginal_predictions() compute marginal predictions variable combination variables, stacking results unique tibble. tidy_marginal_predictions() variables_list argument consisting list specifications passed sequentially variables argument marginaleffects::avg_predictions(). helper function variables_to_predict() used automatically generate suitable list used variables_list. default, unique values retained categorical variables fivenum (.e. Tukey's five numbers, minimum, quartiles maximum) continuous variables. interactions = FALSE, variables_to_predict() return list individual variables used model. interactions = FALSE, search higher order combinations variables (see model_list_higher_order_variables()). variables_list's default value, \"auto\", calls variables_to_predict(interactions = TRUE) \"no_interaction\" shortcut variables_to_predict(interactions = FALSE). can also provide custom specifications (see examples). plot_marginal_predictions() works similar way returns list plots combined patchwork::wrap_plots() (see examples). information, see vignette(\"marginal_tidiers\", \"broom.helpers\").","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_predictions.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Marginal Predictions with marginaleffects::avg_predictions() — tidy_marginal_predictions","text":"","code":"if (FALSE) { # interactive() # Average Marginal Predictions df <- Titanic |> dplyr::as_tibble() |> tidyr::uncount(n) |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, family = binomial ) tidy_marginal_predictions(mod) tidy_plus_plus(mod, tidy_fun = tidy_marginal_predictions) if (require(\"patchwork\")) { plot_marginal_predictions(mod) |> patchwork::wrap_plots() plot_marginal_predictions(mod) |> patchwork::wrap_plots() & ggplot2::scale_y_continuous(limits = c(0, 1), label = scales::percent) } mod2 <- lm(Petal.Length ~ poly(Petal.Width, 2) + Species, data = iris) tidy_marginal_predictions(mod2) if (require(\"patchwork\")) { plot_marginal_predictions(mod2) |> patchwork::wrap_plots() } tidy_marginal_predictions( mod2, variables_list = variables_to_predict(mod2, continuous = \"threenum\") ) tidy_marginal_predictions( mod2, variables_list = list( list(Petal.Width = c(0, 1, 2, 3)), list(Species = unique) ) ) tidy_marginal_predictions( mod2, variables_list = list(list(Species = unique, Petal.Width = 1:3)) ) # Model with interactions mod3 <- glm( Survived ~ Sex * Age + Class, data = df, family = binomial ) tidy_marginal_predictions(mod3) tidy_marginal_predictions(mod3, \"no_interaction\") if (require(\"patchwork\")) { plot_marginal_predictions(mod3) |> patchwork::wrap_plots() plot_marginal_predictions(mod3, \"no_interaction\") |> patchwork::wrap_plots() } tidy_marginal_predictions( mod3, variables_list = list( list(Class = unique, Sex = \"Female\"), list(Age = unique) ) ) # Marginal Predictions at the Mean tidy_marginal_predictions(mod, newdata = \"mean\") if (require(\"patchwork\")) { plot_marginal_predictions(mod, newdata = \"mean\") |> patchwork::wrap_plots() } }"},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_margins.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Average Marginal Effects with margins::margins() — tidy_margins","text":"","code":"tidy_margins(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_margins.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Average Marginal Effects with margins::margins() — tidy_margins","text":"x (model object, e.g. glm) model tidied. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed margins::margins().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_margins.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Average Marginal Effects with margins::margins() — tidy_margins","text":"margins package longer active development may removed CRAN sooner later. advised use marginaleffects package instead, offering functionalities. look article dedicated marginal estimates broom.helpers. tidy_avg_slopes() used alternative. Use margins::margins() estimate average marginal effects (AME) return tibble tidied way used broom.helpers functions. See margins::margins() list supported models. default, margins::margins() estimate average marginal effects (AME): effect computed observed value original dataset averaged. information, see vignette(\"marginal_tidiers\", \"broom.helpers\").","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_margins.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Average Marginal Effects with margins::margins() — tidy_margins","text":"applying margins::margins(), custom contrasts ignored. Treatment contrasts (stats::contr.treatment()) applied categorical variables. Interactions also ignored.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_margins.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Average Marginal Effects with margins::margins() — tidy_margins","text":"","code":"if (FALSE) { # interactive() df <- Titanic |> dplyr::as_tibble() |> tidyr::uncount(n) |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, family = binomial ) tidy_margins(mod) tidy_plus_plus(mod, tidy_fun = tidy_margins) }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_multgee.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy a multgee model — tidy_multgee","title":"Tidy a multgee model — tidy_multgee","text":"tidier models generated multgee::nomLORgee() multgee::ordLORgee(). Term names updated consistent generic models. original term names preserved \"original_term\" column.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_multgee.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy a multgee model — tidy_multgee","text":"","code":"tidy_multgee(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_multgee.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy a multgee model — tidy_multgee","text":"x (LORgee) multgee::nomLORgee() multgee::ordLORgee() model. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed parameters::model_parameters().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_multgee.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Tidy a multgee model — tidy_multgee","text":"noted, multgee::nomLORgee(), baseline y category latest modality y.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_multgee.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tidy a multgee model — tidy_multgee","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"multgee\", boolean = TRUE)) { library(multgee) h <- housing h$status <- factor( h$y, labels = c(\"street\", \"community\", \"independant\") ) mod <- multgee::nomLORgee( status ~ factor(time) * sec, data = h, id = id, repeated = time, ) mod |> tidy_multgee() mod2 <- ordLORgee( formula = y ~ factor(time) + factor(trt) + factor(baseline), data = multgee::arthritis, id = id, repeated = time, LORstr = \"uniform\" ) mod2 |> tidy_multgee() } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_parameters.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy a model with parameters package — tidy_parameters","title":"Tidy a model with parameters package — tidy_parameters","text":"Use parameters::model_parameters() tidy model apply parameters::standardize_names(style = \"broom\") output","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_parameters.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy a model with parameters package — tidy_parameters","text":"","code":"tidy_parameters(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_parameters.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy a model with parameters package — tidy_parameters","text":"x (model object, e.g. glm) model tidied. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed parameters::model_parameters().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_parameters.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Tidy a model with parameters package — tidy_parameters","text":"betareg::betareg(), component column results standardized broom::tidy(), using \"mean\" \"precision\" values.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_parameters.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tidy a model with parameters package — tidy_parameters","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"parameters\", boolean = TRUE)) { lm(Sepal.Length ~ Sepal.Width + Species, data = iris) |> tidy_parameters() } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_plus_plus.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy a model and compute additional informations — tidy_plus_plus","title":"Tidy a model and compute additional informations — tidy_plus_plus","text":"function apply sequentially: tidy_and_attach() tidy_disambiguate_terms() tidy_identify_variables() tidy_add_contrasts() tidy_add_reference_rows() tidy_add_pairwise_contrasts() tidy_add_estimate_to_reference_rows() tidy_add_variable_labels() tidy_add_term_labels() tidy_add_header_rows() tidy_add_n() tidy_remove_intercept() tidy_select_variables() tidy_add_coefficients_type() tidy_detach_model()","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_plus_plus.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy a model and compute additional informations — tidy_plus_plus","text":"","code":"tidy_plus_plus( model, tidy_fun = tidy_with_broom_or_parameters, conf.int = TRUE, conf.level = 0.95, exponentiate = FALSE, model_matrix_attr = TRUE, variable_labels = NULL, instrumental_suffix = \" (instrumental)\", term_labels = NULL, interaction_sep = \" * \", categorical_terms_pattern = \"{level}\", disambiguate_terms = TRUE, disambiguate_sep = \".\", add_reference_rows = TRUE, no_reference_row = NULL, add_pairwise_contrasts = FALSE, pairwise_variables = all_categorical(), keep_model_terms = FALSE, pairwise_reverse = TRUE, contrasts_adjust = NULL, emmeans_args = list(), add_estimate_to_reference_rows = TRUE, add_header_rows = FALSE, show_single_row = NULL, add_n = TRUE, intercept = FALSE, include = everything(), keep_model = FALSE, tidy_post_fun = NULL, quiet = FALSE, strict = FALSE, ... )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_plus_plus.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy a model and compute additional informations — tidy_plus_plus","text":"model (model object, e.g. glm) model attached/tidied. tidy_fun (function) Option specify custom tidier function. conf.int (logical) confidence intervals computed? (see broom::tidy()) conf.level (numeric) Level confidence confidence intervals (default: 95%). exponentiate (logical) Whether exponentiate coefficient estimates. typical logistic, Poisson Cox models, bad idea log logit link; defaults FALSE. model_matrix_attr (logical) Whether model frame model matrix added attributes model (respectively named \"model_frame\" \"model_matrix\") passed . variable_labels (formula-list-selector) named list named vector custom variable labels. instrumental_suffix (string) Suffix added variable labels instrumental variables (fixest models). NULL add nothing. term_labels (list vector) named list named vector custom term labels. interaction_sep (string) Separator interaction terms. categorical_terms_pattern (glue pattern) glue pattern labels categorical terms treatment sum contrasts (see model_list_terms_levels()). disambiguate_terms (logical) terms disambiguated tidy_disambiguate_terms()? (default TRUE) disambiguate_sep (string) Separator tidy_disambiguate_terms(). add_reference_rows (logical) reference rows added? no_reference_row (tidy-select) Variables reference row added, add_reference_rows = TRUE. add_pairwise_contrasts (logical) Apply tidy_add_pairwise_contrasts()? pairwise_variables (tidy-select) Variables add pairwise contrasts. keep_model_terms (logical) Keep original model terms variables pairwise contrasts added? (default FALSE) pairwise_reverse (logical) Determines whether use \"pairwise\" (TRUE) \"revpairwise\" (FALSE), see emmeans::contrast(). contrasts_adjust (string) Optional adjustment method computing contrasts, see emmeans::contrast() (NULL, use emmeans default). emmeans_args (list) List additional parameter pass emmeans::emmeans() computing pairwise contrasts. add_estimate_to_reference_rows (logical) estimate value added reference rows? add_header_rows (logical) header rows added? show_single_row (tidy-select) Variables displayed single row, add_header_rows TRUE. add_n (logical) number observations added? intercept (logical) intercept(s) included? include (tidy-select) Variables include. Default everything(). See also all_continuous(), all_categorical(), all_dichotomous() all_interaction(). keep_model (logical) model kept attribute final result? tidy_post_fun (function) Custom function applied results end tidy_plus_plus() (see note) quiet (logical) Whether broom.helpers return message requested output generated. Default FALSE. strict (logical) Whether broom.helpers return error requested output generated. Default FALSE. ... arguments passed tidy_fun()","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_plus_plus.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Tidy a model and compute additional informations — tidy_plus_plus","text":"tidy_post_fun applied result end tidy_plus_plus() receive one argument (result tidy_plus_plus()). However, needed, model still attached tibble attribute, even keep_model = FALSE. Therefore, possible use tidy_get_model() within tidy_fun , reason, need access source model.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_plus_plus.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tidy a model and compute additional informations — tidy_plus_plus","text":"","code":"if (FALSE) { # interactive() ex1 <- lm(Sepal.Length ~ Sepal.Width + Species, data = iris) |> tidy_plus_plus() ex1 df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate( Survived = factor(Survived, c(\"No\", \"Yes\")) ) |> labelled::set_variable_labels( Class = \"Passenger's class\", Sex = \"Gender\" ) ex2 <- glm( Survived ~ Class + Age * Sex, data = df, weights = df$n, family = binomial ) |> tidy_plus_plus( exponentiate = TRUE, add_reference_rows = FALSE, categorical_terms_pattern = \"{level} / {reference_level}\", add_n = TRUE ) ex2 if (.assert_package(\"gtsummary\", boolean = TRUE)) { ex3 <- glm( response ~ poly(age, 3) + stage + grade * trt, na.omit(gtsummary::trial), family = binomial, contrasts = list( stage = contr.treatment(4, base = 3), grade = contr.sum ) ) |> tidy_plus_plus( exponentiate = TRUE, variable_labels = c(age = \"Age (in years)\"), add_header_rows = TRUE, show_single_row = all_dichotomous(), term_labels = c(\"poly(age, 3)3\" = \"Cubic age\"), keep_model = TRUE ) ex3 } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_remove_intercept.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove intercept(s) — tidy_remove_intercept","title":"Remove intercept(s) — tidy_remove_intercept","text":"remove terms var_type == \"intercept\".","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_remove_intercept.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove intercept(s) — tidy_remove_intercept","text":"","code":"tidy_remove_intercept(x, model = tidy_get_model(x))"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_remove_intercept.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove intercept(s) — tidy_remove_intercept","text":"x (data.frame) tidy tibble produced tidy_*() functions. model (model object, e.g. glm) corresponding model, attached x.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_remove_intercept.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Remove intercept(s) — tidy_remove_intercept","text":"variable column yet available x, tidy_identify_variables() automatically applied.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_remove_intercept.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove intercept(s) — tidy_remove_intercept","text":"","code":"df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived)) glm(Survived ~ Class + Age + Sex, data = df, weights = df$n, family = binomial) |> tidy_and_attach() |> tidy_remove_intercept() #> # A tibble: 5 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 Class2nd Class character categor… 4 -1.02 0.196 -5.19 #> 2 Class3rd Class character categor… 4 -1.78 0.172 -10.4 #> 3 ClassCrew Class character categor… 4 -0.858 0.157 -5.45 #> 4 AgeChild Age character dichoto… 2 1.06 0.244 4.35 #> 5 SexMale Sex character dichoto… 2 -2.42 0.140 -17.2 #> # ℹ 3 more variables: p.value , conf.low , conf.high "},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_select_variables.html","id":null,"dir":"Reference","previous_headings":"","what":"Select variables to keep/drop — tidy_select_variables","title":"Select variables to keep/drop — tidy_select_variables","text":"remove unselected variables results. remove intercept, use tidy_remove_intercept().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_select_variables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Select variables to keep/drop — tidy_select_variables","text":"","code":"tidy_select_variables(x, include = everything(), model = tidy_get_model(x))"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_select_variables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Select variables to keep/drop — tidy_select_variables","text":"x (data.frame) tidy tibble produced tidy_*() functions. include (tidy-select) Variables include. Default everything(). See also all_continuous(), all_categorical(), all_dichotomous() all_interaction(). model (model object, e.g. glm) corresponding model, attached x.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_select_variables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Select variables to keep/drop — tidy_select_variables","text":"x tibble limited included variables (eventually intercept), sorted according include parameter.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_select_variables.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Select variables to keep/drop — tidy_select_variables","text":"variable column yet available x, tidy_identify_variables() automatically applied.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_select_variables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Select variables to keep/drop — tidy_select_variables","text":"","code":"df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived)) res <- glm(Survived ~ Class + Age * Sex, data = df, weights = df$n, family = binomial) |> tidy_and_attach() |> tidy_identify_variables() res #> # A tibble: 7 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 Class2nd Class character categor… 4 -1.03 0.200 -5.17 #> 3 Class3rd Class character categor… 4 -1.81 0.176 -10.3 #> 4 ClassCrew Class character categor… 4 -0.803 0.160 -5.03 #> 5 AgeChild Age character dichoto… 2 -0.110 0.335 -0.328 #> 6 SexMale Sex character dichoto… 2 -2.62 0.151 -17.3 #> 7 AgeChild… Age:Sex NA interac… NA 1.90 0.433 4.39 #> # ℹ 3 more variables: p.value , conf.low , conf.high res |> tidy_select_variables() #> # A tibble: 7 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 Class2nd Class character categor… 4 -1.03 0.200 -5.17 #> 3 Class3rd Class character categor… 4 -1.81 0.176 -10.3 #> 4 ClassCrew Class character categor… 4 -0.803 0.160 -5.03 #> 5 AgeChild Age character dichoto… 2 -0.110 0.335 -0.328 #> 6 SexMale Sex character dichoto… 2 -2.62 0.151 -17.3 #> 7 AgeChild… Age:Sex NA interac… NA 1.90 0.433 4.39 #> # ℹ 3 more variables: p.value , conf.low , conf.high res |> tidy_select_variables(include = \"Class\") #> # A tibble: 4 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 Class2nd Class character categor… 4 -1.03 0.200 -5.17 #> 3 Class3rd Class character categor… 4 -1.81 0.176 -10.3 #> 4 ClassCrew Class character categor… 4 -0.803 0.160 -5.03 #> # ℹ 3 more variables: p.value , conf.low , conf.high res |> tidy_select_variables(include = -c(\"Age\", \"Sex\")) #> # A tibble: 5 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 Class2nd Class character categor… 4 -1.03 0.200 -5.17 #> 3 Class3rd Class character categor… 4 -1.81 0.176 -10.3 #> 4 ClassCrew Class character categor… 4 -0.803 0.160 -5.03 #> 5 AgeChild… Age:Sex NA interac… NA 1.90 0.433 4.39 #> # ℹ 3 more variables: p.value , conf.low , conf.high res |> tidy_select_variables(include = starts_with(\"A\")) #> # A tibble: 3 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 AgeChild Age character dichoto… 2 -0.110 0.335 -0.328 #> 3 AgeChild… Age:Sex NA interac… NA 1.90 0.433 4.39 #> # ℹ 3 more variables: p.value , conf.low , conf.high res |> tidy_select_variables(include = all_categorical()) #> # A tibble: 6 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 Class2nd Class character categor… 4 -1.03 0.200 -5.17 #> 3 Class3rd Class character categor… 4 -1.81 0.176 -10.3 #> 4 ClassCrew Class character categor… 4 -0.803 0.160 -5.03 #> 5 AgeChild Age character dichoto… 2 -0.110 0.335 -0.328 #> 6 SexMale Sex character dichoto… 2 -2.62 0.151 -17.3 #> # ℹ 3 more variables: p.value , conf.low , conf.high res |> tidy_select_variables(include = all_dichotomous()) #> # A tibble: 3 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 AgeChild Age character dichoto… 2 -0.110 0.335 -0.328 #> 3 SexMale Sex character dichoto… 2 -2.62 0.151 -17.3 #> # ℹ 3 more variables: p.value , conf.low , conf.high res |> tidy_select_variables(include = all_interaction()) #> # A tibble: 2 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 AgeChild… Age:Sex NA interac… NA 1.90 0.433 4.39 #> # ℹ 3 more variables: p.value , conf.low , conf.high res |> tidy_select_variables( include = c(\"Age\", all_categorical(dichotomous = FALSE), all_interaction()) ) #> # A tibble: 6 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 AgeChild Age character dichoto… 2 -0.110 0.335 -0.328 #> 3 Class2nd Class character categor… 4 -1.03 0.200 -5.17 #> 4 Class3rd Class character categor… 4 -1.81 0.176 -10.3 #> 5 ClassCrew Class character categor… 4 -0.803 0.160 -5.03 #> 6 AgeChild… Age:Sex NA interac… NA 1.90 0.433 4.39 #> # ℹ 3 more variables: p.value , conf.low , conf.high "},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_with_broom_or_parameters.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy a model with broom or parameters — tidy_with_broom_or_parameters","title":"Tidy a model with broom or parameters — tidy_with_broom_or_parameters","text":"Try tidy model broom::tidy(). fails, try tidy model using parameters::model_parameters() tidy_parameters().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_with_broom_or_parameters.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy a model with broom or parameters — tidy_with_broom_or_parameters","text":"","code":"tidy_with_broom_or_parameters(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_with_broom_or_parameters.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy a model with broom or parameters — tidy_with_broom_or_parameters","text":"x (model object, e.g. glm) model tidied. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed broom::tidy() parameters::model_parameters().","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_zeroinfl.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy a zeroinfl or a hurdle model — tidy_zeroinfl","title":"Tidy a zeroinfl or a hurdle model — tidy_zeroinfl","text":"tidier models generated pscl::zeroinfl() pscl::hurdle(). Term names updated consistent generic models. original term names preserved \"original_term\" column.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_zeroinfl.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy a zeroinfl or a hurdle model — tidy_zeroinfl","text":"","code":"tidy_zeroinfl(x, conf.int = TRUE, conf.level = 0.95, component = NULL, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_zeroinfl.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy a zeroinfl or a hurdle model — tidy_zeroinfl","text":"x (zeroinfl hurdle) pscl::zeroinfl() pscl::hurdle() model. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). component (string)NULL one \"\", \"conditional\", \"zi\", \"zero_inflated\". ... Additional parameters passed parameters::model_parameters().","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_zeroinfl.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tidy a zeroinfl or a hurdle model — tidy_zeroinfl","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"pscl\", boolean = TRUE)) { library(pscl) mod <- zeroinfl( art ~ fem + mar + phd, data = pscl::bioChemists ) mod |> tidy_zeroinfl(exponentiate = TRUE) } }"},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1180","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.18.0","title":"broom.helpers 1.18.0","text":"CRAN release: 2025-01-07 New supported models support glmtoolbox::glmgee() models (#274) New features support instrumental variables fixest models (#279) new argument instrumental_suffix model_list_variables(), tidy_add_variable_labels() tidy_plus_plus() Fixes variable labels now returned model_list_variables() svycoxph models (#275) compatibility R version 4.1 minimum (#276) fix tidy_add_n() models subset argument (#278)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1170","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.17.0","title":"broom.helpers 1.17.0","text":"CRAN release: 2024-08-28 Deprecated functions changes selectors functions selectors all_categorical() now compatible gtsummary version ≥ 2.0.0 (#270) new function scope_tidy() scope tidy tibble allowing tidy select (#270) .select_to_varnames(), .formula_list_to_named_list(), .generic_selector() .is_selector_scoped() now deprecated removed future release: may consider cards::process_selectors() cards::process_formula_selectors() alternatives (#270) Fixes model_get_model_frame.coxph() fixed return correct model frame subject identifier passed survival::coxph() (#268) Documentation Documentation improved, showing now clearly type expected argument (#272)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1160","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.16.0","title":"broom.helpers 1.16.0","text":"CRAN release: 2024-08-20 New features new argument model_matrix_attr tidy_and_attach() tidy_plus_plus() attach model frame model matrix model attributes saving execution time (#254) tidy_add_n() now returns n_ind number individuals, addition number observations (#251) default, tidy_parameters() calls now parameters::model_parameters() pretty_names = FALSE saving execution time (#259) internal code now uses native R pipe (|>), requiring therefore R >= 4.2 (#262) Deprecated support biglmm::bigglm() supported anymore biglmm removed CRAN Deprecated functions tidy_marginal_means() now deprecated, following deprecation marginaleffects::marginal_means(). Use instead tidy_marginal_predictions() option newdata = \"marginalmeans\". tidy_margins() now indicated superseded may deprecated margins removed CRAN. tidy_avg_slopes() used alternative. (#252) Fixes tidy_multgee() fixed properly identify different y.levels (#260 @jackmwolf) tidy_marginal_predictions() updated avoid use deprecated function marginaleffects::datagridcf() (#256)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1150","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.15.0","title":"broom.helpers 1.15.0","text":"CRAN release: 2024-04-05 New supported models support mmrm::mmrm() models (#228) support survival::cch() models (#242) New features new tidy_post_fun argument tidy_plus_plus() (#235) Fix fix order levels categorical variables results tidy_marginal_predictions() (#245) fix supported_models bug fix using tidy_parameters() mixed models (#238) bug fix survey::svyglm() models replicate weights (#240)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1140","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.14.0","title":"broom.helpers 1.14.0","text":"CRAN release: 2023-08-07 New features support MASS::contr.sdif() contrasts (#230) support pscl::zeroinfl() pscl::hurdle() models (#232) support betareg::betareg() models (#234) Fix input packageVersion() character string (#225)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1130","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.13.0","title":"broom.helpers 1.13.0","text":"CRAN release: 2023-03-28 New features tidy_add_estimate_to_reference_rows() now also populate p-values confidence intervals sum contrasts (#220) Marginal tidiers now compatible nnet::multinom(), MASS::polr(), ordinal::clm() ordinal::clmm() models, long type models supported corresponding package, example, margins currently support nnet::multinom() models (#215) Improvements Marginal predictions vignette updated follow changes marginaleffects version 0.10.0 (#216)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1120","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.12.0","title":"broom.helpers 1.12.0","text":"CRAN release: 2023-02-09 New features dedicated article presenting concepts different functions added package documentation website Several tidiers provided tidy results way used broom.helpers functions. Marginal Predictions: tidy_marginal_predictions(), plot_marginal_predictions(), tidy_all_effects(), tidy_ggpredict() Marginal Means: tidy_marginal_means() Marginal Contrasts: tidy_avg_comparisons() tidy_marginal_contrasts() Marginal Effects: tidy_avg_slopes() tidy_margins() New method model_list_higher_order_variables() list highest order combinations variables (#202) New method model_get_response_variable() get name response variable (#202) New helper function seq_range() generate sequence values minimum maximum vector (#202) New argument contrasts_adjust tidy_plus_plus(), tidy_add_pairwise_contrasts() model_get_pairwise_contrasts() allowing change adjustment method used compute pairwise contrasts (#204)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1110","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.11.0","title":"broom.helpers 1.11.0","text":"CRAN release: 2023-01-06 New features New functions tidy_add_pairwise_contrasts() model_get_pairwise_contrasts() compute pairwise contrasts categorical variables emmeans, corresponding new arguments tidy_plus_plus() (#192) New tidier tidy_margins() display Average Marginal Effects (#195) New tidier tidy_all_effects() display Marginal Predictions (#195) New tidier tidy_ggpredict() display Conditional Predictions (#195) Bug fixes improvements Better messages exponentiate argument appropriate (#197)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1100","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.10.0","title":"broom.helpers 1.10.0","text":"CRAN release: 2022-11-30 New features tidy_select_variables() now sorts variables according include (#183) New supported models Support logitr::logitr() models (#179) Experimental support multgee::nomLORgee() multgee::ordLORgee() models (#185) Bug fixes improvements Improvement .get_package_dependencies() efficient. now looks single package description file (#178) New function .get_all_packages_dependencies() list dependencies packages (#178) Bug fix .get_min_version_required() (#181)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-190","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.9.0","title":"broom.helpers 1.9.0","text":"CRAN release: 2022-09-23 New features New function .get_package_dependencies() listing dependencies, including minimum version required, package. (#171) Improvement .assert_package() now taking account comparison operator (> >=) minimum version required (#171) Bug fixes improvements Compatibility upcoming tidyselect v1.2.0 (#173) Avoid unwanted warning mgcv::gam() models (#175)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-180","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.8.0","title":"broom.helpers 1.8.0","text":"CRAN release: 2022-07-05 New supported models Support parsnip::model_fit objects (#161) Support biglm::bigglm() biglmm::bigglm() models (#155) Support fixest::feglm(), fixest::femlm(), fixest::feols() fixest::feNmlm() (requires R>=4.1) (#167) New features Support dplyr::vars() (also exported {gtsummary}) selector now deprecated. Users warned support vars() eventually removed package (#154) .is_selector_scoped(), internal function used generating custom selector functions, now exported (#163)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-170","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.7.0","title":"broom.helpers 1.7.0","text":"CRAN release: 2022-04-22 New features .assert_package() now uses rlang::check_installed() rlang::is_installed() check whether needed packages installed. rlang::check_installed() prompts user install needed package run interactively. (#147) tidy_add_n() model_get_n() support tidycmprsk::crr() models (#143) Listing supported models now available supported_models tibble (#145) Bug fixes Avoiding duplicating rows applying tidy_add_n() mgcv::gam() model smooth terms (#150)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-160","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.6.0","title":"broom.helpers 1.6.0","text":"CRAN release: 2022-01-12 New supported models Support plm::plm() models (#140) New features .formula_list_to_named_list() now respects select_single= argument inputs types. Previously, named lists ignored. Added new argument .formula_list_to_named_list(null_allowed=) argument works conjunction type_check= asserting class/type RHS formula (value named list) (#137) Better error message .formula_list_to_named_list() (#136) Two additional select helpers all_ran_pars() all_ran_vals() Bug fixes Fix .formula_list_to_named_list(type_check=) checks RHS formula value named list. (#138)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-150","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.5.0","title":"broom.helpers 1.5.0","text":"CRAN release: 2021-12-07 New features New method model_get_coefficients_type.tidycrr() (#128) Updated error messaging using broom.helpers::tidy_parameters() include package prefix. message sometimes appears running gtsummary::tbl_regression() users may aware tidy_paramters() function lives. (#129) .formula_list_to_named_list() improvement: now possible add type check (#132) New functions .assert_package() .get_min_version_required() check package’s installation status whether installed version meets minimum required version DESCRIPTION file (#134) Bug fixes Bug fix identifying levels logical variable (#125) Bug fix nnet::multinom() models binary outcome (#130)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-140","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.4.0","title":"broom.helpers 1.4.0","text":"CRAN release: 2021-09-30 New supported models Support glmmTMB::glmmTMB() models (#119) New features passed list may now combination named lists lists formulas, e.g. list(trt ~ 1, all_continuous() ~ 2). shortcut ~ may now used indicate everything() ~ Bug fixes Bug fix computing n binomial models computed lme4::glmer() (#116) Populating effect column adding reference rows (#117)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-130","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.3.0","title":"broom.helpers 1.3.0","text":"CRAN release: 2021-04-10 New supported models Support rstanarm::stan_glm() models Basic support VGAM::vglm() models (#105) New features Custom tieder tidy_parameters() based parameters::model_parameters() (#104) Custom tieder tidy_with_broom_or_parameters() (#104) default, tidy_plus_plus() now uses tidy_with_broom_or_parameters() model_get_coefficients_type() now returns “prop_hazard” cloglog-binomial models (#106)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-121","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.2.1","title":"broom.helpers 1.2.1","text":"CRAN release: 2021-02-26 Bug fixes Better identification term labels interaction terms using sum contrasts (#108) Now tidy_add_n() works multinomial models y coded factor (#109) glue added Suggests","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-120","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.2.0","title":"broom.helpers 1.2.0","text":"CRAN release: 2021-02-22 New features model_get_coefficients_type() now returns “relative_risk” log-binomial models (#101) New function tidy_disambiguate_terms() disambiguating random-effect terms mixed models new options tidy_plus_plus(): disambiguate_terms (TRUE default) disambiguate_sep (#98) mixed models, var_type column now equal \"ran_pars\" \"ran_vals\" random-effect parameters values, based effect column returned broom.mixed::tidy() (#90) New contrasts type (“.contrast”) returned model_list_contrasts() New function tidy_add_n() add number observations (relevant models number events exposure time) (#64) New option add_n tidy_plus_plus() (#64) New functions model_get_n(), model_get_weights(), model_get_offset(), model_get_response() model_compute_terms_contributions() (#64) New supported models Support lfe::felm() models (#79) Support brms::brm() models (#89) Basic support cmprsk::crr() models (#91) Basic support stats::nls() models (#97) Models categorical variable intercept now supported (#85) Added support mgcv::gam() models. (#82) Bug fixes changes Minor breaking change: strict argument removed tidy_identify_variables() (#99) Replaced usethis::ui_*() messaging cli::cli_*() (#94) Bug fix tidy_add_term_labels() variables non standard names (#77) Fix vignette old versions rmarkdown (#95)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-110","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.1.0","title":"broom.helpers 1.1.0","text":"CRAN release: 2020-11-24 Minor breaking change: column var_type returned tidy_identify_variables() now equal \"dichotomous\" categorical variables 2 levels Minor breaking changes: intercepts terms, tidy_identify_variables() now populates variable column term content, instead NA (#66) Minor breaking change: variables can’t identified tidy_identify_variables(), variable column now populated content term column (#63) .generic_selector(): makes easy create selecting functions like all_continuous(). .select_to_varnames(): converts selecting syntax character varnames .formula_list_to_named_list(): takes formula selecting syntax converts named list. New selecting functions all_continuous(), all_categorical(), all_dichotomous(), all_contrasts(), all_intercepts() all_interaction() selecting variables models (#54) Added support multiple imputation models {mice} package. model passed must un-pooled models, pooling step included tidy_fun= (#49 @ddsjoberg) New function tidy_select_variables() keep/drop selected variables output (#45) New functions tidy_add_coefficients_type() model_get_coefficients_type get type coefficients (generic, logistic, Poisson proportional hazard) used model (#46) tidy_add_contrasts() model_list_contrasts() now return additional column contrasts_type New no_reference_row argument tidy_add_reference_rows() (#47) New method model_get_nlevels get number levels categorical variables New column var_nlevels returned tidy_identify_variables(), model_identify_variables() tidy_plus_plus() Categorical terms can now customized pattern taking account term level, reference level /variable label, see model_list_terms_levels() categorical_terms_pattern tidy_plus_plus() tidy_add_term_labels (#61) model_list_terms_levels() now returns additional columns (level, reference_level, contrasts_type, var_label, var_levels dichotomous) model_list_variables() now returns additional var_label column exponentiate argument now passed tidy_*() functions, attribute attached tibble, well custom labels (variable_labels term_labels) show_single_row argument now accepts tidyselect notation (#51 @ddsjoberg) tidy_add_estimate_to_reference_rows() now relies emmeans sum contrasts, allowing cover wider range models Tibbles returned tidy_* functions also inherits \"broom.helpers\" class (#56) interaction_sep argument added tidy_plus_plus() Better management variables non standard names (#67) .clean_backticks() .escape_regex() now exported Bug fix non standard variable names containing character special meaning regular expression (#44) Bug fix tidy_add_header_rows() nnet::multinom models: label header rows missing (#50) Bug fix: now tidy_identify_variables() correctly identify class “integer” type variables (#57) Bug fix tidy_add_header_rows() continuous variables non standard name (#70)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-100","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.0.0","title":"broom.helpers 1.0.0","text":"CRAN release: 2020-09-18 Initial version","code":""}] +[{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"GNU General Public License","title":"GNU General Public License","text":"Version 3, 29 June 2007Copyright © 2007 Free Software Foundation, Inc.  Everyone permitted copy distribute verbatim copies license document, changing allowed.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"preamble","dir":"","previous_headings":"","what":"Preamble","title":"GNU General Public License","text":"GNU General Public License free, copyleft license software kinds works. licenses software practical works designed take away freedom share change works. contrast, GNU General Public License intended guarantee freedom share change versions program–make sure remains free software users. , Free Software Foundation, use GNU General Public License software; applies also work released way authors. can apply programs, . speak free software, referring freedom, price. General Public Licenses designed make sure freedom distribute copies free software (charge wish), receive source code can get want , can change software use pieces new free programs, know can things. protect rights, need prevent others denying rights asking surrender rights. Therefore, certain responsibilities distribute copies software, modify : responsibilities respect freedom others. example, distribute copies program, whether gratis fee, must pass recipients freedoms received. must make sure , , receive can get source code. must show terms know rights. Developers use GNU GPL protect rights two steps: (1) assert copyright software, (2) offer License giving legal permission copy, distribute /modify . developers’ authors’ protection, GPL clearly explains warranty free software. users’ authors’ sake, GPL requires modified versions marked changed, problems attributed erroneously authors previous versions. devices designed deny users access install run modified versions software inside , although manufacturer can . fundamentally incompatible aim protecting users’ freedom change software. systematic pattern abuse occurs area products individuals use, precisely unacceptable. Therefore, designed version GPL prohibit practice products. problems arise substantially domains, stand ready extend provision domains future versions GPL, needed protect freedom users. Finally, every program threatened constantly software patents. States allow patents restrict development use software general-purpose computers, , wish avoid special danger patents applied free program make effectively proprietary. prevent , GPL assures patents used render program non-free. precise terms conditions copying, distribution modification follow.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_0-definitions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"0. Definitions","title":"GNU General Public License","text":"“License” refers version 3 GNU General Public License. “Copyright” also means copyright-like laws apply kinds works, semiconductor masks. “Program” refers copyrightable work licensed License. licensee addressed “”. “Licensees” “recipients” may individuals organizations. “modify” work means copy adapt part work fashion requiring copyright permission, making exact copy. resulting work called “modified version” earlier work work “based ” earlier work. “covered work” means either unmodified Program work based Program. “propagate” work means anything , without permission, make directly secondarily liable infringement applicable copyright law, except executing computer modifying private copy. Propagation includes copying, distribution (without modification), making available public, countries activities well. “convey” work means kind propagation enables parties make receive copies. Mere interaction user computer network, transfer copy, conveying. interactive user interface displays “Appropriate Legal Notices” extent includes convenient prominently visible feature (1) displays appropriate copyright notice, (2) tells user warranty work (except extent warranties provided), licensees may convey work License, view copy License. interface presents list user commands options, menu, prominent item list meets criterion.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_1-source-code","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"1. Source Code","title":"GNU General Public License","text":"“source code” work means preferred form work making modifications . “Object code” means non-source form work. “Standard Interface” means interface either official standard defined recognized standards body, , case interfaces specified particular programming language, one widely used among developers working language. “System Libraries” executable work include anything, work whole, () included normal form packaging Major Component, part Major Component, (b) serves enable use work Major Component, implement Standard Interface implementation available public source code form. “Major Component”, context, means major essential component (kernel, window system, ) specific operating system () executable work runs, compiler used produce work, object code interpreter used run . “Corresponding Source” work object code form means source code needed generate, install, (executable work) run object code modify work, including scripts control activities. However, include work’s System Libraries, general-purpose tools generally available free programs used unmodified performing activities part work. example, Corresponding Source includes interface definition files associated source files work, source code shared libraries dynamically linked subprograms work specifically designed require, intimate data communication control flow subprograms parts work. Corresponding Source need include anything users can regenerate automatically parts Corresponding Source. Corresponding Source work source code form work.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_2-basic-permissions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"2. Basic Permissions","title":"GNU General Public License","text":"rights granted License granted term copyright Program, irrevocable provided stated conditions met. License explicitly affirms unlimited permission run unmodified Program. output running covered work covered License output, given content, constitutes covered work. License acknowledges rights fair use equivalent, provided copyright law. may make, run propagate covered works convey, without conditions long license otherwise remains force. may convey covered works others sole purpose make modifications exclusively , provide facilities running works, provided comply terms License conveying material control copyright. thus making running covered works must exclusively behalf, direction control, terms prohibit making copies copyrighted material outside relationship . Conveying circumstances permitted solely conditions stated . Sublicensing allowed; section 10 makes unnecessary.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_3-protecting-users-legal-rights-from-anti-circumvention-law","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"3. Protecting Users’ Legal Rights From Anti-Circumvention Law","title":"GNU General Public License","text":"covered work shall deemed part effective technological measure applicable law fulfilling obligations article 11 WIPO copyright treaty adopted 20 December 1996, similar laws prohibiting restricting circumvention measures. convey covered work, waive legal power forbid circumvention technological measures extent circumvention effected exercising rights License respect covered work, disclaim intention limit operation modification work means enforcing, work’s users, third parties’ legal rights forbid circumvention technological measures.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_4-conveying-verbatim-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"4. Conveying Verbatim Copies","title":"GNU General Public License","text":"may convey verbatim copies Program’s source code receive , medium, provided conspicuously appropriately publish copy appropriate copyright notice; keep intact notices stating License non-permissive terms added accord section 7 apply code; keep intact notices absence warranty; give recipients copy License along Program. may charge price price copy convey, may offer support warranty protection fee.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_5-conveying-modified-source-versions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"5. Conveying Modified Source Versions","title":"GNU General Public License","text":"may convey work based Program, modifications produce Program, form source code terms section 4, provided also meet conditions: ) work must carry prominent notices stating modified , giving relevant date. b) work must carry prominent notices stating released License conditions added section 7. requirement modifies requirement section 4 “keep intact notices”. c) must license entire work, whole, License anyone comes possession copy. License therefore apply, along applicable section 7 additional terms, whole work, parts, regardless packaged. License gives permission license work way, invalidate permission separately received . d) work interactive user interfaces, must display Appropriate Legal Notices; however, Program interactive interfaces display Appropriate Legal Notices, work need make . compilation covered work separate independent works, nature extensions covered work, combined form larger program, volume storage distribution medium, called “aggregate” compilation resulting copyright used limit access legal rights compilation’s users beyond individual works permit. Inclusion covered work aggregate cause License apply parts aggregate.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_6-conveying-non-source-forms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"6. Conveying Non-Source Forms","title":"GNU General Public License","text":"may convey covered work object code form terms sections 4 5, provided also convey machine-readable Corresponding Source terms License, one ways: ) Convey object code , embodied , physical product (including physical distribution medium), accompanied Corresponding Source fixed durable physical medium customarily used software interchange. b) Convey object code , embodied , physical product (including physical distribution medium), accompanied written offer, valid least three years valid long offer spare parts customer support product model, give anyone possesses object code either (1) copy Corresponding Source software product covered License, durable physical medium customarily used software interchange, price reasonable cost physically performing conveying source, (2) access copy Corresponding Source network server charge. c) Convey individual copies object code copy written offer provide Corresponding Source. alternative allowed occasionally noncommercially, received object code offer, accord subsection 6b. d) Convey object code offering access designated place (gratis charge), offer equivalent access Corresponding Source way place charge. need require recipients copy Corresponding Source along object code. place copy object code network server, Corresponding Source may different server (operated third party) supports equivalent copying facilities, provided maintain clear directions next object code saying find Corresponding Source. Regardless server hosts Corresponding Source, remain obligated ensure available long needed satisfy requirements. e) Convey object code using peer--peer transmission, provided inform peers object code Corresponding Source work offered general public charge subsection 6d. separable portion object code, whose source code excluded Corresponding Source System Library, need included conveying object code work. “User Product” either (1) “consumer product”, means tangible personal property normally used personal, family, household purposes, (2) anything designed sold incorporation dwelling. determining whether product consumer product, doubtful cases shall resolved favor coverage. particular product received particular user, “normally used” refers typical common use class product, regardless status particular user way particular user actually uses, expects expected use, product. product consumer product regardless whether product substantial commercial, industrial non-consumer uses, unless uses represent significant mode use product. “Installation Information” User Product means methods, procedures, authorization keys, information required install execute modified versions covered work User Product modified version Corresponding Source. information must suffice ensure continued functioning modified object code case prevented interfered solely modification made. convey object code work section , , specifically use , User Product, conveying occurs part transaction right possession use User Product transferred recipient perpetuity fixed term (regardless transaction characterized), Corresponding Source conveyed section must accompanied Installation Information. requirement apply neither third party retains ability install modified object code User Product (example, work installed ROM). requirement provide Installation Information include requirement continue provide support service, warranty, updates work modified installed recipient, User Product modified installed. Access network may denied modification materially adversely affects operation network violates rules protocols communication across network. Corresponding Source conveyed, Installation Information provided, accord section must format publicly documented (implementation available public source code form), must require special password key unpacking, reading copying.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_7-additional-terms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"7. Additional Terms","title":"GNU General Public License","text":"“Additional permissions” terms supplement terms License making exceptions one conditions. Additional permissions applicable entire Program shall treated though included License, extent valid applicable law. additional permissions apply part Program, part may used separately permissions, entire Program remains governed License without regard additional permissions. convey copy covered work, may option remove additional permissions copy, part . (Additional permissions may written require removal certain cases modify work.) may place additional permissions material, added covered work, can give appropriate copyright permission. Notwithstanding provision License, material add covered work, may (authorized copyright holders material) supplement terms License terms: ) Disclaiming warranty limiting liability differently terms sections 15 16 License; b) Requiring preservation specified reasonable legal notices author attributions material Appropriate Legal Notices displayed works containing ; c) Prohibiting misrepresentation origin material, requiring modified versions material marked reasonable ways different original version; d) Limiting use publicity purposes names licensors authors material; e) Declining grant rights trademark law use trade names, trademarks, service marks; f) Requiring indemnification licensors authors material anyone conveys material (modified versions ) contractual assumptions liability recipient, liability contractual assumptions directly impose licensors authors. non-permissive additional terms considered “restrictions” within meaning section 10. Program received , part , contains notice stating governed License along term restriction, may remove term. license document contains restriction permits relicensing conveying License, may add covered work material governed terms license document, provided restriction survive relicensing conveying. add terms covered work accord section, must place, relevant source files, statement additional terms apply files, notice indicating find applicable terms. Additional terms, permissive non-permissive, may stated form separately written license, stated exceptions; requirements apply either way.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_8-termination","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"8. Termination","title":"GNU General Public License","text":"may propagate modify covered work except expressly provided License. attempt otherwise propagate modify void, automatically terminate rights License (including patent licenses granted third paragraph section 11). However, cease violation License, license particular copyright holder reinstated () provisionally, unless copyright holder explicitly finally terminates license, (b) permanently, copyright holder fails notify violation reasonable means prior 60 days cessation. Moreover, license particular copyright holder reinstated permanently copyright holder notifies violation reasonable means, first time received notice violation License (work) copyright holder, cure violation prior 30 days receipt notice. Termination rights section terminate licenses parties received copies rights License. rights terminated permanently reinstated, qualify receive new licenses material section 10.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_9-acceptance-not-required-for-having-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"9. Acceptance Not Required for Having Copies","title":"GNU General Public License","text":"required accept License order receive run copy Program. Ancillary propagation covered work occurring solely consequence using peer--peer transmission receive copy likewise require acceptance. However, nothing License grants permission propagate modify covered work. actions infringe copyright accept License. Therefore, modifying propagating covered work, indicate acceptance License .","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_10-automatic-licensing-of-downstream-recipients","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"10. Automatic Licensing of Downstream Recipients","title":"GNU General Public License","text":"time convey covered work, recipient automatically receives license original licensors, run, modify propagate work, subject License. responsible enforcing compliance third parties License. “entity transaction” transaction transferring control organization, substantially assets one, subdividing organization, merging organizations. propagation covered work results entity transaction, party transaction receives copy work also receives whatever licenses work party’s predecessor interest give previous paragraph, plus right possession Corresponding Source work predecessor interest, predecessor can get reasonable efforts. may impose restrictions exercise rights granted affirmed License. example, may impose license fee, royalty, charge exercise rights granted License, may initiate litigation (including cross-claim counterclaim lawsuit) alleging patent claim infringed making, using, selling, offering sale, importing Program portion .","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_11-patents","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"11. Patents","title":"GNU General Public License","text":"“contributor” copyright holder authorizes use License Program work Program based. work thus licensed called contributor’s “contributor version”. contributor’s “essential patent claims” patent claims owned controlled contributor, whether already acquired hereafter acquired, infringed manner, permitted License, making, using, selling contributor version, include claims infringed consequence modification contributor version. purposes definition, “control” includes right grant patent sublicenses manner consistent requirements License. contributor grants non-exclusive, worldwide, royalty-free patent license contributor’s essential patent claims, make, use, sell, offer sale, import otherwise run, modify propagate contents contributor version. following three paragraphs, “patent license” express agreement commitment, however denominated, enforce patent (express permission practice patent covenant sue patent infringement). “grant” patent license party means make agreement commitment enforce patent party. convey covered work, knowingly relying patent license, Corresponding Source work available anyone copy, free charge terms License, publicly available network server readily accessible means, must either (1) cause Corresponding Source available, (2) arrange deprive benefit patent license particular work, (3) arrange, manner consistent requirements License, extend patent license downstream recipients. “Knowingly relying” means actual knowledge , patent license, conveying covered work country, recipient’s use covered work country, infringe one identifiable patents country reason believe valid. , pursuant connection single transaction arrangement, convey, propagate procuring conveyance , covered work, grant patent license parties receiving covered work authorizing use, propagate, modify convey specific copy covered work, patent license grant automatically extended recipients covered work works based . patent license “discriminatory” include within scope coverage, prohibits exercise , conditioned non-exercise one rights specifically granted License. may convey covered work party arrangement third party business distributing software, make payment third party based extent activity conveying work, third party grants, parties receive covered work , discriminatory patent license () connection copies covered work conveyed (copies made copies), (b) primarily connection specific products compilations contain covered work, unless entered arrangement, patent license granted, prior 28 March 2007. Nothing License shall construed excluding limiting implied license defenses infringement may otherwise available applicable patent law.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_12-no-surrender-of-others-freedom","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"12. No Surrender of Others’ Freedom","title":"GNU General Public License","text":"conditions imposed (whether court order, agreement otherwise) contradict conditions License, excuse conditions License. convey covered work satisfy simultaneously obligations License pertinent obligations, consequence may convey . example, agree terms obligate collect royalty conveying convey Program, way satisfy terms License refrain entirely conveying Program.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_13-use-with-the-gnu-affero-general-public-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"13. Use with the GNU Affero General Public License","title":"GNU General Public License","text":"Notwithstanding provision License, permission link combine covered work work licensed version 3 GNU Affero General Public License single combined work, convey resulting work. terms License continue apply part covered work, special requirements GNU Affero General Public License, section 13, concerning interaction network apply combination .","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_14-revised-versions-of-this-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"14. Revised Versions of this License","title":"GNU General Public License","text":"Free Software Foundation may publish revised /new versions GNU General Public License time time. new versions similar spirit present version, may differ detail address new problems concerns. version given distinguishing version number. Program specifies certain numbered version GNU General Public License “later version” applies , option following terms conditions either numbered version later version published Free Software Foundation. Program specify version number GNU General Public License, may choose version ever published Free Software Foundation. Program specifies proxy can decide future versions GNU General Public License can used, proxy’s public statement acceptance version permanently authorizes choose version Program. Later license versions may give additional different permissions. However, additional obligations imposed author copyright holder result choosing follow later version.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_15-disclaimer-of-warranty","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"15. Disclaimer of Warranty","title":"GNU General Public License","text":"WARRANTY PROGRAM, EXTENT PERMITTED APPLICABLE LAW. EXCEPT OTHERWISE STATED WRITING COPYRIGHT HOLDERS /PARTIES PROVIDE PROGRAM “” WITHOUT WARRANTY KIND, EITHER EXPRESSED IMPLIED, INCLUDING, LIMITED , IMPLIED WARRANTIES MERCHANTABILITY FITNESS PARTICULAR PURPOSE. ENTIRE RISK QUALITY PERFORMANCE PROGRAM . PROGRAM PROVE DEFECTIVE, ASSUME COST NECESSARY SERVICING, REPAIR CORRECTION.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_16-limitation-of-liability","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"16. Limitation of Liability","title":"GNU General Public License","text":"EVENT UNLESS REQUIRED APPLICABLE LAW AGREED WRITING COPYRIGHT HOLDER, PARTY MODIFIES /CONVEYS PROGRAM PERMITTED , LIABLE DAMAGES, INCLUDING GENERAL, SPECIAL, INCIDENTAL CONSEQUENTIAL DAMAGES ARISING USE INABILITY USE PROGRAM (INCLUDING LIMITED LOSS DATA DATA RENDERED INACCURATE LOSSES SUSTAINED THIRD PARTIES FAILURE PROGRAM OPERATE PROGRAMS), EVEN HOLDER PARTY ADVISED POSSIBILITY DAMAGES.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"id_17-interpretation-of-sections-15-and-16","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"17. Interpretation of Sections 15 and 16","title":"GNU General Public License","text":"disclaimer warranty limitation liability provided given local legal effect according terms, reviewing courts shall apply local law closely approximates absolute waiver civil liability connection Program, unless warranty assumption liability accompanies copy Program return fee. END TERMS CONDITIONS","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/LICENSE.html","id":"how-to-apply-these-terms-to-your-new-programs","dir":"","previous_headings":"","what":"How to Apply These Terms to Your New Programs","title":"GNU General Public License","text":"develop new program, want greatest possible use public, best way achieve make free software everyone can redistribute change terms. , attach following notices program. safest attach start source file effectively state exclusion warranty; file least “copyright” line pointer full notice found. Also add information contact electronic paper mail. program terminal interaction, make output short notice like starts interactive mode: hypothetical commands show w show c show appropriate parts General Public License. course, program’s commands might different; GUI interface, use “box”. also get employer (work programmer) school, , sign “copyright disclaimer” program, necessary. information , apply follow GNU GPL, see . GNU General Public License permit incorporating program proprietary programs. program subroutine library, may consider useful permit linking proprietary applications library. want , use GNU Lesser General Public License instead License. first, please read .","code":" Copyright (C) 2020 Joseph Larmarange This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . broom.helpers Copyright (C) 2020 Joseph Larmarange This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details."},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"terminology","dir":"Articles","previous_headings":"","what":"Terminology","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"overall idea “marginal effects” provide tools better interpret results model estimating several quantities margins. However, implemented many different ways different ways bunch quasi-synonyms idea “marginal effects”: statistical effects, marginal effects, marginal means, contrasts, marginal slopes, conditional effects, conditional marginal effects, marginal effects mean, many similarly-named ideas. broom.helpers, tried adopt terminology consistent {marginaleffects} package, first released September 2021, Andrew Heiss’ Marginalia blog post published May 2022. Adjusted Predictions correspond outcome predicted fitted model specified scale given combination values predictor variables, observed values, means, factor levels (.k.. “reference grid”). prediction averaged according specific regressor, refer Marginal Predictions. Marginal Contrasts referring comparison (e.g. difference) outcome certain regressor, considering “meaningfully” “typical” values predictors (mean/mode, custom values, averaged observed values…). Contrasts computed categorical variables (e.g. difference two specific levels) continuous variables (change outcome certain change regressor). Marginal Effects / Slopes defined continuous variables partial derivative (slope) regression equation respect regressor interest. Put differently, marginal effect slope prediction function, measured specific value regressor interest. scientific practice, marginal effects fall toolbox marginal contrasts. Marginal Means adjusted predictions model, averaged across “reference grid” categorical predictors. similar marginal predictions, subtle differences. broom.helpers embed several custom tidiers compute quantities return tibble compatible tidy_plus_plus() others broom.helpers’s tidy_*() function. Therefore, possible produce nicely formatted tables gtsummary::tbl_regression() forest plots ggstats::ggcoef_model().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"data-preparation","dir":"Articles","previous_headings":"","what":"Data preparation","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"Let’s consider trial dataset gtsummary package build logistic regression model two categorical predictors (trt stage) two continuous predictor (marker age). include interaction trt marker polynomial terms age (.e. age age^2).","code":"library(broom.helpers) library(gtsummary) library(dplyr) d <- trial |> filter(complete.cases(response, trt, marker, grade, age)) mod <- glm( response ~ trt * marker + stage + poly(age, 2), data = d, family = binomial ) mod |> tbl_regression( exponentiate = TRUE, label = list(age = \"Age in years\") ) |> bold_labels()"},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"marginal-predictions-at-the-mean","dir":"Articles","previous_headings":"Marginal Predictions","what":"Marginal Predictions at the Mean","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"first approach better understand / interpret model consists predict value regressor, model scale, “typical values” regressors. estimates therefore easier interpret, expressed scale outcome (, binary logistic regression, probabilities). differences observed predictions different modalities depend “effect” regressor others regressors fixed “typical values”. However, packages use definition “typical values”.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"the-effectss-approach","dir":"Articles","previous_headings":"Marginal Predictions > Marginal Predictions at the Mean","what":"the {effects}’s approach","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"effects package offer effects::Effect() function compute marginal predictions typical values. Although function named Effect(), produced estimates marginal predictions according terminology presented beginning vignette. understand “typical values” used effects::Effect(), let’s look model matrix generated package used predictions. continuous regressors set observed mean categorical regressors weighted according observed proportions. Somehow, artificial “averaged” individual created, mean age mean marker level, partly receiving Drug Drug B. , predict probability response individual stage T1, T2, T3 T4. continuous variable, effects::Effect() consider several values regressor (based range observed values) estimate marginal predictions different values. effects::allEffects() build marginal predictions regressors, taking account eventual interactions within model. also possible generate similar plots ggeffects::ggeffect(). Please note ggeffects::ggeffect() consider, default, individual variables model existing interactions. generate tibble results formatted way use tidy_plus_plus() broom.helpers’s tidy_*() helpers, broom.helpers provides tidy_all_effects() tieder. therefore easy produce nicely formatted table gtsummary::tbl_regression() forest plot ggstats::ggcoef_model().","code":"library(effects, quietly = TRUE) #> lattice theme set by effectsTheme() #> See ?effectsTheme for details. e <- Effect(\"stage\", mod) e #> #> stage effect #> stage #> T1 T2 T3 T4 #> 0.3866154 0.2179846 0.3501056 0.2938566 plot(e) e$model.matrix #> (Intercept) trtDrug B marker stageT2 stageT3 stageT4 poly(age, 2)1 #> 1 1 0.5202312 0.9191792 0 0 0 -2.228704e-16 #> 2 1 0.5202312 0.9191792 1 0 0 -2.228704e-16 #> 3 1 0.5202312 0.9191792 0 1 0 -2.228704e-16 #> 4 1 0.5202312 0.9191792 0 0 1 -2.228704e-16 #> poly(age, 2)2 trtDrug B:marker #> 1 -0.05568232 0.4781857 #> 2 -0.05568232 0.4781857 #> 3 -0.05568232 0.4781857 #> 4 -0.05568232 0.4781857 #> attr(,\"assign\") #> [1] 0 1 2 3 3 3 4 4 5 #> attr(,\"contrasts\") #> attr(,\"contrasts\")$trt #> [1] \"contr.treatment\" #> #> attr(,\"contrasts\")$stage #> [1] \"contr.treatment\" e2 <- Effect(\"age\", mod) e2 #> #> age effect #> age #> 6 30 40 60 80 #> 0.1664397 0.2392447 0.2760557 0.3606351 0.4568567 plot(e2) allEffects(mod) #> model: response ~ trt * marker + stage + poly(age, 2) #> #> stage effect #> stage #> T1 T2 T3 T4 #> 0.3866154 0.2179846 0.3501056 0.2938566 #> #> age effect #> age #> 6 30 40 60 80 #> 0.1664397 0.2392447 0.2760557 0.3606351 0.4568567 #> #> trt*marker effect #> marker #> trt 0.005 1 2 3 4 #> Drug A 0.2338204 0.2776269 0.3264017 0.3792467 0.4351208 #> Drug B 0.2479065 0.3408371 0.4484189 0.5610548 0.6677329 plot(allEffects(mod)) mod |> ggeffects::ggeffect() |> lapply(plot) |> patchwork::wrap_plots() tidy_all_effects(mod) #> variable term estimate std.error conf.low conf.high #> 1 stage T1 0.3866154 0.08138561 0.24338626 0.5525749 #> 2 stage T2 0.2179846 0.06122617 0.12116925 0.3604304 #> 3 stage T3 0.3501056 0.08749758 0.20225147 0.5337316 #> 4 stage T4 0.2938566 0.07895328 0.16486445 0.4673012 #> 5 poly(age,2) 6 0.1664397 0.15368239 0.02226625 0.6364570 #> 6 poly(age,2) 30 0.2392447 0.05197357 0.15232129 0.3549982 #> 7 poly(age,2) 40 0.2760557 0.04346297 0.19934983 0.3686854 #> 8 poly(age,2) 60 0.3606351 0.05152656 0.26686307 0.4663957 #> 9 poly(age,2) 80 0.4568567 0.16663622 0.18404077 0.7582667 #> 10 trt:marker Drug A:0.005 0.2338204 0.07478345 0.11867604 0.4088555 #> 11 trt:marker Drug B:0.005 0.2479065 0.06818623 0.13864532 0.4029880 #> 12 trt:marker Drug A:1 0.2776269 0.05673207 0.18083471 0.4008740 #> 13 trt:marker Drug B:1 0.3408371 0.05901662 0.23605720 0.4638846 #> 14 trt:marker Drug A:2 0.3264017 0.08136674 0.19002540 0.5002087 #> 15 trt:marker Drug B:2 0.4484189 0.09615134 0.27508336 0.6352624 #> 16 trt:marker Drug A:3 0.3792467 0.13846045 0.16171930 0.6592599 #> 17 trt:marker Drug B:3 0.5610548 0.15197028 0.27607502 0.8107519 #> 18 trt:marker Drug A:4 0.4351208 0.20665349 0.12910815 0.8000955 #> 19 trt:marker Drug B:4 0.6677329 0.19316496 0.26727889 0.9171600 mod |> tbl_regression( tidy_fun = tidy_all_effects, estimate_fun = scales::label_percent(accuracy = .1) ) |> bold_labels() ggstats::ggcoef_model( mod, tidy_fun = tidy_all_effects, vline = FALSE )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"the-marginaleffectss-approach-at-the-mean","dir":"Articles","previous_headings":"Marginal Predictions > Marginal Predictions at the Mean","what":"the {marginaleffects}’s approach at the Mean","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"marginaleffects package allows compute marginal predictions “mean”, .e. considering mean continuous regressors mode (.e. frequent observed modality) categorical regressors. , call marginaleffects::predictions() newdata = \"mean\". Four “mean individuals” generated, just value stage different one individual , predicting probability response. continuous variable, predictions made, default, Tukey’s five numbers, .e. minimum, first quartile, median, third quartile maximum. broom.helpers provides global tidier tidy_marginal_predictions() compute marginal predictions variable combination variables stacking unique tibble. specify newdata = \"mean\" get marginal predictions mean. default, effects::allEffects(), consider higher order combinations variables (identified model_list_higher_order_variables()). Simply specify variables_list = \"no_interaction\" compute marginal predictions individual variable without considering existing interactions. broom.helpers also include plot_marginal_predictions() generate list plots visualize marginal predictions. Use patchwork::wrap_plots() combine plots together. Alternatively, can use ggstats::ggcoef_model(), using tidy_args pass arguments broom.helpers::tidy_marginal_predictions().","code":"library(marginaleffects) predictions( mod, variables = \"stage\", newdata = \"mean\", by = \"stage\" ) #> #> stage Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> T1 0.419 0.0930 4.50 <0.001 17.2 0.237 0.601 #> T2 0.242 0.0702 3.44 <0.001 10.8 0.104 0.379 #> T3 0.381 0.0977 3.90 <0.001 13.3 0.190 0.573 #> T4 0.322 0.0892 3.61 <0.001 11.7 0.148 0.497 #> #> Type: response #> Columns: stage, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high predictions( mod, variables = \"age\", newdata = \"mean\", by = \"age\" ) #> #> age Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> 6 0.127 0.1325 0.961 0.33666 1.6 -0.1324 0.387 #> 37 0.208 0.0659 3.159 0.00158 9.3 0.0790 0.337 #> 47 0.242 0.0702 3.446 < 0.001 10.8 0.1044 0.380 #> 57 0.280 0.0771 3.629 < 0.001 11.8 0.1287 0.431 #> 83 0.395 0.2104 1.878 0.06044 4.0 -0.0173 0.807 #> #> Type: response #> Columns: age, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high mod |> model_list_higher_order_variables() #> [1] \"stage\" \"age\" \"trt:marker\" mod |> tbl_regression( tidy_fun = tidy_marginal_predictions, newdata = \"mean\", estimate_fun = scales::label_percent(accuracy = .1), label = list(age = \"Age in years\") ) |> modify_column_hide(\"p.value\") |> bold_labels() mod |> tbl_regression( tidy_fun = tidy_marginal_predictions, variables_list = \"no_interaction\", newdata = \"mean\", estimate_fun = scales::label_percent(accuracy = .1), label = list(age = \"Age in years\") ) |> modify_column_hide(\"p.value\") |> bold_labels() p <- mod |> plot_marginal_predictions(newdata = \"mean\") |> patchwork::wrap_plots() & ggplot2::scale_y_continuous( labels = scales::label_percent(), limits = c(-0.2, 1) ) p[[2]] <- p[[2]] + ggplot2::xlab(\"Age in years\") p + patchwork::plot_annotation( title = \"Marginal Predictions at the Mean\" ) p <- mod |> plot_marginal_predictions( \"no_interaction\", newdata = \"mean\" ) |> patchwork::wrap_plots() & ggplot2::scale_y_continuous( labels = scales::label_percent(), limits = c(-0.2, 1) ) p[[4]] <- p[[4]] + ggplot2::xlab(\"Age in years\") p + patchwork::plot_annotation( title = \"Marginal Predictions at the Mean\" ) ggstats::ggcoef_model( mod, tidy_fun = tidy_marginal_predictions, tidy_args = list(newdata = \"mean\", variables_list = \"no_interaction\"), vline = FALSE, show_p_values = FALSE, signif_stars = FALSE, significance = NULL, variable_labels = c(age = \"Age in years\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"average-marginal-predictions","dir":"Articles","previous_headings":"Marginal Predictions","what":"Average Marginal Predictions","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"Instead averaging observed values generate “typical observations” predicting outcome, alternative consists predict outcome overall observed values averaging results. precisely, purpose adopt counterfactual approach. Let’s take example. Let’s consider d observed data used estimate model. can make copy dataset, variables identical, considering individuals received Drug . Similarly, generate dataset individuals received Drug B. can now predict outcome observations dA compute average, similarly dB. , , obtain Average Marginal Predictions trt. results computed marginaleffects::avg_predictions(). Note counterfactual approach corresponds default behavior value provided newdata. Important: since version 0.10.0 marginaleffects, add type = \"response\" get result: glm models, predictions done response scale, averaged. type specified, predictions made link scale, averaged back transformed response scale. Thus, average prediction may exactly identical average predictions. can use tidy_marginal_predictions() get average marginal predictions variables plot_marginal_predictions() visual representation.","code":"dA <- d |> mutate(trt = \"Drug A\") dB <- d |> mutate(trt = \"Drug B\") predict(mod, newdata = dA, type = \"response\") |> mean() #> [1] 0.2830866 predict(mod, newdata = dB, type = \"response\") |> mean() #> [1] 0.3431492 avg_predictions(mod, variables = \"trt\", by = \"trt\", type = \"response\") #> #> trt Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> Drug A 0.283 0.0484 5.85 <0.001 27.6 0.188 0.378 #> Drug B 0.343 0.0490 7.01 <0.001 38.6 0.247 0.439 #> #> Type: response #> Columns: trt, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high avg_predictions(mod, variables = \"trt\", by = \"trt\") #> #> trt Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> Drug A 0.283 0.0484 5.85 <0.001 27.6 0.188 0.378 #> Drug B 0.343 0.0490 7.01 <0.001 38.6 0.247 0.439 #> #> Type: response #> Columns: trt, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high b <- binomial() predict(mod, newdata = dA, type = \"link\") |> mean() |> b$linkinv() #> [1] 0.2743123 predict(mod, newdata = dB, type = \"link\") |> mean() |> b$linkinv() #> [1] 0.3331447 mod |> tbl_regression( tidy_fun = tidy_marginal_predictions, type = \"response\", variables_list = \"no_interaction\", estimate_fun = scales::label_percent(accuracy = .1), label = list(age = \"Age in years\") ) |> modify_column_hide(\"p.value\") |> bold_labels() mod |> tbl_regression( tidy_fun = tidy_marginal_predictions, type = \"response\", estimate_fun = scales::label_percent(accuracy = .1), label = list(age = \"Age in years\") ) |> modify_column_hide(\"p.value\") |> bold_labels() p <- plot_marginal_predictions(mod, type = \"response\") |> patchwork::wrap_plots(ncol = 2) & ggplot2::scale_y_continuous( labels = scales::label_percent(), limits = c(-0.2, 1) ) p[[2]] <- p[[2]] + ggplot2::xlab(\"Age in years\") p + patchwork::plot_annotation( title = \"Average Marginal Predictions\" )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"marginal-means-and-marginal-predictions-at-marginal-means","dir":"Articles","previous_headings":"Marginal Predictions","what":"Marginal Means and Marginal Predictions at Marginal Means","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"emmeans package adopted, default, another approach based marginal means estimated marginal means (.k.. emmeans). consider grid predictors combinations observed modalities categorical variables fixing continuous variables means. Let’s call marginaleffects::predictions() newdata = \"marginalmeans\". can see, pred contains 8 rows, one combination trt (2 modalities) stage (4 modalities). age fixed mean (mean(d$age)) well marker. Let’s compute average predictions value stage. can check obtain estimates emmeans::emmeans(). estimates computed, categorical variable, marginaleffects::prediction() using datagrid(grid_type = \"balanced\")1. Marginal means defined categorical variables. However, can define marginal predictions marginal means continuous categorical variables, calling tidy_marginal_predictions() option newdata = \"marginalmeans\". categorical variables, marginal predictions marginal means equal marginal means.","code":"pred <- predictions(mod, newdata = \"marginalmeans\") pred #> #> Estimate Pr(>|z|) S 2.5 % 97.5 % #> 0.353 0.11462 3.1 0.2042 0.537 #> 0.194 < 0.001 10.8 0.0969 0.351 #> 0.318 0.07405 3.8 0.1678 0.519 #> 0.265 0.01648 5.9 0.1351 0.453 #> 0.419 0.39097 1.4 0.2541 0.604 #> 0.242 0.00282 8.5 0.1308 0.403 #> 0.381 0.24194 2.0 0.2147 0.581 #> 0.322 0.06889 3.9 0.1760 0.514 #> #> Type: invlink(link) #> Columns: rowid, estimate, p.value, s.value, conf.low, conf.high, trt, marker, stage, age, response pred |> group_by(stage) |> summarise(mean(estimate)) #> # A tibble: 4 × 2 #> stage `mean(estimate)` #> #> 1 T1 0.386 #> 2 T2 0.218 #> 3 T3 0.349 #> 4 T4 0.294 emmeans::emmeans(mod, \"stage\", type = \"response\") #> stage prob SE df asymp.LCL asymp.UCL #> T1 0.385 0.0813 Inf 0.242 0.551 #> T2 0.217 0.0611 Inf 0.120 0.359 #> T3 0.349 0.0874 Inf 0.201 0.532 #> T4 0.293 0.0788 Inf 0.164 0.466 #> #> Results are averaged over the levels of: trt #> Confidence level used: 0.95 #> Intervals are back-transformed from the logit scale predictions(mod, by = \"trt\", newdata = datagrid(grid_type = \"balanced\") ) #> #> trt Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> Drug A 0.282 0.0572 4.94 <0.001 20.3 0.170 0.394 #> Drug B 0.341 0.0584 5.84 <0.001 27.5 0.227 0.455 #> #> Type: response #> Columns: trt, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high predictions(mod, by = \"stage\", newdata = datagrid(grid_type = \"balanced\") ) #> #> stage Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> T1 0.386 0.0809 4.77 <0.001 19.0 0.2272 0.544 #> T2 0.218 0.0609 3.58 <0.001 11.5 0.0985 0.337 #> T3 0.349 0.0870 4.02 <0.001 14.0 0.1789 0.520 #> T4 0.294 0.0786 3.74 <0.001 12.4 0.1395 0.447 #> #> Type: response #> Columns: stage, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high mod |> tbl_regression( tidy_fun = tidy_marginal_predictions, newdata = \"marginalmeans\", variables_list = \"no_interaction\", estimate_fun = scales::label_percent(accuracy = .1), label = list(age = \"Age in years\") ) |> modify_column_hide(\"p.value\") |> bold_labels()"},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"marginal-predictions-at-the-median","dir":"Articles","previous_headings":"Marginal Predictions > Alternative approaches","what":"Marginal Predictions at the Median","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"similar marginal predictions mean, except continuous variables fixed median observed values (categorical variables mode). Simply use newdata = \"median\".","code":"mod |> tbl_regression( tidy_fun = tidy_marginal_predictions, newdata = \"median\", variables_list = \"no_interaction\", estimate_fun = scales::label_percent(accuracy = .1), label = list(age = \"Age in years\") ) |> modify_column_hide(\"p.value\") |> bold_labels()"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"the-ggeffectsggpredicts-approach","dir":"Articles","previous_headings":"Marginal Predictions > Alternative approaches","what":"the ggeffects::ggpredict()’s approach","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"ggeffects package offers ggeffects::ggpredict() function generates marginal predictions mean continuous variables first modality (used reference) categorical variables. broom.helpers provides tidy_ggpredict() tidier.","code":"mod |> tbl_regression( tidy_fun = tidy_ggpredict, estimate_fun = scales::label_percent(accuracy = .1), label = list(age = \"Age in years\") ) |> bold_labels() #> Some of the focal terms are of type `character`. This may lead to #> unexpected results. It is recommended to convert these variables to #> factors before fitting the model. #> The following variables are of type character: `trt` mod |> ggeffects::ggpredict() |> plot() |> patchwork::wrap_plots() #> Some of the focal terms are of type `character`. This may lead to #> unexpected results. It is recommended to convert these variables to #> factors before fitting the model. #> The following variables are of type character: `trt`"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"marginal-contrasts","dir":"Articles","previous_headings":"","what":"Marginal Contrasts","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"Now way estimate marginal predictions, can easily compute marginal contrasts, .e. difference marginal predictions.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"average-marginal-contrasts","dir":"Articles","previous_headings":"Marginal Contrasts","what":"Average Marginal Contrasts","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"Let’s consider first categorical variable, e.g. stage. Average Marginal Predictions obtained marginaleffects::avg_predictions(). contrast \"T2\" \"T1\" simply difference two adjusted predictions: marginaleffects::avg_comparisons() function allows compute differences adjusted predictions. Note: fact, avg_comparisons() computed contrasts observed values averaging . construction, equivalent difference average marginal predictions. contrast averaged observed values, can call average marginal contrast. default, modality contrasted first one taken reference. types contrasts specified using variables argument. Let’s consider continuous variable: default, marginaleffects::avg_comparisons() computes, observed value, effect increasing age one unit (comparing adjusted predictions regressor equal observed value minus 0.5 observed value plus 0.5). possible compute contrast another gap, example average difference increase 10 years: Contrasts individual predictors easily obtained: noted column names consistent tidiers used broom.helpers. Therefore, comparisons object passed directly tidy_plus_plus(). Instead, use broom.helpers::tidy_avg_comparisons(). custom tidier compatible tidy_plus_plus() suit functions provided broom.helpers. nicely formatted table can therefore generated gtsummary::tbl_regression(). Similarly, forest plot produced ggstats::ggcoef_model().","code":"pred <- avg_predictions(mod, variables = \"stage\", by = \"stage\", type = \"response\") pred #> #> stage Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> T1 0.389 0.0715 5.44 <0.001 24.2 0.249 0.529 #> T2 0.225 0.0577 3.91 <0.001 13.4 0.112 0.338 #> T3 0.354 0.0786 4.51 <0.001 17.2 0.200 0.508 #> T4 0.300 0.0706 4.25 <0.001 15.5 0.161 0.438 #> #> Type: response #> Columns: stage, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high pred$estimate[2] - pred$estimate[1] #> [1] -0.1637819 comp <- avg_comparisons(mod, variables = \"stage\") comp #> #> Contrast Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> T2 - T1 -0.1638 0.0925 -1.770 0.0767 3.7 -0.345 0.0175 #> T3 - T1 -0.0351 0.1065 -0.330 0.7417 0.4 -0.244 0.1736 #> T4 - T1 -0.0895 0.1004 -0.891 0.3727 1.4 -0.286 0.1073 #> #> Term: stage #> Type: response #> Columns: term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high avg_comparisons(mod, variables = \"stage\") #> #> Contrast Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> T2 - T1 -0.1638 0.0925 -1.770 0.0767 3.7 -0.345 0.0175 #> T3 - T1 -0.0351 0.1065 -0.330 0.7417 0.4 -0.244 0.1736 #> T4 - T1 -0.0895 0.1004 -0.891 0.3727 1.4 -0.286 0.1073 #> #> Term: stage #> Type: response #> Columns: term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high avg_comparisons(mod, variables = list(stage = \"sequential\")) #> #> Contrast Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> T2 - T1 -0.1638 0.0925 -1.770 0.0767 3.7 -0.3451 0.0175 #> T3 - T2 0.1287 0.0972 1.324 0.1856 2.4 -0.0619 0.3192 #> T4 - T3 -0.0544 0.1060 -0.513 0.6081 0.7 -0.2622 0.1535 #> #> Term: stage #> Type: response #> Columns: term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high avg_comparisons(mod, variables = list(stage = \"pairwise\")) #> #> Contrast Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> T2 - T1 -0.1638 0.0925 -1.770 0.0767 3.7 -0.3451 0.0175 #> T3 - T1 -0.0351 0.1065 -0.330 0.7417 0.4 -0.2437 0.1736 #> T3 - T2 0.1287 0.0972 1.324 0.1856 2.4 -0.0619 0.3192 #> T4 - T1 -0.0895 0.1004 -0.891 0.3727 1.4 -0.2862 0.1073 #> T4 - T2 0.0743 0.0917 0.811 0.4176 1.3 -0.1054 0.2540 #> T4 - T3 -0.0544 0.1060 -0.513 0.6081 0.7 -0.2622 0.1535 #> #> Term: stage #> Type: response #> Columns: term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high avg_comparisons(mod, variables = \"age\") #> #> Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> 0.00399 0.00239 1.67 0.0954 3.4 -7e-04 0.00868 #> #> Term: age #> Type: response #> Comparison: +1 #> Columns: term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high, predicted_lo, predicted_hi, predicted avg_comparisons(mod, variables = list(age = 10)) #> #> Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> 0.0412 0.0288 1.43 0.152 2.7 -0.0152 0.0976 #> #> Term: age #> Type: response #> Comparison: +10 #> Columns: term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high, predicted_lo, predicted_hi, predicted avg_comparisons(mod) #> #> Term Contrast Estimate Std. Error z Pr(>|z|) S 2.5 % #> age +1 0.00399 0.00239 1.667 0.0954 3.4 -0.00070 #> marker +1 0.07470 0.04150 1.800 0.0719 3.8 -0.00664 #> stage T2 - T1 -0.16378 0.09252 -1.770 0.0767 3.7 -0.34511 #> stage T3 - T1 -0.03509 0.10646 -0.330 0.7417 0.4 -0.24374 #> stage T4 - T1 -0.08947 0.10037 -0.891 0.3727 1.4 -0.28620 #> trt Drug B - Drug A 0.06006 0.06893 0.871 0.3836 1.4 -0.07504 #> 97.5 % #> 0.00868 #> 0.15604 #> 0.01755 #> 0.17356 #> 0.10726 #> 0.19517 #> #> Type: response #> Columns: term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high tidy_avg_comparisons(mod) #> # A tibble: 6 × 9 #> variable term estimate std.error statistic p.value s.value conf.low conf.high #> #> 1 age +1 0.00399 0.00239 1.67 0.0954 3.39 -7.00e-4 0.00868 #> 2 marker +1 0.0747 0.0415 1.80 0.0719 3.80 -6.64e-3 0.156 #> 3 stage T2 -… -0.164 0.0925 -1.77 0.0767 3.71 -3.45e-1 0.0175 #> 4 stage T3 -… -0.0351 0.106 -0.330 0.742 0.431 -2.44e-1 0.174 #> 5 stage T4 -… -0.0895 0.100 -0.891 0.373 1.42 -2.86e-1 0.107 #> 6 trt Drug… 0.0601 0.0689 0.871 0.384 1.38 -7.50e-2 0.195 mod |> tidy_plus_plus(tidy_fun = tidy_avg_comparisons) #> # A tibble: 6 × 20 #> term variable var_label var_class var_type var_nlevels contrasts #> #> 1 +1 age age nmatrix.2 continu… NA NA #> 2 +1 marker Marker Leve… numeric continu… NA NA #> 3 T2 - T1 stage T Stage factor categor… 4 contr.tr… #> 4 T3 - T1 stage T Stage factor categor… 4 contr.tr… #> 5 T4 - T1 stage T Stage factor categor… 4 contr.tr… #> 6 Drug B - Drug A trt Chemotherap… character dichoto… 2 contr.tr… #> # ℹ 13 more variables: contrasts_type , reference_row , label , #> # n_obs , n_event , estimate , std.error , #> # statistic , p.value , s.value , conf.low , #> # conf.high , label_attr mod |> tbl_regression( tidy_fun = tidy_avg_comparisons, estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() ggstats::ggcoef_model( mod, tidy_fun = tidy_avg_comparisons, variable_labels = c(age = \"Age in years\") ) + ggplot2::scale_x_continuous( labels = scales::label_percent(style_positive = \"plus\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"marginal-contrasts-at-the-mean","dir":"Articles","previous_headings":"Marginal Contrasts","what":"Marginal Contrasts at the Mean","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"Instead computing contrasts observed values averaging, another approach consist considering hypothetical individual whose characteristics correspond “average” predicting results computing contrasts. achieved marginaleffects using newdata = \"mean\". case, consider individual continuous predictors equal mean observed values categorical predictors set mode (.e. frequent value) observed values. newdata argument can passed tidy_avg_comparisons(), tidy_plus_plus gtsummary::tbl_regression(). ggstats::ggcoef_model(), use tidy_args pass newdata = \"mean\".","code":"pred <- predictions(mod, variables = \"trt\", newdata = \"mean\") pred #> #> marker stage age trt Estimate Pr(>|z|) S 2.5 % 97.5 % #> 0.919 T2 46.9 Drug A 0.194 < 0.001 10.8 0.0969 0.351 #> 0.919 T2 46.9 Drug B 0.242 0.00282 8.5 0.1308 0.403 #> #> Type: invlink(link) #> Columns: rowid, rowidcf, estimate, p.value, s.value, conf.low, conf.high, marker, stage, age, response, trt pred$estimate[2] - pred$estimate[1] #> [1] 0.04738154 comparisons(mod, variables = \"trt\", newdata = \"mean\") #> #> Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % marker stage age #> 0.0474 0.0579 0.819 0.413 1.3 -0.066 0.161 0.919 T2 46.9 #> #> Term: trt #> Type: response #> Comparison: Drug B - Drug A #> Columns: rowid, term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high, predicted_lo, predicted_hi, predicted, trt, marker, stage, age, response mod |> tbl_regression( tidy_fun = tidy_avg_comparisons, newdata = \"mean\", estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() mod |> ggstats::ggcoef_model( tidy_fun = tidy_avg_comparisons, tidy_args = list(newdata = \"mean\"), variable_labels = c(age = \"Age in years\") ) + ggplot2::scale_x_continuous( labels = scales::label_percent(style_positive = \"plus\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"alternative-approaches-1","dir":"Articles","previous_headings":"Marginal Contrasts","what":"Alternative approaches","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"assumptions, \"marginalmeans\" \"median\", defined using newdata. See documentation marginaleffects::comparisons().","code":"mod |> tbl_regression( tidy_fun = tidy_avg_comparisons, newdata = \"marginalmeans\", estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() mod |> ggstats::ggcoef_model( tidy_fun = tidy_avg_comparisons, tidy_args = list(newdata = \"marginalmeans\"), variable_labels = c(age = \"Age in years\") ) + ggplot2::scale_x_continuous( labels = scales::label_percent(style_positive = \"plus\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"dealing-with-interactions","dir":"Articles","previous_headings":"Marginal Contrasts","what":"Dealing with interactions","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"model, defined interaction trt marker. Therefore, interested compute contrast marker value trt. Alternatively, possible compute “cross-contrasts” showing happening marker trt changing. tidier tidy_marginal_contrasts() allows compute directly several combinations variables stack results unique tibble. default, interaction, contrasts computed last variable interaction according different values first variables (one variable continuous, using Tukey’s five numbers). option variables_list = \"cross\" used get “cross-contrasts” interactions. option variables_list = \"no_interaction\" used get average marginal contrasts variable without considering interactions. , display marginal contrasts mean, indicate newdata = \"mean\". information way customize combination variables, see documentation examples tidy_marginal_contrasts().","code":"avg_comparisons( mod, variables = list(marker = 1), newdata = datagrid( trt = unique, grid_type = \"counterfactual\" ), by = \"trt\" ) #> #> Term trt Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> marker Drug A 0.0472 0.0573 0.824 0.4101 1.3 -0.0651 0.159 #> marker Drug B 0.1004 0.0590 1.703 0.0887 3.5 -0.0152 0.216 #> #> Type: response #> Comparison: +1 #> Columns: term, contrast, trt, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high avg_comparisons( mod, variables = list(marker = 1, trt = \"reference\"), cross = TRUE ) #> #> C: marker C: trt Estimate Std. Error z Pr(>|z|) S 2.5 % 97.5 % #> +1 Drug B - Drug A 0.161 0.0959 1.67 0.0941 3.4 -0.0274 0.348 #> #> Type: response #> Columns: term, contrast_marker, contrast_trt, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high, predicted_lo, predicted_hi, predicted mod |> tbl_regression( tidy_fun = tidy_marginal_contrasts, estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() ggstats::ggcoef_model( mod, tidy_fun = tidy_marginal_contrasts, variable_labels = c(age = \"Age in years\") ) mod |> tbl_regression( tidy_fun = tidy_marginal_contrasts, variables_list = \"cross\", estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() mod |> tbl_regression( tidy_fun = tidy_marginal_contrasts, variables_list = \"no_interaction\", estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() ggstats::ggcoef_model( mod, tidy_fun = tidy_marginal_contrasts, tidy_args = list(variables_list = \"no_interaction\"), variable_labels = c(age = \"Age in years\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"marginal-effects-marginal-slopes","dir":"Articles","previous_headings":"","what":"Marginal Effects / Marginal Slopes","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"Marginal effects similar marginal contrasts subtle difference. continuous regressor, marginal contrast seen difference marginal effect partial derivative. Put differently, marginal effect continuous regressor xx slope prediction function yy, measured specific value xx, .e. ∂y/∂x{\\partial y}/{\\partial x}. Marginal effects expressed according scale model represent expected change outcome increase one unit regressor. definition, marginal effects defined categorical variables, marginal contrasts reported instead. Like marginal contrasts, several approaches exist compute marginal effects. details, see dedicated vignette marginaleffects package.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"average-marginal-effects-ame","dir":"Articles","previous_headings":"Marginal Effects / Marginal Slopes","what":"Average Marginal Effects (AME)","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"marginal effect computed observed values averaged marginaleffects::avg_slopes(). Column names consistent tidiers used broom.helpers. Use tidy_avg_slopes() instead. Please note categorical variables, marginal contrasts returned. results obtained margins::margins() function inspired Stata’s margins command. margins::margins() compatible stats::poly(), rewrite model, replacing poly(age, 2) age + age^2. broom.helpers, gtsummary ggstats, use tidy_margins().","code":"avg_slopes(mod) #> #> Term Contrast Estimate Std. Error z Pr(>|z|) S 2.5 % #> age dY/dX 0.00397 0.00237 1.679 0.0932 3.4 -0.000666 #> marker dY/dX 0.07104 0.03818 1.861 0.0628 4.0 -0.003781 #> stage T2 - T1 -0.16378 0.09252 -1.770 0.0767 3.7 -0.345109 #> stage T3 - T1 -0.03509 0.10646 -0.330 0.7417 0.4 -0.243740 #> stage T4 - T1 -0.08947 0.10037 -0.891 0.3727 1.4 -0.286204 #> trt Drug B - Drug A 0.06006 0.06893 0.871 0.3836 1.4 -0.075043 #> 97.5 % #> 0.00861 #> 0.14587 #> 0.01755 #> 0.17356 #> 0.10726 #> 0.19517 #> #> Type: response #> Columns: term, contrast, estimate, std.error, statistic, p.value, s.value, conf.low, conf.high mod |> tbl_regression( tidy_fun = tidy_avg_slopes, estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() mod |> ggstats::ggcoef_model( tidy_fun = tidy_avg_slopes, variable_labels = c(age = \"Age in years\") ) + ggplot2::scale_x_continuous( labels = scales::label_percent(style_positive = \"plus\") ) mod_alt <- glm( response ~ trt * marker + stage + age + age^2, data = d, family = binomial ) margins::margins(mod_alt) |> tidy() #> # A tibble: 6 × 5 #> term estimate std.error statistic p.value #> #> 1 age 0.00397 0.00236 1.68 0.0927 #> 2 marker 0.0710 0.0380 1.87 0.0617 #> 3 stageT2 -0.164 0.0922 -1.78 0.0754 #> 4 stageT3 -0.0351 0.106 -0.330 0.742 #> 5 stageT4 -0.0895 0.100 -0.891 0.373 #> 6 trtDrug B 0.0600 0.0689 0.871 0.384 mod_alt |> tbl_regression( tidy_fun = tidy_margins, estimate_fun = scales::label_percent(style_positive = \"plus\") ) |> bold_labels()"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"marginal-effects-at-the-mean-mem","dir":"Articles","previous_headings":"Marginal Effects / Marginal Slopes","what":"Marginal Effects at the Mean (MEM)","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"marginal effects mean2, simple use newdata = \"mean\".","code":"mod |> tbl_regression( tidy_fun = tidy_avg_slopes, newdata = \"mean\", estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() mod |> ggstats::ggcoef_model( tidy_fun = tidy_avg_slopes, tidy_args = list(newdata = \"mean\"), variable_labels = c(age = \"Age in years\") ) + ggplot2::scale_x_continuous( labels = scales::label_percent(style_positive = \"plus\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"marginal-effects-at-marginal-means","dir":"Articles","previous_headings":"Marginal Effects / Marginal Slopes","what":"Marginal Effects at Marginal Means","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"Simply use newdata = \"marginalmeans\".","code":"mod |> tbl_regression( tidy_fun = tidy_avg_slopes, newdata = \"marginalmeans\", estimate_fun = scales::label_percent(style_positive = \"plus\"), label = list(age = \"Age in years\") ) |> bold_labels() mod |> ggstats::ggcoef_model( tidy_fun = tidy_avg_slopes, tidy_args = list(newdata = \"marginalmeans\"), variable_labels = c(age = \"Age in years\") ) + ggplot2::scale_x_continuous( labels = scales::label_percent(style_positive = \"plus\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/marginal_tidiers.html","id":"further-readings","dir":"Articles","previous_headings":"","what":"Further readings","title":"Marginal effects / slopes, contrasts, means and predictions with broom.helpers","text":"Documentation marginaleffects package Vincent Arel-Bundock Marginalia: guide figuring heck marginal effects, marginal slopes, average marginal effects, marginal effects mean, marginal things Andrew Heiss Introduction Adjusted Predictions Marginal Effects R Daniel Lüdecke Introduction margins","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"forest-plot","dir":"Articles","previous_headings":"","what":"Forest Plot","title":"Getting Started with broom.helpers","text":"create figure, ’ll need add information tidy tibble, .e. ’ll need group terms belong variable, add reference row, etc. Parsing information can difficult, broom.helper package made simple. Note: used tidy_and_attach() instead broom::tidy(). broom.helpers functions needs copy original model. avoid passing model step, easier way attach model attribute tibble tidy_attach_model(). tidy_and_attach() simply shortcut model |> broom::tidy() |> tidy_and_attach(model). now tibble every piece information need create forest plot using ggplot2. Note:: advanced nicely formatted plots model coefficients, look ggstats::ggcoef_model() dedicated vignette. ggstats::ggcoef_model() internally uses broom.helpers.","code":"tidy_forest <- model_logit |> # perform initial tidying of the model tidy_and_attach(exponentiate = TRUE, conf.int = TRUE) |> # adding in the reference row for categorical variables tidy_add_reference_rows() |> # adding a reference value to appear in plot tidy_add_estimate_to_reference_rows() |> # adding the variable labels tidy_add_term_labels() |> # removing intercept estimate from model tidy_remove_intercept() tidy_forest #> # A tibble: 5 × 16 #> term variable var_label var_class var_type var_nlevels contrasts #> #> 1 trtDrug A trt Chemotherapy Trea… character dichoto… 2 contr.tr… #> 2 trtDrug B trt Chemotherapy Trea… character dichoto… 2 contr.tr… #> 3 gradeI grade Grade factor categor… 3 contr.tr… #> 4 gradeII grade Grade factor categor… 3 contr.tr… #> 5 gradeIII grade Grade factor categor… 3 contr.tr… #> # ℹ 9 more variables: contrasts_type , reference_row , label , #> # estimate , std.error , statistic , p.value , #> # conf.low , conf.high tidy_forest |> mutate( plot_label = paste(var_label, label, sep = \":\") |> forcats::fct_inorder() |> forcats::fct_rev() ) |> ggplot(aes(x = plot_label, y = estimate, ymin = conf.low, ymax = conf.high, color = variable)) + geom_hline(yintercept = 1, linetype = 2) + geom_pointrange() + coord_flip() + theme(legend.position = \"none\") + labs( y = \"Odds Ratio\", x = \" \", title = \"Forest Plot using broom.helpers\" )"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"table-summary","dir":"Articles","previous_headings":"","what":"Table Summary","title":"Getting Started with broom.helpers","text":"addition aiding figure creation, broom.helpers package can help summarize model table. example , add header reference rows, utilize existing variable labels. Let’s change labels shown summary table well. Note:: advanced nicely formatted tables model coefficients, look gtsummary::tbl_regression() dedicated vignette. gtsummary::tbl_regression() internally uses broom.helpers.","code":"tidy_table <- model_logit |> # perform initial tidying of the model tidy_and_attach(exponentiate = TRUE, conf.int = TRUE) |> # adding in the reference row for categorical variables tidy_add_reference_rows() |> # adding the variable labels tidy_add_term_labels() |> # add header row tidy_add_header_rows() |> # removing intercept estimate from model tidy_remove_intercept() # print summary table options(knitr.kable.NA = \"\") tidy_table |> # format model estimates select(label, estimate, conf.low, conf.high, p.value) |> mutate(across(all_of(c(\"estimate\", \"conf.low\", \"conf.high\")), style_ratio)) |> mutate(across(p.value, style_pvalue)) |> print_table()"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"all-in-one-function","dir":"Articles","previous_headings":"","what":"All-in-one function","title":"Getting Started with broom.helpers","text":"also handy wrapper, called tidy_plus_plus(), commonly used tidy_*() functions, can executed single line code: See documentation tidy_plus_plus() full list available options.","code":"model_logit |> tidy_plus_plus(exponentiate = TRUE) #> # A tibble: 5 × 18 #> term variable var_label var_class var_type var_nlevels contrasts #> #> 1 trtDrug A trt Chemotherapy Trea… character dichoto… 2 contr.tr… #> 2 trtDrug B trt Chemotherapy Trea… character dichoto… 2 contr.tr… #> 3 gradeI grade Grade factor categor… 3 contr.tr… #> 4 gradeII grade Grade factor categor… 3 contr.tr… #> 5 gradeIII grade Grade factor categor… 3 contr.tr… #> # ℹ 11 more variables: contrasts_type , reference_row , label , #> # n_obs , n_event , estimate , std.error , #> # statistic , p.value , conf.low , conf.high model_logit |> tidy_plus_plus(exponentiate = TRUE) |> print_table()"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"advanced-examples","dir":"Articles","previous_headings":"","what":"Advanced examples","title":"Getting Started with broom.helpers","text":"broom.helpers can also handle different contrasts categorical variables use polynomial terms continuous variables.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"polynomial-terms","dir":"Articles","previous_headings":"Advanced examples","what":"Polynomial terms","title":"Getting Started with broom.helpers","text":"polynomial terms continuous variable defined stats::poly(), broom.helpers able identify corresponding variable, create appropriate labels add header rows.","code":"model_poly <- glm(response ~ poly(age, 3) + ttdeath, na.omit(trial), family = binomial) model_poly |> tidy_plus_plus( exponentiate = TRUE, add_header_rows = TRUE, variable_labels = c(age = \"Age in years\") ) |> print_table()"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"different-type-of-contrasts","dir":"Articles","previous_headings":"Advanced examples","what":"Different type of contrasts","title":"Getting Started with broom.helpers","text":"default, categorical variables coded treatment contrasts (see stats::contr.treatment()). contrasts, model coefficients correspond effect modality compared reference modality (default, first one). tidy_add_reference_rows() allows add row reference modality tidy_add_estimate_to_reference_rows() populate estimate value references rows 0 (1 exponentiate = TRUE). tidy_add_term_labels() able retrieve label factor level associated specific model term. Using stats::contr.treatment(), possible defined alternative reference rows. properly managed broom.helpers. can also use sum contrasts (cf. stats::contr.sum()). case, model coefficient corresponds difference modality grand mean. variable 4 modalities coded 3 terms. However, value computed (using emmeans::emmeans()) last modality, corresponding difference modality grand mean equal sum coefficients multiplied -1. broom.helpers identify categorical variables coded sum contrasts retrieve estimate value reference term. types contrasts exist, like Helmert (contr.helmert()) polynomial (contr.poly()). complex modality coded combination terms. Therefore, contrasts, possible associate specific model term level original factor. broom.helpers add reference term case.","code":"model_1 <- glm( response ~ stage + grade * trt, gtsummary::trial, family = binomial ) model_1 |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_reference_rows() |> tidy_add_estimate_to_reference_rows(exponentiate = TRUE) |> tidy_add_term_labels() |> print_table() model_2 <- glm( response ~ stage + grade * trt, gtsummary::trial, family = binomial, contrasts = list( stage = contr.treatment(4, base = 3), grade = contr.treatment(3, base = 2), trt = contr.treatment(2, base = 2) ) ) model_2 |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_reference_rows() |> tidy_add_estimate_to_reference_rows(exponentiate = TRUE) |> tidy_add_term_labels() |> print_table() model_3 <- glm( response ~ stage + grade * trt, gtsummary::trial, family = binomial, contrasts = list( stage = contr.sum, grade = contr.sum, trt = contr.sum ) ) model_3 |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_reference_rows() |> tidy_add_estimate_to_reference_rows(exponentiate = TRUE) |> tidy_add_term_labels() |> print_table() model_4 <- glm( response ~ stage + grade * trt, gtsummary::trial, family = binomial, contrasts = list( stage = contr.poly, grade = contr.helmert, trt = contr.poly ) ) model_4 |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_reference_rows() |> tidy_add_estimate_to_reference_rows(exponentiate = TRUE) |> tidy_add_term_labels() |> print_table()"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"pairwise-contrasts-of-categorical-variable","dir":"Articles","previous_headings":"Advanced examples","what":"Pairwise contrasts of categorical variable","title":"Getting Started with broom.helpers","text":"Pairwise contrasts categorical variables computed tidy_add_pairwise_contrasts().","code":"model_logit <- glm(response ~ age + trt + grade, trial, family = binomial) model_logit |> tidy_and_attach() |> tidy_add_pairwise_contrasts() |> print_table() model_logit |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_pairwise_contrasts() |> print_table() model_logit |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_pairwise_contrasts(pairwise_reverse = FALSE) |> print_table() model_logit |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_pairwise_contrasts(keep_model_terms = TRUE) |> print_table()"},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"column-details","dir":"Articles","previous_headings":"","what":"Column Details","title":"Getting Started with broom.helpers","text":"summary additional columns may added broom.helpers function. table includes column name, function adds column, short description information column. Note: tidy_add_estimate_to_reference_rows() create additional column; rather, populates ‘estimate’ column reference rows.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"additional-attributes","dir":"Articles","previous_headings":"","what":"Additional attributes","title":"Getting Started with broom.helpers","text":"list additional attributes broom.helpers may attached results. table includes attribute name, function adds attribute, short description.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/articles/tidy.html","id":"supported-models","dir":"Articles","previous_headings":"","what":"Supported models","title":"Getting Started with broom.helpers","text":"Note: list models tested. broom.helpers may may work properly partially types models. hesitate provide feedback GitHub.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Joseph Larmarange. Author, maintainer. Daniel D. Sjoberg. Author.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Larmarange J, Sjoberg D (2025). broom.helpers: Helpers Model Coefficients Tibbles. R package version 1.18.0.9000, https://github.com/larmarange/broom.helpers, https://larmarange.github.io/broom.helpers/.","code":"@Manual{, title = {broom.helpers: Helpers for Model Coefficients Tibbles}, author = {Joseph Larmarange and Daniel D. Sjoberg}, year = {2025}, note = {R package version 1.18.0.9000, https://github.com/larmarange/broom.helpers}, url = {https://larmarange.github.io/broom.helpers/}, }"},{"path":"https://larmarange.github.io/broom.helpers/dev/index.html","id":"broomhelpers-","dir":"","previous_headings":"","what":"Helpers for Model Coefficients Tibbles","title":"Helpers for Model Coefficients Tibbles","text":"broom.helpers package provides suite functions work regression model broom::tidy() tibbles. suite includes functions group regression model terms variable, insert reference header rows categorical variables, add variable labels, . broom.helpers used, particular, gtsummary::tbl_regression() producing nice formatted tables model coefficients ggstats::ggcoef_model() plotting model coefficients.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/index.html","id":"installation--documentation","dir":"","previous_headings":"","what":"Installation & Documentation","title":"Helpers for Model Coefficients Tibbles","text":"install stable version: Documentation stable version: https://larmarange.github.io/broom.helpers/ install development version: Documentation development version: https://larmarange.github.io/broom.helpers/dev/","code":"install.packages(\"broom.helpers\") remotes::install_github(\"larmarange/broom.helpers\")"},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/index.html","id":"all-in-one-wrapper","dir":"","previous_headings":"Examples","what":"all-in-one wrapper","title":"Helpers for Model Coefficients Tibbles","text":"","code":"mod1 <- lm(Sepal.Length ~ Sepal.Width + Species, data = iris) library(broom.helpers) ex1 <- mod1 |> tidy_plus_plus() ex1 #> # A tibble: 4 × 17 #> term variable var_label var_class var_type var_nlevels contrasts #> #> 1 Sepal.Width Sepal.Wi… Sepal.Wi… numeric continu… NA #> 2 Speciessetosa Species Species factor categor… 3 contr.tr… #> 3 Speciesversicolor Species Species factor categor… 3 contr.tr… #> 4 Speciesvirginica Species Species factor categor… 3 contr.tr… #> # ℹ 10 more variables: contrasts_type , reference_row , label , #> # n_obs , estimate , std.error , statistic , #> # p.value , conf.low , conf.high dplyr::glimpse(ex1) #> Rows: 4 #> Columns: 17 #> $ term \"Sepal.Width\", \"Speciessetosa\", \"Speciesversicolor\", \"S… #> $ variable \"Sepal.Width\", \"Species\", \"Species\", \"Species\" #> $ var_label \"Sepal.Width\", \"Species\", \"Species\", \"Species\" #> $ var_class \"numeric\", \"factor\", \"factor\", \"factor\" #> $ var_type \"continuous\", \"categorical\", \"categorical\", \"categorica… #> $ var_nlevels NA, 3, 3, 3 #> $ contrasts NA, \"contr.treatment\", \"contr.treatment\", \"contr.treatm… #> $ contrasts_type NA, \"treatment\", \"treatment\", \"treatment\" #> $ reference_row NA, TRUE, FALSE, FALSE #> $ label \"Sepal.Width\", \"setosa\", \"versicolor\", \"virginica\" #> $ n_obs 150, 50, 50, 50 #> $ estimate 0.8035609, 0.0000000, 1.4587431, 1.9468166 #> $ std.error 0.1063390, NA, 0.1121079, 0.1000150 #> $ statistic 7.556598, NA, 13.011954, 19.465255 #> $ p.value 4.187340e-12, NA, 3.478232e-26, 2.094475e-42 #> $ conf.low 0.5933983, NA, 1.2371791, 1.7491525 #> $ conf.high 1.013723, NA, 1.680307, 2.144481 mod2 <- glm( response ~ poly(age, 3) + stage + grade * trt, na.omit(gtsummary::trial), family = binomial, contrasts = list( stage = contr.treatment(4, base = 3), grade = contr.sum ) ) ex2 <- mod2 |> tidy_plus_plus( exponentiate = TRUE, variable_labels = c(age = \"Age (in years)\"), add_header_rows = TRUE, show_single_row = \"trt\" ) ex2 #> # A tibble: 17 × 19 #> term variable var_label var_class var_type var_nlevels header_row contrasts #> #> 1 age Age (in … nmatrix.3 continu… NA TRUE #> 2 poly(… age Age (in … nmatrix.3 continu… NA FALSE #> 3 poly(… age Age (in … nmatrix.3 continu… NA FALSE #> 4 poly(… age Age (in … nmatrix.3 continu… NA FALSE #> 5 stage T Stage factor categor… 4 TRUE contr.tr… #> 6 stage1 stage T Stage factor categor… 4 FALSE contr.tr… #> 7 stage2 stage T Stage factor categor… 4 FALSE contr.tr… #> 8 stage3 stage T Stage factor categor… 4 FALSE contr.tr… #> 9 stage4 stage T Stage factor categor… 4 FALSE contr.tr… #> 10 grade Grade factor categor… 3 TRUE contr.sum #> 11 grade1 grade Grade factor categor… 3 FALSE contr.sum #> 12 grade2 grade Grade factor categor… 3 FALSE contr.sum #> 13 grade3 grade Grade factor categor… 3 FALSE contr.sum #> 14 trtDr… trt Chemothe… character dichoto… 2 NA contr.tr… #> 15 grade:t… Grade * … interac… NA TRUE #> 16 grade… grade:t… Grade * … interac… NA FALSE #> 17 grade… grade:t… Grade * … interac… NA FALSE #> # ℹ 11 more variables: contrasts_type , reference_row , label , #> # n_obs , n_event , estimate , std.error , #> # statistic , p.value , conf.low , conf.high dplyr::glimpse(ex2) #> Rows: 17 #> Columns: 19 #> $ term NA, \"poly(age, 3)1\", \"poly(age, 3)2\", \"poly(age, 3)3\", … #> $ variable \"age\", \"age\", \"age\", \"age\", \"stage\", \"stage\", \"stage\", … #> $ var_label \"Age (in years)\", \"Age (in years)\", \"Age (in years)\", \"… #> $ var_class \"nmatrix.3\", \"nmatrix.3\", \"nmatrix.3\", \"nmatrix.3\", \"fa… #> $ var_type \"continuous\", \"continuous\", \"continuous\", \"continuous\",… #> $ var_nlevels NA, NA, NA, NA, 4, 4, 4, 4, 4, 3, 3, 3, 3, 2, NA, NA, NA #> $ header_row TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, F… #> $ contrasts NA, NA, NA, NA, \"contr.treatment(base=3)\", \"contr.treat… #> $ contrasts_type NA, NA, NA, NA, \"treatment\", \"treatment\", \"treatment\", … #> $ reference_row NA, NA, NA, NA, NA, FALSE, FALSE, TRUE, FALSE, NA, FALS… #> $ label \"Age (in years)\", \"Age (in years)\", \"Age (in years)²\", … #> $ n_obs NA, 173, 173, 173, NA, 46, 50, 35, 42, NA, 63, 53, 57, … #> $ n_event NA, 54, 54, 54, NA, 17, 12, 13, 12, NA, 20, 16, 18, 30,… #> $ estimate NA, 20.2416394, 1.2337899, 0.4931553, NA, 1.0047885, 0.… #> $ std.error NA, 2.3254455, 2.3512842, 2.3936657, NA, 0.4959893, 0.5… #> $ statistic NA, 1.29340459, 0.08935144, -0.29533409, NA, 0.00963137… #> $ p.value NA, 0.1958712, 0.9288026, 0.7677387, NA, 0.9923154, 0.1… #> $ conf.low NA, 0.225454425, 0.007493208, 0.004745694, NA, 0.379776… #> $ conf.high NA, 2315.587655, 100.318341, 74.226179, NA, 2.683385, 1…"},{"path":"https://larmarange.github.io/broom.helpers/dev/index.html","id":"fine-control","dir":"","previous_headings":"Examples","what":"fine control","title":"Helpers for Model Coefficients Tibbles","text":"","code":"ex3 <- mod1 |> # perform initial tidying of model tidy_and_attach() |> # add reference row tidy_add_reference_rows() |> # add term labels tidy_add_term_labels() |> # remove intercept tidy_remove_intercept() ex3 #> # A tibble: 4 × 16 #> term variable var_label var_class var_type var_nlevels contrasts #> #> 1 Sepal.Width Sepal.Wi… Sepal.Wi… numeric continu… NA #> 2 Speciessetosa Species Species factor categor… 3 contr.tr… #> 3 Speciesversicolor Species Species factor categor… 3 contr.tr… #> 4 Speciesvirginica Species Species factor categor… 3 contr.tr… #> # ℹ 9 more variables: contrasts_type , reference_row , label , #> # estimate , std.error , statistic , p.value , #> # conf.low , conf.high dplyr::glimpse(ex3) #> Rows: 4 #> Columns: 16 #> $ term \"Sepal.Width\", \"Speciessetosa\", \"Speciesversicolor\", \"S… #> $ variable \"Sepal.Width\", \"Species\", \"Species\", \"Species\" #> $ var_label \"Sepal.Width\", \"Species\", \"Species\", \"Species\" #> $ var_class \"numeric\", \"factor\", \"factor\", \"factor\" #> $ var_type \"continuous\", \"categorical\", \"categorical\", \"categorica… #> $ var_nlevels NA, 3, 3, 3 #> $ contrasts NA, \"contr.treatment\", \"contr.treatment\", \"contr.treatm… #> $ contrasts_type NA, \"treatment\", \"treatment\", \"treatment\" #> $ reference_row NA, TRUE, FALSE, FALSE #> $ label \"Sepal.Width\", \"setosa\", \"versicolor\", \"virginica\" #> $ estimate 0.8035609, NA, 1.4587431, 1.9468166 #> $ std.error 0.1063390, NA, 0.1121079, 0.1000150 #> $ statistic 7.556598, NA, 13.011954, 19.465255 #> $ p.value 4.187340e-12, NA, 3.478232e-26, 2.094475e-42 #> $ conf.low 0.5933983, NA, 1.2371791, 1.7491525 #> $ conf.high 1.013723, NA, 1.680307, 2.144481 ex4 <- mod2 |> # perform initial tidying of model tidy_and_attach(exponentiate = TRUE) |> # add variable labels, including a custom value for age tidy_add_variable_labels(labels = c(age = \"Age in years\")) |> # add reference rows for categorical variables tidy_add_reference_rows() |> # add a, estimate value of reference terms tidy_add_estimate_to_reference_rows(exponentiate = TRUE) |> # add header rows for categorical variables tidy_add_header_rows() ex4 #> # A tibble: 20 × 17 #> term variable var_label var_class var_type var_nlevels header_row contrasts #> #> 1 (Inte… (Interc… (Interce… interce… NA NA #> 2 age Age in y… nmatrix.3 continu… NA TRUE #> 3 poly(… age Age in y… nmatrix.3 continu… NA FALSE #> 4 poly(… age Age in y… nmatrix.3 continu… NA FALSE #> 5 poly(… age Age in y… nmatrix.3 continu… NA FALSE #> 6 stage T Stage factor categor… 4 TRUE contr.tr… #> 7 stage1 stage T Stage factor categor… 4 FALSE contr.tr… #> 8 stage2 stage T Stage factor categor… 4 FALSE contr.tr… #> 9 stage3 stage T Stage factor categor… 4 FALSE contr.tr… #> 10 stage4 stage T Stage factor categor… 4 FALSE contr.tr… #> 11 grade Grade factor categor… 3 TRUE contr.sum #> 12 grade1 grade Grade factor categor… 3 FALSE contr.sum #> 13 grade2 grade Grade factor categor… 3 FALSE contr.sum #> 14 grade3 grade Grade factor categor… 3 FALSE contr.sum #> 15 trt Chemothe… character dichoto… 2 TRUE contr.tr… #> 16 trtDr… trt Chemothe… character dichoto… 2 FALSE contr.tr… #> 17 trtDr… trt Chemothe… character dichoto… 2 FALSE contr.tr… #> 18 grade:t… Grade * … interac… NA TRUE #> 19 grade… grade:t… Grade * … interac… NA FALSE #> 20 grade… grade:t… Grade * … interac… NA FALSE #> # ℹ 9 more variables: contrasts_type , reference_row , label , #> # estimate , std.error , statistic , p.value , #> # conf.low , conf.high dplyr::glimpse(ex4) #> Rows: 20 #> Columns: 17 #> $ term \"(Intercept)\", NA, \"poly(age, 3)1\", \"poly(age, 3)2\", \"p… #> $ variable \"(Intercept)\", \"age\", \"age\", \"age\", \"age\", \"stage\", \"st… #> $ var_label \"(Intercept)\", \"Age in years\", \"Age in years\", \"Age in … #> $ var_class NA, \"nmatrix.3\", \"nmatrix.3\", \"nmatrix.3\", \"nmatrix.3\",… #> $ var_type \"intercept\", \"continuous\", \"continuous\", \"continuous\", … #> $ var_nlevels NA, NA, NA, NA, NA, 4, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2,… #> $ header_row NA, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALS… #> $ contrasts NA, NA, NA, NA, NA, \"contr.treatment(base=3)\", \"contr.t… #> $ contrasts_type NA, NA, NA, NA, NA, \"treatment\", \"treatment\", \"treatmen… #> $ reference_row NA, NA, NA, NA, NA, NA, FALSE, FALSE, TRUE, FALSE, NA, … #> $ label \"(Intercept)\", \"Age in years\", \"Age in years\", \"Age in … #> $ estimate 0.5266376, NA, 20.2416394, 1.2337899, 0.4931553, NA, 1.… #> $ std.error 0.4130930, NA, 2.3254455, 2.3512842, 2.3936657, NA, 0.4… #> $ statistic -1.55229592, NA, 1.29340459, 0.08935144, -0.29533409, N… #> $ p.value 0.1205914, NA, 0.1958712, 0.9288026, 0.7677387, NA, 0.9… #> $ conf.low 0.227717775, NA, 0.225454425, 0.007493208, 0.004745694,… #> $ conf.high 1.164600, NA, 2315.587655, 100.318341, 74.226179, NA, 2…"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/assert_package.html","id":null,"dir":"Reference","previous_headings":"","what":"Check a package installation status or minimum required version — assert_package","title":"Check a package installation status or minimum required version — assert_package","text":"function .assert_package() checks whether package installed returns error FALSE available. package search provided, function check whether minimum version package required. function .get_package_dependencies() returns tibble dependencies specific package. Finally, .get_min_version_required() return, , minimum version pkg required pkg_search, NULL minimum version required.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/assert_package.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check a package installation status or minimum required version — assert_package","text":"","code":".assert_package(pkg, fn = NULL, pkg_search = \"broom.helpers\", boolean = FALSE) .get_package_dependencies(pkg_search = \"broom.helpers\") .get_all_packages_dependencies( pkg_search = NULL, remove_duplicates = FALSE, lib.loc = NULL ) .get_min_version_required(pkg, pkg_search = \"broom.helpers\")"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/assert_package.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check a package installation status or minimum required version — assert_package","text":"pkg (string) Name required package. fn (string) Name calling function user perspective. Used write informative error messages. pkg_search (string) Name package function search minimum required version . boolean (logical) Whether return TRUE/FALSE, rather error package/package version available. Default FALSE, return error pkg installed. remove_duplicates (logical) several versions package installed, first one returned? lib.loc (string) Location R library trees search , see utils::installed.packages().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/assert_package.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check a package installation status or minimum required version — assert_package","text":"logical error .assert_package(), NULL character minimum version required .get_min_version_required(), tibble .get_package_dependencies().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/assert_package.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Check a package installation status or minimum required version — assert_package","text":"get_all_packages_dependencies() used get list dependencies installed packages.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/assert_package.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Check a package installation status or minimum required version — assert_package","text":"","code":"if (FALSE) { # interactive() .assert_package(\"broom\", boolean = TRUE) .get_package_dependencies() .get_min_version_required(\"brms\") }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-clean_backticks.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove backticks around variable names — .clean_backticks","title":"Remove backticks around variable names — .clean_backticks","text":"Remove backticks around variable names","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-clean_backticks.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove backticks around variable names — .clean_backticks","text":"","code":".clean_backticks(x, variable_names = x)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-clean_backticks.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove backticks around variable names — .clean_backticks","text":"x (string) character vector cleaned. variable_names (string) Optional vector variable names, obtained model_list_variables(only_variable = TRUE), properly take account interaction terms/variables.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-escape_regex.html","id":null,"dir":"Reference","previous_headings":"","what":"Escapes any characters that would have special meaning in a regular expression — .escape_regex","title":"Escapes any characters that would have special meaning in a regular expression — .escape_regex","text":"functions adapted Hmisc::escapeRegex()","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-escape_regex.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Escapes any characters that would have special meaning in a regular expression — .escape_regex","text":"","code":".escape_regex(string)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-escape_regex.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Escapes any characters that would have special meaning in a regular expression — .escape_regex","text":"string (string) character vector.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-formula_list_to_named_list.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert formula selector to a named list — .formula_list_to_named_list","title":"Convert formula selector to a named list — .formula_list_to_named_list","text":"function soon removed broom.helpers. Please consider cards::process_formula_selectors() alternative.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-formula_list_to_named_list.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert formula selector to a named list — .formula_list_to_named_list","text":"","code":".formula_list_to_named_list( x, data = NULL, var_info = NULL, arg_name = NULL, select_single = FALSE, type_check = NULL, type_check_msg = NULL, null_allowed = TRUE )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-formula_list_to_named_list.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert formula selector to a named list — .formula_list_to_named_list","text":"x list selecting formulas data data frame select columns . Default NULL var_info data frame variable names attributes. May also pass character vector variable names. Default NULL arg_name Optional string indicating source argument name. helps error messaging. Default NULL. select_single Logical indicating whether result must single variable. Default FALSE type_check predicate function checks elements passed RHS formulas x= (element named list) satisfy function. type_check_msg type_check= fails, string provided printed error message. NULL, generic error message printed. null_allowed NULL values accepted right hand side formulas?","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-formula_list_to_named_list.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Convert formula selector to a named list — .formula_list_to_named_list","text":"Functions takes list formulas, named list, combination named elements formula elements returns named list. example, list(age = 1, starts_with(\"stage\") ~ 2).","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-formula_list_to_named_list.html","id":"shortcuts","dir":"Reference","previous_headings":"","what":"Shortcuts","title":"Convert formula selector to a named list — .formula_list_to_named_list","text":"shortcut specifying option applied columns/variables omitting LHS formula. example, list(~ 1) equivalent passing list(everything() ~ 1). Additionally, single formula may passed instead placing single formula list; e.g. everything() ~ 1 equivalent passing list(everything() ~ 1)","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-generic_selector.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generate a custom selector function — .generic_selector","text":"","code":".generic_selector(variable_column, select_column, select_expr, fun_name) .is_selector_scoped(variable_column, select_column)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-generic_selector.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generate a custom selector function — .generic_selector","text":"variable_column string indicating column variable names stored select_column character vector columns used select_expr= argument select_expr unquoted predicate command subset data frame select variables fun_name quoted name function .generic_selector() used. helps error messaging.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-generic_selector.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Generate a custom selector function — .generic_selector","text":"custom selector functions","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-generic_selector.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Generate a custom selector function — .generic_selector","text":".is_selector_scoped() checks selector properly registered env_variable_type$df_var_info.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-select_to_varnames.html","id":null,"dir":"Reference","previous_headings":"","what":"Variable selector — .select_to_varnames","title":"Variable selector — .select_to_varnames","text":"function soon removed broom.helpers. Please consider cards::process_selectors() alternative.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-select_to_varnames.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Variable selector — .select_to_varnames","text":"","code":".select_to_varnames( select, data = NULL, var_info = NULL, arg_name = NULL, select_single = FALSE )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-select_to_varnames.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Variable selector — .select_to_varnames","text":"select single object selecting variables, e.g. c(age, stage), starts_with(\"age\") data data frame select columns . Default NULL var_info data frame variable names attributes. May also pass character vector variable names. Default NULL arg_name Optional string indicating source argument name. helps error messaging. Default NULL. select_single Logical indicating whether result must single variable. Default FALSE","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-select_to_varnames.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Variable selector — .select_to_varnames","text":"character vector variable names","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/dot-select_to_varnames.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Variable selector — .select_to_varnames","text":"Function takes select()-like inputs converts selector character vector variable names. Functions accepts tidyselect syntax, additional selector functions defined within package","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_compute_terms_contributions.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute a matrix of terms contributions — model_compute_terms_contributions","title":"Compute a matrix of terms contributions — model_compute_terms_contributions","text":"Used model_get_n(). row term, equal 1 row taken account estimate number observations, 0 otherwise.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_compute_terms_contributions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute a matrix of terms contributions — model_compute_terms_contributions","text":"","code":"model_compute_terms_contributions(model) # Default S3 method model_compute_terms_contributions(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_compute_terms_contributions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute a matrix of terms contributions — model_compute_terms_contributions","text":"model (model object, e.g. glm) model object.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_compute_terms_contributions.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute a matrix of terms contributions — model_compute_terms_contributions","text":"function cover lavaan models (NULL returned).","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_compute_terms_contributions.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute a matrix of terms contributions — model_compute_terms_contributions","text":"","code":"if (FALSE) { # interactive() mod <- lm(Sepal.Length ~ Sepal.Width, iris) mod |> model_compute_terms_contributions() mod <- lm(hp ~ mpg + factor(cyl) + disp:hp, mtcars) mod |> model_compute_terms_contributions() mod <- glm( response ~ stage * grade + trt, gtsummary::trial, family = binomial, contrasts = list( stage = contr.sum, grade = contr.treatment(3, 2), trt = \"contr.SAS\" ) ) mod |> model_compute_terms_contributions() mod <- glm( response ~ stage * trt, gtsummary::trial, family = binomial, contrasts = list(stage = contr.poly) ) mod |> model_compute_terms_contributions() mod <- glm( Survived ~ Class * Age + Sex, data = Titanic |> as.data.frame(), weights = Freq, family = binomial ) mod |> model_compute_terms_contributions() d <- dplyr::as_tibble(Titanic) |> dplyr::group_by(Class, Sex, Age) |> dplyr::summarise( n_survived = sum(n * (Survived == \"Yes\")), n_dead = sum(n * (Survived == \"No\")) ) mod <- glm(cbind(n_survived, n_dead) ~ Class * Age + Sex, data = d, family = binomial) mod |> model_compute_terms_contributions() }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_assign.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the assign attribute of model matrix of a model — model_get_assign","title":"Get the assign attribute of model matrix of a model — model_get_assign","text":"Return assign attribute attached object returned stats::model.matrix().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_assign.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the assign attribute of model matrix of a model — model_get_assign","text":"","code":"model_get_assign(model) # Default S3 method model_get_assign(model) # S3 method for class 'vglm' model_get_assign(model) # S3 method for class 'model_fit' model_get_assign(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_assign.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the assign attribute of model matrix of a model — model_get_assign","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_assign.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the assign attribute of model matrix of a model — model_get_assign","text":"","code":"lm(hp ~ mpg + factor(cyl), mtcars) |> model_get_assign() #> [1] 0 1 2 2 #> attr(,\"model_matrix\") #> (Intercept) mpg factor(cyl)6 factor(cyl)8 #> Mazda RX4 1 21.0 1 0 #> Mazda RX4 Wag 1 21.0 1 0 #> Datsun 710 1 22.8 0 0 #> Hornet 4 Drive 1 21.4 1 0 #> Hornet Sportabout 1 18.7 0 1 #> Valiant 1 18.1 1 0 #> Duster 360 1 14.3 0 1 #> Merc 240D 1 24.4 0 0 #> Merc 230 1 22.8 0 0 #> Merc 280 1 19.2 1 0 #> Merc 280C 1 17.8 1 0 #> Merc 450SE 1 16.4 0 1 #> Merc 450SL 1 17.3 0 1 #> Merc 450SLC 1 15.2 0 1 #> Cadillac Fleetwood 1 10.4 0 1 #> Lincoln Continental 1 10.4 0 1 #> Chrysler Imperial 1 14.7 0 1 #> Fiat 128 1 32.4 0 0 #> Honda Civic 1 30.4 0 0 #> Toyota Corolla 1 33.9 0 0 #> Toyota Corona 1 21.5 0 0 #> Dodge Challenger 1 15.5 0 1 #> AMC Javelin 1 15.2 0 1 #> Camaro Z28 1 13.3 0 1 #> Pontiac Firebird 1 19.2 0 1 #> Fiat X1-9 1 27.3 0 0 #> Porsche 914-2 1 26.0 0 0 #> Lotus Europa 1 30.4 0 0 #> Ford Pantera L 1 15.8 0 1 #> Ferrari Dino 1 19.7 1 0 #> Maserati Bora 1 15.0 0 1 #> Volvo 142E 1 21.4 0 0 #> attr(,\"model_matrix\")attr(,\"assign\") #> [1] 0 1 2 2 #> attr(,\"model_matrix\")attr(,\"contrasts\") #> attr(,\"model_matrix\")attr(,\"contrasts\")$`factor(cyl)` #> [1] \"contr.treatment\" #>"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_coefficients_type.html","id":null,"dir":"Reference","previous_headings":"","what":"Get coefficient type — model_get_coefficients_type","title":"Get coefficient type — model_get_coefficients_type","text":"Indicate type coefficient among \"generic\", \"logistic\", \"poisson\", \"relative_risk\" \"prop_hazard\".","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_coefficients_type.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get coefficient type — model_get_coefficients_type","text":"","code":"model_get_coefficients_type(model) # Default S3 method model_get_coefficients_type(model) # S3 method for class 'glm' model_get_coefficients_type(model) # S3 method for class 'negbin' model_get_coefficients_type(model) # S3 method for class 'geeglm' model_get_coefficients_type(model) # S3 method for class 'fixest' model_get_coefficients_type(model) # S3 method for class 'biglm' model_get_coefficients_type(model) # S3 method for class 'glmerMod' model_get_coefficients_type(model) # S3 method for class 'clogit' model_get_coefficients_type(model) # S3 method for class 'polr' model_get_coefficients_type(model) # S3 method for class 'multinom' model_get_coefficients_type(model) # S3 method for class 'svyolr' model_get_coefficients_type(model) # S3 method for class 'clm' model_get_coefficients_type(model) # S3 method for class 'clmm' model_get_coefficients_type(model) # S3 method for class 'coxph' model_get_coefficients_type(model) # S3 method for class 'crr' model_get_coefficients_type(model) # S3 method for class 'tidycrr' model_get_coefficients_type(model) # S3 method for class 'cch' model_get_coefficients_type(model) # S3 method for class 'model_fit' model_get_coefficients_type(model) # S3 method for class 'LORgee' model_get_coefficients_type(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_coefficients_type.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get coefficient type — model_get_coefficients_type","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_coefficients_type.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get coefficient type — model_get_coefficients_type","text":"","code":"lm(hp ~ mpg + factor(cyl), mtcars) |> model_get_coefficients_type() #> [1] \"generic\" df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) glm(Survived ~ Class + Age * Sex, data = df, weights = df$n, family = binomial) |> model_get_coefficients_type() #> [1] \"logistic\""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_contrasts.html","id":null,"dir":"Reference","previous_headings":"","what":"Get contrasts used in the model — model_get_contrasts","title":"Get contrasts used in the model — model_get_contrasts","text":"Get contrasts used model","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_contrasts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get contrasts used in the model — model_get_contrasts","text":"","code":"model_get_contrasts(model) # S3 method for class 'model_fit' model_get_contrasts(model) # S3 method for class 'zeroinfl' model_get_contrasts(model) # S3 method for class 'hurdle' model_get_contrasts(model) # S3 method for class 'betareg' model_get_contrasts(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_contrasts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get contrasts used in the model — model_get_contrasts","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_contrasts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get contrasts used in the model — model_get_contrasts","text":"","code":"glm( am ~ mpg + factor(cyl), data = mtcars, family = binomial, contrasts = list(`factor(cyl)` = contr.sum) ) |> model_get_contrasts() #> $`factor(cyl)` #> [,1] [,2] #> 4 1 0 #> 6 0 1 #> 8 -1 -1 #>"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the model from model objects — model_get_model","title":"Get the model from model objects — model_get_model","text":"model objects proper R model objects. , however, model objects store proper object internally (e.g. mice models). function extracts model object cases.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the model from model objects — model_get_model","text":"","code":"model_get_model(model) # Default S3 method model_get_model(model) # S3 method for class 'mira' model_get_model(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the model from model objects — model_get_model","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the model from model objects — model_get_model","text":"","code":"lm(hp ~ mpg + factor(cyl), mtcars) |> model_get_model() #> #> Call: #> lm(formula = hp ~ mpg + factor(cyl), data = mtcars) #> #> Coefficients: #> (Intercept) mpg factor(cyl)6 factor(cyl)8 #> 171.349 -3.327 16.623 88.105 #>"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_frame.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the model frame of a model — model_get_model_frame","title":"Get the model frame of a model — model_get_model_frame","text":"structure object returned stats::model.frame() slightly differ certain types models. model_get_model_frame() always return object data structure NULL possible compute model frame model.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_frame.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the model frame of a model — model_get_model_frame","text":"","code":"model_get_model_frame(model) # Default S3 method model_get_model_frame(model) # S3 method for class 'coxph' model_get_model_frame(model) # S3 method for class 'svycoxph' model_get_model_frame(model) # S3 method for class 'survreg' model_get_model_frame(model) # S3 method for class 'biglm' model_get_model_frame(model) # S3 method for class 'model_fit' model_get_model_frame(model) # S3 method for class 'fixest' model_get_model_frame(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_frame.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the model frame of a model — model_get_model_frame","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_frame.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the model frame of a model — model_get_model_frame","text":"","code":"lm(hp ~ mpg + factor(cyl), mtcars) |> model_get_model_frame() |> head() #> hp mpg factor(cyl) #> Mazda RX4 110 21.0 6 #> Mazda RX4 Wag 110 21.0 6 #> Datsun 710 93 22.8 4 #> Hornet 4 Drive 110 21.4 6 #> Hornet Sportabout 175 18.7 8 #> Valiant 105 18.1 6"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_matrix.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the model matrix of a model — model_get_model_matrix","title":"Get the model matrix of a model — model_get_model_matrix","text":"structure object returned stats::model.matrix() slightly differ certain types models. model_get_model_matrix() always return object structure stats::model.matrix.default().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_matrix.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the model matrix of a model — model_get_model_matrix","text":"","code":"model_get_model_matrix(model, ...) # Default S3 method model_get_model_matrix(model, ...) # S3 method for class 'multinom' model_get_model_matrix(model, ...) # S3 method for class 'clm' model_get_model_matrix(model, ...) # S3 method for class 'brmsfit' model_get_model_matrix(model, ...) # S3 method for class 'glmmTMB' model_get_model_matrix(model, ...) # S3 method for class 'plm' model_get_model_matrix(model, ...) # S3 method for class 'biglm' model_get_model_matrix(model, ...) # S3 method for class 'model_fit' model_get_model_matrix(model, ...) # S3 method for class 'fixest' model_get_model_matrix(model, ...) # S3 method for class 'LORgee' model_get_model_matrix(model, ...) # S3 method for class 'betareg' model_get_model_matrix(model, ...) # S3 method for class 'cch' model_get_model_matrix(model, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_matrix.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the model matrix of a model — model_get_model_matrix","text":"model (model object, e.g. glm) model object. ... Additional arguments passed stats::model.matrix().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_matrix.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get the model matrix of a model — model_get_model_matrix","text":"models fitted glmmTMB::glmmTMB(), return model matrix taking account components (\"cond\", \"zi\" \"disp\"). restricted model matrix, please refer glmmTMB::model.matrix.glmmTMB(). plm::plm() models, constant columns removed. fixest models, recreate model matrix main variables instrumental variables. options, see fixest::model.matrix.fixest.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_model_matrix.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the model matrix of a model — model_get_model_matrix","text":"","code":"lm(hp ~ mpg + factor(cyl), mtcars) |> model_get_model_matrix() |> head() #> (Intercept) mpg factor(cyl)6 factor(cyl)8 #> Mazda RX4 1 21.0 1 0 #> Mazda RX4 Wag 1 21.0 1 0 #> Datsun 710 1 22.8 0 0 #> Hornet 4 Drive 1 21.4 1 0 #> Hornet Sportabout 1 18.7 0 1 #> Valiant 1 18.1 1 0"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_n.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the number of observations — model_get_n","title":"Get the number of observations — model_get_n","text":"binomial multinomial logistic models, also return number events.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_n.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the number of observations — model_get_n","text":"","code":"model_get_n(model) # Default S3 method model_get_n(model) # S3 method for class 'glm' model_get_n(model) # S3 method for class 'glmerMod' model_get_n(model) # S3 method for class 'multinom' model_get_n(model) # S3 method for class 'LORgee' model_get_n(model) # S3 method for class 'coxph' model_get_n(model) # S3 method for class 'survreg' model_get_n(model) # S3 method for class 'model_fit' model_get_n(model) # S3 method for class 'tidycrr' model_get_n(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_n.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the number of observations — model_get_n","text":"model (model object, e.g. glm) model object.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_n.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get the number of observations — model_get_n","text":"Poisson models, return number events exposure time (defined stats::offset()). Cox models (survival::coxph()), return number events, exposure time number individuals. competing risk regression models (tidycmprsk::crr()), n_event takes account event interest defined failcode. See tidy_add_n() details. total number observations (N_obs), individuals (N_ind), events (N_event) exposure time (Exposure) stored attributes returned tibble. function cover lavaan models (NULL returned).","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_n.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the number of observations — model_get_n","text":"","code":"lm(hp ~ mpg + factor(cyl) + disp:hp, mtcars) |> model_get_n() #> # A tibble: 6 × 2 #> term n_obs #> #> 1 (Intercept) 32 #> 2 mpg 32 #> 3 factor(cyl)6 7 #> 4 factor(cyl)8 14 #> 5 hp:disp 32 #> 6 factor(cyl)4 11 mod <- glm( response ~ stage * grade + trt, gtsummary::trial, family = binomial, contrasts = list(stage = contr.sum, grade = contr.treatment(3, 2), trt = \"contr.SAS\") ) mod |> model_get_n() #> # A tibble: 16 × 3 #> term n_obs n_event #> #> 1 (Intercept) 193 61 #> 2 stage1 52 18 #> 3 stage2 52 13 #> 4 stage3 40 15 #> 5 grade1 67 21 #> 6 grade3 63 21 #> 7 trtDrug A 95 28 #> 8 stage1:grade1 17 6 #> 9 stage2:grade1 17 4 #> 10 stage3:grade1 18 7 #> 11 stage1:grade3 13 6 #> 12 stage2:grade3 19 5 #> 13 stage3:grade3 13 4 #> 14 stage4 49 15 #> 15 grade2 63 19 #> 16 trtDrug B 98 33 if (FALSE) { # \\dontrun{ mod <- glm( Survived ~ Class * Age + Sex, data = Titanic |> as.data.frame(), weights = Freq, family = binomial ) mod |> model_get_n() d <- dplyr::as_tibble(Titanic) |> dplyr::group_by(Class, Sex, Age) |> dplyr::summarise( n_survived = sum(n * (Survived == \"Yes\")), n_dead = sum(n * (Survived == \"No\")) ) mod <- glm(cbind(n_survived, n_dead) ~ Class * Age + Sex, data = d, family = binomial) mod |> model_get_n() mod <- glm(response ~ age + grade * trt, gtsummary::trial, family = poisson) mod |> model_get_n() mod <- glm( response ~ trt * grade + offset(ttdeath), gtsummary::trial, family = poisson ) mod |> model_get_n() dont df <- survival::lung |> dplyr::mutate(sex = factor(sex)) mod <- survival::coxph(survival::Surv(time, status) ~ ph.ecog + age + sex, data = df) mod |> model_get_n() mod <- lme4::lmer(Reaction ~ Days + (Days | Subject), lme4::sleepstudy) mod |> model_get_n() mod <- lme4::glmer(response ~ trt * grade + (1 | stage), family = binomial, data = gtsummary::trial ) mod |> model_get_n() mod <- lme4::glmer(cbind(incidence, size - incidence) ~ period + (1 | herd), family = binomial, data = lme4::cbpp ) mod |> model_get_n() } # }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_nlevels.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the number of levels for each factor used in xlevels — model_get_nlevels","title":"Get the number of levels for each factor used in xlevels — model_get_nlevels","text":"Get number levels factor used xlevels","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_nlevels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the number of levels for each factor used in xlevels — model_get_nlevels","text":"","code":"model_get_nlevels(model) # Default S3 method model_get_nlevels(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_nlevels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the number of levels for each factor used in xlevels — model_get_nlevels","text":"model (model object, e.g. glm) model object.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_nlevels.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get the number of levels for each factor used in xlevels — model_get_nlevels","text":"tibble two columns: \"variable\" \"var_nlevels\"","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_nlevels.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the number of levels for each factor used in xlevels — model_get_nlevels","text":"","code":"lm(hp ~ mpg + factor(cyl), mtcars) |> model_get_nlevels() #> # A tibble: 1 × 2 #> variable var_nlevels #> #> 1 factor(cyl) 3"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_offset.html","id":null,"dir":"Reference","previous_headings":"","what":"Get model offset — model_get_offset","title":"Get model offset — model_get_offset","text":"function cover lavaan models (NULL returned).","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_offset.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get model offset — model_get_offset","text":"","code":"model_get_offset(model) # Default S3 method model_get_offset(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_offset.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get model offset — model_get_offset","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_offset.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get model offset — model_get_offset","text":"","code":"mod <- glm( response ~ trt + offset(log(ttdeath)), gtsummary::trial, family = poisson ) mod |> model_get_offset() #> [1] 3.178054 3.178054 3.178054 2.870169 2.799109 2.749832 3.178054 2.913980 #> [9] 3.178054 2.354228 3.178054 3.178054 2.663053 2.556452 3.121483 2.164472 #> [17] 3.178054 2.721953 3.178054 3.178054 3.178054 3.178054 2.828496 3.173460 #> [25] 1.843719 2.758109 3.178054 3.178054 2.737609 2.858193 3.178054 3.039749 #> [33] 3.178054 3.178054 3.178054 2.527327 3.178054 2.746630 2.890372 2.891482 #> [41] 2.520113 2.493205 3.178054 2.857619 3.178054 3.178054 3.178054 2.500616 #> [49] 2.304583 2.903069 2.343727 3.178054 3.178054 2.962175 2.502255 2.671386 #> [57] 2.962175 2.318458 2.576422 2.314514 3.178054 3.125444 3.178054 3.096934 #> [65] 3.178054 3.026261 3.145445 1.998774 3.178054 3.178054 3.178054 3.178054 #> [73] 3.178054 2.955951 1.983756 3.173041 2.786861 3.178054 2.643334 3.178054 #> [81] 3.178054 3.178054 2.799717 3.170106 3.178054 2.910719 2.437116 3.041661 #> [89] 1.673351 3.132010 2.335052 3.178054 3.178054 2.676903 2.951780 3.178054 #> [97] 3.053529 2.776954 2.299581 3.178054 3.178054 2.983153 2.813611 2.414126 #> [105] 2.906354 3.178054 2.865624 2.859340 3.178054 3.129389 2.615935 3.178054 #> [113] 3.178054 2.859913 3.178054 3.178054 3.178054 3.178054 3.178054 2.564949 #> [121] 2.275214 2.750471 3.178054 1.261298 3.013081 3.153163 2.801541 3.178054 #> [129] 3.178054 2.684440 2.879760 3.178054 3.083285 3.178054 3.178054 2.540026 #> [137] 3.178054 3.178054 3.178054 3.178054 2.309561 3.178054 3.178054 3.178054 #> [145] 3.012098 3.178054 3.178054 3.060115 2.536075 2.571084 3.178054 2.714695 #> [153] 3.002708 2.356126 3.178054 3.178054 3.178054 3.178054 3.161247 3.178054 #> [161] 2.994732 2.744061 3.166319 3.109507 2.972464 2.807594 3.178054 3.178054 #> [169] 3.178054 3.086943 3.178054 2.528126 3.178054 2.695978 2.800933 3.178054 #> [177] 2.223542 2.877512 3.178054 3.178054 2.294553 2.782539 2.352327 3.035434 #> [185] 3.178054 2.799717 3.178054 3.109061 3.178054 3.072693 3.178054 2.986187 #> [193] 3.178054 #> attr(,\"label\") #> [1] \"Months to Death/Censor\""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_pairwise_contrasts.html","id":null,"dir":"Reference","previous_headings":"","what":"Get pairwise comparison of the levels of a categorical variable — model_get_pairwise_contrasts","title":"Get pairwise comparison of the levels of a categorical variable — model_get_pairwise_contrasts","text":"computed emmeans::emmeans().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_pairwise_contrasts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get pairwise comparison of the levels of a categorical variable — model_get_pairwise_contrasts","text":"","code":"model_get_pairwise_contrasts( model, variables, pairwise_reverse = TRUE, contrasts_adjust = NULL, conf.level = 0.95, emmeans_args = list() )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_pairwise_contrasts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get pairwise comparison of the levels of a categorical variable — model_get_pairwise_contrasts","text":"model (model object, e.g. glm) model object. variables (tidy-select) Variables add pairwise contrasts. pairwise_reverse (logical) Determines whether use \"pairwise\" (TRUE) \"revpairwise\" (FALSE), see emmeans::contrast(). contrasts_adjust optional adjustment method computing contrasts, see emmeans::contrast() (NULL, use emmeans default) conf.level (numeric) Level confidence confidence intervals (default: 95%). emmeans_args (logical) List additional parameter pass emmeans::emmeans() computing pairwise contrasts.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_pairwise_contrasts.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get pairwise comparison of the levels of a categorical variable — model_get_pairwise_contrasts","text":"pscl::zeroinfl() pscl::hurdle() models, pairwise contrasts computed separately component, using mode = \"count\" mode = \"zero\" (see documentation emmeans) component column added results. support still experimental.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_pairwise_contrasts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get pairwise comparison of the levels of a categorical variable — model_get_pairwise_contrasts","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"emmeans\", boolean = TRUE)) { mod <- lm(Sepal.Length ~ Species, data = iris) mod |> model_get_pairwise_contrasts(variables = \"Species\") mod |> model_get_pairwise_contrasts( variables = \"Species\", contrasts_adjust = \"none\" ) } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_response.html","id":null,"dir":"Reference","previous_headings":"","what":"Get model response — model_get_response","title":"Get model response — model_get_response","text":"function cover lavaan models (NULL returned).","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_response.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get model response — model_get_response","text":"","code":"model_get_response(model) # Default S3 method model_get_response(model) # S3 method for class 'glm' model_get_response(model) # S3 method for class 'glmerMod' model_get_response(model) # S3 method for class 'model_fit' model_get_response(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_response.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get model response — model_get_response","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_response.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get model response — model_get_response","text":"","code":"lm(hp ~ mpg + factor(cyl) + disp:hp, mtcars) |> model_get_response() #> Mazda RX4 Mazda RX4 Wag Datsun 710 Hornet 4 Drive #> 110 110 93 110 #> Hornet Sportabout Valiant Duster 360 Merc 240D #> 175 105 245 62 #> Merc 230 Merc 280 Merc 280C Merc 450SE #> 95 123 123 180 #> Merc 450SL Merc 450SLC Cadillac Fleetwood Lincoln Continental #> 180 180 205 215 #> Chrysler Imperial Fiat 128 Honda Civic Toyota Corolla #> 230 66 52 65 #> Toyota Corona Dodge Challenger AMC Javelin Camaro Z28 #> 97 150 150 245 #> Pontiac Firebird Fiat X1-9 Porsche 914-2 Lotus Europa #> 175 66 91 113 #> Ford Pantera L Ferrari Dino Maserati Bora Volvo 142E #> 264 175 335 109 mod <- glm( response ~ stage * grade + trt, gtsummary::trial, family = binomial, contrasts = list(stage = contr.sum, grade = contr.treatment(3, 2), trt = \"contr.SAS\") ) mod |> model_get_response() #> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #> 0 1 0 1 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 #> 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 #> 0 0 0 0 0 0 1 0 0 1 1 0 0 1 0 0 1 0 0 0 #> 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 #> 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 1 1 0 #> 62 63 64 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 #> 0 0 0 0 1 1 0 0 1 0 0 0 1 0 0 0 0 0 0 1 #> 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 #> 0 0 0 1 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 #> 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 #> 0 0 1 0 0 0 0 1 1 0 0 1 1 0 0 0 0 1 0 0 #> 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 140 141 142 143 144 #> 0 0 1 1 0 0 0 1 0 0 0 1 0 1 1 1 1 1 0 1 #> 145 146 147 148 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 #> 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 #> 166 167 168 169 170 171 172 173 174 175 176 177 178 180 181 182 183 184 185 186 #> 0 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 0 1 0 1 #> 187 188 189 190 191 192 193 194 196 197 198 199 200 #> 0 0 0 0 0 0 0 0 0 1 1 0 0 #> attr(,\"label\") #> [1] \"Tumor Response\" mod <- glm( Survived ~ Class * Age + Sex, data = Titanic |> as.data.frame(), weights = Freq, family = binomial ) mod |> model_get_response() #> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 0 1 1 #> 27 28 29 30 31 32 #> 1 1 1 1 1 1 d <- dplyr::as_tibble(Titanic) |> dplyr::group_by(Class, Sex, Age) |> dplyr::summarise( n_survived = sum(n * (Survived == \"Yes\")), n_dead = sum(n * (Survived == \"No\")) ) #> `summarise()` has grouped output by 'Class', 'Sex'. You can override using the #> `.groups` argument. mod <- glm(cbind(n_survived, n_dead) ~ Class * Age + Sex, data = d, family = binomial, y = FALSE) mod |> model_get_response() #> 1 2 3 4 5 6 7 #> 0.97222222 1.00000000 0.32571429 1.00000000 0.86021505 1.00000000 0.08333333 #> 8 9 10 11 12 13 14 #> 1.00000000 0.46060606 0.45161290 0.16233766 0.27083333 0.86956522 0.00000000 #> 15 16 #> 0.22273782 0.00000000"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_response_variable.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the name of the response variable — model_get_response_variable","title":"Get the name of the response variable — model_get_response_variable","text":"Get name response variable","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_response_variable.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the name of the response variable — model_get_response_variable","text":"","code":"model_get_response_variable(model) # Default S3 method model_get_response_variable(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_response_variable.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the name of the response variable — model_get_response_variable","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_response_variable.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the name of the response variable — model_get_response_variable","text":"","code":"lm(hp ~ mpg + factor(cyl) + disp:hp, mtcars) |> model_get_response_variable() #> [1] \"hp\" mod <- glm( response ~ stage * grade + trt, gtsummary::trial, family = binomial ) mod |> model_get_response_variable() #> [1] \"response\" mod <- glm( Survived ~ Class * Age + Sex, data = Titanic |> as.data.frame(), weights = Freq, family = binomial ) mod |> model_get_response_variable() #> [1] \"Survived\""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_terms.html","id":null,"dir":"Reference","previous_headings":"","what":"Get the terms of a model — model_get_terms","title":"Get the terms of a model — model_get_terms","text":"Return result stats::terms() applied model NULL possible get terms model.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_terms.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get the terms of a model — model_get_terms","text":"","code":"model_get_terms(model) # Default S3 method model_get_terms(model) # S3 method for class 'brmsfit' model_get_terms(model) # S3 method for class 'glmmTMB' model_get_terms(model) # S3 method for class 'model_fit' model_get_terms(model) # S3 method for class 'betareg' model_get_terms(model) # S3 method for class 'betareg' model_get_terms(model) # S3 method for class 'cch' model_get_terms(model) # S3 method for class 'fixest' model_get_terms(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_terms.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get the terms of a model — model_get_terms","text":"model (model object, e.g. glm) model object.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_terms.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get the terms of a model — model_get_terms","text":"models fitted glmmTMB::glmmTMB(), return terms object taking account components (\"cond\" \"zi\"). restricted terms object, please refer glmmTMB::terms.glmmTMB(). fixest models, return term object combining main variables instrumental variables.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_terms.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get the terms of a model — model_get_terms","text":"","code":"lm(hp ~ mpg + factor(cyl), mtcars) |> model_get_terms() #> hp ~ mpg + factor(cyl) #> attr(,\"variables\") #> list(hp, mpg, factor(cyl)) #> attr(,\"factors\") #> mpg factor(cyl) #> hp 0 0 #> mpg 1 0 #> factor(cyl) 0 1 #> attr(,\"term.labels\") #> [1] \"mpg\" \"factor(cyl)\" #> attr(,\"order\") #> [1] 1 1 #> attr(,\"intercept\") #> [1] 1 #> attr(,\"response\") #> [1] 1 #> attr(,\".Environment\") #> #> attr(,\"predvars\") #> list(hp, mpg, factor(cyl)) #> attr(,\"dataClasses\") #> hp mpg factor(cyl) #> \"numeric\" \"numeric\" \"factor\""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_weights.html","id":null,"dir":"Reference","previous_headings":"","what":"Get sampling weights used by a model — model_get_weights","title":"Get sampling weights used by a model — model_get_weights","text":"function cover lavaan models (NULL returned).","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_weights.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get sampling weights used by a model — model_get_weights","text":"","code":"model_get_weights(model) # Default S3 method model_get_weights(model) # S3 method for class 'svyglm' model_get_weights(model) # S3 method for class 'svrepglm' model_get_weights(model) # S3 method for class 'model_fit' model_get_weights(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_weights.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get sampling weights used by a model — model_get_weights","text":"model (model object, e.g. glm) model object.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_weights.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Get sampling weights used by a model — model_get_weights","text":"class svrepglm objects (GLM survey object replicate weights), return original sampling weights data, replicate weights.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_weights.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get sampling weights used by a model — model_get_weights","text":"","code":"mod <- lm(Sepal.Length ~ Sepal.Width, iris) mod |> model_get_weights() #> [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> [112] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> [149] 1 1 mod <- lm(hp ~ mpg + factor(cyl) + disp:hp, mtcars, weights = mtcars$gear) mod |> model_get_weights() #> [1] 4 4 4 3 3 3 3 4 4 4 4 3 3 3 3 3 3 4 4 4 3 3 3 3 3 4 5 5 5 5 5 4 mod <- glm( response ~ stage * grade + trt, gtsummary::trial, family = binomial ) mod |> model_get_weights() #> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 62 63 64 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 140 141 142 143 144 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 145 146 147 148 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 166 167 168 169 170 171 172 173 174 175 176 177 178 180 181 182 183 184 185 186 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #> 187 188 189 190 191 192 193 194 196 197 198 199 200 #> 1 1 1 1 1 1 1 1 1 1 1 1 1 mod <- glm( Survived ~ Class * Age + Sex, data = Titanic |> as.data.frame(), weights = Freq, family = binomial ) mod |> model_get_weights() #> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #> 0 0 35 0 0 0 17 0 118 154 387 670 4 13 89 3 5 11 13 0 #> 21 22 23 24 25 26 27 28 29 30 31 32 #> 1 13 14 0 57 14 75 192 140 80 76 20 d <- dplyr::as_tibble(Titanic) |> dplyr::group_by(Class, Sex, Age) |> dplyr::summarise( n_survived = sum(n * (Survived == \"Yes\")), n_dead = sum(n * (Survived == \"No\")) ) #> `summarise()` has grouped output by 'Class', 'Sex'. You can override using the #> `.groups` argument. mod <- glm(cbind(n_survived, n_dead) ~ Class * Age + Sex, data = d, family = binomial) mod |> model_get_weights() #> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #> 144 1 175 5 93 13 168 11 165 31 462 48 23 0 862 0"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_xlevels.html","id":null,"dir":"Reference","previous_headings":"","what":"Get xlevels used in the model — model_get_xlevels","title":"Get xlevels used in the model — model_get_xlevels","text":"Get xlevels used model","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_xlevels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get xlevels used in the model — model_get_xlevels","text":"","code":"model_get_xlevels(model) # Default S3 method model_get_xlevels(model) # S3 method for class 'lmerMod' model_get_xlevels(model) # S3 method for class 'glmerMod' model_get_xlevels(model) # S3 method for class 'felm' model_get_xlevels(model) # S3 method for class 'brmsfit' model_get_xlevels(model) # S3 method for class 'glmmTMB' model_get_xlevels(model) # S3 method for class 'plm' model_get_xlevels(model) # S3 method for class 'model_fit' model_get_xlevels(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_xlevels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get xlevels used in the model — model_get_xlevels","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_get_xlevels.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get xlevels used in the model — model_get_xlevels","text":"","code":"lm(hp ~ mpg + factor(cyl), mtcars) |> model_get_xlevels() #> $`factor(cyl)` #> [1] \"4\" \"6\" \"8\" #>"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_identify_variables.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify for each coefficient of a model the corresponding variable — model_identify_variables","title":"Identify for each coefficient of a model the corresponding variable — model_identify_variables","text":"also identify interaction terms intercept(s).","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_identify_variables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify for each coefficient of a model the corresponding variable — model_identify_variables","text":"","code":"model_identify_variables(model) # Default S3 method model_identify_variables(model) # S3 method for class 'lavaan' model_identify_variables(model) # S3 method for class 'aov' model_identify_variables(model) # S3 method for class 'clm' model_identify_variables(model) # S3 method for class 'clmm' model_identify_variables(model) # S3 method for class 'gam' model_identify_variables(model) # S3 method for class 'model_fit' model_identify_variables(model) # S3 method for class 'logitr' model_identify_variables(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_identify_variables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identify for each coefficient of a model the corresponding variable — model_identify_variables","text":"model (model object, e.g. glm) model object.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_identify_variables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Identify for each coefficient of a model the corresponding variable — model_identify_variables","text":"tibble four columns: term: coefficients model variable: corresponding variable var_class: class variable (cf. stats::.MFclass()) var_type: \"continuous\", \"dichotomous\" (categorical variable 2 levels), \"categorical\" (categorical variable 3 levels), \"intercept\" \"interaction\" var_nlevels: number original levels categorical variables","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_identify_variables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Identify for each coefficient of a model the corresponding variable — model_identify_variables","text":"","code":"df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) glm( Survived ~ Class + Age * Sex, data = df, weights = df$n, family = binomial ) |> model_identify_variables() #> # A tibble: 7 × 5 #> term variable var_class var_nlevels var_type #> #> 1 (Intercept) NA NA NA intercept #> 2 Class2nd Class character 4 categorical #> 3 Class3rd Class character 4 categorical #> 4 ClassCrew Class character 4 categorical #> 5 AgeChild Age character 2 dichotomous #> 6 SexMale Sex character 2 dichotomous #> 7 AgeChild:SexMale Age:Sex NA NA interaction lm( Sepal.Length ~ poly(Sepal.Width, 2) + Species, data = iris, contrasts = list(Species = contr.sum) ) |> model_identify_variables() #> # A tibble: 5 × 5 #> term variable var_class var_nlevels var_type #> #> 1 (Intercept) NA NA NA intercept #> 2 poly(Sepal.Width, 2)1 Sepal.Width nmatrix.2 NA continuous #> 3 poly(Sepal.Width, 2)2 Sepal.Width nmatrix.2 NA continuous #> 4 Species1 Species factor 3 categorical #> 5 Species2 Species factor 3 categorical"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_contrasts.html","id":null,"dir":"Reference","previous_headings":"","what":"List contrasts used by a model — model_list_contrasts","title":"List contrasts used by a model — model_list_contrasts","text":"List contrasts used model","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_contrasts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List contrasts used by a model — model_list_contrasts","text":"","code":"model_list_contrasts(model) # Default S3 method model_list_contrasts(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_contrasts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List contrasts used by a model — model_list_contrasts","text":"model (model object, e.g. glm) model object.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_contrasts.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List contrasts used by a model — model_list_contrasts","text":"tibble three columns: variable: variable name contrasts: contrasts used contrasts_type: type contrasts (\"treatment\", \"sum\", \"poly\", \"helmert\", \"sdiff, \"\" \".contrast\") reference: variables treatment, SAS sum contrasts, position reference level","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_contrasts.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"List contrasts used by a model — model_list_contrasts","text":"models intercept, contrasts applied one categorical variable. case, one dummy term returned level categorical variable.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_contrasts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List contrasts used by a model — model_list_contrasts","text":"","code":"glm( am ~ mpg + factor(cyl), data = mtcars, family = binomial, contrasts = list(`factor(cyl)` = contr.sum) ) |> model_list_contrasts() #> # A tibble: 1 × 4 #> variable contrasts reference contrasts_type #> #> 1 factor(cyl) contr.sum 3 sum"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_higher_order_variables.html","id":null,"dir":"Reference","previous_headings":"","what":"List higher order variables of a model — model_list_higher_order_variables","title":"List higher order variables of a model — model_list_higher_order_variables","text":"List higher order variables model","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_higher_order_variables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List higher order variables of a model — model_list_higher_order_variables","text":"","code":"model_list_higher_order_variables(model) # Default S3 method model_list_higher_order_variables(model)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_higher_order_variables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List higher order variables of a model — model_list_higher_order_variables","text":"model (model object, e.g. glm) model object.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_higher_order_variables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List higher order variables of a model — model_list_higher_order_variables","text":"","code":"lm(hp ~ mpg + factor(cyl) + disp:hp, mtcars) |> model_list_higher_order_variables() #> [1] \"mpg\" \"factor(cyl)\" \"hp:disp\" mod <- glm( response ~ stage * grade + trt:stage, gtsummary::trial, family = binomial ) mod |> model_list_higher_order_variables() #> [1] \"stage:grade\" \"stage:trt\" mod <- glm( Survived ~ Class * Age + Sex, data = Titanic |> as.data.frame(), weights = Freq, family = binomial ) mod |> model_list_higher_order_variables() #> [1] \"Sex\" \"Class:Age\""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_terms_levels.html","id":null,"dir":"Reference","previous_headings":"","what":"List levels of categorical terms — model_list_terms_levels","title":"List levels of categorical terms — model_list_terms_levels","text":"categorical variables treatment, SAS, sum successive differences contrasts (cf. MASS::contr.sdif()), categorical variables contrast.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_terms_levels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List levels of categorical terms — model_list_terms_levels","text":"","code":"model_list_terms_levels( model, label_pattern = \"{level}\", variable_labels = NULL, sdif_term_level = c(\"diff\", \"ratio\") ) # Default S3 method model_list_terms_levels( model, label_pattern = \"{level}\", variable_labels = NULL, sdif_term_level = c(\"diff\", \"ratio\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_terms_levels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List levels of categorical terms — model_list_terms_levels","text":"model (model object, e.g. glm) model object. label_pattern (glue pattern) glue pattern term labels (see examples). variable_labels (list string) optional named list named vector custom variable labels passed model_list_variables() sdif_term_level (string) successive differences contrasts, term levels named? \"diff\" \"B - \" (default), \"ratio\" \"B / \".","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_terms_levels.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List levels of categorical terms — model_list_terms_levels","text":"tibble ten columns: variable: variable contrasts_type: type contrasts (\"sum\" \"treatment\") term: term name level: term level level_rank: rank level reference: logical indicating term reference level reference_level: level reference term var_label: variable label obtained model_list_variables() var_nlevels: number levels variable dichotomous: logical indicating variable dichotomous label: term label (default equal term level) first nine columns can used label_pattern.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_terms_levels.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List levels of categorical terms — model_list_terms_levels","text":"","code":"glm( am ~ mpg + factor(cyl), data = mtcars, family = binomial, contrasts = list(`factor(cyl)` = contr.sum) ) |> model_list_terms_levels() #> # A tibble: 3 × 11 #> variable contrasts_type term level level_rank reference reference_level #> #> 1 factor(cyl) sum factor(… 4 1 FALSE 8 #> 2 factor(cyl) sum factor(… 6 2 FALSE 8 #> 3 factor(cyl) sum factor(… 8 3 TRUE 8 #> # ℹ 4 more variables: var_label , var_nlevels , dichotomous , #> # label df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, weights = df$n, family = binomial, contrasts = list(Age = contr.sum, Class = \"contr.helmert\") ) mod |> model_list_terms_levels() #> # A tibble: 4 × 11 #> variable contrasts_type term level level_rank reference reference_level #> #> 1 Age sum Age1 Adult 1 FALSE Child #> 2 Age sum Age2 Child 2 TRUE Child #> 3 Sex treatment SexFemale Female 1 TRUE Female #> 4 Sex treatment SexMale Male 2 FALSE Female #> # ℹ 4 more variables: var_label , var_nlevels , dichotomous , #> # label mod |> model_list_terms_levels(\"{level} vs {reference_level}\") #> # A tibble: 4 × 11 #> variable contrasts_type term level level_rank reference reference_level #> #> 1 Age sum Age1 Adult 1 FALSE Child #> 2 Age sum Age2 Child 2 TRUE Child #> 3 Sex treatment SexFemale Female 1 TRUE Female #> 4 Sex treatment SexMale Male 2 FALSE Female #> # ℹ 4 more variables: var_label , var_nlevels , dichotomous , #> # label mod |> model_list_terms_levels(\"{variable} [{level} - {reference_level}]\") #> # A tibble: 4 × 11 #> variable contrasts_type term level level_rank reference reference_level #> #> 1 Age sum Age1 Adult 1 FALSE Child #> 2 Age sum Age2 Child 2 TRUE Child #> 3 Sex treatment SexFemale Female 1 TRUE Female #> 4 Sex treatment SexMale Male 2 FALSE Female #> # ℹ 4 more variables: var_label , var_nlevels , dichotomous , #> # label mod |> model_list_terms_levels( \"{ifelse(reference, level, paste(level, '-', reference_level))}\" ) #> # A tibble: 4 × 11 #> variable contrasts_type term level level_rank reference reference_level #> #> 1 Age sum Age1 Adult 1 FALSE Child #> 2 Age sum Age2 Child 2 TRUE Child #> 3 Sex treatment SexFemale Female 1 TRUE Female #> 4 Sex treatment SexMale Male 2 FALSE Female #> # ℹ 4 more variables: var_label , var_nlevels , dichotomous , #> # label "},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_variables.html","id":null,"dir":"Reference","previous_headings":"","what":"List all the variables used in a model — model_list_variables","title":"List all the variables used in a model — model_list_variables","text":"Including variables used interaction.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_variables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"List all the variables used in a model — model_list_variables","text":"","code":"model_list_variables( model, labels = NULL, only_variable = FALSE, add_var_type = FALSE, instrumental_suffix = \" (instrumental)\" ) # Default S3 method model_list_variables( model, labels = NULL, only_variable = FALSE, add_var_type = FALSE, instrumental_suffix = \" (instrumental)\" ) # S3 method for class 'lavaan' model_list_variables( model, labels = NULL, only_variable = FALSE, add_var_type = FALSE, instrumental_suffix = \" (instrumental)\" ) # S3 method for class 'logitr' model_list_variables( model, labels = NULL, only_variable = FALSE, add_var_type = FALSE, instrumental_suffix = \" (instrumental)\" )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_variables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"List all the variables used in a model — model_list_variables","text":"model (model object, e.g. glm) model object. labels (list string) optional named list named vector custom variable labels. only_variable (logical) TRUE, return \"variable\" column. add_var_type (logical) TRUE, add var_nlevels var_type columns. instrumental_suffix (string) Suffix added variable labels instrumental variables (fixest models). NULL add nothing.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_variables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"List all the variables used in a model — model_list_variables","text":"tibble three columns: variable: corresponding variable var_class: class variable (cf. stats::.MFclass()) label_attr: variable label defined original data frame label attribute (cf. labelled::var_label()) var_label: variable label (priority, labels defined, label_attr available, otherwise variable) add_var_type = TRUE: var_type: \"continuous\", \"dichotomous\" (categorical variable 2 levels), \"categorical\" (categorical variable 3 levels), \"intercept\" \"interaction\" var_nlevels: number original levels categorical variables","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/model_list_variables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"List all the variables used in a model — model_list_variables","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"gtsummary\", boolean = TRUE)) { df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) glm( Survived ~ Class + Age:Sex, data = df, weights = df$n, family = binomial ) |> model_list_variables() lm( Sepal.Length ~ poly(Sepal.Width, 2) + Species, data = iris, contrasts = list(Species = contr.sum) ) |> model_list_variables() glm( response ~ poly(age, 3) + stage + grade * trt, na.omit(gtsummary::trial), family = binomial, ) |> model_list_variables() } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"Objects exported from other packages — reexports","title":"Objects exported from other packages — reexports","text":"objects imported packages. Follow links see documentation. dplyr all_of, any_of, contains, ends_with, everything, last_col, matches, num_range, one_of, starts_with, vars, ","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/scope_tidy.html","id":null,"dir":"Reference","previous_headings":"","what":"Scoping a tidy tibble allowing to tidy select — scope_tidy","title":"Scoping a tidy tibble allowing to tidy select — scope_tidy","text":"function uses information model tidy tibble generate data frame exposing different variables model, data frame used tidy selection. addition, columns \"var_type\", \"var_class\" \"contrasts_type\" scoped values added attributes data frame. example, var_type='continuous' variable \"age\", attribute attr(.$age, 'gtsummary.var_type') <- 'continuous' set. attribute used selector like all_continuous(). Note: attributes prefixed \"gtsummary.\" compatible selectors provided {gtsummary}.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/scope_tidy.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Scoping a tidy tibble allowing to tidy select — scope_tidy","text":"","code":"scope_tidy(x, data = NULL)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/scope_tidy.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Scoping a tidy tibble allowing to tidy select — scope_tidy","text":"x (data.frame) tidy tibble, \"variable\" column, returned tidy_identify_variables(). data (data.frame) optional data frame attributes added .","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/scope_tidy.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Scoping a tidy tibble allowing to tidy select — scope_tidy","text":"data frame.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/scope_tidy.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Scoping a tidy tibble allowing to tidy select — scope_tidy","text":"","code":"mod <- lm(Sepal.Length ~ Sepal.Width * Species, data = iris) tt <- mod |> tidy_and_attach() |> tidy_add_contrasts() scope_tidy(tt) |> str() #> tibble [1 × 4] (S3: tbl_df/tbl/data.frame) #> $ (Intercept) : logi NA #> ..- attr(*, \"gtsummary.var_type\")= chr \"intercept\" #> $ Sepal.Width : num NA #> ..- attr(*, \"gtsummary.var_type\")= chr \"continuous\" #> ..- attr(*, \"gtsummary.var_class\")= Named chr \"numeric\" #> .. ..- attr(*, \"names\")= chr \"Sepal.Width\" #> $ Species : Factor w/ 0 levels: NA #> ..- attr(*, \"gtsummary.var_type\")= chr \"categorical\" #> ..- attr(*, \"gtsummary.var_class\")= Named chr \"factor\" #> .. ..- attr(*, \"names\")= chr \"Species\" #> ..- attr(*, \"gtsummary.contrasts_type\")= chr \"treatment\" #> $ Sepal.Width:Species: logi NA #> ..- attr(*, \"gtsummary.var_type\")= chr \"interaction\" scope_tidy(tt, data = model_get_model_frame(mod)) |> str() #> 'data.frame':\t150 obs. of 3 variables: #> $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... #> $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ... #> ..- attr(*, \"gtsummary.var_type\")= chr \"continuous\" #> ..- attr(*, \"gtsummary.var_class\")= Named chr \"numeric\" #> .. ..- attr(*, \"names\")= chr \"Sepal.Width\" #> $ Species : Factor w/ 3 levels \"setosa\",\"versicolor\",..: 1 1 1 1 1 1 1 1 1 1 ... #> ..- attr(*, \"gtsummary.var_type\")= chr \"categorical\" #> ..- attr(*, \"gtsummary.var_class\")= Named chr \"factor\" #> .. ..- attr(*, \"names\")= chr \"Species\" #> ..- attr(*, \"gtsummary.contrasts_type\")= chr \"treatment\" #> - attr(*, \"terms\")=Classes 'terms', 'formula' language Sepal.Length ~ Sepal.Width * Species #> .. ..- attr(*, \"variables\")= language list(Sepal.Length, Sepal.Width, Species) #> .. ..- attr(*, \"factors\")= int [1:3, 1:3] 0 1 0 0 0 1 0 1 1 #> .. .. ..- attr(*, \"dimnames\")=List of 2 #> .. .. .. ..$ : chr [1:3] \"Sepal.Length\" \"Sepal.Width\" \"Species\" #> .. .. .. ..$ : chr [1:3] \"Sepal.Width\" \"Species\" \"Sepal.Width:Species\" #> .. ..- attr(*, \"term.labels\")= chr [1:3] \"Sepal.Width\" \"Species\" \"Sepal.Width:Species\" #> .. ..- attr(*, \"order\")= int [1:3] 1 1 2 #> .. ..- attr(*, \"intercept\")= int 1 #> .. ..- attr(*, \"response\")= int 1 #> .. ..- attr(*, \".Environment\")= #> .. ..- attr(*, \"predvars\")= language list(Sepal.Length, Sepal.Width, Species) #> .. ..- attr(*, \"dataClasses\")= Named chr [1:3] \"numeric\" \"numeric\" \"factor\" #> .. .. ..- attr(*, \"names\")= chr [1:3] \"Sepal.Length\" \"Sepal.Width\" \"Species\" scope_tidy(tt) |> dplyr::select(dplyr::starts_with(\"Se\")) |> names() #> [1] \"Sepal.Width\" \"Sepal.Width:Species\" scope_tidy(tt) |> dplyr::select(where(is.factor)) |> names() #> [1] \"Species\" scope_tidy(tt) |> dplyr::select(all_continuous()) |> names() #> [1] \"Sepal.Width\" scope_tidy(tt) |> dplyr::select(all_contrasts()) |> names() #> [1] \"Species\" scope_tidy(tt) |> dplyr::select(all_interaction()) |> names() #> [1] \"Sepal.Width:Species\" scope_tidy(tt) |> dplyr::select(all_intercepts()) |> names() #> [1] \"(Intercept)\""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/select_helpers.html","id":null,"dir":"Reference","previous_headings":"","what":"Select helper functions — select_helpers","title":"Select helper functions — select_helpers","text":"Set functions supplement tidyselect set functions selecting columns data frames (items well). all_continuous() selects continuous variables all_categorical() selects categorical (including \"dichotomous\") variables all_dichotomous() selects type \"dichotomous\" all_interaction() selects interaction terms regression model all_intercepts() selects intercept terms regression model all_contrasts() selects variables regression model based type contrast all_ran_pars() all_ran_vals() random-effect parameters values mixed model (see vignette(\"broom_mixed_intro\", package = \"broom.mixed\"))","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/select_helpers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Select helper functions — select_helpers","text":"","code":"all_continuous(continuous2 = TRUE) all_categorical(dichotomous = TRUE) all_dichotomous() all_interaction() all_ran_pars() all_ran_vals() all_intercepts() all_contrasts( contrasts_type = c(\"treatment\", \"sum\", \"poly\", \"helmert\", \"sdif\", \"other\") )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/select_helpers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Select helper functions — select_helpers","text":"continuous2 (logical) Whether include continuous2 variables, default TRUE. compatibility {gtsummary}), see gtsummary::all_continuous2(). dichotomous (logical) Whether include dichotomous variables, default TRUE. contrasts_type (string) Type contrast select. NULL, variables contrast selected. Default NULL. Select among contrast types c(\"treatment\", \"sum\", \"poly\", \"helmert\", \"sdif\", \"\").","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/select_helpers.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Select helper functions — select_helpers","text":"character vector column names selected.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/select_helpers.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Select helper functions — select_helpers","text":"","code":"if (FALSE) { # interactive() glm(response ~ age * trt + grade, gtsummary::trial, family = binomial) |> tidy_plus_plus(exponentiate = TRUE, include = all_categorical()) glm(response ~ age + trt + grade + stage, gtsummary::trial, family = binomial, contrasts = list(trt = contr.SAS, grade = contr.sum, stage = contr.poly) ) |> tidy_plus_plus( exponentiate = TRUE, include = all_contrasts(c(\"treatment\", \"sum\")) ) }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/seq_range.html","id":null,"dir":"Reference","previous_headings":"","what":"Sequence generation between min and max — seq_range","title":"Sequence generation between min and max — seq_range","text":"Sequence generation min max","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/seq_range.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sequence generation between min and max — seq_range","text":"","code":"seq_range(x, length.out = 25)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/seq_range.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sequence generation between min and max — seq_range","text":"x (numeric) numeric vector. length.(integer) Desired length sequence (positive integer).","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/seq_range.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Sequence generation between min and max — seq_range","text":"numeric vector","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/seq_range.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Sequence generation between min and max — seq_range","text":"seq_range(x, length.) shortcut seq(min(x, na.rm = TRUE), max(x, na.rm = TRUE), length.= length.)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/seq_range.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Sequence generation between min and max — seq_range","text":"","code":"seq_range(iris$Petal.Length) #> [1] 1.000000 1.245833 1.491667 1.737500 1.983333 2.229167 2.475000 2.720833 #> [9] 2.966667 3.212500 3.458333 3.704167 3.950000 4.195833 4.441667 4.687500 #> [17] 4.933333 5.179167 5.425000 5.670833 5.916667 6.162500 6.408333 6.654167 #> [25] 6.900000"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/supported_models.html","id":null,"dir":"Reference","previous_headings":"","what":"Listing of Supported Models — supported_models","title":"Listing of Supported Models — supported_models","text":"Listing Supported Models","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/supported_models.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Listing of Supported Models — supported_models","text":"","code":"supported_models"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/supported_models.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Listing of Supported Models — supported_models","text":"data frame one row per supported model model Model notes Notes","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_coefficients_type.html","id":null,"dir":"Reference","previous_headings":"","what":"Add coefficients type and label as attributes — tidy_add_coefficients_type","title":"Add coefficients type and label as attributes — tidy_add_coefficients_type","text":"Add type coefficients (\"generic\", \"logistic\", \"poisson\", \"relative_risk\" \"prop_hazard\") corresponding coefficient labels, attributes x (respectively named coefficients_type coefficients_label).","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_coefficients_type.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add coefficients type and label as attributes — tidy_add_coefficients_type","text":"","code":"tidy_add_coefficients_type( x, exponentiate = attr(x, \"exponentiate\"), model = tidy_get_model(x) )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_coefficients_type.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add coefficients type and label as attributes — tidy_add_coefficients_type","text":"x (data.frame) tidy tibble produced tidy_*() functions. exponentiate (logical) Whether exponentiate coefficient estimates. consistent original call broom::tidy(). model (model object, e.g. glm) corresponding model, attached x.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_coefficients_type.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add coefficients type and label as attributes — tidy_add_coefficients_type","text":"","code":"ex1 <- lm(hp ~ mpg + factor(cyl), mtcars) |> tidy_and_attach() |> tidy_add_coefficients_type() attr(ex1, \"coefficients_type\") #> [1] \"generic\" attr(ex1, \"coefficients_label\") #> [1] \"Beta\" df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) ex2 <- glm( Survived ~ Class + Age * Sex, data = df, weights = df$n, family = binomial ) |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_coefficients_type() attr(ex2, \"coefficients_type\") #> [1] \"logistic\" attr(ex2, \"coefficients_label\") #> [1] \"OR\""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_contrasts.html","id":null,"dir":"Reference","previous_headings":"","what":"Add contrasts type for categorical variables — tidy_add_contrasts","title":"Add contrasts type for categorical variables — tidy_add_contrasts","text":"Add contrasts column corresponding contrasts used categorical variable contrasts_type column equal \"treatment\", \"sum\", \"poly\", \"helmert\", \"\" \".contrast\".","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_contrasts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add contrasts type for categorical variables — tidy_add_contrasts","text":"","code":"tidy_add_contrasts(x, model = tidy_get_model(x), quiet = FALSE)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_contrasts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add contrasts type for categorical variables — tidy_add_contrasts","text":"x (data.frame) tidy tibble produced tidy_*() functions. model (model object, e.g. glm) corresponding model, attached x. quiet (logical) Whether broom.helpers return message tidy_disambiguate_terms() already applied","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_contrasts.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add contrasts type for categorical variables — tidy_add_contrasts","text":"variable column yet available x, tidy_identify_variables() automatically applied.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_contrasts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add contrasts type for categorical variables — tidy_add_contrasts","text":"","code":"df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) glm( Survived ~ Class + Age + Sex, data = df, weights = df$n, family = binomial, contrasts = list(Age = contr.sum, Class = \"contr.helmert\") ) |> tidy_and_attach() |> tidy_add_contrasts() #> # A tibble: 6 × 13 #> term variable var_class var_type var_nlevels contrasts contrasts_type #> #> 1 (Intercept) (Intercep… NA interce… NA NA NA #> 2 Class1 Class character categor… 4 contr.he… helmert #> 3 Class2 Class character categor… 4 contr.he… helmert #> 4 Class3 Class character categor… 4 contr.he… helmert #> 5 Age1 Age character dichoto… 2 contr.sum sum #> 6 SexMale Sex character dichoto… 2 contr.tr… treatment #> # ℹ 6 more variables: estimate , std.error , statistic , #> # p.value , conf.low , conf.high "},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_estimate_to_reference_rows.html","id":null,"dir":"Reference","previous_headings":"","what":"Add an estimate value to references rows for categorical variables — tidy_add_estimate_to_reference_rows","title":"Add an estimate value to references rows for categorical variables — tidy_add_estimate_to_reference_rows","text":"categorical variables treatment contrast (stats::contr.treatment()) SAS contrast (stats::contr.SAS()), add estimate equal 0 (1 exponentiate = TRUE) reference row.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_estimate_to_reference_rows.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add an estimate value to references rows for categorical variables — tidy_add_estimate_to_reference_rows","text":"","code":"tidy_add_estimate_to_reference_rows( x, exponentiate = attr(x, \"exponentiate\"), conf.level = attr(x, \"conf.level\"), model = tidy_get_model(x), quiet = FALSE )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_estimate_to_reference_rows.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add an estimate value to references rows for categorical variables — tidy_add_estimate_to_reference_rows","text":"x (data.frame) tidy tibble produced tidy_*() functions. exponentiate (logical) Whether exponentiate coefficient estimates. consistent original call broom::tidy() conf.level (numeric) Confidence level, default use value indicated previously tidy_and_attach(), used sum contrasts. model (model object, e.g. glm) corresponding model, attached x. quiet (logical) Whether broom.helpers return message requested output generated. Default FALSE.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_estimate_to_reference_rows.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add an estimate value to references rows for categorical variables — tidy_add_estimate_to_reference_rows","text":"categorical variables sum contrast (stats::contr.sum()), estimate value reference row equal sum coefficients multiplied -1 (eventually exponentiated exponentiate = TRUE), obtained emmeans::emmeans(). emmeans package therefore installed. sum contrasts, model coefficient corresponds difference level grand mean. sum contrasts, confidence intervals p-values also computed added reference rows. variables, change made. reference_row column yet available x, tidy_add_reference_rows() automatically applied.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_estimate_to_reference_rows.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add an estimate value to references rows for categorical variables — tidy_add_estimate_to_reference_rows","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"gtsummary\", boolean = TRUE) && .assert_package(\"emmeans\", boolean = TRUE)) { df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(dplyr::across(where(is.character), factor)) glm( Survived ~ Class + Age + Sex, data = df, weights = df$n, family = binomial, contrasts = list(Age = contr.sum, Class = \"contr.SAS\") ) |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_reference_rows() |> tidy_add_estimate_to_reference_rows() glm( response ~ stage + grade * trt, gtsummary::trial, family = binomial, contrasts = list( stage = contr.treatment(4, base = 3), grade = contr.treatment(3, base = 2), trt = contr.treatment(2, base = 2) ) ) |> tidy_and_attach() |> tidy_add_reference_rows() |> tidy_add_estimate_to_reference_rows() } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_header_rows.html","id":null,"dir":"Reference","previous_headings":"","what":"Add header rows variables with several terms — tidy_add_header_rows","title":"Add header rows variables with several terms — tidy_add_header_rows","text":"variables several terms (usually categorical variables also case continuous variables polynomial terms splines), tidy_add_header_rows() add additional row per variable, label equal var_label. additional rows identified header_row column.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_header_rows.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add header rows variables with several terms — tidy_add_header_rows","text":"","code":"tidy_add_header_rows( x, show_single_row = NULL, model = tidy_get_model(x), quiet = FALSE, strict = FALSE )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_header_rows.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add header rows variables with several terms — tidy_add_header_rows","text":"x (data.frame) tidy tibble produced tidy_*() functions. show_single_row (tidy-select) Names dichotomous variables displayed single row. See also all_dichotomous(). model (model object, e.g. glm) corresponding model, attached x. quiet (logical) Whether broom.helpers return message requested output generated. Default FALSE. strict (logical) Whether broom.helpers return error requested output generated. Default FALSE.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_header_rows.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add header rows variables with several terms — tidy_add_header_rows","text":"show_single_row argument allows specify list dichotomous variables displayed single row instead two rows. added header_row column equal : TRUE header row; FALSE normal row variable header row; NA variables without header row. label column yet available x, tidy_add_term_labels() automatically applied.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_header_rows.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add header rows variables with several terms — tidy_add_header_rows","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"gtsummary\", boolean = TRUE)) { df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) res <- glm( Survived ~ Class + Age + Sex, data = df, weights = df$n, family = binomial, contrasts = list(Age = contr.sum, Class = \"contr.SAS\") ) |> tidy_and_attach() |> tidy_add_variable_labels(labels = list(Class = \"Custom label for Class\")) |> tidy_add_reference_rows() res |> tidy_add_header_rows() res |> tidy_add_header_rows(show_single_row = all_dichotomous()) glm( response ~ stage + grade * trt, gtsummary::trial, family = binomial, contrasts = list( stage = contr.treatment(4, base = 3), grade = contr.treatment(3, base = 2), trt = contr.treatment(2, base = 2) ) ) |> tidy_and_attach() |> tidy_add_reference_rows() |> tidy_add_header_rows() } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_n.html","id":null,"dir":"Reference","previous_headings":"","what":"Add the (weighted) number of observations — tidy_add_n","title":"Add the (weighted) number of observations — tidy_add_n","text":"Add number observations new column n_obs, taking account weights defined.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_n.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add the (weighted) number of observations — tidy_add_n","text":"","code":"tidy_add_n(x, model = tidy_get_model(x))"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_n.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add the (weighted) number of observations — tidy_add_n","text":"x (data.frame) tidy tibble produced tidy_*() functions. model (model object, e.g. glm) corresponding model, attached x.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_n.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add the (weighted) number of observations — tidy_add_n","text":"continuous variables, corresponds valid observations contributing model. categorical variables coded treatment sum contrasts, model term associated one level original categorical variable. Therefore, n_obs correspond number observations associated level. n_obs also computed reference rows. polynomial contrasts (defined stats::contr.poly()), levels contribute computation model term. Therefore, n_obs equal total number observations. Helmert custom contrasts, rows contributing positively (.e. positive contrast) computation term considered estimating n_obs. result therefore difficult interpret. better understanding observations taken account compute n_obs values, look model_compute_terms_contributions(). interaction terms, rows contributing terms interaction considered compute n_obs. binomial logistic models, tidy_add_n() also return corresponding number events (n_event) term, taking account defined weights. Observed proportions obtained n_obs / n_event. Similarly, number events computed multinomial logistic models (nnet::multinom()) level outcome (y.level), corresponding number observations equal outcome level. Poisson models, n_event equal number counts per term. addition, third column exposure computed. offset defined, exposure assumed equal 1 (eventually multiplied weights) per observation. offset defined, exposure equal (weighted) sum exponential offset (reminder, model effect x ratio y / z, Poisson model defined glm(y ~ x + offset(log(z)), family = poisson)). Observed rates obtained n_event / exposure. Cox models (survival::coxph()), individual coded several observations (several rows). n_obs correspond weighted number observations different number individuals n_ind. tidy_add_n() also compute (weighted) number events (n_event) according definition survival::Surv() object. Exposure time also returned exposure column. equal (weighted) sum time variable one variable time passed survival::Surv(), (weighted) sum time2 - time two time variables defined survival::Surv(). competing risk regression models (tidycmprsk::crr()), n_event takes account event interest defined failcode. (weighted) total number observations (N_obs), individuals (N_ind), events (N_event) exposure time (Exposure) stored attributes returned tibble.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_n.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add the (weighted) number of observations — tidy_add_n","text":"","code":"if (FALSE) { # interactive() lm(Petal.Length ~ ., data = iris) |> tidy_and_attach() |> tidy_add_n() lm(Petal.Length ~ ., data = iris, contrasts = list(Species = contr.sum)) |> tidy_and_attach() |> tidy_add_n() lm(Petal.Length ~ ., data = iris, contrasts = list(Species = contr.poly)) |> tidy_and_attach() |> tidy_add_n() lm(Petal.Length ~ poly(Sepal.Length, 2), data = iris) |> tidy_and_attach() |> tidy_add_n() df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) glm( Survived ~ Class + Age + Sex, data = df, weights = df$n, family = binomial, contrasts = list(Age = contr.sum, Class = \"contr.helmert\") ) |> tidy_and_attach() |> tidy_add_n() glm( Survived ~ Class * (Age:Sex), data = df, weights = df$n, family = binomial, contrasts = list(Age = contr.sum, Class = \"contr.helmert\") ) |> tidy_and_attach() |> tidy_add_n() glm(response ~ age + grade * trt, gtsummary::trial, family = poisson) |> tidy_and_attach() |> tidy_add_n() glm( response ~ trt * grade + offset(log(ttdeath)), gtsummary::trial, family = poisson ) |> tidy_and_attach() |> tidy_add_n() }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_pairwise_contrasts.html","id":null,"dir":"Reference","previous_headings":"","what":"Add pairwise contrasts for categorical variables — tidy_add_pairwise_contrasts","title":"Add pairwise contrasts for categorical variables — tidy_add_pairwise_contrasts","text":"Computes pairwise contrasts emmeans::emmeans() add results tibble. Works models supported emmeans, see vignette(\"models\", package = \"emmeans\").","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_pairwise_contrasts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add pairwise contrasts for categorical variables — tidy_add_pairwise_contrasts","text":"","code":"tidy_add_pairwise_contrasts( x, variables = all_categorical(), keep_model_terms = FALSE, pairwise_reverse = TRUE, contrasts_adjust = NULL, conf.level = attr(x, \"conf.level\"), emmeans_args = list(), model = tidy_get_model(x), quiet = FALSE )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_pairwise_contrasts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add pairwise contrasts for categorical variables — tidy_add_pairwise_contrasts","text":"x (data.frame) tidy tibble produced tidy_*() functions. variables include (tidy-select) Variables pairwise contrasts added. Default all_categorical(). keep_model_terms (logical) Keep terms model? pairwise_reverse (logical) Determines whether use \"pairwise\" (TRUE) \"revpairwise\" (FALSE), see emmeans::contrast(). contrasts_adjust (string) Optional adjustment method computing contrasts, see emmeans::contrast() (NULL, use emmeans default). conf.level (numeric) Confidence level, default use value indicated previously tidy_and_attach(). emmeans_args (list) List additional parameter pass emmeans::emmeans() computing pairwise contrasts. model (model object, e.g. glm) corresponding model, attached x. quiet (logical) Whether broom.helpers return message requested output generated. Default FALSE.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_pairwise_contrasts.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Add pairwise contrasts for categorical variables — tidy_add_pairwise_contrasts","text":"contrasts column yet available x, tidy_add_contrasts() automatically applied. multi-components models, zero-inflated Poisson beta regression, support pairwise contrasts still experimental.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_pairwise_contrasts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add pairwise contrasts for categorical variables — tidy_add_pairwise_contrasts","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"emmeans\", boolean = TRUE)) { mod1 <- lm(Sepal.Length ~ Species, data = iris) mod1 |> tidy_and_attach() |> tidy_add_pairwise_contrasts() mod1 |> tidy_and_attach() |> tidy_add_pairwise_contrasts(pairwise_reverse = FALSE) mod1 |> tidy_and_attach() |> tidy_add_pairwise_contrasts(keep_model_terms = TRUE) mod1 |> tidy_and_attach() |> tidy_add_pairwise_contrasts(contrasts_adjust = \"none\") if (.assert_package(\"gtsummary\", boolean = TRUE)) { mod2 <- glm( response ~ age + trt + grade, data = gtsummary::trial, family = binomial ) mod2 |> tidy_and_attach(exponentiate = TRUE) |> tidy_add_pairwise_contrasts() } } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_reference_rows.html","id":null,"dir":"Reference","previous_headings":"","what":"Add references rows for categorical variables — tidy_add_reference_rows","title":"Add references rows for categorical variables — tidy_add_reference_rows","text":"categorical variables treatment contrast (stats::contr.treatment()), SAS contrast (stats::contr.SAS()) sum contrast (stats::contr.sum()), successive differences contrast (MASS::contr.sdif()) add reference row.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_reference_rows.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add references rows for categorical variables — tidy_add_reference_rows","text":"","code":"tidy_add_reference_rows( x, no_reference_row = NULL, model = tidy_get_model(x), quiet = FALSE )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_reference_rows.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add references rows for categorical variables — tidy_add_reference_rows","text":"x (data.frame) tidy tibble produced tidy_*() functions. no_reference_row (tidy-select) Variables reference row added. See also all_categorical() all_dichotomous(). model (model object, e.g. glm) corresponding model, attached x. quiet (logical) Whether broom.helpers return message requested output generated. Default FALSE.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_reference_rows.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add references rows for categorical variables — tidy_add_reference_rows","text":"added reference_row column equal : TRUE reference row; FALSE normal row variable reference row; NA variables without reference row. contrasts column yet available x, tidy_add_contrasts() automatically applied. tidy_add_reference_rows() populate label reference term. therefore better apply tidy_add_term_labels() tidy_add_reference_rows() rather . Similarly, better apply tidy_add_reference_rows() tidy_add_n().","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_reference_rows.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add references rows for categorical variables — tidy_add_reference_rows","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"gtsummary\", boolean = TRUE)) { df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) res <- glm( Survived ~ Class + Age + Sex, data = df, weights = df$n, family = binomial, contrasts = list(Age = contr.sum, Class = \"contr.SAS\") ) |> tidy_and_attach() res |> tidy_add_reference_rows() res |> tidy_add_reference_rows(no_reference_row = all_dichotomous()) res |> tidy_add_reference_rows(no_reference_row = \"Class\") glm( response ~ stage + grade * trt, gtsummary::trial, family = binomial, contrasts = list( stage = contr.treatment(4, base = 3), grade = contr.treatment(3, base = 2), trt = contr.treatment(2, base = 2) ) ) |> tidy_and_attach() |> tidy_add_reference_rows() } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_term_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"Add term labels — tidy_add_term_labels","title":"Add term labels — tidy_add_term_labels","text":"add term labels label column, based : labels provided labels argument provided; factor levels categorical variables coded treatment, SAS sum contrasts (label customized categorical_terms_pattern argument); variable labels one term per variable; term name otherwise.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_term_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add term labels — tidy_add_term_labels","text":"","code":"tidy_add_term_labels( x, labels = NULL, interaction_sep = \" * \", categorical_terms_pattern = \"{level}\", model = tidy_get_model(x), quiet = FALSE, strict = FALSE )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_term_labels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add term labels — tidy_add_term_labels","text":"x (data.frame) tidy tibble produced tidy_*() functions. labels (list string) optional named list named vector custom term labels. interaction_sep (string) Separator interaction terms. categorical_terms_pattern (glue pattern) glue pattern labels categorical terms treatment sum contrasts (see examples model_list_terms_levels()). model (model object, e.g. glm) corresponding model, attached x. quiet (logical) Whether broom.helpers return message requested output generated. Default FALSE. strict (logical) Whether broom.helpers return error requested output generated. Default FALSE.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_term_labels.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add term labels — tidy_add_term_labels","text":"variable_label column yet available x, tidy_add_variable_labels() automatically applied. contrasts column yet available x, tidy_add_contrasts() automatically applied. possible pass custom label term labels, including interaction terms.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_term_labels.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add term labels — tidy_add_term_labels","text":"","code":"if (FALSE) { # interactive() df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) |> labelled::set_variable_labels( Class = \"Passenger's class\", Sex = \"Sex\" ) mod <- glm(Survived ~ Class * Age * Sex, data = df, weights = df$n, family = binomial) mod |> tidy_and_attach() |> tidy_add_term_labels() mod |> tidy_and_attach() |> tidy_add_term_labels( interaction_sep = \" x \", categorical_terms_pattern = \"{level} / {reference_level}\" ) }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_variable_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"Add variable labels — tidy_add_variable_labels","title":"Add variable labels — tidy_add_variable_labels","text":"add variable labels var_label column, based : labels provided labels argument provided; variable labels defined original data frame label attribute (cf. labelled::var_label()); variable name otherwise.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_variable_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add variable labels — tidy_add_variable_labels","text":"","code":"tidy_add_variable_labels( x, labels = NULL, interaction_sep = \" * \", instrumental_suffix = \" (instrumental)\", model = tidy_get_model(x) )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_variable_labels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add variable labels — tidy_add_variable_labels","text":"x (data.frame) tidy tibble produced tidy_*() functions. labels (formula-list-selector) optional named list named vector custom variable labels. interaction_sep (string) Separator interaction terms. instrumental_suffix (string) Suffix added variable labels instrumental variables (fixest models). NULL add nothing. model (model object, e.g. glm) corresponding model, attached x.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_variable_labels.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add variable labels — tidy_add_variable_labels","text":"variable column yet available x, tidy_identify_variables() automatically applied. possible pass custom label interaction term labels (see examples).","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_add_variable_labels.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add variable labels — tidy_add_variable_labels","text":"","code":"df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) |> labelled::set_variable_labels( Class = \"Passenger's class\", Sex = \"Sex\" ) glm(Survived ~ Class * Age * Sex, data = df, weights = df$n, family = binomial) |> tidy_and_attach() |> tidy_add_variable_labels( labels = list( \"(Intercept)\" ~ \"Custom intercept\", Sex ~ \"Gender\", \"Class:Age\" ~ \"Custom label\" ) ) #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: glm.fit: algorithm did not converge #> Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred #> Warning: collapsing to unique 'x' values #> # A tibble: 16 × 12 #> term variable var_label var_class var_type var_nlevels estimate std.error #> #> 1 (Interc… (Interc… Custom i… NA interce… NA 3.56 0.507 #> 2 Class2nd Class Passenge… character categor… 4 -1.74 0.589 #> 3 Class3rd Class Passenge… character categor… 4 -3.71 0.531 #> 4 ClassCr… Class Passenge… character categor… 4 -1.66 0.800 #> 5 AgeChild Age Age character dichoto… 2 11.0 883. #> 6 SexMale Sex Gender character dichoto… 2 -4.28 0.532 #> 7 Class2n… Class:A… Custom l… NA interac… NA 3.53 1066. #> 8 Class3r… Class:A… Custom l… NA interac… NA -11.0 883. #> 9 ClassCr… Class:A… Custom l… NA interac… NA NA NA #> 10 Class2n… Class:S… Passenge… NA interac… NA 0.0680 0.671 #> 11 Class3r… Class:S… Passenge… NA interac… NA 2.80 0.569 #> 12 ClassCr… Class:S… Passenge… NA interac… NA 1.14 0.820 #> 13 AgeChil… Age:Sex Age * Ge… NA interac… NA 5.25 1091. #> 14 Class2n… Class:A… Passenge… NA interac… NA -1.19 1383. #> 15 Class3r… Class:A… Passenge… NA interac… NA -4.57 1091. #> 16 ClassCr… Class:A… Passenge… NA interac… NA NA NA #> # ℹ 4 more variables: statistic , p.value , conf.low , #> # conf.high "},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_all_effects.html","id":null,"dir":"Reference","previous_headings":"","what":"Marginal Predictions at the mean with effects::allEffects() — tidy_all_effects","title":"Marginal Predictions at the mean with effects::allEffects() — tidy_all_effects","text":"Use effects::allEffects() estimate marginal predictions return tibble tidied way used broom.helpers functions. See vignette(\"functions-supported--effects\", package = \"effects\") list supported models.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_all_effects.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Marginal Predictions at the mean with effects::allEffects() — tidy_all_effects","text":"","code":"tidy_all_effects(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_all_effects.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Marginal Predictions at the mean with effects::allEffects() — tidy_all_effects","text":"x (model object, e.g. glm) model tidied. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed effects::allEffects().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_all_effects.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Marginal Predictions at the mean with effects::allEffects() — tidy_all_effects","text":"default, effects::allEffects() estimate marginal predictions mean observed means continuous variables weighting modalities categorical variables according observed distribution original dataset. Marginal predictions therefore computed sort averaged situation / typical values variables fixed model. information, see vignette(\"marginal_tidiers\", \"broom.helpers\").","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_all_effects.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Marginal Predictions at the mean with effects::allEffects() — tidy_all_effects","text":"model contains interactions, effects::allEffects() return marginal predictions different levels interactions.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_all_effects.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Marginal Predictions at the mean with effects::allEffects() — tidy_all_effects","text":"","code":"if (FALSE) { # interactive() df <- Titanic |> dplyr::as_tibble() |> tidyr::uncount(n) |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, family = binomial ) tidy_all_effects(mod) tidy_plus_plus(mod, tidy_fun = tidy_all_effects) }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_attach_model.html","id":null,"dir":"Reference","previous_headings":"","what":"Attach a full model to the tibble of model terms — tidy_attach_model","title":"Attach a full model to the tibble of model terms — tidy_attach_model","text":"facilitate use broom helpers pipe, recommended attach original model attribute tibble model terms generated broom::tidy().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_attach_model.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Attach a full model to the tibble of model terms — tidy_attach_model","text":"","code":"tidy_attach_model(x, model, .attributes = NULL) tidy_and_attach( model, tidy_fun = tidy_with_broom_or_parameters, conf.int = TRUE, conf.level = 0.95, exponentiate = FALSE, model_matrix_attr = TRUE, ... ) tidy_get_model(x) tidy_detach_model(x)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_attach_model.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Attach a full model to the tibble of model terms — tidy_attach_model","text":"x (data.frame) tidy tibble produced tidy_*() functions. model (model object, e.g. glm) model attached/tidied. .attributes (list) Named list additional attributes attached x. tidy_fun (function) Option specify custom tidier function. conf.int (logical) confidence intervals computed? (see broom::tidy()) conf.level (numeric) Level confidence confidence intervals (default: 95%). exponentiate (logical) Whether exponentiate coefficient estimates. typical logistic, Poisson Cox models, bad idea log logit link; defaults FALSE. model_matrix_attr (logical) Whether model frame model matrix added attributes model (respectively named \"model_frame\" \"model_matrix\") passed ... arguments passed tidy_fun().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_attach_model.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Attach a full model to the tibble of model terms — tidy_attach_model","text":"tidy_attach_model() attach model tibble already generated tidy_and_attach() apply broom::tidy() attach model. Use tidy_get_model() get model attached tibble tidy_detach_model() remove attribute containing model.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_attach_model.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Attach a full model to the tibble of model terms — tidy_attach_model","text":"","code":"mod <- lm(Sepal.Length ~ Sepal.Width + Species, data = iris) tt <- mod |> tidy_and_attach(conf.int = TRUE) tt #> # A tibble: 4 × 7 #> term estimate std.error statistic p.value conf.low conf.high #> #> 1 (Intercept) 2.25 0.370 6.09 9.57e- 9 1.52 2.98 #> 2 Sepal.Width 0.804 0.106 7.56 4.19e-12 0.593 1.01 #> 3 Speciesversicolor 1.46 0.112 13.0 3.48e-26 1.24 1.68 #> 4 Speciesvirginica 1.95 0.100 19.5 2.09e-42 1.75 2.14 tidy_get_model(tt) #> #> Call: #> lm(formula = Sepal.Length ~ Sepal.Width + Species, data = iris) #> #> Coefficients: #> (Intercept) Sepal.Width Speciesversicolor Speciesvirginica #> 2.2514 0.8036 1.4587 1.9468 #>"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_comparisons.html","id":null,"dir":"Reference","previous_headings":"","what":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_avg_comparisons","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_avg_comparisons","text":"Use marginaleffects::avg_comparisons() estimate marginal contrasts return tibble tidied way used broom.helpers functions. See marginaleffects::avg_comparisons() list supported models.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_comparisons.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_avg_comparisons","text":"","code":"tidy_avg_comparisons(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_comparisons.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_avg_comparisons","text":"x (model object, e.g. glm) model tidied. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed marginaleffects::avg_comparisons().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_comparisons.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_avg_comparisons","text":"default, marginaleffects::avg_comparisons() estimate average marginal contrasts: contrast computed observed value original dataset (counterfactual approach) averaged. Marginal Contrasts Mean computed specifying newdata = \"mean\". variables argument can used select contrasts computed. Please refer documentation page marginaleffects::avg_comparisons(). See also tidy_marginal_contrasts() taking account interactions. information, see vignette(\"marginal_tidiers\", \"broom.helpers\").","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_comparisons.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_avg_comparisons","text":"","code":"if (FALSE) { # interactive() # Average Marginal Contrasts df <- Titanic |> dplyr::as_tibble() |> tidyr::uncount(n) |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, family = binomial ) tidy_avg_comparisons(mod) tidy_plus_plus(mod, tidy_fun = tidy_avg_comparisons) mod2 <- lm(Petal.Length ~ poly(Petal.Width, 2) + Species, data = iris) tidy_avg_comparisons(mod2) # Custumizing the type of contrasts tidy_avg_comparisons( mod2, variables = list(Petal.Width = 2, Species = \"pairwise\") ) # Marginal Contrasts at the Mean tidy_avg_comparisons(mod, newdata = \"mean\") tidy_plus_plus(mod, tidy_fun = tidy_avg_comparisons, newdata = \"mean\") }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_slopes.html","id":null,"dir":"Reference","previous_headings":"","what":"Marginal Slopes / Effects with marginaleffects::avg_slopes() — tidy_avg_slopes","title":"Marginal Slopes / Effects with marginaleffects::avg_slopes() — tidy_avg_slopes","text":"Use marginaleffects::avg_slopes() estimate marginal slopes / effects return tibble tidied way used broom.helpers functions. See marginaleffects::avg_slopes() list supported models.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_slopes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Marginal Slopes / Effects with marginaleffects::avg_slopes() — tidy_avg_slopes","text":"","code":"tidy_avg_slopes(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_slopes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Marginal Slopes / Effects with marginaleffects::avg_slopes() — tidy_avg_slopes","text":"x (model object, e.g. glm) model tidied. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed marginaleffects::avg_slopes().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_slopes.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Marginal Slopes / Effects with marginaleffects::avg_slopes() — tidy_avg_slopes","text":"default, marginaleffects::avg_slopes() estimate average marginal effects (AME): effect computed observed value original dataset averaged. Marginal Effects Mean (MEM) computed specifying newdata = \"mean\". types marginal effects computed. Please refer documentation page marginaleffects::avg_slopes(). information, see vignette(\"marginal_tidiers\", \"broom.helpers\").","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_avg_slopes.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Marginal Slopes / Effects with marginaleffects::avg_slopes() — tidy_avg_slopes","text":"","code":"if (FALSE) { # interactive() # Average Marginal Effects (AME) df <- Titanic |> dplyr::as_tibble() |> tidyr::uncount(n) |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, family = binomial ) tidy_avg_slopes(mod) tidy_plus_plus(mod, tidy_fun = tidy_avg_slopes) mod2 <- lm(Petal.Length ~ poly(Petal.Width, 2) + Species, data = iris) tidy_avg_slopes(mod2) # Marginal Effects at the Mean (MEM) tidy_avg_slopes(mod, newdata = \"mean\") tidy_plus_plus(mod, tidy_fun = tidy_avg_slopes, newdata = \"mean\") }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_broom.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy with broom::tidy() and checks that all arguments are used — tidy_broom","title":"Tidy with broom::tidy() and checks that all arguments are used — tidy_broom","text":"Tidy broom::tidy() checks arguments used","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_broom.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy with broom::tidy() and checks that all arguments are used — tidy_broom","text":"","code":"tidy_broom(x, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_broom.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy with broom::tidy() and checks that all arguments are used — tidy_broom","text":"x (model object, e.g. glm) model tidied. ... Additional parameters passed broom::tidy().","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_disambiguate_terms.html","id":null,"dir":"Reference","previous_headings":"","what":"Disambiguate terms — tidy_disambiguate_terms","title":"Disambiguate terms — tidy_disambiguate_terms","text":"mixed models, term column returned broom.mixed may duplicated values random-effect parameters random-effect values. case, terms disambiguated prefixing value group column. tidy_disambiguate_terms() change term group column x. original term value kept new column original_term.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_disambiguate_terms.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Disambiguate terms — tidy_disambiguate_terms","text":"","code":"tidy_disambiguate_terms(x, sep = \".\", model = tidy_get_model(x), quiet = FALSE)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_disambiguate_terms.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Disambiguate terms — tidy_disambiguate_terms","text":"x (data.frame) tidy tibble produced tidy_*() functions. sep (string) Separator added group name term. model (model object, e.g. glm) corresponding model, attached x. quiet (logical) Whether broom.helpers return message requested output generated. Default FALSE.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_disambiguate_terms.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Disambiguate terms — tidy_disambiguate_terms","text":"","code":"if (FALSE) { # interactive() if ( .assert_package(\"lme4\", boolean = TRUE) && .assert_package(\"broom.mixed\", boolean = TRUE) && .assert_package(\"gtsummary\", boolean = TRUE) ) { mod <- lme4::lmer(marker ~ stage + (1 | grade) + (death | response), gtsummary::trial) mod |> tidy_and_attach() |> tidy_disambiguate_terms() } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_ggpredict.html","id":null,"dir":"Reference","previous_headings":"","what":"Marginal Predictions with ggeffects::ggpredict() — tidy_ggpredict","title":"Marginal Predictions with ggeffects::ggpredict() — tidy_ggpredict","text":"Use ggeffects::ggpredict() estimate marginal predictions return tibble tidied way used broom.helpers functions. See https://strengejacke.github.io/ggeffects/ list supported models.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_ggpredict.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Marginal Predictions with ggeffects::ggpredict() — tidy_ggpredict","text":"","code":"tidy_ggpredict(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_ggpredict.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Marginal Predictions with ggeffects::ggpredict() — tidy_ggpredict","text":"x (model object, e.g. glm) model tidied. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed ggeffects::ggpredict().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_ggpredict.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Marginal Predictions with ggeffects::ggpredict() — tidy_ggpredict","text":"default, ggeffects::ggpredict() estimate marginal predictions observed mean continuous variables first modality categorical variables (regardless type contrasts used model). information, see vignette(\"marginal_tidiers\", \"broom.helpers\").","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_ggpredict.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Marginal Predictions with ggeffects::ggpredict() — tidy_ggpredict","text":"default, ggeffects::ggpredict() estimates marginal predictions individual variable, regardless eventual interactions.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_ggpredict.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Marginal Predictions with ggeffects::ggpredict() — tidy_ggpredict","text":"","code":"if (FALSE) { # interactive() df <- Titanic |> dplyr::as_tibble() |> tidyr::uncount(n) |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, family = binomial ) tidy_ggpredict(mod) tidy_plus_plus(mod, tidy_fun = tidy_ggpredict) }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_identify_variables.html","id":null,"dir":"Reference","previous_headings":"","what":"Identify the variable corresponding to each model coefficient — tidy_identify_variables","title":"Identify the variable corresponding to each model coefficient — tidy_identify_variables","text":"tidy_identify_variables() add tidy tibble three additional columns: variable, var_class, var_type var_nlevels.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_identify_variables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Identify the variable corresponding to each model coefficient — tidy_identify_variables","text":"","code":"tidy_identify_variables(x, model = tidy_get_model(x), quiet = FALSE)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_identify_variables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Identify the variable corresponding to each model coefficient — tidy_identify_variables","text":"x (data.frame) tidy tibble produced tidy_*() functions. model (model object, e.g. glm) corresponding model, attached x. quiet (logical) Whether broom.helpers return message requested output generated. Default FALSE.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_identify_variables.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Identify the variable corresponding to each model coefficient — tidy_identify_variables","text":"also identify interaction terms intercept(s). var_type : \"continuous\", \"dichotomous\" (categorical variable 2 levels), \"categorical\" (categorical variable 3 levels ), \"intercept\" \"interaction\" \"ran_pars (random-effect parameters mixed models) \"ran_vals\" (random-effect values mixed models) \"unknown\" rare cases tidy_identify_variables() fail identify list variables dichotomous categorical variables, var_nlevels corresponds number original levels corresponding variables. fixest models, new column instrumental added indicate instrumental variables.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_identify_variables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Identify the variable corresponding to each model coefficient — tidy_identify_variables","text":"","code":"df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) glm( Survived ~ Class + Age * Sex, data = df, weights = df$n, family = binomial ) |> tidy_and_attach() |> tidy_identify_variables() #> # A tibble: 7 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 Class2nd Class character categor… 4 -1.03 0.200 -5.17 #> 3 Class3rd Class character categor… 4 -1.81 0.176 -10.3 #> 4 ClassCrew Class character categor… 4 -0.803 0.160 -5.03 #> 5 AgeChild Age character dichoto… 2 -0.110 0.335 -0.328 #> 6 SexMale Sex character dichoto… 2 -2.62 0.151 -17.3 #> 7 AgeChild… Age:Sex NA interac… NA 1.90 0.433 4.39 #> # ℹ 3 more variables: p.value , conf.low , conf.high lm( Sepal.Length ~ poly(Sepal.Width, 2) + Species, data = iris, contrasts = list(Species = contr.sum) ) |> tidy_and_attach(conf.int = TRUE) |> tidy_identify_variables() #> # A tibble: 5 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 5.84 0.0359 163. #> 2 poly(Sep… Sepal.W… nmatrix.2 continu… NA 4.27 0.568 7.52 #> 3 poly(Sep… Sepal.W… nmatrix.2 continu… NA -0.0720 0.447 -0.161 #> 4 Species1 Species factor categor… 3 -1.13 0.0647 -17.5 #> 5 Species2 Species factor categor… 3 0.324 0.0593 5.46 #> # ℹ 3 more variables: p.value , conf.low , conf.high "},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_contrasts.html","id":null,"dir":"Reference","previous_headings":"","what":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_marginal_contrasts","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_marginal_contrasts","text":"Use marginaleffects::avg_comparisons() estimate marginal contrasts variable model return tibble tidied way used broom.helpers functions. See marginaleffects::avg_comparisons() list supported models.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_contrasts.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_marginal_contrasts","text":"","code":"tidy_marginal_contrasts( x, variables_list = \"auto\", conf.int = TRUE, conf.level = 0.95, ... ) variables_to_contrast( model, interactions = TRUE, cross = FALSE, var_categorical = \"reference\", var_continuous = 1, by_categorical = unique, by_continuous = stats::fivenum )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_contrasts.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_marginal_contrasts","text":"x (model object, e.g. glm) model tidied. variables_list (list string) list whose elements sequentially passed variables marginaleffects::avg_comparisons() (see details ); alternatively, also string \"auto\" (default), \"cross\" \"no_interaction\" conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed marginaleffects::avg_comparisons(). model (model object, e.g. glm) model. interactions (logical) combinations variables corresponding interactions returned? cross (logical) interaction TRUE, \"cross-contrasts\" computed? (FALSE, last term interaction passed variable terms passed ) var_categorical (predictor values) Default variable value categorical variables. var_continuous (predictor values) Default variable value continuous variables. by_categorical (predictor values) Default value categorical variables. by_continuous (predictor values) Default value continuous variables.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_contrasts.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_marginal_contrasts","text":"Marginal contrasts obtained calling, variable combination variables, marginaleffects::avg_comparisons(). tidy_marginal_contrasts() compute marginal contrasts variable combination variables, stacking results unique tibble. tidy_marginal_contrasts() variables_list argument consisting list specifications passed sequentially variables argument marginaleffects::avg_comparisons(). Considering single categorical variable named cat, tidy_marginal_contrasts() call avg_comparisons(model, variables = list(cat = \"reference\")) obtain average marginal contrasts variable. Considering single continuous variable named cont, tidy_marginalcontrasts() call avg_comparisons(model, variables = list(cont = 1)) obtain average marginal contrasts increase one unit. combination variables, several possibilities. compute \"cross-contrasts\" providing simultaneously several variables variables specifying cross = TRUE marginaleffects::avg_comparisons(). Alternatively, compute contrasts first variable specified variables different values second variable specified . helper function variables_to_contrast() used automatically generate suitable list used variables_list. combination variables list two named elements: \"variables\" list named elements passed variables \"\" list named elements used creating relevant datagrid whose names passed . variables_list's default value, \"auto\", calls variables_to_contrast(interactions = TRUE, cross = FALSE) \"no_interaction\" shortcut variables_to_contrast(interactions = FALSE). \"cross\" calls variables_to_contrast(interactions = TRUE, cross = TRUE) can also provide custom specifications (see examples). default, average marginal contrasts computed: contrasts computed using counterfactual grid value variable interest, averaging results. Marginal contrasts mean obtained indicating newdata = \"mean\". assumptions possible, see help file marginaleffects::avg_comparisons(). information, see vignette(\"marginal_tidiers\", \"broom.helpers\").","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_contrasts.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Marginal Contrasts with marginaleffects::avg_comparisons() — tidy_marginal_contrasts","text":"","code":"if (FALSE) { # interactive() # Average Marginal Contrasts df <- Titanic |> dplyr::as_tibble() |> tidyr::uncount(n) |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, family = binomial ) tidy_marginal_contrasts(mod) tidy_plus_plus(mod, tidy_fun = tidy_marginal_contrasts) mod2 <- lm(Petal.Length ~ poly(Petal.Width, 2) + Species, data = iris) tidy_marginal_contrasts(mod2) tidy_marginal_contrasts( mod2, variables_list = variables_to_predict( mod2, continuous = 3, categorical = \"pairwise\" ) ) # Model with interactions mod3 <- glm( Survived ~ Sex * Age + Class, data = df, family = binomial ) tidy_marginal_contrasts(mod3) tidy_marginal_contrasts(mod3, \"no_interaction\") tidy_marginal_contrasts(mod3, \"cross\") tidy_marginal_contrasts( mod3, variables_list = list( list(variables = list(Class = \"pairwise\"), by = list(Sex = unique)), list(variables = list(Age = \"all\")), list(variables = list(Class = \"sequential\", Sex = \"reference\")) ) ) mod4 <- lm(Sepal.Length ~ Petal.Length * Petal.Width + Species, data = iris) tidy_marginal_contrasts(mod4) tidy_marginal_contrasts( mod4, variables_list = list( list( variables = list(Species = \"sequential\"), by = list(Petal.Length = c(2, 5)) ), list( variables = list(Petal.Length = 2), by = list(Species = unique, Petal.Width = 2:4) ) ) ) # Marginal Contrasts at the Mean tidy_marginal_contrasts(mod, newdata = \"mean\") tidy_marginal_contrasts(mod3, newdata = \"mean\") }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_means.html","id":null,"dir":"Reference","previous_headings":"","what":"Marginal Means with marginaleffects::marginal_means() — tidy_marginal_means","title":"Marginal Means with marginaleffects::marginal_means() — tidy_marginal_means","text":"function deprecated. Use instead tidy_marginal_predictions() option newdata = \"marginalmeans\".","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_means.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Marginal Means with marginaleffects::marginal_means() — tidy_marginal_means","text":"","code":"tidy_marginal_means(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_means.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Marginal Means with marginaleffects::marginal_means() — tidy_marginal_means","text":"x (model object, e.g. glm) model tidied. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed marginaleffects::marginal_means().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_means.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Marginal Means with marginaleffects::marginal_means() — tidy_marginal_means","text":"Use marginaleffects::marginal_means() estimate marginal means return tibble tidied way used broom.helpers functions. See marginaleffects::marginal_means()() list supported models. marginaleffects::marginal_means() estimate marginal means: adjusted predictions, averaged across grid categorical predictors, holding numeric predictors means. Please refer documentation page marginaleffects::marginal_means(). Marginal means defined categorical variables. information, see vignette(\"marginal_tidiers\", \"broom.helpers\").","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_means.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Marginal Means with marginaleffects::marginal_means() — tidy_marginal_means","text":"","code":"if (FALSE) { # interactive() # Average Marginal Means df <- Titanic |> dplyr::as_tibble() |> tidyr::uncount(n) |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, family = binomial ) tidy_marginal_means(mod) tidy_plus_plus(mod, tidy_fun = tidy_marginal_means) mod2 <- lm(Petal.Length ~ poly(Petal.Width, 2) + Species, data = iris) tidy_marginal_means(mod2) }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_predictions.html","id":null,"dir":"Reference","previous_headings":"","what":"Marginal Predictions with marginaleffects::avg_predictions() — tidy_marginal_predictions","title":"Marginal Predictions with marginaleffects::avg_predictions() — tidy_marginal_predictions","text":"Use marginaleffects::avg_predictions() estimate marginal predictions variable model return tibble tidied way used broom.helpers functions. See marginaleffects::avg_predictions() list supported models.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_predictions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Marginal Predictions with marginaleffects::avg_predictions() — tidy_marginal_predictions","text":"","code":"tidy_marginal_predictions( x, variables_list = \"auto\", conf.int = TRUE, conf.level = 0.95, ... ) variables_to_predict( model, interactions = TRUE, categorical = unique, continuous = stats::fivenum ) plot_marginal_predictions(x, variables_list = \"auto\", conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_predictions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Marginal Predictions with marginaleffects::avg_predictions() — tidy_marginal_predictions","text":"x (model object, e.g. glm) model tidied. variables_list (list string) list whose elements sequentially passed variables marginaleffects::avg_predictions() (see details ); alternatively, also string \"auto\" (default) \"no_interaction\". conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed marginaleffects::avg_predictions(). model (model object, e.g. glm) model. interactions (logical) combinations variables corresponding interactions returned? categorical (predictor values) Default values categorical variables. continuous (predictor values) Default values continuous variables.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_predictions.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Marginal Predictions with marginaleffects::avg_predictions() — tidy_marginal_predictions","text":"Marginal predictions obtained calling, variable, marginaleffects::avg_predictions() variable used variables argument. Considering categorical variable named cat, tidy_marginal_predictions() call avg_predictions(model, variables = list(cat = unique), = \"cat\") obtain average marginal predictions variable. Considering continuous variable named cont, tidy_marginal_predictions() call avg_predictions(model, variables = list(cont = \"fivenum\"), = \"cont\") obtain average marginal predictions variable minimum, first quartile, median, third quartile maximum observed values cont. default, average marginal predictions computed: predictions made using counterfactual grid value variable interest, averaging results. Marginal predictions mean obtained indicating newdata = \"mean\". assumptions possible, see help file marginaleffects::avg_predictions(). tidy_marginal_predictions() compute marginal predictions variable combination variables, stacking results unique tibble. tidy_marginal_predictions() variables_list argument consisting list specifications passed sequentially variables argument marginaleffects::avg_predictions(). helper function variables_to_predict() used automatically generate suitable list used variables_list. default, unique values retained categorical variables fivenum (.e. Tukey's five numbers, minimum, quartiles maximum) continuous variables. interactions = FALSE, variables_to_predict() return list individual variables used model. interactions = FALSE, search higher order combinations variables (see model_list_higher_order_variables()). variables_list's default value, \"auto\", calls variables_to_predict(interactions = TRUE) \"no_interaction\" shortcut variables_to_predict(interactions = FALSE). can also provide custom specifications (see examples). plot_marginal_predictions() works similar way returns list plots combined patchwork::wrap_plots() (see examples). information, see vignette(\"marginal_tidiers\", \"broom.helpers\").","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_marginal_predictions.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Marginal Predictions with marginaleffects::avg_predictions() — tidy_marginal_predictions","text":"","code":"if (FALSE) { # interactive() # Average Marginal Predictions df <- Titanic |> dplyr::as_tibble() |> tidyr::uncount(n) |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, family = binomial ) tidy_marginal_predictions(mod) tidy_plus_plus(mod, tidy_fun = tidy_marginal_predictions) if (require(\"patchwork\")) { plot_marginal_predictions(mod) |> patchwork::wrap_plots() plot_marginal_predictions(mod) |> patchwork::wrap_plots() & ggplot2::scale_y_continuous(limits = c(0, 1), label = scales::percent) } mod2 <- lm(Petal.Length ~ poly(Petal.Width, 2) + Species, data = iris) tidy_marginal_predictions(mod2) if (require(\"patchwork\")) { plot_marginal_predictions(mod2) |> patchwork::wrap_plots() } tidy_marginal_predictions( mod2, variables_list = variables_to_predict(mod2, continuous = \"threenum\") ) tidy_marginal_predictions( mod2, variables_list = list( list(Petal.Width = c(0, 1, 2, 3)), list(Species = unique) ) ) tidy_marginal_predictions( mod2, variables_list = list(list(Species = unique, Petal.Width = 1:3)) ) # Model with interactions mod3 <- glm( Survived ~ Sex * Age + Class, data = df, family = binomial ) tidy_marginal_predictions(mod3) tidy_marginal_predictions(mod3, \"no_interaction\") if (require(\"patchwork\")) { plot_marginal_predictions(mod3) |> patchwork::wrap_plots() plot_marginal_predictions(mod3, \"no_interaction\") |> patchwork::wrap_plots() } tidy_marginal_predictions( mod3, variables_list = list( list(Class = unique, Sex = \"Female\"), list(Age = unique) ) ) # Marginal Predictions at the Mean tidy_marginal_predictions(mod, newdata = \"mean\") if (require(\"patchwork\")) { plot_marginal_predictions(mod, newdata = \"mean\") |> patchwork::wrap_plots() } }"},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_margins.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Average Marginal Effects with margins::margins() — tidy_margins","text":"","code":"tidy_margins(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_margins.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Average Marginal Effects with margins::margins() — tidy_margins","text":"x (model object, e.g. glm) model tidied. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed margins::margins().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_margins.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Average Marginal Effects with margins::margins() — tidy_margins","text":"margins package longer active development may removed CRAN sooner later. advised use marginaleffects package instead, offering functionalities. look article dedicated marginal estimates broom.helpers. tidy_avg_slopes() used alternative. Use margins::margins() estimate average marginal effects (AME) return tibble tidied way used broom.helpers functions. See margins::margins() list supported models. default, margins::margins() estimate average marginal effects (AME): effect computed observed value original dataset averaged. information, see vignette(\"marginal_tidiers\", \"broom.helpers\").","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_margins.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Average Marginal Effects with margins::margins() — tidy_margins","text":"applying margins::margins(), custom contrasts ignored. Treatment contrasts (stats::contr.treatment()) applied categorical variables. Interactions also ignored.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_margins.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Average Marginal Effects with margins::margins() — tidy_margins","text":"","code":"if (FALSE) { # interactive() df <- Titanic |> dplyr::as_tibble() |> tidyr::uncount(n) |> dplyr::mutate(Survived = factor(Survived, c(\"No\", \"Yes\"))) mod <- glm( Survived ~ Class + Age + Sex, data = df, family = binomial ) tidy_margins(mod) tidy_plus_plus(mod, tidy_fun = tidy_margins) }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_multgee.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy a multgee model — tidy_multgee","title":"Tidy a multgee model — tidy_multgee","text":"tidier models generated multgee::nomLORgee() multgee::ordLORgee(). Term names updated consistent generic models. original term names preserved \"original_term\" column.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_multgee.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy a multgee model — tidy_multgee","text":"","code":"tidy_multgee(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_multgee.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy a multgee model — tidy_multgee","text":"x (LORgee) multgee::nomLORgee() multgee::ordLORgee() model. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed parameters::model_parameters().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_multgee.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Tidy a multgee model — tidy_multgee","text":"noted, multgee::nomLORgee(), baseline y category latest modality y.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_multgee.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tidy a multgee model — tidy_multgee","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"multgee\", boolean = TRUE)) { library(multgee) h <- housing h$status <- factor( h$y, labels = c(\"street\", \"community\", \"independant\") ) mod <- multgee::nomLORgee( status ~ factor(time) * sec, data = h, id = id, repeated = time, ) mod |> tidy_multgee() mod2 <- ordLORgee( formula = y ~ factor(time) + factor(trt) + factor(baseline), data = multgee::arthritis, id = id, repeated = time, LORstr = \"uniform\" ) mod2 |> tidy_multgee() } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_parameters.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy a model with parameters package — tidy_parameters","title":"Tidy a model with parameters package — tidy_parameters","text":"Use parameters::model_parameters() tidy model apply parameters::standardize_names(style = \"broom\") output","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_parameters.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy a model with parameters package — tidy_parameters","text":"","code":"tidy_parameters(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_parameters.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy a model with parameters package — tidy_parameters","text":"x (model object, e.g. glm) model tidied. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed parameters::model_parameters().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_parameters.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Tidy a model with parameters package — tidy_parameters","text":"betareg::betareg(), component column results standardized broom::tidy(), using \"mean\" \"precision\" values.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_parameters.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tidy a model with parameters package — tidy_parameters","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"parameters\", boolean = TRUE)) { lm(Sepal.Length ~ Sepal.Width + Species, data = iris) |> tidy_parameters() } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_plus_plus.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy a model and compute additional informations — tidy_plus_plus","title":"Tidy a model and compute additional informations — tidy_plus_plus","text":"function apply sequentially: tidy_and_attach() tidy_disambiguate_terms() tidy_identify_variables() tidy_add_contrasts() tidy_add_reference_rows() tidy_add_pairwise_contrasts() tidy_add_estimate_to_reference_rows() tidy_add_variable_labels() tidy_add_term_labels() tidy_add_header_rows() tidy_add_n() tidy_remove_intercept() tidy_select_variables() tidy_add_coefficients_type() tidy_detach_model()","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_plus_plus.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy a model and compute additional informations — tidy_plus_plus","text":"","code":"tidy_plus_plus( model, tidy_fun = tidy_with_broom_or_parameters, conf.int = TRUE, conf.level = 0.95, exponentiate = FALSE, model_matrix_attr = TRUE, variable_labels = NULL, instrumental_suffix = \" (instrumental)\", term_labels = NULL, interaction_sep = \" * \", categorical_terms_pattern = \"{level}\", disambiguate_terms = TRUE, disambiguate_sep = \".\", add_reference_rows = TRUE, no_reference_row = NULL, add_pairwise_contrasts = FALSE, pairwise_variables = all_categorical(), keep_model_terms = FALSE, pairwise_reverse = TRUE, contrasts_adjust = NULL, emmeans_args = list(), add_estimate_to_reference_rows = TRUE, add_header_rows = FALSE, show_single_row = NULL, add_n = TRUE, intercept = FALSE, include = everything(), keep_model = FALSE, tidy_post_fun = NULL, quiet = FALSE, strict = FALSE, ... )"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_plus_plus.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy a model and compute additional informations — tidy_plus_plus","text":"model (model object, e.g. glm) model attached/tidied. tidy_fun (function) Option specify custom tidier function. conf.int (logical) confidence intervals computed? (see broom::tidy()) conf.level (numeric) Level confidence confidence intervals (default: 95%). exponentiate (logical) Whether exponentiate coefficient estimates. typical logistic, Poisson Cox models, bad idea log logit link; defaults FALSE. model_matrix_attr (logical) Whether model frame model matrix added attributes model (respectively named \"model_frame\" \"model_matrix\") passed . variable_labels (formula-list-selector) named list named vector custom variable labels. instrumental_suffix (string) Suffix added variable labels instrumental variables (fixest models). NULL add nothing. term_labels (list vector) named list named vector custom term labels. interaction_sep (string) Separator interaction terms. categorical_terms_pattern (glue pattern) glue pattern labels categorical terms treatment sum contrasts (see model_list_terms_levels()). disambiguate_terms (logical) terms disambiguated tidy_disambiguate_terms()? (default TRUE) disambiguate_sep (string) Separator tidy_disambiguate_terms(). add_reference_rows (logical) reference rows added? no_reference_row (tidy-select) Variables reference row added, add_reference_rows = TRUE. add_pairwise_contrasts (logical) Apply tidy_add_pairwise_contrasts()? pairwise_variables (tidy-select) Variables add pairwise contrasts. keep_model_terms (logical) Keep original model terms variables pairwise contrasts added? (default FALSE) pairwise_reverse (logical) Determines whether use \"pairwise\" (TRUE) \"revpairwise\" (FALSE), see emmeans::contrast(). contrasts_adjust (string) Optional adjustment method computing contrasts, see emmeans::contrast() (NULL, use emmeans default). emmeans_args (list) List additional parameter pass emmeans::emmeans() computing pairwise contrasts. add_estimate_to_reference_rows (logical) estimate value added reference rows? add_header_rows (logical) header rows added? show_single_row (tidy-select) Variables displayed single row, add_header_rows TRUE. add_n (logical) number observations added? intercept (logical) intercept(s) included? include (tidy-select) Variables include. Default everything(). See also all_continuous(), all_categorical(), all_dichotomous() all_interaction(). keep_model (logical) model kept attribute final result? tidy_post_fun (function) Custom function applied results end tidy_plus_plus() (see note) quiet (logical) Whether broom.helpers return message requested output generated. Default FALSE. strict (logical) Whether broom.helpers return error requested output generated. Default FALSE. ... arguments passed tidy_fun()","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_plus_plus.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Tidy a model and compute additional informations — tidy_plus_plus","text":"tidy_post_fun applied result end tidy_plus_plus() receive one argument (result tidy_plus_plus()). However, needed, model still attached tibble attribute, even keep_model = FALSE. Therefore, possible use tidy_get_model() within tidy_fun , reason, need access source model.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_plus_plus.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tidy a model and compute additional informations — tidy_plus_plus","text":"","code":"if (FALSE) { # interactive() ex1 <- lm(Sepal.Length ~ Sepal.Width + Species, data = iris) |> tidy_plus_plus() ex1 df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate( Survived = factor(Survived, c(\"No\", \"Yes\")) ) |> labelled::set_variable_labels( Class = \"Passenger's class\", Sex = \"Gender\" ) ex2 <- glm( Survived ~ Class + Age * Sex, data = df, weights = df$n, family = binomial ) |> tidy_plus_plus( exponentiate = TRUE, add_reference_rows = FALSE, categorical_terms_pattern = \"{level} / {reference_level}\", add_n = TRUE ) ex2 if (.assert_package(\"gtsummary\", boolean = TRUE)) { ex3 <- glm( response ~ poly(age, 3) + stage + grade * trt, na.omit(gtsummary::trial), family = binomial, contrasts = list( stage = contr.treatment(4, base = 3), grade = contr.sum ) ) |> tidy_plus_plus( exponentiate = TRUE, variable_labels = c(age = \"Age (in years)\"), add_header_rows = TRUE, show_single_row = all_dichotomous(), term_labels = c(\"poly(age, 3)3\" = \"Cubic age\"), keep_model = TRUE ) ex3 } }"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_remove_intercept.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove intercept(s) — tidy_remove_intercept","title":"Remove intercept(s) — tidy_remove_intercept","text":"remove terms var_type == \"intercept\".","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_remove_intercept.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove intercept(s) — tidy_remove_intercept","text":"","code":"tidy_remove_intercept(x, model = tidy_get_model(x))"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_remove_intercept.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove intercept(s) — tidy_remove_intercept","text":"x (data.frame) tidy tibble produced tidy_*() functions. model (model object, e.g. glm) corresponding model, attached x.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_remove_intercept.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Remove intercept(s) — tidy_remove_intercept","text":"variable column yet available x, tidy_identify_variables() automatically applied.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_remove_intercept.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove intercept(s) — tidy_remove_intercept","text":"","code":"df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived)) glm(Survived ~ Class + Age + Sex, data = df, weights = df$n, family = binomial) |> tidy_and_attach() |> tidy_remove_intercept() #> # A tibble: 5 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 Class2nd Class character categor… 4 -1.02 0.196 -5.19 #> 2 Class3rd Class character categor… 4 -1.78 0.172 -10.4 #> 3 ClassCrew Class character categor… 4 -0.858 0.157 -5.45 #> 4 AgeChild Age character dichoto… 2 1.06 0.244 4.35 #> 5 SexMale Sex character dichoto… 2 -2.42 0.140 -17.2 #> # ℹ 3 more variables: p.value , conf.low , conf.high "},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_select_variables.html","id":null,"dir":"Reference","previous_headings":"","what":"Select variables to keep/drop — tidy_select_variables","title":"Select variables to keep/drop — tidy_select_variables","text":"remove unselected variables results. remove intercept, use tidy_remove_intercept().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_select_variables.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Select variables to keep/drop — tidy_select_variables","text":"","code":"tidy_select_variables(x, include = everything(), model = tidy_get_model(x))"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_select_variables.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Select variables to keep/drop — tidy_select_variables","text":"x (data.frame) tidy tibble produced tidy_*() functions. include (tidy-select) Variables include. Default everything(). See also all_continuous(), all_categorical(), all_dichotomous() all_interaction(). model (model object, e.g. glm) corresponding model, attached x.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_select_variables.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Select variables to keep/drop — tidy_select_variables","text":"x tibble limited included variables (eventually intercept), sorted according include parameter.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_select_variables.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Select variables to keep/drop — tidy_select_variables","text":"variable column yet available x, tidy_identify_variables() automatically applied.","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_select_variables.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Select variables to keep/drop — tidy_select_variables","text":"","code":"df <- Titanic |> dplyr::as_tibble() |> dplyr::mutate(Survived = factor(Survived)) res <- glm(Survived ~ Class + Age * Sex, data = df, weights = df$n, family = binomial) |> tidy_and_attach() |> tidy_identify_variables() res #> # A tibble: 7 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 Class2nd Class character categor… 4 -1.03 0.200 -5.17 #> 3 Class3rd Class character categor… 4 -1.81 0.176 -10.3 #> 4 ClassCrew Class character categor… 4 -0.803 0.160 -5.03 #> 5 AgeChild Age character dichoto… 2 -0.110 0.335 -0.328 #> 6 SexMale Sex character dichoto… 2 -2.62 0.151 -17.3 #> 7 AgeChild… Age:Sex NA interac… NA 1.90 0.433 4.39 #> # ℹ 3 more variables: p.value , conf.low , conf.high res |> tidy_select_variables() #> # A tibble: 7 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 Class2nd Class character categor… 4 -1.03 0.200 -5.17 #> 3 Class3rd Class character categor… 4 -1.81 0.176 -10.3 #> 4 ClassCrew Class character categor… 4 -0.803 0.160 -5.03 #> 5 AgeChild Age character dichoto… 2 -0.110 0.335 -0.328 #> 6 SexMale Sex character dichoto… 2 -2.62 0.151 -17.3 #> 7 AgeChild… Age:Sex NA interac… NA 1.90 0.433 4.39 #> # ℹ 3 more variables: p.value , conf.low , conf.high res |> tidy_select_variables(include = \"Class\") #> # A tibble: 4 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 Class2nd Class character categor… 4 -1.03 0.200 -5.17 #> 3 Class3rd Class character categor… 4 -1.81 0.176 -10.3 #> 4 ClassCrew Class character categor… 4 -0.803 0.160 -5.03 #> # ℹ 3 more variables: p.value , conf.low , conf.high res |> tidy_select_variables(include = -c(\"Age\", \"Sex\")) #> # A tibble: 5 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 Class2nd Class character categor… 4 -1.03 0.200 -5.17 #> 3 Class3rd Class character categor… 4 -1.81 0.176 -10.3 #> 4 ClassCrew Class character categor… 4 -0.803 0.160 -5.03 #> 5 AgeChild… Age:Sex NA interac… NA 1.90 0.433 4.39 #> # ℹ 3 more variables: p.value , conf.low , conf.high res |> tidy_select_variables(include = starts_with(\"A\")) #> # A tibble: 3 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 AgeChild Age character dichoto… 2 -0.110 0.335 -0.328 #> 3 AgeChild… Age:Sex NA interac… NA 1.90 0.433 4.39 #> # ℹ 3 more variables: p.value , conf.low , conf.high res |> tidy_select_variables(include = all_categorical()) #> # A tibble: 6 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 Class2nd Class character categor… 4 -1.03 0.200 -5.17 #> 3 Class3rd Class character categor… 4 -1.81 0.176 -10.3 #> 4 ClassCrew Class character categor… 4 -0.803 0.160 -5.03 #> 5 AgeChild Age character dichoto… 2 -0.110 0.335 -0.328 #> 6 SexMale Sex character dichoto… 2 -2.62 0.151 -17.3 #> # ℹ 3 more variables: p.value , conf.low , conf.high res |> tidy_select_variables(include = all_dichotomous()) #> # A tibble: 3 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 AgeChild Age character dichoto… 2 -0.110 0.335 -0.328 #> 3 SexMale Sex character dichoto… 2 -2.62 0.151 -17.3 #> # ℹ 3 more variables: p.value , conf.low , conf.high res |> tidy_select_variables(include = all_interaction()) #> # A tibble: 2 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 AgeChild… Age:Sex NA interac… NA 1.90 0.433 4.39 #> # ℹ 3 more variables: p.value , conf.low , conf.high res |> tidy_select_variables( include = c(\"Age\", all_categorical(dichotomous = FALSE), all_interaction()) ) #> # A tibble: 6 × 11 #> term variable var_class var_type var_nlevels estimate std.error statistic #> #> 1 (Interce… (Interc… NA interce… NA 2.18 0.176 12.4 #> 2 AgeChild Age character dichoto… 2 -0.110 0.335 -0.328 #> 3 Class2nd Class character categor… 4 -1.03 0.200 -5.17 #> 4 Class3rd Class character categor… 4 -1.81 0.176 -10.3 #> 5 ClassCrew Class character categor… 4 -0.803 0.160 -5.03 #> 6 AgeChild… Age:Sex NA interac… NA 1.90 0.433 4.39 #> # ℹ 3 more variables: p.value , conf.low , conf.high "},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_with_broom_or_parameters.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy a model with broom or parameters — tidy_with_broom_or_parameters","title":"Tidy a model with broom or parameters — tidy_with_broom_or_parameters","text":"Try tidy model broom::tidy(). fails, try tidy model using parameters::model_parameters() tidy_parameters().","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_with_broom_or_parameters.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy a model with broom or parameters — tidy_with_broom_or_parameters","text":"","code":"tidy_with_broom_or_parameters(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_with_broom_or_parameters.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy a model with broom or parameters — tidy_with_broom_or_parameters","text":"x (model object, e.g. glm) model tidied. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). ... Additional parameters passed broom::tidy() parameters::model_parameters().","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_zeroinfl.html","id":null,"dir":"Reference","previous_headings":"","what":"Tidy a zeroinfl or a hurdle model — tidy_zeroinfl","title":"Tidy a zeroinfl or a hurdle model — tidy_zeroinfl","text":"tidier models generated pscl::zeroinfl() pscl::hurdle(). Term names updated consistent generic models. original term names preserved \"original_term\" column.","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_zeroinfl.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tidy a zeroinfl or a hurdle model — tidy_zeroinfl","text":"","code":"tidy_zeroinfl(x, conf.int = TRUE, conf.level = 0.95, component = NULL, ...)"},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_zeroinfl.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tidy a zeroinfl or a hurdle model — tidy_zeroinfl","text":"x (zeroinfl hurdle) pscl::zeroinfl() pscl::hurdle() model. conf.int (logical) Whether include confidence interval tidied output. conf.level (numeric) confidence level use confidence interval (0 ans 1). component (string)NULL one \"\", \"conditional\", \"zi\", \"zero_inflated\". ... Additional parameters passed parameters::model_parameters().","code":""},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/reference/tidy_zeroinfl.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Tidy a zeroinfl or a hurdle model — tidy_zeroinfl","text":"","code":"if (FALSE) { # interactive() if (.assert_package(\"pscl\", boolean = TRUE)) { library(pscl) mod <- zeroinfl( art ~ fem + mar + phd, data = pscl::bioChemists ) mod |> tidy_zeroinfl(exponentiate = TRUE) } }"},{"path":[]},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1180","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.18.0","title":"broom.helpers 1.18.0","text":"CRAN release: 2025-01-07 New supported models support glmtoolbox::glmgee() models (#274) New features support instrumental variables fixest models (#279) new argument instrumental_suffix model_list_variables(), tidy_add_variable_labels() tidy_plus_plus() Fixes variable labels now returned model_list_variables() svycoxph models (#275) compatibility R version 4.1 minimum (#276) fix tidy_add_n() models subset argument (#278)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1170","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.17.0","title":"broom.helpers 1.17.0","text":"CRAN release: 2024-08-28 Deprecated functions changes selectors functions selectors all_categorical() now compatible gtsummary version ≥ 2.0.0 (#270) new function scope_tidy() scope tidy tibble allowing tidy select (#270) .select_to_varnames(), .formula_list_to_named_list(), .generic_selector() .is_selector_scoped() now deprecated removed future release: may consider cards::process_selectors() cards::process_formula_selectors() alternatives (#270) Fixes model_get_model_frame.coxph() fixed return correct model frame subject identifier passed survival::coxph() (#268) Documentation Documentation improved, showing now clearly type expected argument (#272)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1160","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.16.0","title":"broom.helpers 1.16.0","text":"CRAN release: 2024-08-20 New features new argument model_matrix_attr tidy_and_attach() tidy_plus_plus() attach model frame model matrix model attributes saving execution time (#254) tidy_add_n() now returns n_ind number individuals, addition number observations (#251) default, tidy_parameters() calls now parameters::model_parameters() pretty_names = FALSE saving execution time (#259) internal code now uses native R pipe (|>), requiring therefore R >= 4.2 (#262) Deprecated support biglmm::bigglm() supported anymore biglmm removed CRAN Deprecated functions tidy_marginal_means() now deprecated, following deprecation marginaleffects::marginal_means(). Use instead tidy_marginal_predictions() option newdata = \"marginalmeans\". tidy_margins() now indicated superseded may deprecated margins removed CRAN. tidy_avg_slopes() used alternative. (#252) Fixes tidy_multgee() fixed properly identify different y.levels (#260 @jackmwolf) tidy_marginal_predictions() updated avoid use deprecated function marginaleffects::datagridcf() (#256)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1150","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.15.0","title":"broom.helpers 1.15.0","text":"CRAN release: 2024-04-05 New supported models support mmrm::mmrm() models (#228) support survival::cch() models (#242) New features new tidy_post_fun argument tidy_plus_plus() (#235) Fix fix order levels categorical variables results tidy_marginal_predictions() (#245) fix supported_models bug fix using tidy_parameters() mixed models (#238) bug fix survey::svyglm() models replicate weights (#240)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1140","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.14.0","title":"broom.helpers 1.14.0","text":"CRAN release: 2023-08-07 New features support MASS::contr.sdif() contrasts (#230) support pscl::zeroinfl() pscl::hurdle() models (#232) support betareg::betareg() models (#234) Fix input packageVersion() character string (#225)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1130","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.13.0","title":"broom.helpers 1.13.0","text":"CRAN release: 2023-03-28 New features tidy_add_estimate_to_reference_rows() now also populate p-values confidence intervals sum contrasts (#220) Marginal tidiers now compatible nnet::multinom(), MASS::polr(), ordinal::clm() ordinal::clmm() models, long type models supported corresponding package, example, margins currently support nnet::multinom() models (#215) Improvements Marginal predictions vignette updated follow changes marginaleffects version 0.10.0 (#216)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1120","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.12.0","title":"broom.helpers 1.12.0","text":"CRAN release: 2023-02-09 New features dedicated article presenting concepts different functions added package documentation website Several tidiers provided tidy results way used broom.helpers functions. Marginal Predictions: tidy_marginal_predictions(), plot_marginal_predictions(), tidy_all_effects(), tidy_ggpredict() Marginal Means: tidy_marginal_means() Marginal Contrasts: tidy_avg_comparisons() tidy_marginal_contrasts() Marginal Effects: tidy_avg_slopes() tidy_margins() New method model_list_higher_order_variables() list highest order combinations variables (#202) New method model_get_response_variable() get name response variable (#202) New helper function seq_range() generate sequence values minimum maximum vector (#202) New argument contrasts_adjust tidy_plus_plus(), tidy_add_pairwise_contrasts() model_get_pairwise_contrasts() allowing change adjustment method used compute pairwise contrasts (#204)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1110","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.11.0","title":"broom.helpers 1.11.0","text":"CRAN release: 2023-01-06 New features New functions tidy_add_pairwise_contrasts() model_get_pairwise_contrasts() compute pairwise contrasts categorical variables emmeans, corresponding new arguments tidy_plus_plus() (#192) New tidier tidy_margins() display Average Marginal Effects (#195) New tidier tidy_all_effects() display Marginal Predictions (#195) New tidier tidy_ggpredict() display Conditional Predictions (#195) Bug fixes improvements Better messages exponentiate argument appropriate (#197)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-1100","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.10.0","title":"broom.helpers 1.10.0","text":"CRAN release: 2022-11-30 New features tidy_select_variables() now sorts variables according include (#183) New supported models Support logitr::logitr() models (#179) Experimental support multgee::nomLORgee() multgee::ordLORgee() models (#185) Bug fixes improvements Improvement .get_package_dependencies() efficient. now looks single package description file (#178) New function .get_all_packages_dependencies() list dependencies packages (#178) Bug fix .get_min_version_required() (#181)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-190","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.9.0","title":"broom.helpers 1.9.0","text":"CRAN release: 2022-09-23 New features New function .get_package_dependencies() listing dependencies, including minimum version required, package. (#171) Improvement .assert_package() now taking account comparison operator (> >=) minimum version required (#171) Bug fixes improvements Compatibility upcoming tidyselect v1.2.0 (#173) Avoid unwanted warning mgcv::gam() models (#175)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-180","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.8.0","title":"broom.helpers 1.8.0","text":"CRAN release: 2022-07-05 New supported models Support parsnip::model_fit objects (#161) Support biglm::bigglm() biglmm::bigglm() models (#155) Support fixest::feglm(), fixest::femlm(), fixest::feols() fixest::feNmlm() (requires R>=4.1) (#167) New features Support dplyr::vars() (also exported {gtsummary}) selector now deprecated. Users warned support vars() eventually removed package (#154) .is_selector_scoped(), internal function used generating custom selector functions, now exported (#163)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-170","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.7.0","title":"broom.helpers 1.7.0","text":"CRAN release: 2022-04-22 New features .assert_package() now uses rlang::check_installed() rlang::is_installed() check whether needed packages installed. rlang::check_installed() prompts user install needed package run interactively. (#147) tidy_add_n() model_get_n() support tidycmprsk::crr() models (#143) Listing supported models now available supported_models tibble (#145) Bug fixes Avoiding duplicating rows applying tidy_add_n() mgcv::gam() model smooth terms (#150)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-160","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.6.0","title":"broom.helpers 1.6.0","text":"CRAN release: 2022-01-12 New supported models Support plm::plm() models (#140) New features .formula_list_to_named_list() now respects select_single= argument inputs types. Previously, named lists ignored. Added new argument .formula_list_to_named_list(null_allowed=) argument works conjunction type_check= asserting class/type RHS formula (value named list) (#137) Better error message .formula_list_to_named_list() (#136) Two additional select helpers all_ran_pars() all_ran_vals() Bug fixes Fix .formula_list_to_named_list(type_check=) checks RHS formula value named list. (#138)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-150","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.5.0","title":"broom.helpers 1.5.0","text":"CRAN release: 2021-12-07 New features New method model_get_coefficients_type.tidycrr() (#128) Updated error messaging using broom.helpers::tidy_parameters() include package prefix. message sometimes appears running gtsummary::tbl_regression() users may aware tidy_paramters() function lives. (#129) .formula_list_to_named_list() improvement: now possible add type check (#132) New functions .assert_package() .get_min_version_required() check package’s installation status whether installed version meets minimum required version DESCRIPTION file (#134) Bug fixes Bug fix identifying levels logical variable (#125) Bug fix nnet::multinom() models binary outcome (#130)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-140","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.4.0","title":"broom.helpers 1.4.0","text":"CRAN release: 2021-09-30 New supported models Support glmmTMB::glmmTMB() models (#119) New features passed list may now combination named lists lists formulas, e.g. list(trt ~ 1, all_continuous() ~ 2). shortcut ~ may now used indicate everything() ~ Bug fixes Bug fix computing n binomial models computed lme4::glmer() (#116) Populating effect column adding reference rows (#117)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-130","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.3.0","title":"broom.helpers 1.3.0","text":"CRAN release: 2021-04-10 New supported models Support rstanarm::stan_glm() models Basic support VGAM::vglm() models (#105) New features Custom tieder tidy_parameters() based parameters::model_parameters() (#104) Custom tieder tidy_with_broom_or_parameters() (#104) default, tidy_plus_plus() now uses tidy_with_broom_or_parameters() model_get_coefficients_type() now returns “prop_hazard” cloglog-binomial models (#106)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-121","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.2.1","title":"broom.helpers 1.2.1","text":"CRAN release: 2021-02-26 Bug fixes Better identification term labels interaction terms using sum contrasts (#108) Now tidy_add_n() works multinomial models y coded factor (#109) glue added Suggests","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-120","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.2.0","title":"broom.helpers 1.2.0","text":"CRAN release: 2021-02-22 New features model_get_coefficients_type() now returns “relative_risk” log-binomial models (#101) New function tidy_disambiguate_terms() disambiguating random-effect terms mixed models new options tidy_plus_plus(): disambiguate_terms (TRUE default) disambiguate_sep (#98) mixed models, var_type column now equal \"ran_pars\" \"ran_vals\" random-effect parameters values, based effect column returned broom.mixed::tidy() (#90) New contrasts type (“.contrast”) returned model_list_contrasts() New function tidy_add_n() add number observations (relevant models number events exposure time) (#64) New option add_n tidy_plus_plus() (#64) New functions model_get_n(), model_get_weights(), model_get_offset(), model_get_response() model_compute_terms_contributions() (#64) New supported models Support lfe::felm() models (#79) Support brms::brm() models (#89) Basic support cmprsk::crr() models (#91) Basic support stats::nls() models (#97) Models categorical variable intercept now supported (#85) Added support mgcv::gam() models. (#82) Bug fixes changes Minor breaking change: strict argument removed tidy_identify_variables() (#99) Replaced usethis::ui_*() messaging cli::cli_*() (#94) Bug fix tidy_add_term_labels() variables non standard names (#77) Fix vignette old versions rmarkdown (#95)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-110","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.1.0","title":"broom.helpers 1.1.0","text":"CRAN release: 2020-11-24 Minor breaking change: column var_type returned tidy_identify_variables() now equal \"dichotomous\" categorical variables 2 levels Minor breaking changes: intercepts terms, tidy_identify_variables() now populates variable column term content, instead NA (#66) Minor breaking change: variables can’t identified tidy_identify_variables(), variable column now populated content term column (#63) .generic_selector(): makes easy create selecting functions like all_continuous(). .select_to_varnames(): converts selecting syntax character varnames .formula_list_to_named_list(): takes formula selecting syntax converts named list. New selecting functions all_continuous(), all_categorical(), all_dichotomous(), all_contrasts(), all_intercepts() all_interaction() selecting variables models (#54) Added support multiple imputation models {mice} package. model passed must un-pooled models, pooling step included tidy_fun= (#49 @ddsjoberg) New function tidy_select_variables() keep/drop selected variables output (#45) New functions tidy_add_coefficients_type() model_get_coefficients_type get type coefficients (generic, logistic, Poisson proportional hazard) used model (#46) tidy_add_contrasts() model_list_contrasts() now return additional column contrasts_type New no_reference_row argument tidy_add_reference_rows() (#47) New method model_get_nlevels get number levels categorical variables New column var_nlevels returned tidy_identify_variables(), model_identify_variables() tidy_plus_plus() Categorical terms can now customized pattern taking account term level, reference level /variable label, see model_list_terms_levels() categorical_terms_pattern tidy_plus_plus() tidy_add_term_labels (#61) model_list_terms_levels() now returns additional columns (level, reference_level, contrasts_type, var_label, var_levels dichotomous) model_list_variables() now returns additional var_label column exponentiate argument now passed tidy_*() functions, attribute attached tibble, well custom labels (variable_labels term_labels) show_single_row argument now accepts tidyselect notation (#51 @ddsjoberg) tidy_add_estimate_to_reference_rows() now relies emmeans sum contrasts, allowing cover wider range models Tibbles returned tidy_* functions also inherits \"broom.helpers\" class (#56) interaction_sep argument added tidy_plus_plus() Better management variables non standard names (#67) .clean_backticks() .escape_regex() now exported Bug fix non standard variable names containing character special meaning regular expression (#44) Bug fix tidy_add_header_rows() nnet::multinom models: label header rows missing (#50) Bug fix: now tidy_identify_variables() correctly identify class “integer” type variables (#57) Bug fix tidy_add_header_rows() continuous variables non standard name (#70)","code":""},{"path":"https://larmarange.github.io/broom.helpers/dev/news/index.html","id":"broomhelpers-100","dir":"Changelog","previous_headings":"","what":"broom.helpers 1.0.0","title":"broom.helpers 1.0.0","text":"CRAN release: 2020-09-18 Initial version","code":""}]