Repetir o script não garante reproduzir a análise:

as decisões do pesquisador como grau de liberdade

Ronaldo Lima Jr.

Universidade de Brasília | CNPq

LENZ, Friedrich. The ratio of proton and electron masses. Physical Review, v. 82, n. 4, p. 554, 1951.

LENZ, Friedrich. The ratio of proton and electron masses. Physical Review, v. 82, n. 4, p. 554, 1951.

  • Início sec. XX: praticamente nenhum método reportado
  • Metade sec. XX: pouco método reportado
  • Sec. XXI: crises de replicabilidade

Exemplo 1 (McElreath 2020)

  • 2015, periódico de alto impacto, 1170 crianças: associação negativa entre religiosidade e generosidade
    • países (categóricos) foram lidos como variável contínua
    • Canadá (país #2) foi interpretado como duas vezes “mais país” do que os EUA (país #1)
    • artigo removido, final feliz porque os dados foram compartilhados

Exemplo 2 (McElreath 2020)

  • 2010: “Growth in a time of debt” by Reinhart & Rogoff
  • 2013: “Does High Public Debt Consistently Stifle Economic Growth? A Critique of Reinhart and Rogoff” by Herndon, Ash & Pollin

Exemplo 2 (McElreath 2020)

  • 2010: “Growth in a time of debt” by Reinhart & Rogoff
  • 2013: “Does High Public Debt Consistently Stifle Economic Growth? A Critique of Reinhart and Rogoff” by Herndon, Ash & Pollin

Novamente, final feliz porque os dados foram compartilhados (quando requisitados), mas…

  • E se os dados não tivessem sido compartilhados?
  • E os dados que nunca foram compartilhados, e erros nunca detectados?

Decisões do pesquisador

“In light of this idiosyncratic variability, we recommend that researchers more transparently share details of their analysis, strengthen the link between theoretical construct and quantitative system, and calibrate their (un)certainty in their conclusions.”

Exemplo 1:

Lima Jr & Garica (2021)

library(languageR)
data(danish) 
  • Pergunta de pesquisa: tem diferença entre “ede” e “bar”?

Decisão 1: Teste t entre “ede” e “bar”

dan %>%
  filter(Affix %in% c("ede", "bar")) %>%
  t.test(LogRT ~ Affix, data = .)

    Welch Two Sample t-test

data:  LogRT by Affix
t = 2.5034, df = 421.23, p-value = 0.01268
alternative hypothesis: true difference in means between group bar and group ede is not equal to 0
95 percent confidence interval:
 0.01095439 0.09103241
sample estimates:
mean in group bar mean in group ede 
         6.795550          6.744556 

Decisão 1: Teste t entre “ede” e “bar”

t = 2.5034, df = 421.23, p-value = 0.01268
  • Tem diferença entre “ede” e “bar”?
    • Sim!

Decisão 2: ANOVA com comparações múltiplas

anovaDan = aov(LogRT ~ Affix, data = dan) 
summary(anovaDan)
              Df Sum Sq Mean Sq F value   Pr(>F)    
Affix          4   1.89  0.4717   12.09 1.32e-09 ***
Residuals   1035  40.39  0.0390                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(anovaDan)
  Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = LogRT ~ Affix, data = dan)

$Affix
                diff           lwr          upr     p adj
ede-bar  -0.05099340 -1.034311e-01  0.001444266 0.0612021
ende-bar  0.05413199 -5.440768e-05  0.108318388 0.0503757
ere-bar   0.01781355 -3.468447e-02  0.070311574 0.8863835
lig-bar  -0.06136498 -1.139239e-01 -0.008806100 0.0127046
ende-ede  0.10512539  5.129924e-02  0.158951542 0.0000012
ere-ede   0.06880695  1.668084e-02  0.120933061 0.0029895
lig-ede  -0.01037158 -6.255898e-02  0.041815820 0.9827775
ere-ende -0.03631844 -9.020339e-02  0.017566517 0.3500510
lig-ende -0.11549697 -1.694412e-01 -0.061552722 0.0000001
lig-ere  -0.07917853 -1.314266e-01 -0.026930484 0.0003598

Decisão 2: ANOVA com comparações múltiplas

                diff           lwr          upr     p adj
ede-bar  -0.05099340 -1.034311e-01  0.001444266 0.0612021
  • Tem diferença entre “ede” e “bar”?
    • Não…

Decisão 3: Modelo de regressão linear

fit1 = lm(LogRT ~ Affix, data = dan) 
summary(fit1)

Call:
lm(formula = LogRT ~ Affix, data = dan)

Residuals:
     Min       1Q   Median       3Q      Max 
-0.48793 -0.12759 -0.02011  0.10379  0.91810 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  6.79555    0.01366 497.301  < 2e-16 ***
Affixede    -0.05099    0.01919  -2.657  0.00800 ** 
Affixende    0.05413    0.01983   2.730  0.00644 ** 
Affixere     0.01781    0.01921   0.927  0.35403    
Affixlig    -0.06136    0.01923  -3.190  0.00146 ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.1976 on 1035 degrees of freedom
Multiple R-squared:  0.04463,   Adjusted R-squared:  0.04094 
F-statistic: 12.09 on 4 and 1035 DF,  p-value: 1.321e-09

Decisão 3: Modelo de regressão linear

            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  6.79555    0.01366 497.301  < 2e-16 ***
Affixede    -0.05099    0.01919  -2.657  0.00800 ** 
  • Tem diferença entre “ede” e “bar”?
    • Sim!

Decisão 4: Modelo de regressão linear com efeitos mistos

library(lmerTest) 

fit2 = lmer(LogRT ~ Affix + (1 | Subject) + (1 | Word), data = dan) 
summary(fit2)
Linear mixed model fit by REML. t-tests use Satterthwaite's method [
lmerModLmerTest]
Formula: LogRT ~ Affix + (1 | Subject) + (1 | Word)
   Data: dan

REML criterion at convergence: -625.8

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-2.6209 -0.5759 -0.1543  0.4105  4.8372 

Random effects:
 Groups   Name        Variance Std.Dev.
 Word     (Intercept) 0.004886 0.06990 
 Subject  (Intercept) 0.007325 0.08559 
 Residual             0.027676 0.16636 
Number of obs: 1040, groups:  Word, 49; Subject, 22

Fixed effects:
            Estimate Std. Error       df t value Pr(>|t|)    
(Intercept)  6.80096    0.03091 61.07064 220.051   <2e-16 ***
Affixede    -0.05612    0.03521 43.93137  -1.594   0.1182    
Affixende    0.05002    0.03622 44.15087   1.381   0.1743    
Affixere     0.01091    0.03522 43.96980   0.310   0.7583    
Affixlig    -0.06635    0.03523 44.00575  -1.884   0.0662 .  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
          (Intr) Affixd Affxnd Affixr
Affixede  -0.572                     
Affixende -0.556  0.488              
Affixere  -0.572  0.502  0.488       
Affixlig  -0.572  0.502  0.488  0.502

Decisão 4: Modelo de regressão linear com efeitos mistos

            Estimate Std. Error       df t value Pr(>|t|)    
(Intercept)  6.80096    0.03091 61.07064 220.051   <2e-16 ***
Affixede    -0.05612    0.03521 43.93137  -1.594   0.1182    
  • Tem diferença entre “ede” e “bar”?
    • Não…

Exemplo 2

Lima Jr. (2019)

  • Satterthwaite’s method
lmertTest::mod1 = lmer(distancia ~ gravacao + (gravacao|falante))
summary(mod1)

Fixed effects:
  Estimate Std. Error       df t value Pr(>|t|)    
(Intercept)  1.16050    0.12993 15.49896   8.932 1.67e-07
recording    0.14390    0.07027  9.81783   2.048   0.0683   

  • t-statistics and the normal distribution function
sjPlot::tab_model(mod1)

Fixed effects:
  Estimate Std. Error       df t value Pr(>|t|)    
(Intercept)  1.16050    0.12993 15.49896   8.932 1.67e-07
recording    0.14390    0.07027  9.81783   2.048   0.048 
  • conditional F-test with Kenward-Roger approximation
sjPlot::tab_model(mod1, p.val = "kr")

Fixed effects:
  Estimate Std. Error       df t value Pr(>|t|)    
(Intercept)  1.16050    0.12993 15.49896   8.932 1.67e-07
recording    0.14390    0.07027  9.81783   2.048   0.071  

Exemplo 3

O quarteto de Anscombe (1973)

  • \(\bar{X}\) de x = 9
  • \(s\) de x = 3,3
  • \(\bar{X}\) de y = 7,5
  • \(s\) de y = 2
  • Corr de x e y = 0,816
  • Regressão linear: \(y = 3+0,5x\)
    • \(R^2=0,67\)

Datasaurus dozen

Datasaurus dozen

Boxplot

Boxplot

Boxplot

Boxplot

E aí? O que fazer?

  • Não decidir também é uma decisão
  • Estudar, estudar, estudar
  • Modalizar, incluir incerteza
  • Ser transparente em todas as decisões

Slides:

@ronaldolimajunior