class: center, middle, inverse, title-slide # Effect size plot OLS ## Using flipbookr and xaringan ### Me --- <style type="text/css"> .remark-code{line-height: 1.5; font-size: 70%} @media print { .has-continuation { display: block; } } code.r.hljs.remark-code{ position: relative; overflow-x: hidden; } code.r.hljs.remark-code:hover{ overflow-x:visible; width: 500px; border-style: solid; } </style> --- count: false .panel1-setup-auto[ ```r *knitr::opts_chunk$set(echo = TRUE) ``` ] .panel2-setup-auto[ ] --- count: false .panel1-setup-auto[ ```r knitr::opts_chunk$set(echo = TRUE) *library(tidyverse) ``` ] .panel2-setup-auto[ ] --- count: false .panel1-setup-auto[ ```r knitr::opts_chunk$set(echo = TRUE) library(tidyverse) ``` ] .panel2-setup-auto[ ] <style> .panel1-setup-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-setup-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-setup-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style> --- count: false .panel1-cars-auto[ ```r *mtcars ``` ] .panel2-cars-auto[ ``` mpg cyl disp hp drat wt qsec vs am gear carb Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2 Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2 Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4 Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4 Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1 Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1 Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1 Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1 Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2 Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6 Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8 Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2 ``` ] --- count: false .panel1-cars-auto[ ```r mtcars %>% * select(mpg, cyl, hp, disp) ``` ] .panel2-cars-auto[ ``` mpg cyl hp disp Mazda RX4 21.0 6 110 160.0 Mazda RX4 Wag 21.0 6 110 160.0 Datsun 710 22.8 4 93 108.0 Hornet 4 Drive 21.4 6 110 258.0 Hornet Sportabout 18.7 8 175 360.0 Valiant 18.1 6 105 225.0 Duster 360 14.3 8 245 360.0 Merc 240D 24.4 4 62 146.7 Merc 230 22.8 4 95 140.8 Merc 280 19.2 6 123 167.6 Merc 280C 17.8 6 123 167.6 Merc 450SE 16.4 8 180 275.8 Merc 450SL 17.3 8 180 275.8 Merc 450SLC 15.2 8 180 275.8 Cadillac Fleetwood 10.4 8 205 472.0 Lincoln Continental 10.4 8 215 460.0 Chrysler Imperial 14.7 8 230 440.0 Fiat 128 32.4 4 66 78.7 Honda Civic 30.4 4 52 75.7 Toyota Corolla 33.9 4 65 71.1 Toyota Corona 21.5 4 97 120.1 Dodge Challenger 15.5 8 150 318.0 AMC Javelin 15.2 8 150 304.0 Camaro Z28 13.3 8 245 350.0 Pontiac Firebird 19.2 8 175 400.0 Fiat X1-9 27.3 4 66 79.0 Porsche 914-2 26.0 4 91 120.3 Lotus Europa 30.4 4 113 95.1 Ford Pantera L 15.8 8 264 351.0 Ferrari Dino 19.7 6 175 145.0 Maserati Bora 15.0 8 335 301.0 Volvo 142E 21.4 4 109 121.0 ``` ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% * remove_missing() ``` ] .panel2-cars-auto[ ``` mpg cyl hp disp Mazda RX4 21.0 6 110 160.0 Mazda RX4 Wag 21.0 6 110 160.0 Datsun 710 22.8 4 93 108.0 Hornet 4 Drive 21.4 6 110 258.0 Hornet Sportabout 18.7 8 175 360.0 Valiant 18.1 6 105 225.0 Duster 360 14.3 8 245 360.0 Merc 240D 24.4 4 62 146.7 Merc 230 22.8 4 95 140.8 Merc 280 19.2 6 123 167.6 Merc 280C 17.8 6 123 167.6 Merc 450SE 16.4 8 180 275.8 Merc 450SL 17.3 8 180 275.8 Merc 450SLC 15.2 8 180 275.8 Cadillac Fleetwood 10.4 8 205 472.0 Lincoln Continental 10.4 8 215 460.0 Chrysler Imperial 14.7 8 230 440.0 Fiat 128 32.4 4 66 78.7 Honda Civic 30.4 4 52 75.7 Toyota Corolla 33.9 4 65 71.1 Toyota Corona 21.5 4 97 120.1 Dodge Challenger 15.5 8 150 318.0 AMC Javelin 15.2 8 150 304.0 Camaro Z28 13.3 8 245 350.0 Pontiac Firebird 19.2 8 175 400.0 Fiat X1-9 27.3 4 66 79.0 Porsche 914-2 26.0 4 91 120.3 Lotus Europa 30.4 4 113 95.1 Ford Pantera L 15.8 8 264 351.0 Ferrari Dino 19.7 6 175 145.0 Maserati Bora 15.0 8 335 301.0 Volvo 142E 21.4 4 109 121.0 ``` ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% * mutate(mpg_sd = mpg/sd(mpg)) ``` ] .panel2-cars-auto[ ``` mpg cyl hp disp mpg_sd Mazda RX4 21.0 6 110 160.0 3.484351 Mazda RX4 Wag 21.0 6 110 160.0 3.484351 Datsun 710 22.8 4 93 108.0 3.783009 Hornet 4 Drive 21.4 6 110 258.0 3.550719 Hornet Sportabout 18.7 8 175 360.0 3.102731 Valiant 18.1 6 105 225.0 3.003178 Duster 360 14.3 8 245 360.0 2.372677 Merc 240D 24.4 4 62 146.7 4.048484 Merc 230 22.8 4 95 140.8 3.783009 Merc 280 19.2 6 123 167.6 3.185692 Merc 280C 17.8 6 123 167.6 2.953402 Merc 450SE 16.4 8 180 275.8 2.721112 Merc 450SL 17.3 8 180 275.8 2.870441 Merc 450SLC 15.2 8 180 275.8 2.522006 Cadillac Fleetwood 10.4 8 205 472.0 1.725583 Lincoln Continental 10.4 8 215 460.0 1.725583 Chrysler Imperial 14.7 8 230 440.0 2.439045 Fiat 128 32.4 4 66 78.7 5.375855 Honda Civic 30.4 4 52 75.7 5.044012 Toyota Corolla 33.9 4 65 71.1 5.624737 Toyota Corona 21.5 4 97 120.1 3.567311 Dodge Challenger 15.5 8 150 318.0 2.571783 AMC Javelin 15.2 8 150 304.0 2.522006 Camaro Z28 13.3 8 245 350.0 2.206755 Pontiac Firebird 19.2 8 175 400.0 3.185692 Fiat X1-9 27.3 4 66 79.0 4.529656 Porsche 914-2 26.0 4 91 120.3 4.313958 Lotus Europa 30.4 4 113 95.1 5.044012 Ford Pantera L 15.8 8 264 351.0 2.621559 Ferrari Dino 19.7 6 175 145.0 3.268653 Maserati Bora 15.0 8 335 301.0 2.488822 Volvo 142E 21.4 4 109 121.0 3.550719 ``` ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% * mutate(cyl_sd = cyl/sd(cyl)) ``` ] .panel2-cars-auto[ ``` mpg cyl hp disp mpg_sd cyl_sd Mazda RX4 21.0 6 110 160.0 3.484351 3.35961 Mazda RX4 Wag 21.0 6 110 160.0 3.484351 3.35961 Datsun 710 22.8 4 93 108.0 3.783009 2.23974 Hornet 4 Drive 21.4 6 110 258.0 3.550719 3.35961 Hornet Sportabout 18.7 8 175 360.0 3.102731 4.47948 Valiant 18.1 6 105 225.0 3.003178 3.35961 Duster 360 14.3 8 245 360.0 2.372677 4.47948 Merc 240D 24.4 4 62 146.7 4.048484 2.23974 Merc 230 22.8 4 95 140.8 3.783009 2.23974 Merc 280 19.2 6 123 167.6 3.185692 3.35961 Merc 280C 17.8 6 123 167.6 2.953402 3.35961 Merc 450SE 16.4 8 180 275.8 2.721112 4.47948 Merc 450SL 17.3 8 180 275.8 2.870441 4.47948 Merc 450SLC 15.2 8 180 275.8 2.522006 4.47948 Cadillac Fleetwood 10.4 8 205 472.0 1.725583 4.47948 Lincoln Continental 10.4 8 215 460.0 1.725583 4.47948 Chrysler Imperial 14.7 8 230 440.0 2.439045 4.47948 Fiat 128 32.4 4 66 78.7 5.375855 2.23974 Honda Civic 30.4 4 52 75.7 5.044012 2.23974 Toyota Corolla 33.9 4 65 71.1 5.624737 2.23974 Toyota Corona 21.5 4 97 120.1 3.567311 2.23974 Dodge Challenger 15.5 8 150 318.0 2.571783 4.47948 AMC Javelin 15.2 8 150 304.0 2.522006 4.47948 Camaro Z28 13.3 8 245 350.0 2.206755 4.47948 Pontiac Firebird 19.2 8 175 400.0 3.185692 4.47948 Fiat X1-9 27.3 4 66 79.0 4.529656 2.23974 Porsche 914-2 26.0 4 91 120.3 4.313958 2.23974 Lotus Europa 30.4 4 113 95.1 5.044012 2.23974 Ford Pantera L 15.8 8 264 351.0 2.621559 4.47948 Ferrari Dino 19.7 6 175 145.0 3.268653 3.35961 Maserati Bora 15.0 8 335 301.0 2.488822 4.47948 Volvo 142E 21.4 4 109 121.0 3.550719 2.23974 ``` ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% mutate(cyl_sd = cyl/sd(cyl)) %>% * mutate(disp_sd = disp/sd(disp)) ``` ] .panel2-cars-auto[ ``` mpg cyl hp disp mpg_sd cyl_sd disp_sd Mazda RX4 21.0 6 110 160.0 3.484351 3.35961 1.2909608 Mazda RX4 Wag 21.0 6 110 160.0 3.484351 3.35961 1.2909608 Datsun 710 22.8 4 93 108.0 3.783009 2.23974 0.8713986 Hornet 4 Drive 21.4 6 110 258.0 3.550719 3.35961 2.0816744 Hornet Sportabout 18.7 8 175 360.0 3.102731 4.47948 2.9046619 Valiant 18.1 6 105 225.0 3.003178 3.35961 1.8154137 Duster 360 14.3 8 245 360.0 2.372677 4.47948 2.9046619 Merc 240D 24.4 4 62 146.7 4.048484 2.23974 1.1836497 Merc 230 22.8 4 95 140.8 3.783009 2.23974 1.1360455 Merc 280 19.2 6 123 167.6 3.185692 3.35961 1.3522815 Merc 280C 17.8 6 123 167.6 2.953402 3.35961 1.3522815 Merc 450SE 16.4 8 180 275.8 2.721112 4.47948 2.2252937 Merc 450SL 17.3 8 180 275.8 2.870441 4.47948 2.2252937 Merc 450SLC 15.2 8 180 275.8 2.522006 4.47948 2.2252937 Cadillac Fleetwood 10.4 8 205 472.0 1.725583 4.47948 3.8083345 Lincoln Continental 10.4 8 215 460.0 1.725583 4.47948 3.7115124 Chrysler Imperial 14.7 8 230 440.0 2.439045 4.47948 3.5501423 Fiat 128 32.4 4 66 78.7 5.375855 2.23974 0.6349914 Honda Civic 30.4 4 52 75.7 5.044012 2.23974 0.6107858 Toyota Corolla 33.9 4 65 71.1 5.624737 2.23974 0.5736707 Toyota Corona 21.5 4 97 120.1 3.567311 2.23974 0.9690275 Dodge Challenger 15.5 8 150 318.0 2.571783 4.47948 2.5657847 AMC Javelin 15.2 8 150 304.0 2.522006 4.47948 2.4528256 Camaro Z28 13.3 8 245 350.0 2.206755 4.47948 2.8239768 Pontiac Firebird 19.2 8 175 400.0 3.185692 4.47948 3.2274021 Fiat X1-9 27.3 4 66 79.0 4.529656 2.23974 0.6374119 Porsche 914-2 26.0 4 91 120.3 4.313958 2.23974 0.9706412 Lotus Europa 30.4 4 113 95.1 5.044012 2.23974 0.7673148 Ford Pantera L 15.8 8 264 351.0 2.621559 4.47948 2.8320453 Ferrari Dino 19.7 6 175 145.0 3.268653 3.35961 1.1699333 Maserati Bora 15.0 8 335 301.0 2.488822 4.47948 2.4286201 Volvo 142E 21.4 4 109 121.0 3.550719 2.23974 0.9762891 ``` ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% mutate(cyl_sd = cyl/sd(cyl)) %>% mutate(disp_sd = disp/sd(disp)) %>% * mutate(hp_sd = hp/sd(hp)) ``` ] .panel2-cars-auto[ ``` mpg cyl hp disp mpg_sd cyl_sd disp_sd hp_sd Mazda RX4 21.0 6 110 160.0 3.484351 3.35961 1.2909608 1.6043669 Mazda RX4 Wag 21.0 6 110 160.0 3.484351 3.35961 1.2909608 1.6043669 Datsun 710 22.8 4 93 108.0 3.783009 2.23974 0.8713986 1.3564193 Hornet 4 Drive 21.4 6 110 258.0 3.550719 3.35961 2.0816744 1.6043669 Hornet Sportabout 18.7 8 175 360.0 3.102731 4.47948 2.9046619 2.5524020 Valiant 18.1 6 105 225.0 3.003178 3.35961 1.8154137 1.5314412 Duster 360 14.3 8 245 360.0 2.372677 4.47948 2.9046619 3.5733627 Merc 240D 24.4 4 62 146.7 4.048484 2.23974 1.1836497 0.9042796 Merc 230 22.8 4 95 140.8 3.783009 2.23974 1.1360455 1.3855896 Merc 280 19.2 6 123 167.6 3.185692 3.35961 1.3522815 1.7939739 Merc 280C 17.8 6 123 167.6 2.953402 3.35961 1.3522815 1.7939739 Merc 450SE 16.4 8 180 275.8 2.721112 4.47948 2.2252937 2.6253277 Merc 450SL 17.3 8 180 275.8 2.870441 4.47948 2.2252937 2.6253277 Merc 450SLC 15.2 8 180 275.8 2.522006 4.47948 2.2252937 2.6253277 Cadillac Fleetwood 10.4 8 205 472.0 1.725583 4.47948 3.8083345 2.9899566 Lincoln Continental 10.4 8 215 460.0 1.725583 4.47948 3.7115124 3.1358081 Chrysler Imperial 14.7 8 230 440.0 2.439045 4.47948 3.5501423 3.3545854 Fiat 128 32.4 4 66 78.7 5.375855 2.23974 0.6349914 0.9626202 Honda Civic 30.4 4 52 75.7 5.044012 2.23974 0.6107858 0.7584280 Toyota Corolla 33.9 4 65 71.1 5.624737 2.23974 0.5736707 0.9480350 Toyota Corona 21.5 4 97 120.1 3.567311 2.23974 0.9690275 1.4147599 Dodge Challenger 15.5 8 150 318.0 2.571783 4.47948 2.5657847 2.1877731 AMC Javelin 15.2 8 150 304.0 2.522006 4.47948 2.4528256 2.1877731 Camaro Z28 13.3 8 245 350.0 2.206755 4.47948 2.8239768 3.5733627 Pontiac Firebird 19.2 8 175 400.0 3.185692 4.47948 3.2274021 2.5524020 Fiat X1-9 27.3 4 66 79.0 4.529656 2.23974 0.6374119 0.9626202 Porsche 914-2 26.0 4 91 120.3 4.313958 2.23974 0.9706412 1.3272490 Lotus Europa 30.4 4 113 95.1 5.044012 2.23974 0.7673148 1.6481224 Ford Pantera L 15.8 8 264 351.0 2.621559 4.47948 2.8320453 3.8504807 Ferrari Dino 19.7 6 175 145.0 3.268653 3.35961 1.1699333 2.5524020 Maserati Bora 15.0 8 335 301.0 2.488822 4.47948 2.4286201 4.8860266 Volvo 142E 21.4 4 109 121.0 3.550719 2.23974 0.9762891 1.5897818 ``` ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% mutate(cyl_sd = cyl/sd(cyl)) %>% mutate(disp_sd = disp/sd(disp)) %>% mutate(hp_sd = hp/sd(hp)) %>% * lm(mpg_sd ~ cyl_sd + disp_sd + hp_sd, data = .) ``` ] .panel2-cars-auto[ ``` Call: lm(formula = mpg_sd ~ cyl_sd + disp_sd + hp_sd, data = .) Coefficients: (Intercept) cyl_sd disp_sd hp_sd 5.6720 -0.3637 -0.3874 -0.1670 ``` ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% mutate(cyl_sd = cyl/sd(cyl)) %>% mutate(disp_sd = disp/sd(disp)) %>% mutate(hp_sd = hp/sd(hp)) %>% lm(mpg_sd ~ cyl_sd + disp_sd + hp_sd, data = .) -> *m1 ``` ] .panel2-cars-auto[ ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% mutate(cyl_sd = cyl/sd(cyl)) %>% mutate(disp_sd = disp/sd(disp)) %>% mutate(hp_sd = hp/sd(hp)) %>% lm(mpg_sd ~ cyl_sd + disp_sd + hp_sd, data = .) -> m1 *confint(m1) ``` ] .panel2-cars-auto[ ``` 2.5 % 97.5 % (Intercept) 4.7914718 6.5525513 cyl_sd -0.8476508 0.1202260 disp_sd -0.8256293 0.0508532 hp_sd -0.5083989 0.1744132 ``` ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% mutate(cyl_sd = cyl/sd(cyl)) %>% mutate(disp_sd = disp/sd(disp)) %>% mutate(hp_sd = hp/sd(hp)) %>% lm(mpg_sd ~ cyl_sd + disp_sd + hp_sd, data = .) -> m1 confint(m1) %>% * as_tibble() ``` ] .panel2-cars-auto[ ``` # A tibble: 4 × 2 `2.5 %` `97.5 %` <dbl> <dbl> 1 4.79 6.55 2 -0.848 0.120 3 -0.826 0.0509 4 -0.508 0.174 ``` ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% mutate(cyl_sd = cyl/sd(cyl)) %>% mutate(disp_sd = disp/sd(disp)) %>% mutate(hp_sd = hp/sd(hp)) %>% lm(mpg_sd ~ cyl_sd + disp_sd + hp_sd, data = .) -> m1 confint(m1) %>% as_tibble() -> *confint_m1 ``` ] .panel2-cars-auto[ ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% mutate(cyl_sd = cyl/sd(cyl)) %>% mutate(disp_sd = disp/sd(disp)) %>% mutate(hp_sd = hp/sd(hp)) %>% lm(mpg_sd ~ cyl_sd + disp_sd + hp_sd, data = .) -> m1 confint(m1) %>% as_tibble() -> confint_m1 *m1 ``` ] .panel2-cars-auto[ ``` Call: lm(formula = mpg_sd ~ cyl_sd + disp_sd + hp_sd, data = .) Coefficients: (Intercept) cyl_sd disp_sd hp_sd 5.6720 -0.3637 -0.3874 -0.1670 ``` ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% mutate(cyl_sd = cyl/sd(cyl)) %>% mutate(disp_sd = disp/sd(disp)) %>% mutate(hp_sd = hp/sd(hp)) %>% lm(mpg_sd ~ cyl_sd + disp_sd + hp_sd, data = .) -> m1 confint(m1) %>% as_tibble() -> confint_m1 m1 %>% * broom::tidy(conf.int = T) ``` ] .panel2-cars-auto[ ``` # A tibble: 4 × 7 term estimate std.error statistic p.value conf.low conf.high <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 (Intercept) 5.67 0.430 13.2 1.54e-13 4.79 6.55 2 cyl_sd -0.364 0.236 -1.54 1.35e- 1 -0.848 0.120 3 disp_sd -0.387 0.214 -1.81 8.09e- 2 -0.826 0.0509 4 hp_sd -0.167 0.167 -1.00 3.25e- 1 -0.508 0.174 ``` ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% mutate(cyl_sd = cyl/sd(cyl)) %>% mutate(disp_sd = disp/sd(disp)) %>% mutate(hp_sd = hp/sd(hp)) %>% lm(mpg_sd ~ cyl_sd + disp_sd + hp_sd, data = .) -> m1 confint(m1) %>% as_tibble() -> confint_m1 m1 %>% broom::tidy(conf.int = T) %>% * slice(-1) ``` ] .panel2-cars-auto[ ``` # A tibble: 3 × 7 term estimate std.error statistic p.value conf.low conf.high <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 cyl_sd -0.364 0.236 -1.54 0.135 -0.848 0.120 2 disp_sd -0.387 0.214 -1.81 0.0809 -0.826 0.0509 3 hp_sd -0.167 0.167 -1.00 0.325 -0.508 0.174 ``` ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% mutate(cyl_sd = cyl/sd(cyl)) %>% mutate(disp_sd = disp/sd(disp)) %>% mutate(hp_sd = hp/sd(hp)) %>% lm(mpg_sd ~ cyl_sd + disp_sd + hp_sd, data = .) -> m1 confint(m1) %>% as_tibble() -> confint_m1 m1 %>% broom::tidy(conf.int = T) %>% slice(-1) %>% * mutate(term = fct_reorder(term, estimate) %>% * fct_rev()) ``` ] .panel2-cars-auto[ ``` # A tibble: 3 × 7 term estimate std.error statistic p.value conf.low conf.high <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> 1 cyl_sd -0.364 0.236 -1.54 0.135 -0.848 0.120 2 disp_sd -0.387 0.214 -1.81 0.0809 -0.826 0.0509 3 hp_sd -0.167 0.167 -1.00 0.325 -0.508 0.174 ``` ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% mutate(cyl_sd = cyl/sd(cyl)) %>% mutate(disp_sd = disp/sd(disp)) %>% mutate(hp_sd = hp/sd(hp)) %>% lm(mpg_sd ~ cyl_sd + disp_sd + hp_sd, data = .) -> m1 confint(m1) %>% as_tibble() -> confint_m1 m1 %>% broom::tidy(conf.int = T) %>% slice(-1) %>% mutate(term = fct_reorder(term, estimate) %>% fct_rev()) %>% * ggplot() ``` ] .panel2-cars-auto[ ![](broom_viz_flipbook_files/figure-html/cars_auto_17_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% mutate(cyl_sd = cyl/sd(cyl)) %>% mutate(disp_sd = disp/sd(disp)) %>% mutate(hp_sd = hp/sd(hp)) %>% lm(mpg_sd ~ cyl_sd + disp_sd + hp_sd, data = .) -> m1 confint(m1) %>% as_tibble() -> confint_m1 m1 %>% broom::tidy(conf.int = T) %>% slice(-1) %>% mutate(term = fct_reorder(term, estimate) %>% fct_rev()) %>% ggplot() + * aes(y = term, x = estimate) ``` ] .panel2-cars-auto[ ![](broom_viz_flipbook_files/figure-html/cars_auto_18_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% mutate(cyl_sd = cyl/sd(cyl)) %>% mutate(disp_sd = disp/sd(disp)) %>% mutate(hp_sd = hp/sd(hp)) %>% lm(mpg_sd ~ cyl_sd + disp_sd + hp_sd, data = .) -> m1 confint(m1) %>% as_tibble() -> confint_m1 m1 %>% broom::tidy(conf.int = T) %>% slice(-1) %>% mutate(term = fct_reorder(term, estimate) %>% fct_rev()) %>% ggplot() + aes(y = term, x = estimate) + * geom_point() ``` ] .panel2-cars-auto[ ![](broom_viz_flipbook_files/figure-html/cars_auto_19_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% mutate(cyl_sd = cyl/sd(cyl)) %>% mutate(disp_sd = disp/sd(disp)) %>% mutate(hp_sd = hp/sd(hp)) %>% lm(mpg_sd ~ cyl_sd + disp_sd + hp_sd, data = .) -> m1 confint(m1) %>% as_tibble() -> confint_m1 m1 %>% broom::tidy(conf.int = T) %>% slice(-1) %>% mutate(term = fct_reorder(term, estimate) %>% fct_rev()) %>% ggplot() + aes(y = term, x = estimate) + geom_point() + * geom_segment(aes(x = conf.low, xend = conf.high, yend = term)) ``` ] .panel2-cars-auto[ ![](broom_viz_flipbook_files/figure-html/cars_auto_20_output-1.png)<!-- --> ] --- count: false .panel1-cars-auto[ ```r mtcars %>% select(mpg, cyl, hp, disp) %>% remove_missing() %>% mutate(mpg_sd = mpg/sd(mpg)) %>% mutate(cyl_sd = cyl/sd(cyl)) %>% mutate(disp_sd = disp/sd(disp)) %>% mutate(hp_sd = hp/sd(hp)) %>% lm(mpg_sd ~ cyl_sd + disp_sd + hp_sd, data = .) -> m1 confint(m1) %>% as_tibble() -> confint_m1 m1 %>% broom::tidy(conf.int = T) %>% slice(-1) %>% mutate(term = fct_reorder(term, estimate) %>% fct_rev()) %>% ggplot() + aes(y = term, x = estimate) + geom_point() + geom_segment(aes(x = conf.low, xend = conf.high, yend = term)) + * geom_vline(xintercept = 0, linetype = "dashed") ``` ] .panel2-cars-auto[ ![](broom_viz_flipbook_files/figure-html/cars_auto_21_output-1.png)<!-- --> ] <style> .panel1-cars-auto { color: black; width: 38.6060606060606%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel2-cars-auto { color: black; width: 59.3939393939394%; hight: 32%; float: left; padding-left: 1%; font-size: 80% } .panel3-cars-auto { color: black; width: NA%; hight: 33%; float: left; padding-left: 1%; font-size: 80% } </style>