হোসমার-লেমেশো পরীক্ষায় এর স্বাধীনতার ডিগ্রি


33

লজিস্টিক রিগ্রেশন মডেলের ফিটনেস (জিওএফ) এর হোস্টার-লেমশো পরীক্ষার (এইচএলটি) পরীক্ষার পরিসংখ্যানটি নীচে সংজ্ঞায়িত করা হয়েছে:

নমুনা তারপর বিভক্ত করা deciles, , এক নির্ণয় নিম্নলিখিত পরিমাণে decile প্রতি:ডি 1 , ডি 2 , , ডি ডিd=10D1,D2,,Dd

  • O1d=iDdyi , অর্থাত্ ধনাত্মক মামলার পরিলক্ষিত সংখ্যা ;Dd
  • O0d=iDd(1yi) , অর্থাত্ নেতিবাচক মামলার পরিলক্ষিত সংখ্যা ;Dd
  • E1d=iDdπ^i , অর্থাত্ ধনাত্মক কেসের আনুমানিক সংখ্যা ;Dd
  • E0d=iDd(1π^i) , অর্থাত্ ডেসিল নেতিবাচক মামলার আনুমানিক সংখ্যা ;Dd

যেখানে হ'ল তম পর্যবেক্ষণের জন্য বাইনারি ফলাফল এবং সেই পর্যবেক্ষণের আনুমানিক সম্ভাবনা।yiiπ^i

তারপরে পরীক্ষার পরিসংখ্যানগুলি এর পরে সংজ্ঞায়িত করা হয়:

X2=h=01g=1d((OhgEhg)2Ehg)=g=1d(O1gngπ^gng(1π^g)π^g)2,

যেখানে π^g decile গড় আনুমানিক সম্ভাব্যতা g দিন ng decile কোম্পানি সংখ্যা হতে হবে।

হোসমার-লেমেশোর মতে ( এই লিঙ্কটি দেখুন ) এই পরিসংখ্যানটির (certain ডিগ্রি স্বাধীনতার ডিগ্রি সহ একটি বিতরণ । χ2(d2)

অন্যদিকে , আমি যদি সারি (ডেস্কলগুলির সাথে মিলিত) এবং 2 টি কলাম (সত্য / মিথ্যা বাইনারি ফলাফলের সাথে সঙ্গতিপূর্ণ) সহ একটি কনজিঞ্জেন্সি টেবিলটি সংজ্ঞায়িত করি তবে এই সংঘাতের সারণির জন্য পরীক্ষার পরীক্ষার-পরিসংখ্যান would হিসাবে একই উপরে সংজ্ঞায়িত অবশ্য অনিশ্চিত টেবিল ক্ষেত্রে, এই পরীক্ষাটি পরিসংখ্যাত হয় সঙ্গে স্বাধীন ডিগ্রীগুলিরআরও এক ডিগ্রি স্বাধীনতা !dχ2X2χ2(d1)(21)=d1

স্বাধীনতার ডিগ্রি সংখ্যার মধ্যে এই পার্থক্য কীভাবে ব্যাখ্যা করা যায়?

সম্পাদনা: মন্তব্য পড়ার পরে সংযোজন:

@whuber

তারা বলে ( হোস্টার ডিডাব্লু, লেমেশো এস। (1980), একাধিক লজিস্টিক রিগ্রেশন মডেলটির জন্য একটি ধার্মিকতা-পরীক্ষা-নিরীক্ষা। পরিসংখ্যানগুলিতে যোগাযোগ, A10, 1043-1069 ) যে মুর এবং স্প্রিল দ্বারা প্রদর্শিত একটি উপপাদ্য রয়েছে এটি অনুসরণ করে যে যদি (1) পরামিতিগুলি অনগ্রুপযুক্ত ডেটার সম্ভাবনা ফাংশনগুলি ব্যবহার করে এবং (2) 2xg টেবিলের ফ্রিকোয়েন্সিগুলি আনুমানিক পরামিতিগুলির উপর নির্ভর করে, তবে কোষগুলি এলোমেলো, স্থির নয়, তারপরে উপযুক্ত নিয়মিততার পরিস্থিতিতে (1) এবং (2) এর অধীনে ফিট পরিসংখ্যানগুলির সদ্ব্যবহার হ'ল আনুমানিক প্যারামিটার এবং ওয়েট চি-স্কোয়ার ভেরিয়েবলের যোগফলের কারণে স্বাধীনতার ডিগ্রিগুলির স্বাভাবিক হ্রাস সহ একটি কেন্দ্রীয় চি-বর্গক্ষেত্র।

তারপরে, আমি যদি তাদের কাগজগুলি ভালভাবে বুঝতে পারি তবে তারা এই 'সংশোধন শব্দটির' জন্য একটি সান্নিধ্যের সন্ধান করার চেষ্টা করে যা আমি যদি এটি ভালভাবে বুঝতে পারি তবে চি-বর্গের এলোমেলো ভেরিয়েবলগুলির এই ভারিত যোগফল এবং তারা সিমুলেশন তৈরি করে এটি করে তবে আমি অবশ্যই স্বীকার করতে হবে যে তারা সেখানে কী বলে আমি পুরোপুরি বুঝতে পারি না, তাই আমার প্রশ্ন; কেন এই কোষগুলি এলোমেলো, কীভাবে এটি স্বাধীনতার ডিগ্রিগুলিকে প্রভাবিত করে? যদি আমি ঘরগুলির সীমানা ঠিক করি এবং তারপরে আমি আনুমানিক স্কোরের উপর ভিত্তি করে নির্দিষ্ট কোষগুলিতে পর্যবেক্ষণগুলি শ্রেণিবদ্ধ করি তবে সে ক্ষেত্রে কোষের 'সামগ্রী' থাকা সত্ত্বেও ঘরগুলি এলোমেলো নয়?

@ ফ্র্যাঙ্ক হেরেল: হোস্টার-লেমশো পরীক্ষার যে 'ত্রুটিগুলি' আপনি নীচে আপনার মন্তব্যে উল্লেখ করেছেন, তা কি চি-স্কোয়ারের ওজনযুক্ত যোগফলের সান্নিধ্যের ফলাফল ?


9
বইটিতে এই পরীক্ষার বিস্তারিত বিবরণ এবং এর ভিত্তি রয়েছে contains আপনার প্রশ্নের পিপি 145-149 এ সম্পূর্ণরূপে উত্তর দেওয়া হয়েছে। পরীক্ষায় স্বাধীনতার ডিগ্রি নির্ধারণ করা একটি সূক্ষ্ম জিনিস, কারণ এই পরীক্ষাগুলির বেশিরভাগই আনুমানিক (প্রথম স্থানে) হয় এবং এই সংমিতিগুলি তখনই ভাল যখন আপাতদৃষ্টিতে ছোটখাটো প্রযুক্তিগত শর্ত প্রয়োগ হয়। এই সমস্ত বিষয়ে কিছু আলোচনার জন্য, stats.stackexchange.com/a/17148 দেখুন । এইচএন্ডএল একটি নিখুঁত ব্যবহারিক রুট নিয়েছে: তারা তাদের " ডি -2 ডিএফ-র একটি বিস্তৃত সেট" - এর উপর ভিত্তি করে ডি - 2 ডিএফ-এর সুপারিশটি ভিত্তি করে । χ2d2
হোবার

4
(১) ক্ষমতার অভাব, (২) অবিচ্ছিন্ন সম্ভাবনার বাইনিং এবং (৩) বিনিংয়ের পছন্দ এবং সিদ্ধান্তের সংজ্ঞা বাছাইয়ের ক্ষেত্রে স্বেচ্ছাচারিতার কারণে এই পরীক্ষাটি এখন অপ্রচলিত হিসাবে বিবেচিত হয়। হোসমার - লে সেসি 1 ডিএফ পরীক্ষা বা স্পিগেলহাল্টার পরীক্ষা করার পরামর্শ দেওয়া হয়। উদাহরণস্বরূপ আর rmsপ্যাকেজ residuals.lrmএবং val.probফাংশনগুলি দেখুন।
ফ্র্যাঙ্ক হ্যারেল

2
@ ফ্র্যাঙ্ক হেরেল: (ক) এমনকি হোসমার-লেমশো পরীক্ষাটি অপ্রচলিত বলে আমি মনে করি, এখনও সাথে পার্থক্যটি বুঝতে আগ্রহী এবং (খ) আপনার কাছে এমন একটি উল্লেখ রয়েছে যা দেখায় যে স্পাইগেলহাল্টার পরীক্ষায় হোসমারের চেয়ে বেশি শক্তি রয়েছে? -লেমশো পরীক্ষা? χ2

2
এই প্রশ্নের মূল প্রশ্নের তুলনায় আইএমএইচও খুব ছোট are
ফ্রাঙ্ক হ্যারেল

3
আমি মনে করি বিশদটি এই সাইটে অন্য কোথাও প্রদর্শিত হবে। সংক্ষেপে, (1) হোমার পরীক্ষাটি নির্বিচারে দেখিয়েছিলেন - ডেসিক্যালগুলি কীভাবে গণনা করা হয় তা সম্পর্কে খুব সংবেদনশীল; (2) এটি শক্তি অভাব। আপনি দেখতে পাচ্ছেন যে এটি বিন্যাসকৃত ক্রমাঙ্কন বক্ররেখা (একটি মসৃণ ক্রমাঙ্কন বক্রের বিপরীতে) প্লট করে এবং জাম্পগুলি লক্ষ্য করে অসম্পূর্ণ পরিমাণের উপর ভিত্তি করে। এছাড়াও, চূড়ান্ত ওভারফিটিংয়ের জন্য এটি সঠিকভাবে শাস্তি দেয় না।
ফ্র্যাঙ্ক হ্যারেল

উত্তর:


2

হোসমার ডিডাব্লু, লেমেশো এস। (1980), একাধিক লজিস্টিক রিগ্রেশন মডেলটির জন্য গডনেস-অফ-ফিট পরীক্ষা। পরিসংখ্যানগুলিতে যোগাযোগ, A10, 1043-1069 দেখায় যে:

যদি মডেলটি লজিস্টিক রিগ্রেশন মডেল হয় এবং প্যারামিটারগুলি সর্বাধিক সম্ভাবনা দ্বারা অনুমান করা হয় এবং জি গ্রুপগুলি অনুমানিত সম্ভাবনার উপর নির্ধারিত হয় তবে এটি ধারণ করে যে এক্স 2 অ্যাসিপটোটিকভাবে χ 2 ( জি - পি - 1 ) + পি + 1 i = 1 λ i χ 2 i ( 1 ) (হোসমার, লেমেশো, 1980, পি। 1052, উপপাদ্য 2)।pGX2χ2(Gp1)+i=1p+1λiχi2(1)

(দ্রষ্টব্য: প্রয়োজনীয় শর্তাদি 1052 পৃষ্ঠার উপপাদ্য 2 এ স্পষ্টভাবে নয় তবে যদি কেউ মনোযোগ সহকারে কাগজ এবং প্রমাণটি পড়ে থাকেন তবে এই পপ আপ)

দ্বিতীয় শব্দটি গ্রুপিংটি আনুমানিক - অর্থাত এলোমেলো - পরিমাণের ভিত্তিতে (হোসমার, লেমেশো, 1980, পি। 1051) এর ভিত্তিতে ফলাফল থেকে আসেi=1p+1λiχi2(1)

সিমুলেশন ব্যবহার করে তারা দেখিয়েছিল যে দ্বিতীয় শব্দটি (সিমুলেশন ক্ষেত্রে ব্যবহৃত ক্ষেত্রে) প্রায় (হোসমার, লেমেশো, 1980, পি । 1060) দ্বারা প্রায় হতে পারেχ2(p1)

এই দুটি সত্যের সংমিশ্রণের ফলে দুটি ভেরিয়েবলের সমষ্টি হয়, একটি জি - পি - 1 ডিগ্রি স্বাধীনতার সাথে এবং দ্বিতীয়টি পি - 1 ডিগ্রি স্বাধীনতা বা এক্স 2χ 2 ( জি - পি - 1 + পি - - 1 = জি - 2 )χ2Gp1p1X2χ2(Gp1+p1=G2)

সুতরাং প্রশ্নের উত্তরটি 'ওজনযুক্ত চি-বর্গক্ষেত্র শব্দ' এর উপস্থিতির মধ্যে বা এই গোষ্ঠীগুলিতে নির্ধারিত সম্ভাব্য সম্ভাবনাগুলি যা তারা নিজেরাই এলোমেলো ভেরিয়েবলগুলি ব্যবহার করে সংজ্ঞায়িত করা হয় তার মধ্যে অন্তর্ভুক্ত।

আরও দেখুন Hosmer Lemeshow (1980) কাগজ - উপপাদ্য 2


'So the answer to the question lies in the occurrence of the 'weighted chi-square term' and in the fact that the groups are defined using estimated probabilities that are themselves random variables.' A) The estimated probabilities makes that you get an extra reduction of p+1, which makes the main difference to the case of the contingency table (in which only g terms are estimated). B) The weighted chi-square term occurs as a correction because the estimate is not a likelihood estimate or equally efficient, and this makes that the effect of the reduction is less extra than (p+1).
Sextus Empiricus

@Martijn Weterings: Am I right if I conclude that what you say in this comment is not exactly the same explanation (not to say completely different) as what you say in your answer ? Does your comment lead to the conclusion that the df are G2 ?

My answer explains the intuition behind the difference in degrees of freedom compared to the reasoning based on "the test-statistic for the χ2 test for this contingency table", it explains why they are different (case estimating fixed cells). It focuses on the 'usual reduction' from which you would conclude that the df would be G-3. However, certain conditions for the 'usual reduction' are not met. For this reason (random cells) you get the more complicated terms with the weighted chi-square term as a correction and you effectively end up with G-2. It is far from completely different.
Sextus Empiricus

@ Martijn Weterings, sorry but I can't upvote because I don't see any notion like 'random cells' in your answer at all, do you mean that al your nice pictures (and I mean this, they are very nice) explain something about 'random cells' or did you come up with that notion after reading my answer ?

Don't be sorry. I agree that my answer is not an exact answer to show exactly the degrees of freedom in the HL test. I am sorry for that. What you have is Chernoff Lehman statistic (with also random cells) that follows a i=1ks1χ2(1)+i=ksk1λiχi2(1) distribution. It is currently unclear to me what part is troubling you, I hope you can be more constructive in this. If you want all explained, you already have the articles for that. My answer just tackled the i=1ks1χ2(1) explaining the main difference to contingency table test.
Sextus Empiricus

2

The theorem that you refer to (the usual reduction part "usual reduction of degrees of freedom due to estimated parameters") has been mostly advocated by R.A. Fisher. In 'On the interpretation of Chi Square from Contingency Tables, and the Calculation of P' (1922) he argued to use the (R1)(C1) rule and in 'The goodness of fit of regression formulae' (1922) he argues to reduce the degrees of freedom by the number of parameters used in the regression to obtain expected values from the data. (It is interesting to note that people misused the chi-square test, with wrong degrees of freedom, for more than twenty years since it's introduction in 1900)

Your case is of the second kind (regression) and not of the former kind (contingency table) although the two are related in that they are linear restrictions on the parameters.

Because you model the expected values, based on your observed values, and you do this with a model that has two parameters, the 'usual' reduction in degrees of freedom is two plus one (an extra one because the O_i need to sum up to a total, which is another linear restriction, and you end up effectively with a reduction of two, instead of three, because of the 'in-efficiency' of the modeled expected values).


The chi-square test uses a χ2 as a distance measure to express how close a result is to the expected data. In the many versions of the chi-square tests the distribution of this 'distance' is related to the sum of deviations in normal distributed variables (which is true in the limit only and is an approximation if you deal with non-normal distributed data).

For the multivariate normal distribution the density function is related to the χ2 by

f(x1,...,xk)=e12χ2(2π)k|Σ|

with |Σ| the determinant of the covariance matrix of x

and χ2=(xμ)TΣ1(xμ) is the mahalanobis distance which reduces to the Euclidian distance if Σ=I.

In his 1900 article Pearson argued that the χ2-levels are spheroids and that he can transform to spherical coordinates in order to integrate a value such as P(χ2>a). Which becomes a single integral.


It is this geometrical representation, χ2 as a distance and also a term in density function, that can help to understand the reduction of degrees of freedom when linear restrictions are present.

First the case of a 2x2 contingency table. You should notice that the four values OiEiEi are not four independent normal distributed variables. They are instead related to each other and boil down to a single variable.

Lets use the table

Oij=o11o12o21o22

then if the expected values

Eij=e11e12e21e22

where fixed then oijeijeij would be distributed as a chi-square distribution with four degrees of freedom but often we estimate the eij based on the oij and the variation is not like four independent variables. Instead we get that all the differences between o and e are the same

(o11e11)=(o22e22)=(o21e21)=(o12e12)=o11(o11+o12)(o11+o21)(o11+o12+o21+o22)

and they are effectively a single variable rather than four. Geometrically you can see this as the χ2 value not integrated on a four dimensional sphere but on a single line.

Note that this contingency table test is not the case for the contingency table in the Hosmer-Lemeshow test (it uses a different null hypothesis!). See also section 2.1 'the case when β0 and β_ are known' in the article of Hosmer and Lemshow. In their case you get 2g-1 degrees of freedom and not g-1 degrees of freedom as in the (R-1)(C-1) rule. This (R-1)(C-1) rule is specifically the case for the null hypothesis that row and column variables are independent (which creates R+C-1 constraints on the oiei values). The Hosmer-Lemeshow test relates to the hypothesis that the cells are filled according to the probabilities of a logistic regression model based on four parameters in the case of distributional assumption A and p+1 parameters in the case of distributional assumption B.

Second the case of a regression. A regression does something similar to the difference oe as the contingency table and reduces the dimensionality of the variation. There is a nice geometrical representation for this as the value yi can be represented as the sum of a model term βxi and a residual (not error) terms ϵi. These model term and residual term each represent a dimensional space that is perpendicular to each other. That means the residual terms ϵi can not take any possible value! Namely they are reduced by the part which projects on the model, and more particular 1 dimension for each parameter in the model.


Maybe the following images can help a bit

Below are 400 times three (uncorrelated) variables from the binomial distributions B(n=60,p=1/6,2/6,3/6). They relate to normal distributed variables N(μ=np,σ2=np(1p)). In the same image we draw the iso-surface for χ2=1,2,6. Integrating over this space by using the spherical coordinates such that we only need a single integration (because changing the angle does not change the density), over χ results in 0ae12χ2χd1dχ in which this χd1 part represents the area of the d-dimensional sphere. If we would limit the variables χ in some way than the integration would not be over a d-dimensional sphere but something of lower dimension.

graphical representation of chi^2

The image below can be used to get an idea of the dimensional reduction in the residual terms. It explains the least squares fitting method in geometric term.

In blue you have measurements. In red you have what the model allows. The measurement is often not exactly equal to the model and has some deviation. You can regard this, geometrically, as the distance from the measured point to the red surface.

The red arrows mu1 and mu2 have values (1,1,1) and (0,1,2) and could be related to some linear model as x = a + b * z + error or

[x1x2x3]=a[111]+b[012]+[ϵ1ϵ2ϵ3]

so the span of those two vectors (1,1,1) and (0,1,2) (the red plane) are the values for x that are possible in the regression model and ϵ is a vector that is the difference between the observed value and the regression/modeled value. In the least squares method this vector is perpendicular (least distance is least sum of squares) to the red surface (and the modeled value is the projection of the observed value onto the red surface).

So this difference between observed and (modelled) expected is a sum of vectors that are perpendicular to the model vector (and this space has dimension of the total space minus the number of model vectors).

In our simple example case. The total dimension is 3. The model has 2 dimensions. And the error has a dimension 1 (so no matter which of those blue points you take, the green arrows show a single example, the error terms have always the same ratio, follow a single vector).

graphical representation of regression dimension reduction


I hope this explanation helps. It is in no way a rigorous proof and there are some special algebraic tricks that need to be solved in these geometric representations. But anyway I like these two geometrical representations. The one for the trick of Pearson to integrate the χ2 by using the spherical coordinates, and the other for viewing the sum of least squares method as a projection onto a plane (or larger span).

I am always amazed how we end up with oee, this is in my point of view not trivial since the normal approximation of a binomial is not a devision by e but by np(1p) and in the case of contingency tables you can work it out easily but in the case of the regression or other linear restrictions it does not work out so easily while the literature is often very easy in arguing that 'it works out the same for other linear restrictions'. (An interesting example of the problem. If you performe the following test multiple times 'throw 2 times 10 times a coin and only register the cases in which the sum is 10' then you do not get the typical chi-square distribution for this "simple" linear restriction)


2
In my honest opinion this answer has very nice figures and arguments that are related to χ2 test but it has not so much to do with the question which is about the Hosmer-Lemeshow test for a logistic regression. You are arguing something with a regression where 1 parameters is estimated but the Hosmer-Lemeshow test is about a logistic regression where p>1 parameters are estimated. See also stats.stackexchange.com/questions/296312/…

... and, as you say, you end up with an e in the denominator and not with a np(1p) , so this does not answer this question. Hence I have to downvote, sorry (but the graphs are very nice :-) ).

You were asking in a comment for "to understand the formula or at least the 'intuitive' explanation". So that is what you get with these geometrical interpretations. To calculate exactly how these np(1p) cancel out if you add both the positive and negative cases is far from intuitive and does not help you understand the dimensions.
Sextus Empiricus

In my answer I used the typical (d1p) degrees of freedom and assumed that the regression was performed with one parameter (p=1), which was a mistake. The parameters in your references are two, a β0 and β. These two parameters would have reduced the dimensionality to d-3 if only the proper conditions (efficient estimate) would have been met (see for instance again a nice article from Fisher 'The conditions under which the chi square measures the discrepancy between observation and hypothesis')....
Sextus Empiricus

....anyway, I explained why we don't get dimension d-1 (and should instead expect something like d-3, if you put two parameters in the regression) and how the dimensional reduction by an efficient estimate can be imagined. It is the Moore-Spruill article that works out the extra terms (potentially increasing the effective degrees of freedom) due to that inefficiency and it is the Hosmer-Lemeshow simulation that shows that d-2 works best. That theoretical work is far from intuitive and the simulation is far from exact. My answer is just the requested explanation for the difference with d-1.
Sextus Empiricus
আমাদের সাইট ব্যবহার করে, আপনি স্বীকার করেছেন যে আপনি আমাদের কুকি নীতি এবং গোপনীয়তা নীতিটি পড়েছেন এবং বুঝতে পেরেছেন ।
Licensed under cc by-sa 3.0 with attribution required.