Does


18

Bir r -değeri olan değerin de p değeri olup olmadığını anlamaya çalışırken kendimi karıştırmışım gibi görünüyor .

Bunu anlamak gibi, veri noktaları seti ile doğrusal ilişki içinde r arasında değişen bir değere sahip olabilir 1 için 1 ve bu değerin, her ne olursa olsun, bir olabilir p -değeri olan Şekil eğer r önemli ölçüde farklı olduğu 0 (yani, , iki değişken arasında doğrusal bir korelasyon varsa).

Doğrusal regresyona geçildiğinde, denklemiyle tanımlanan verilere bir fonksiyon eklenebilir Y=a+bX. a ve b (kesişim ve eğim) de 0'dan önemli ölçüde farklı olup olmadıklarını göstermek için p değerlerine sahiptir .0

Şimdiye kadar doğru şeyi anlamış varsayarsak vardır p için -değeri r ve p için -değeri b sadece aynı şey? O zaman p- değeri olan r kareli değil, r veya b olduğunu söylemek doğru mu?prb olduğunu mu?

Yanıtlar:


14

Diğer kullanıcılar tarafından çok sayıda (doğru) Yorumlara ek olarak işaret olduğunu p için -değeri r2 ile aynıdır p küresel için-değeri F de alabilirsiniz testte, not p ilişkili -Değer r2 " şirketinden" gerçeğini kullanarak r2 boş hipotez altında olarak dağıtılır Beta(vn2,vd2), buradavnvevd, ilişkiliFstatikiçin sırasıyla pay ve payda serbestlik dereceleridir.

Beta dağıtımındaki Wikipedia girişinin Diğer dağıtımlardan türetilmiş alt bölümündeki 3. madde işareti bize şunu söyler:

Eğer Xχ2(α) ve Yχ2(β) bağımsız, o zaman XX+YBeta(α2,β2) .

Eh, yazabilir ki Xr2 formu.XX+Y

Let , bir değişken için kareler toplamı olduğu , Y , S S E bir gerileme karesel toplamı Y başka değişkenlere ve S S R , bir olmak "düşük karelerinin toplamı," S S R = S S , Y - S S e . Sonra r 2 = 1 - S S DSSYYSSEYSSRSSR=SSYSSE Ve elbette, karelerin toplamı olanSSRveSSE, sırasıylavnvevdserbestlik dereceleriileχ2olarak dağıtılır. Bu nedenle, r2Beta(vn

r2=1SSESSY=SSYSSESSY=SSRSSR+SSE
SSRSSEχ2vnvd
r2Beta(vn2,vd2)
(Tabii ki, iki ki-karenin bağımsız olduğunu göstermedim. Belki bir yorumcu bu konuda bir şeyler söyleyebilir.)

R'de gösterim (@gung'dan borçlanma kodu):

set.seed(111)
x = runif(20)
y = 5 + rnorm(20)
cor.test(x,y)

# Pearson's product-moment correlation
# 
# data:  x and y
# t = 1.151, df = 18, p-value = 0.2648
# alternative hypothesis: true correlation is not equal to 0
# 95 percent confidence interval:
#  -0.2043606  0.6312210
# sample estimates:
#       cor 
# 0.2618393 

summary(lm(y~x))

# Call:
#   lm(formula = y ~ x)
# 
# Residuals:
#     Min      1Q  Median      3Q     Max 
# -1.6399 -0.6246  0.1968  0.5168  2.0355 
# 
# Coefficients:
#             Estimate Std. Error t value Pr(>|t|)    
# (Intercept)   4.6077     0.4534  10.163 6.96e-09 ***
# x             1.1121     0.9662   1.151    0.265    
# ---
#   Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# 
# Residual standard error: 1.061 on 18 degrees of freedom
# Multiple R-squared:  0.06856,  Adjusted R-squared:  0.01681 
# F-statistic: 1.325 on 1 and 18 DF,  p-value: 0.2648

1 - pbeta(0.06856, 1/2, 18/2)

# [1] 0.2647731

6

Umarım bu dördüncü (!) Cevabı işleri daha da netleştirir.

Basit doğrusal regresyonda üç eşdeğer test vardır:

  1. Değişken X'in sıfır nüfus eğimi için t-testiX
  2. ve Y yanıtı arasında sıfır popülasyon korelasyonu için t-testiXY
  3. Sıfır popülasyon R kare için F testi, yani değişkenliğinin hiçbiri farklı X ile açıklanamaz .YX

Her üç test de ve Y arasında doğrusal bir ilişki olup olmadığını kontrol eder ve neyse ki (!) Hepsi aynı sonuca götürür. Test istatistikleri eşdeğerdir. (Test 1 ve 2 , sadece kare test istatistiği ile test 3'ün örnekleme F-dağılımına karşılık gelen n - 2 df ile Öğrenci dağılımına dayanmaktadır ).XYn2

R'de kısa bir örnek:

# Input
set.seed(3)

n <- 100
X <- runif(n)
Y <- rnorm(n) + X

cor.test(~ X + Y) # For test 2 (correlation)

# Output (part)
# t = 3.1472, df = 98, p-value = 0.002184
# alternative hypothesis: true correlation is not equal to 0

# Input (for the other two tests)
fit <- lm(Y ~ X)
summary(fit)      

# Output (partial)
Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept) -0.03173    0.18214  -0.174  0.86204   
X            1.02051    0.32426   3.147  0.00218 **
---
Signif. codes:  0***0.001**0.01*0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.9239 on 98 degrees of freedom
Multiple R-squared:  0.09179,   Adjusted R-squared:  0.08253 
F-statistic: 9.905 on 1 and 98 DF,  p-value: 0.002184

Gördüğünüz gibi, üç test 0.00218'lik aynı p değerini verir. Test 3'ün çıktının son satırındaki test olduğunu unutmayın.

Bu nedenle, R-kare için F testiniz çok sık yapılan bir testtir, ancak pek çok istatistikçi bunu R-kare için bir test olarak yorumlamamaktadır.


5

You seem to have a decent understanding to me. We could get a p-value for r2, but since it is a (non-stochastic) function of r, the ps would be identical.


ρr2αβρβα. However, r2 is significant if either α or β are non-zero. This helps visualize what the respective tests are assessing.
AdamO

1
@AdamO, I can't follow the argument in your comment. Similar to Michael Mayer's post below, in R try: set.seed(111); x = runif(20); y = 5 + rnorm(20); cor.test(x,y); summary(lm(y~x)). The p for r is .265. The p for b & for the global F test are identical, even though the p for a is 6.96e-09.
gung - Reinstate Monica

Exactly my point. r is different from r2 and their p-value is NOT identical. r2 may be a function of r, but it is not even a monotonic function. r2 can be significant when r is not. What does r2 measure? It's the residual standard error after drawing the OLS trendline and calculating residuals. In your example, will the residual variance be less than the unconditional Y variance? Absolutely. r2 is significant then. You can calculate the operating characteristics with bootstrap and the connection between ANOVA and ordinary least squares also sheds light on the matter.
AdamO

4
You can also get the p-value associated with r2 "directly" using the fact that r2 under the null hypothesis is distributed as Beta(vn2,vd2), where vn and vd are the numerator and denominator degrees of freedom, respectively, for the associated F-statistic. (See the 3rd identity here: en.wikipedia.org/wiki/… .) So, using @gung's example data, if in R we enter 1 - pbeta(0.06856, 1/2, 18/2) we get 0.2647731.
Jake Westfall

4
@AdamO, I still don't understand. They are both .265, how are they not identical?
gung - Reinstate Monica

4

There are several ways of deriving the test statistic for tests of the Pearson correlation, ρ. To obtain a p-value, it is worth emphasizing that you need both a test and a sampling distribution of a test statistic under the null hypothesis. Your title and question seems to have some confusion between Pearson correlation and the "variance explained" r2. I will consider the correlation coefficient first.

There is no "best" way to test the Pearson correlation which I'm aware of. Fisher's Z transformation is one such way, based on hyperbolic transformations, so that the inference is a little bit more efficient. This is certainly a "good" approach, but the sad bit is that inference for this parameter is consistent with inference about the slope parameter β for association: they tell the same story in the long run.

The reason why statisticians have (classically) wholly preferred tests of β is because we do have a "best" test: linear regression, which is the BLUE estimator. In the days of modern statistics, we don't really care if a test is "best" any more, but linear regression has plenty of other fantastic properties that justify its continued usage for determining the association between two variables. In general, your intuition is right: they're essentially the same thing, and we focus our attention upon β as a more practical measure of association.

The r2 is a function of both the slope and the intercept. If either of these values are nonzero, the r2 should have a discernable sampling distribution relative to that which would be expected if the linear parameters were zero. However, deriving distributions of r2 under the null and comparing to r2 under some alternative hypothesis doesn't give me much confidence that this test has much power to detect what we want it to. Just a gut feeling. Again turning to "best" estimators, OLS gives us "best" estimates of both the slope and the intercept, so we have that confidence that our test is at least good for determining the same (if any) association by directly testing the model parameters. To me, jointly testing the α and β with OLS is superior to any test about r2 except in a rare case of (perhaps) a non-nested predictive modeling calibration application... but BIC would probably be a better measure in that scenario anyway.


1
"The r2 is a function of both the slope and the intercept." Maybe I'm missing something but... isn't it just a function of the slope? Maybe you could provide a concrete demonstration?
Jake Westfall

Sure. Recall that if observed data perfectly correspond with the trendline, then r2=1 exactly. Consider "flat response" data with no variability but a non-zero intercept, so all tuples take the form (xi,β0) for all i{1,2,n}. r2=1 as alluded to. The coefficient of determination serves as a reasonable summary of predictive ability for a linear equation, and obtaining those predictions requires both a slope and an intercept.
AdamO

1

This isn't quite how I would interpret things. I don't think I'd ever calculate a p-value for r or r2. r and r2 are qualitative measures of a model, not measures that we're comparing to a distribution, so a p-value doesn't really make sense.

Getting a p-value for b makes a lot of sense - that's what tells you whether the model has a linear relationship or not. If b is statistically significantly different from 0 then you conclude that there is a linear relationship between the variables. The r or r2 then tells you how well the model explains the variation in the data. If r2 is low, then your independent variable isn't helping to explain very much about the dependent variable.

A p-value for a tells us if the intercept is statistically significantly different from 0 or not. This is of varying usefulness, depending on the data. My favorite example: if you do a linear regression between gestation time and birth weight you might find an intercept of, say, 8 ounces that is statistically different from 0. However, since the intercept represents a gestation age of 0 weeks, it doesn't really mean anything.

If anyone does regularly calculate p-values for an r2 I'd be interested in hearing about them.


4
Take a closer look at the output of your favorite regression command: it should report an F statistic and a p-value for it. That is also the p-value for the R2, because F and R2 are directly and monotonically related. For ordinary regression with n data, F=(n2)R2/(1R2). Its p-value will be the p-value for the slope. Therefore if you have ever used a p-value for b in ordinary regression, you have used a p-value for R2.
whuber

In practice it seems like people do not think in terms of the significance of r or r^2. What might be more useful is a confidence interval around them.
N Brouwer
Sitemizi kullandığınızda şunları okuyup anladığınızı kabul etmiş olursunuz: Çerez Politikası ve Gizlilik Politikası.
Licensed under cc by-sa 3.0 with attribution required.