प्रतिगमन गुणांक को सामान्य करने के बारे में प्रश्न


16

यकीन नहीं है कि अगर सामान्य शब्द यहां उपयोग करने के लिए सही शब्द है, लेकिन मैं जो कुछ भी पूछने की कोशिश कर रहा हूं, उसे स्पष्ट करने की पूरी कोशिश करूंगा। यहां इस्तेमाल किया जाने वाला अनुमानक कम से कम वर्ग है।

मान लें कि आपके पास , तो आप इसका अर्थ जहाँ और , से लगा सकते हैं उस अब अनुमान लगाने पर कोई प्रभाव नहीं है ।y = β 0 + β 1 एक्स 1y=β0+β1x1 y = β ' 0 + β 1 एक्स ' 1y=β′0+β1x′1 β ' 0 = β 0 + β 1 ˉ एक्स 1 β′0=β0+β1x¯1एक्स ' 1 = एक्स - ˉ एक्सx′1=x−x¯ β ' 0β′0 β 1β1

इस मैं मतलब द्वारा β 1β^1 में y = β 1 एक्स ' 1y=β1x′1 के बराबर है β 1β^1 में y = β 0 + β 1 एक्स 1y=β0+β1x1 । हमने आसान वर्ग गणना के लिए समीकरण को कम कर दिया है।

आप इस विधि को सामान्य रूप से कैसे लागू करते हैं? अब मेरे पास मॉडल y = β 1 ई एक्स 1 टी + β 2 ई एक्स 2 टीy=β1ex1t+β2ex2t , मैं इसे y = \ beta_1x ' तक कम करने का प्रयास कर रहा हूं y = β 1 एक्स 'y=β1x′।


आप किस प्रकार के डेटा का विश्लेषण कर रहे हैं, और आप अपने मॉडल से , को क्यों निकालना चाहते हैं । इसके अलावा, क्या कोई कारण है कि आप इंटरसेप्ट को हटा रहे हैं? यदि आप डेटा को केंद्र में रखते हैं, तो ढलान मॉडल के साथ / बिना अवरोधन के समान होगा, लेकिन अवरोधन वाला मॉडल आपके डेटा को बेहतर तरीके से फिट करेगा। ई एक्स 1 टीex1t
— काबर्के

@caburke मैं मॉडल के फिट होने के बारे में चिंतित नहीं हूं, क्योंकि मैंने और गणना करने के बाद उन्हें वापस मॉडल में डाल दिया है। इस अभ्यास के लिए बिंदु का अनुमान । मूल समीकरण को केवल y = \ beta_1x ' तक कम करके , कम से कम वर्ग गणना आसान हो जाएगी (x' जो मैं जानने की कोशिश कर रहा हूं उसका हिस्सा है, इसमें ई ^ {x_1t} शामिल हो सकता है )। मैं तंत्र को सीखने की कोशिश कर रहा हूं, यह एक किताब टकी का एक सवाल है। β 1 β 2 β 1 y = β 1 एक्स ' ई एक्स 1 टीβ1β2β1y=β1x′ex1t
— कृपाण CN

@ आपकी टिप्पणी के अंत में अवलोकन हैरान करने वाला है। यह संभवत: अशुभ अभिव्यक्तियों पर लागू नहीं हो सकता है - उनमें ऐसी कोई भी चीज़ नहीं है जिसे यथोचित रूप से "ढलान" माना जा सकता है - लेकिन यह ओएलएस सेटिंग में सही नहीं है: औसत-केंद्रित डेटा के लिए फिट उतना ही अच्छा है एक अवरोधन के साथ फिट। कृपाण, आपका मॉडल अस्पष्ट है: में से कौन सा चर हैं और कौन से पैरामीटर हैं? इच्छित त्रुटि संरचना क्या है? (और Tukey के पुस्तकों की है जहाँ से आप सवाल है?)β 1 , β 2 , x 1 , x 2 , tβ1,β2,x1,x2,t
— whuber

1
@whuber यह Tukey की पुस्तक "डेटा विश्लेषण और प्रतिगमन: आंकड़ों में एक दूसरा कोर्स" अध्याय 14A से है। वे पैरामीटर हैं जो हम अनुमान लगाने की कोशिश कर रहे हैं, वे प्रत्येक हैं जो n अवलोकनों के साथ हैं, मुझे लगता है कि यह समय चर के साथ जुड़ा हुआ है, हालांकि यह निर्दिष्ट नहीं किया गया था। त्रुटि सामान्य होनी चाहिए और इस प्रश्न को अनदेखा किया जा सकता है। β 1 , β 2 x 1 , x 2 tβ1,β2x1,x2t
— कृपाण सीएन

1
@ जब मैं ज्यादातर पोस्ट के पहले भाग की बात कर रहा था, लेकिन मेरी टिप्पणी में यह स्पष्ट नहीं था। मेरा क्या मतलब था कि यदि आप केवल मीन- मतलब रखते हैं , तो नहीं , जैसा कि ओपी में सुझाया जा रहा था, और फिर इंटरसेप्ट को हटा दें, तो फिट और खराब हो जाएगा, क्योंकि जरूरी नहीं कि यह उस स्थिति में हो, जब । ढलान ओपी की अंतिम पंक्ति में वर्णित मॉडल में गुणांक के लिए एक अच्छा शब्द नहीं है। xxyyˉy=0y¯=0
— काबर्के

जवाबों:


38

यद्यपि मैं यहाँ प्रश्न के साथ न्याय नहीं कर सकता हूँ - इसके लिए एक छोटे मोनोग्राफ की आवश्यकता होगी - यह कुछ प्रमुख विचारों को फिर से समझने में मददगार हो सकता है।

प्रश्न

आइए प्रश्न को बहाल करने और अस्पष्ट शब्दावली का उपयोग करके शुरू करें। डेटा का आदेश दिया जोड़ों की सूची से मिलकर बनता है । ज्ञात स्थिरांक और मानों को निर्धारित करते हैं और । हम एक मॉडल प्रस्तुत करते हैं जिसमें(ti,yi)(ti,yi) α1α1α2α2x1,i=exp(α1ti)x1,i=exp(α1ti)x2,i=exp(α2ti)x2,i=exp(α2ti)

yi=β1x1,i+β2x2,i+εi

yi=β1x1,i+β2x2,i+εi

के लिए स्थिरांक और , अनुमान लगाया जा करने के लिए यादृच्छिक रहे हैं, और - वैसे भी एक अच्छा सन्निकटन के लिए - स्वतंत्र और एक आम विचरण (जिसका आकलन ब्याज की भी है) हो रही है।β1β1β2β2εiεi

पृष्ठभूमि: रैखिक "मिलान"

Mosteller और Tukey का उल्लेख चर x 1 = ( x 1 , 1 , x 1 , 2 , … ) और x 2 के रूप में "मेल खाता है।" उन्हें विशिष्ट तरीके से y = ( y 1 , y 2 , ... ) के मूल्यों का "मिलान" करने के लिए उपयोग किया जाएगा , जिसे मैं चित्रित करूंगा। अधिक आम तौर पर, y और x को एक ही यूक्लिडियन सदिश स्थान में कोई भी दो वैक्टर, " y " और x की भूमिका निभाते हैं।x1(x1,1,x1,2,…)x2y=(y1,y2,…)yxyxकि "माचिस"। हम कई λ x द्वारा y लगभग अनुमानित करने के लिए एक गुणांक λ को व्यवस्थित रूप से अलग करने पर विचार करते हैं । सबसे अच्छा सन्निकटन तब प्राप्त होता है जब λ x यथासंभव y के करीब होता है। समान रूप से, y - λ x की चुकता लंबाई कम से कम है।λyλxλxyy−λx

इस मिलान प्रक्रिया की कल्पना करने का एक तरीका यह है कि x और y का एक स्कैल्पलॉट बनाया जाए जिस पर x → λ x का ग्राफ खींचा जाए । स्कैप्लेट पॉइंट्स और इस ग्राफ के बीच की ऊर्ध्वाधर दूरियाँ अवशिष्ट वेक्टर y के घटक हैं - λ x ; उनके वर्गों का योग यथासंभव छोटा किया जाना है। आनुपातिकता के एक निरंतरता तक, ये वर्ग उन बिंदुओं पर केंद्रित हलकों के क्षेत्र हैं ( x i , y i ) जो अवशिष्ट के बराबर त्रिज्या के साथ हैं: हम इन सभी मंडलियों के क्षेत्रों का योग कम से कम करना चाहते हैं।xyx→λx y−λx(xi,yi)

मध्य पैनल में λ का इष्टतम मान दिखाने वाला एक उदाहरण यहां दिया गया है :λ

Panel

स्कैप्लॉट में बिंदु नीले हैं; x → λ x का ग्राफ एक लाल रेखा है। यह दृष्टांत इस बात पर जोर देता है कि लाल रेखा मूल ( 0 , 0 ) से होकर गुजरने के लिए विवश है : यह लाइन फिटिंग का एक विशेष मामला है।x→λx(0,0)

अनुक्रमिक मिलान द्वारा एकाधिक प्रतिगमन प्राप्त किया जा सकता है

प्रश्न की सेटिंग पर लौटते हुए, हमारे पास एक लक्ष्य y और दो माचिस x 1 और x 2 हैं । हम संख्या की तलाश ख 1 और बी 2 , जिसके लिए y द्वारा यथासंभव करीबी रूप से अनुमानित किया गया है ख 1 एक्स 1 + ख 2 एक्स 2 कम से कम दूरी की भावना में फिर से,। एक्स 1 के साथ मनमाने ढंग से शुरुआत करते हुए , मोस्टलेर और टुकी शेष चर x 2 और y से x 1 से मेल खाते हैंyx1x2b1b2yb1x1+b2x2x1x2yx1। के रूप में इन मैचों के लिए बच गया लिखें एक्स 2 ⋅ 1 और y ⋅ 1 क्रमश: ⋅ 1 इंगित करता है कि एक्स 1 की गई चर "से बाहर ले जाया" किया है।x2⋅1y⋅1⋅1x1

हम लिख सकते है

y = λ 1 एक्स 1 + y ⋅ 1  और  एक्स 2 = λ 2 एक्स 1 + x 2 ⋅ 1 ।

y=λ1x1+y⋅1 and x2=λ2x1+x2⋅1.

लेने के बाद एक्स 1 से बाहर एक्स 2 और y , हम लक्ष्य बच मिलान करने के लिए आगे बढ़ना y ⋅ 1 मिलान बच करने के लिए x 2 ⋅ 1 । अंतिम बच रहे हैं y ⋅ 12 । बीजगणितीय रूप से, हमने लिखा हैx1x2yy⋅1x2⋅1y⋅12

y ⋅ 1 = λ 3 एक्स 2 ⋅ 1 + y ⋅ 12 ;  जिस कारण से y = λ 1 एक्स 1 + y ⋅ 1 = λ 1 एक्स 1 + λ 3 एक्स 2 ⋅ 1 + y ⋅ 12 = λ 1 एक्स 1 + λ 3 ( एक्स 2 - λ 2 एक्स 1 ) +y ⋅ 12= ( Λ 1 - λ 3 λ 2 ) एक्स 1 + λ 3 एक्स 2 + y ⋅ 12 ।

y⋅1y=λ3x2⋅1+y⋅12; whence=λ1x1+y⋅1=λ1x1+λ3x2⋅1+y⋅12=λ1x1+λ3(x2−λ2x1)+y⋅12=(λ1−λ3λ2)x1+λ3x2+y⋅12.

इससे पता चलता है कि अंतिम चरण में λ 3 x 1 और x 2 से y के मिलान में x 2 का गुणांक है ।λ3x2x1x2y

हम बस के रूप में अच्छी तरह से पहले लेने से रवाना किया जा सकता था एक्स 2 से बाहर एक्स 1 और y , उत्पादन एक्स 1 ⋅ 2 और y ⋅ 2 , और फिर लेने एक्स 1 ⋅ 2 से बाहर y ⋅ 2 , बच का एक अलग सेट उपज y ⋅ २१ । इस बार, के गुणांक एक्स 1 अंतिम चरण में पाया - के फोन यह जाने μ 3 के गुणांक --is एक्स 1 का मिलान में एक्स 1 औरx2x1yx1⋅2y⋅2x1⋅2y⋅2y⋅21x1μ3x1x1x2x2 to yy.

Finally, for comparison, we might run a multiple (ordinary least squares regression) of yy against x1x1 and x2x2. Let those residuals be y⋅lmy⋅lm. It turns out that the coefficients in this multiple regression are precisely the coefficients μ3μ3 and λ3λ3 found previously and that all three sets of residuals, y⋅12y⋅12, y⋅21y⋅21, and y⋅lmy⋅lm, are identical.

Depicting the process

इसमें से कोई भी नया नहीं है: यह सब पाठ में है। मैं एक सचित्र विश्लेषण की पेशकश करना चाहूंगा, जो हमने अब तक प्राप्त की गई सभी चीजों के एक बिखरे हुए मैट्रिक्स का उपयोग करके किया है।

Scatterplot

क्योंकि इन डेटा प्रेरित होती है, हमने अंतर्निहित "सही" का मान दिखाने के लक्जरी है y पिछले पंक्ति और स्तंभ पर: इन मूल्यों हैं बीटा 1 एक्स 1 + β 2 एक्स 2 में जोड़ा त्रुटि के बिना।yβ1x1+β2x2

विकर्ण के नीचे के स्क्रैपप्लेट्स को मैचर्स के ग्राफ के साथ सजाया गया है, बिल्कुल पहले आंकड़े की तरह। शून्य ढलान वाले रेखांकन लाल रंग में खींचे जाते हैं: ये उन स्थितियों को इंगित करते हैं जहां मिलान करने वाला हमें कुछ भी नया नहीं देता; अवशिष्ट लक्ष्य के समान हैं। इसके अलावा, संदर्भ के लिए, मूल (जहां भी यह एक भूखंड के भीतर दिखाई देता है) एक खुले लाल सर्कल के रूप में दिखाया गया है: याद रखें कि सभी संभव मिलान लाइनों को इस बिंदु से गुजरना होगा।

इस भूखंड का अध्ययन करके प्रतिगमन के बारे में बहुत कुछ सीखा जा सकता है। हाइलाइट्स में से कुछ हैं:

  • The matching of x2x2 to x1x1 (row 2, column 1) is poor. This is a good thing: it indicates that x1x1 and x2x2 are providing very different information; using both together will likely be a much better fit to yy than using either one alone.

  • Once a variable has been taken out of a target, it does no good to try to take that variable out again: the best matching line will be zero. See the scatterplots for x2⋅1x2⋅1 versus x1x1 or y⋅1y⋅1 versus x1x1, for instance.

  • The values x1x1, x2x2, x1⋅2x1⋅2, and x2⋅1x2⋅1 have all been taken out of y⋅lmy⋅lm.

  • Multiple regression of yy against x1x1 and x2x2 can be achieved first by computing y⋅1y⋅1 and x2⋅1x2⋅1. These scatterplots appear at (row, column) = (8,1)(8,1) and (2,1)(2,1), respectively. With these residuals in hand, we look at their scatterplot at (4,3)(4,3). These three one-variable regressions do the trick. As Mosteller & Tukey explain, the standard errors of the coefficients can be obtained almost as easily from these regressions, too--but that's not the topic of this question, so I will stop here.

Code

These data were (reproducibly) created in R with a simulation. The analyses, checks, and plots were also produced with R. This is the code.

#
# Simulate the data.
#
set.seed(17)
t.var <- 1:50                                    # The "times" t[i]
x <- exp(t.var %o% c(x1=-0.1, x2=0.025) )        # The two "matchers" x[1,] and x[2,]
beta <- c(5, -1)                                 # The (unknown) coefficients
sigma <- 1/2                                     # Standard deviation of the errors
error <- sigma * rnorm(length(t.var))            # Simulated errors
y <- (y.true <- as.vector(x %*% beta)) + error   # True and simulated y values
data <- data.frame(t.var, x, y, y.true)

par(col="Black", bty="o", lty=0, pch=1)
pairs(data)                                      # Get a close look at the data
#
# Take out the various matchers.
#
take.out <- function(y, x) {fit <- lm(y ~ x - 1); resid(fit)}
data <- transform(transform(data, 
  x2.1 = take.out(x2, x1),
  y.1 = take.out(y, x1),
  x1.2 = take.out(x1, x2),
  y.2 = take.out(y, x2)
), 
  y.21 = take.out(y.2, x1.2),
  y.12 = take.out(y.1, x2.1)
)
data$y.lm <- resid(lm(y ~ x - 1))               # Multiple regression for comparison
#
# Analysis.
#
# Reorder the dataframe (for presentation):
data <- data[c(1:3, 5:12, 4)]

# Confirm that the three ways to obtain the fit are the same:
pairs(subset(data, select=c(y.12, y.21, y.lm)))

# Explore what happened:
panel.lm <- function (x, y, col=par("col"), bg=NA, pch=par("pch"),
   cex=1, col.smooth="red",  ...) {
  box(col="Gray", bty="o")
  ok <- is.finite(x) & is.finite(y)
  if (any(ok))  {
    b <- coef(lm(y[ok] ~ x[ok] - 1))
    col0 <- ifelse(abs(b) < 10^-8, "Red", "Blue")
    lwd0 <- ifelse(abs(b) < 10^-8, 3, 2)
    abline(c(0, b), col=col0, lwd=lwd0)
  }
  points(x, y, pch = pch, col="Black", bg = bg, cex = cex)    
  points(matrix(c(0,0), nrow=1), col="Red", pch=1)
}
panel.hist <- function(x, ...) {
  usr <- par("usr"); on.exit(par(usr))
  par(usr = c(usr[1:2], 0, 1.5) )
  h <- hist(x, plot = FALSE)
  breaks <- h$breaks; nB <- length(breaks)
  y <- h$counts; y <- y/max(y)
  rect(breaks[-nB], 0, breaks[-1], y,  ...)
}
par(lty=1, pch=19, col="Gray")
pairs(subset(data, select=c(-t.var, -y.12, -y.21)), col="Gray", cex=0.8, 
   lower.panel=panel.lm, diag.panel=panel.hist)

# Additional interesting plots:
par(col="Black", pch=1)
#pairs(subset(data, select=c(-t.var, -x1.2, -y.2, -y.21)))
#pairs(subset(data, select=c(-t.var, -x1, -x2)))
#pairs(subset(data, select=c(x2.1, y.1, y.12)))

# Details of the variances, showing how to obtain multiple regression
# standard errors from the OLS matches.
norm <- function(x) sqrt(sum(x * x))
lapply(data, norm)
s <- summary(lm(y ~ x1 + x2 - 1, data=data))
c(s$sigma, s$coefficients["x1", "Std. Error"] * norm(data$x1.2)) # Equal
c(s$sigma, s$coefficients["x2", "Std. Error"] * norm(data$x2.1)) # Equal
c(s$sigma, norm(data$y.12) / sqrt(length(data$y.12) - 2))        # Equal

1
Could multiple regression of yy against x1x1 and x2x2 still be achieved by first computing y.1y.1 and x2.1x2.1 if x1x1 and x2x2 were correlated? Wouldn't it then make a big difference whether we sequentially regressed yy on x1x1 and x2.1x2.1 or on x2x2 and x1.2x1.2 ? How does this relate to one regression equation with multiple explanatory variables?
— miura

1
@miura, One of the leitmotifs of that chapter in Mosteller & Tukey is that when the xixi are correlated, the partials xi⋅jxi⋅j have low variances; because their variances appear in the denominator of a formula for the estimation variance of their coefficients, this implies the corresponding coefficients will have relatively uncertain estimates. That's a fact of the data, M&T say, and you need to recognize that. It makes no difference whether you start the regression with x1 or x2: compare y.21 to y.12 in my code.
— whuber

1
I came across this today, here is what I think on the question by @miura, Think of a 2 dimensional space where Y is to be projected as a combination of two vectors. y = ax1 + bx2 + res (=0). Now think of y as a combination of 3 variables, y = ax1 + bx2 + cx3. and x3 = mx1 + nx2. so certainly, the order in which you choose your variables is going to effect the coefficients. The reason for this is: the minimum error here can be obtained by various combinations. However, in few examples, the minimum error can be obtained by only one combination and that is where the order will not matter.
— Gaurav Singhal

@whuber Can you elaborate on how this equation might be used for a multivariate regression that also has a constant term ? ie y = B1 * x1 + B2 * x2 + c ? It is not clear to me how the constant term can be derived. Also I understand in general what was done for the 2 variables, enough at least to replicate it in Excel. How can that be expanded to 3 variables ? x1, x2, x3. It seems clear that we would need to remove x3 first from y, x1, and x2. then remove x2 from x1 and y. But it is not clear to me how to then get the B3 term.
— Fairly Nerdy

I have answered some of my questions I have in the comment above. For a 3 variable regression, we would have 6 steps. Remove x1 from x2, from x3, and from y. Then remove x2,1 from x3,1 and from y1. Then remove x3,21 from y21. That results in 6 equations, each of which is of the form variable = lamda * different variable + residual. One of those equations has a y as the first variable, and if you just keep substituting the other variables in, you get the equation you need
— Fairly Nerdy
हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.