Coeficientes de uma Regressão

Diferenças entre Coeficientes Padronizados vs Brutos

Jose Storopoli https://scholar.google.com/citations?user=xGU7H1QAAAAJ&hl=en (UNINOVE)https://www.uninove.br
August 1, 2021

Em tabelas de regressão temos geralmente temos duas opções de como reportar os coeficientes:

Simulação

Para explicar melhor esses conceitos, simularemos alguns dados:

N <- 1000
x <- rnorm(N, 1, 0.1)
error <- rnorm(N, 0, 1)
y <- rep(10, N) + (100 * x) + error

df <- data.frame(x, y)

Observem os dados com o pacote skimr (Waring et al., 2021) usando a função skim():

Table 1: Data summary
Name df
Number of rows 1000
Number of columns 2
_______________________
Column type frequency:
numeric 2
________________________
Group variables None

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
x 0 1 1 0.1 0.72 0.94 1 1.1 1.3 ▁▅▇▃▁
y 0 1 110 10.1 79.76 103.59 110 116.8 142.3 ▁▅▇▃▁

Média e Desvio Padrões

Prestem atenção:

Coeficientes Brutos vs Padronizados

Agora vamos executar uma regressão1 e mostrar coeficientes tanto como brutos, assim como padronizados:

library(lm.beta)
model <- lm.beta(lm(y ~ x, df))
summary(model)

Call:
lm(formula = y ~ x, data = df)

Residuals:
   Min     1Q Median     3Q    Max 
-3.028 -0.691  0.004  0.709  3.291 

Coefficients:
            Estimate Standardized Std. Error t value
(Intercept)    9.161        0.000      0.323    28.4
x            100.880        0.995      0.321   314.2
                       Pr(>|t|)    
(Intercept) <0.0000000000000002 ***
x           <0.0000000000000002 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1 on 998 degrees of freedom
Multiple R-squared:  0.99,  Adjusted R-squared:  0.99 
F-statistic: 9.87e+04 on 1 and 998 DF,  p-value: <0.0000000000000002

Ambas colunas o output de summary() mostram a mesma coisa:

Ambiente

R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
 [1] lm.beta_1.5-1        loo_2.4.1            DescTools_0.99.41   
 [4] gapminder_0.3.0      ggExtra_0.9          dplyr_1.0.6         
 [7] rstan_2.21.2         StanHeaders_2.21.0-7 MASS_7.3-54         
[10] ggforce_0.3.3        gganimate_1.0.7      plotly_4.9.3        
[13] carData_3.0-4        DiagrammeR_1.0.6.1   brms_2.15.0         
[16] rstanarm_2.21.1      Rcpp_1.0.6           skimr_2.1.3         
[19] readr_1.4.0          readxl_1.3.1         tibble_3.1.2        
[22] ggplot2_3.3.3        patchwork_1.1.1      cowplot_1.1.1       

loaded via a namespace (and not attached):
  [1] utf8_1.2.1           tidyselect_1.1.1     lme4_1.1-27         
  [4] htmlwidgets_1.5.3    grid_4.1.0           munsell_0.5.0       
  [7] codetools_0.2-18     ragg_1.1.2           distill_1.2         
 [10] DT_0.18              gifski_1.4.3-1       miniUI_0.1.1.1      
 [13] withr_2.4.2          Brobdingnag_1.2-6    colorspace_2.0-1    
 [16] highr_0.9            knitr_1.33           rstudioapi_0.13     
 [19] stats4_4.1.0         bayesplot_1.8.0      labeling_0.4.2      
 [22] repr_1.1.3           mnormt_2.0.2         polyclip_1.10-0     
 [25] farver_2.1.0         bridgesampling_1.1-2 rprojroot_2.0.2     
 [28] coda_0.19-4          vctrs_0.3.8          generics_0.1.0      
 [31] xfun_0.23            R6_2.5.0             markdown_1.1        
 [34] isoband_0.2.4        gamm4_0.2-6          projpred_2.0.2      
 [37] assertthat_0.2.1     promises_1.2.0.1     scales_1.1.1        
 [40] rootSolve_1.8.2.1    gtable_0.3.0         downlit_0.2.1       
 [43] processx_3.5.2       lmom_2.8             rlang_0.4.11        
 [46] systemfonts_1.0.2    splines_4.1.0        lazyeval_0.2.2      
 [49] checkmate_2.0.0      inline_0.3.19        yaml_2.2.1          
 [52] reshape2_1.4.4       abind_1.4-5          threejs_0.3.3       
 [55] crosstalk_1.1.1      backports_1.2.1      httpuv_1.6.1        
 [58] rsconnect_0.8.18     tools_4.1.0          bookdown_0.22       
 [61] ellipsis_0.3.2       jquerylib_0.1.4      RColorBrewer_1.1-2  
 [64] proxy_0.4-25         ggridges_0.5.3       plyr_1.8.6          
 [67] base64enc_0.1-3      visNetwork_2.0.9     progress_1.2.2      
 [70] purrr_0.3.4          ps_1.6.0             prettyunits_1.1.1   
 [73] zoo_1.8-9            here_1.0.1           magrittr_2.0.1      
 [76] data.table_1.14.0    magick_2.7.2         colourpicker_1.1.0  
 [79] tmvnsim_1.0-2        mvtnorm_1.1-1        matrixStats_0.59.0  
 [82] hms_1.1.0            shinyjs_2.0.0        mime_0.10           
 [85] evaluate_0.14        xtable_1.8-4         shinystan_2.5.0     
 [88] gridExtra_2.3        rstantools_2.1.1     compiler_4.1.0      
 [91] V8_3.4.2             crayon_1.4.1         minqa_1.2.4         
 [94] htmltools_0.5.1.1    mgcv_1.8-35          later_1.2.0         
 [97] tidyr_1.1.3          expm_0.999-6         Exact_2.1           
[100] RcppParallel_5.1.4   lubridate_1.7.10     DBI_1.1.1           
[103] tweenr_1.0.2         boot_1.3-28          Matrix_1.3-3        
[106] cli_2.5.0            parallel_4.1.0       igraph_1.2.6        
[109] pkgconfig_2.0.3      xml2_1.3.2           dygraphs_1.1.1.6    
[112] bslib_0.2.5.1        stringr_1.4.0        callr_3.7.0         
[115] digest_0.6.27        rmarkdown_2.8        cellranger_1.1.0    
[118] gld_2.6.2            curl_4.3.1           shiny_1.6.0         
[121] gtools_3.8.2         nloptr_1.2.2.2       lifecycle_1.0.0     
[124] nlme_3.1-152         jsonlite_1.7.2       viridisLite_0.4.0   
[127] fansi_0.5.0          pillar_1.6.1         lattice_0.20-44     
[130] fastmap_1.1.0        httr_1.4.2           pkgbuild_1.2.0      
[133] survival_3.2-11      glue_1.4.2           xts_0.12.1          
[136] png_0.1-7            shinythemes_1.2.0    class_7.3-19        
[139] stringi_1.6.2        sass_0.4.0           textshaping_0.3.4   
[142] e1071_1.7-7         
Waring, E., Quinn, M., McNamara, A., Arino de la Rubia, E., Zhu, H., & Ellis, S. (2021). Skimr: Compact and flexible summaries of data. Retrieved from https://CRAN.R-project.org/package=skimr

  1. estou rodando uma regressão simples frequentista pois o foco não é a robustez da inferência mas apenas uma mera exemplificação de como interpretar coeficientes.↩︎

References

Corrections

If you see mistakes or want to suggest changes, please create an issue on the source repository.

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY-SA 4.0. Source code is available at https://github.com/storopoli/Estatistica-Bayesiana, unless otherwise noted. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".

Citation

For attribution, please cite this work as

Storopoli (2021, Aug. 1). Estatística Bayesiana com R e Stan: Coeficientes de uma Regressão. Retrieved from https://storopoli.github.io/Estatistica-Bayesiana/aux-Regressao_Coeficientes.html

BibTeX citation

@misc{storopoli2021regressaocoeficientesR,
  author = {Storopoli, Jose},
  title = {Estatística Bayesiana com R e Stan: Coeficientes de uma Regressão},
  url = {https://storopoli.github.io/Estatistica-Bayesiana/aux-Regressao_Coeficientes.html},
  year = {2021}
}