You are on page 1of 60

‫بسم هللا الرحمن الرحيم‬

‫الوحدة الحادية عشرة‬


‫مساق تحليل االنحدار‪PSY752‬‬

‫‪A Categorical Independent Variable: Dummy, Effect,‬‬


‫‪and Orthogonal Coding‬‬

‫مقدمة‬

‫اقتصر الحديث فيما سبق من وحدات على تصاميم المتغيرات المستقلة أو المتنبئات فيها متغيرات متصلة‬

‫‪. continuous‬وهن اك ن وع آخ ر من المتغ يرات ه و المتغ يرات التص نيفية ‪ . categorical variable‬إن‬

‫المعلومات المحصلة من المتغيرات التصنيفية يمكن استخدامها للشرح أو التنبؤ ‪.explain or predict‬‬

‫ويمكن استخدام المتغيرات التصنيفية في تحليل االنحدار‪ ،‬بعد أن يتم ترميزها ‪ coded‬أوال‪.‬سيتم التعرض‬

‫إلى طريق ة ترم يز المتغ يرات التص نيفية في ه ذه الوح دة‪.‬وس يتم التط رق للتحلي ل في ح ال حج وم العين ات‬

‫متساوي وغير متساوي‪ .‬وسيتم في نهاية الوحدة المقارنة بين تحليل االنحدار المتعدد وتحليل التباين‪.‬‬

‫‪e.g., experimental, quasi-‬‬ ‫ويمكن اس تخدام المتغ يرات التص نيفية في تص اميم بحثي ة مختلف ة(‪,‬‬

‫‪ )experimental, nonexperimental‬ألغراض الشرح والتنبؤ‪.‬‬

‫الترميز‪ ،‬وطرق الترميز‪Coding and Methods of Coding :‬‬

‫‪1‬‬
‫‪The method of coding categorical variables and the manner in which they are‬‬
‫‪used in regression analysis is the same, regardless of the type of design and‬‬
‫‪regardless of whether the aim is explanation or prediction.‬‬
‫الترم‪--‬يز عب ارة عن مجموع ة من الرم وز يمكن تعيينه ا بحيث تعم ل على تحوي ل ح رف‪،‬أو كلم ة‪،‬أو‬

‫عب ارة أو إش ارة إلى ش كل أو رقم أو أي تمثي ل آخ ر‪ ،‬وتع يين الرم وز في عملي ة الترم يز يتب ع لقاع دة أو‬

‫مجموع ة قواع د ُتح َد د بتعري ف المتغ ير المس تخدم‪ ،‬على س بيل المث ال‪ :‬يمكن أن تعَّين مجموع ة الرم وز {‬

‫‪ }A,B,C‬لثالث معالجات مختلفة‪ .‬أونعين مجموعة الرموز {‪ }0,1‬لتشير إلى مجموعة ض ابطة وتجريبية‬

‫أو إلى ذك ور وإ ن اث‪ .‬ق د تك ون القاع دة واض حة لبعض المتغ يرات وق د تتطلب القلي ل من التوض يح ‪ ،‬في‬

‫بعض األحي ان كم ا في تع يين الص فر والواح د لل ذكور واإلن اث ‪ ،‬بينم ا تتطلب بعض المتغ يرات تعريف ات‬

‫وتوضيحات موسعة للقواعد التي قد ال يكون هناك اتفاق عليها بين جميع أو معظم المهتمين‪ ،‬مثل شرح‬

‫قواعد تصنيف المرضى المصابين بأمراض عقلية وفقا ألمراضهم ‪.‬‬

‫طرق الترميز ‪Method of Coding‬‬

‫الترميز الوهمي ( ‪) Dummy coding‬‬ ‫أ‪.‬‬

‫طريقة األثر ( ‪) Effect coding‬‬ ‫ب‪.‬‬

‫طريقة التعامد ( ‪)Orthogonal coding‬‬ ‫ت‪.‬‬

‫المتغيرات الوهمية (‪)Dummy Variables‬‬

‫‪Dummy Variables: Numeric variables used in regression analysis to represent‬‬


‫‪categorical data that can only take on one of two values: zero or one.‬‬
‫‪i.e A dummy variable is a binary variable that takes a value of 0 or 1. One adds‬‬
‫‪such variables to a regression model to represent factors which are of a binary‬‬
‫‪nature i.e. they are either observed or not observed.‬‬

‫‪2‬‬
The number of dummy variables we must create is equal to k-1 where k is the
number of different values that the categorical variable can take on.
Example 1: Create a Dummy Variable with Only Two Values
Suppose we have the following dataset and we would like to
use gender and age to predict income:

To use gender as a predictor variable in a regression


model, we must convert it into a dummy variable.
Since it is currently a categorical variable that can take
on two different values (“Male” or “Female”), we only need
to create k-1 = 2-1 = 1 dummy variable.
To create this dummy variable, we can choose one of the
values (“Male” or “Female”) to represent 0 and the other to
represent 1.
In general, we usually represent the most frequently
occurring value with a 0, which would be “Male” in this
dataset.
Thus, here’s how we would convert gender into a dummy
variable:

3
‫‪We could then use Age and Gender_Dummy as‬‬ ‫‪predictor‬‬
‫‪variables in a regression model.‬‬
‫الترميز الوهمي ( ‪) Dummy coding‬‬

‫الترميز الوهمي‬

‫‪If a matrix has only one row or only one column it is called a vector. A‬‬
‫‪matrix having only one row is called a row vector. is a row vector‬‬
‫‪because it has only one row.‬‬

‫يعتبر الترميز الوهمي أبسط طريقة لترميز المتغيرات التصنيفية‪.‬يقوم الشخص هنا بتوليد عدة ‪vectors‬‬

‫‪(vectors‬أعم دة) ‪ ،‬بحيث يش ير الرم ز‪ 1‬إلى العض وية في مجموع ة معين ة وص فر إلى ع دم العض وية في‬

‫المجموع ة في العم ود ‪ .‬بمع نى آخ ر القيم ال تي تعطى في الترم يز للمتغ يرات الوهمي ة ال تش ير إلى قي اس‬

‫‪4‬‬
‫حقيقي‪ ،‬بل تستخدم لتمييز عضوية المجموعة‪ .‬أبسط حالة يكون فيها المتغير التصنيفي يتكون من فئتين‬

‫فقط كالمجموعتين التجريبية والضابطة‪،‬أو الذكور واإلناث‪.‬‬

‫ترميز المتغيرات الوهمية الثنائية ‪A VARIABLE WITH TWO CATEGORIES‬‬

‫مث ال‪:‬للبيان ات في ج دول‪ 11.1‬لتجرب ة تن اولت بيان ات من عين ة مكون ة من ‪ 10‬أش خاص م وزعين على‬

‫مجموعتين(قد تكون تجريبية وضابطة‪ ،‬ذكور وإ ناث‪.)....،‬‬

‫تحليل االنحدار البسيط ‪Simple Regression Analysis‬‬

‫‪5‬‬
‫ لتوضيح تطبيق ترميز المتغيرات الوهمية في‬11.1‫سيتم اجراء تحليل االنحدار البسيط للبيانات في جدول‬

vector ‫العالم ات على المتغ ير الت ابع لكال المجموع تين في عم ود‬11.2‫يع رض ج دول‬. ‫ل االنح دار‬--‫تحلي‬

:‫ثالثة أعمدة منفصلة تم عرضها أيضا في الجدول‬. ‫منفصل‬

Xl is a unit vector (i.e.,all subjects are assigned 1 's in this vector( .

X2, subjects in E are assigned 1 's, whereas those in C are assigned O's.

X3, subjects in C are assigned 1 's and those in E are assigned O's

X2 and X3, then, are dummy vectors in which a categorical variable with two

categories (e.g.,E and C, male and female) was coded.

‫ تساعد في الشرح أو التنبؤ في‬X's ‫)) لمالحظة فيما إذا كانت قيم‬Y on the X's ‫يمكن اآلن ايجاد انحدار‬

‫بمع نى آخ ر الب احث يبحث فيم ا إذا ك انت المعلوم ات الم أخوذة من العض وية في مجموع ات‬.Y ‫التب اين في‬

.Y ‫مختلفة تساعد في الشرح في التباين في‬

:‫في الوحدة السادسة بينت كيف نستفيد من جبر المصفوفات في حل المعادالت كاآلتي‬

In linear algebra, the transpose of a matrix is an operator which flips a matrix over its diagonal; that
is, it switches the row and column indices of the matrix A by producing another matrix, often denoted
by AT (among other notations).[1]

6
7
8
9
‫اختبار معامل االنحدار ‪Test of the Regression Coefficient‬‬

‫أش‪-‬رت س‪-‬ابقا أن معام‪-‬ل االنح‪-‬دار‪ b‬يس‪-‬اوي انح‪-‬راف وس‪-‬ط المجموع‪-‬ة واح‪-‬د عن وس‪-‬ط المجموع‪-‬ة ص‪-‬فر‪،‬‬

‫بمع نى ‪ b‬تساوي الفرق بين وسطين‪.‬نفس القيم تم الحص ول عليه ا في (‪ and (b) )a‬في ج دول ‪، 11.3‬‬

‫)‪ .‬وبه‪-- -‬ذا‬ ‫)‪ ،‬وفي الثاني ة س البة(‬ ‫م ا ع دا في األولى موجب ة أي(‬

‫اختبار الداللة لـ ‪ b‬مكافئ الختبار الفرق بين وسطين ‪ .‬وبهذا فإن قيمة)‪ t=2.31,df=8(N-K-1‬هو نفسه‬

‫الذي تم الحصول عليه عندما طبقنا (‪.)11.1‬‬

‫االنحدار ومجموع مربعات البواقي ‪Regression and Residual Sums of Squares‬‬

‫الح ظ أن مجم وع المربع ات متط ابق في (‪ and (b) of Table 11.3 )a‬بس بب أنهم ا يعكس ان نفس‬

‫المعلومات حول عضوية المجموعة‪ ،‬بغض النظر عن الرموز المحددة لألعضاء في المجموعة‪.‬‬

‫المتغير ذو الفئات المتعددة ‪A Variable with Multiple Categories‬‬

‫سأقوم بعرض مثال يتضمن متغير ذو فئات متعددة ‪ ،‬وسأقوم بتحليل المسألة بطريقة ‪ ،ANOVA‬ومن ثم‬

‫بطريقة تحليل االنحدار المتعدد لتوضيح تطابق الطريقتين‪.‬‬

‫تحليل التباين األحادي ‪One-Way Analysis of Variance‬‬

‫‪10‬‬
‫ ويهد ف التحليل إلى بيان‬.‫يستخدم تحليل التباين األحادي الختبار الفروق بين متوسطات مجتمعين فأكثر‬

.‫ما إذا كانت أوساط المجتمعات متساوية‬

‫ بيانات لثالث مجموعات هي‬11.4‫يعرض جدول‬

Which A I and A2 are, say, two treatments for weight reduction whereas A3 is

a placebo. Or, AI, A2, and A3 may represent three different methods of teaching

reading.

Alternatively, the data may be viewed as having been obtained in

nonexperimental research.

Scores on Y would indicate their attitudes.

The three groups can, of course, represent three other kinds of categories

11
The group that gets all zeros is the base group or comparison group

Multiple Regression Analysis ‫تحليل االنحدار المتعدد‬

.‫ لتوضيح تطبيق ترميز المتغير الوهمي ذي الفئات المتعددة‬Table 11.4 ‫سأقوم اآلن باستخدام بيانات‬

. a single vector ‫ في عمود منفرد‬Y‫ تم عرض عالمات المتغير التابع‬11.5 ‫في جدول‬

‫بحل السؤال باستخدام تحليل االنحدار المتعدد‬

1-Using dummy coding,I created two vectors, Dl and D2, in Table 11.5.

2-In Dl, I assigned 1 's to subjects in group Al and 0's to subjects not in AI.

3- In D2, I assigned 1 's to subjects in group A2 and 0's to those not in

12
A2 .

Note that I am using the letter D to stand for dummy coding and a number

to indicate the group assigned 1 's in the given vector.

Thus, assuming a design with five categories, D4 would mean the dummy vector

in which group 4 is assigned 1 's. I could create also a vector in which subjects

of group A3 would be assigned l's and those not in this group would be assigned

D's.

This, however, is not necessary as the information about group membership is

exhausted by the two vectors I created. A third vector will not add any

information to that contained in the first two vectors-see the previous

discussion about the linear dependency in X when the number of coded

vectors is equal to the number of groups and about(X'X) therefore being singular.

Stated another way, knowing an individual's status on the first two coded

vectors is sufficient information about his or her group membership.

Thus, an individual who has a 1 in D 1 and a 0 in D2 belongs to group AI; one

who has a 0 in D 1 and a 1 in D2 is a member of group A2; and an individual

who has 0's in both vectors is a member of group A3•

13
In general, to code a categorical variable with g categories or groups it is

necessary to create g - 1 vectors, each of which will have 1 's for the members

of a given group and 0's for those not belonging to the group.

Because only g - 1 vectors are created, it follows that members of one group will

have 0's in all the vectors.

In the present example there are three categories and therefore I created two

vectors. Members of group A3 are assigned 0's in both vectors.

Instead of assigning l' s to groups A I and A2, I could have created two different

vectors (I do this in the computer analyses that follow). Thus, I could have

assigned 1 's to members of groups A2 and A3, respectively, in the two vectors.

In this case, members of group Al would be assigned O's in both vectors. In the

following I discuss considerations in the choice of the group assigned O's. Note,

however, that regardless of which groups are assigned 1 's, the number of

vectors necessary and sufficient for information about group membership in the

present example is two.

Nomenclature ‫التسمية‬

14
Hereafter, I will refer to members of the group assigned 1 's in a given vector as

being identified in that vector. Thus, members of A I are identified in D 1, and

members of A 2 are identified in D2(see Table 11.5).

This terminology generalizes to designs with any number of groups or categories,

as each group (except for the one assigned O's throughout) is assigned 1 's (i.e.,

identified) in one vector only and is assigned O's in the rest of the vectors.

15
16
Y D1 D2
4 1 0
5 1 0
6 1 0
7 1 0
8 1 0
7 0 1
8 0 1
9 0 1
10 0 1
11 0 1

17
1 0 0
2 0 0
3 0 0
4 0 0
5 0 0

Model Summary
Adjusted R Std. Error of the
Model R R Square Square Estimate
1 .866a .750 .708 1.581
a. Predictors: (Constant), D2, D1

ANOVAa
Model Sum of Squares df Mean Square F Sig.
1 Regression 90.000 2 45.000 18.000 .000b
Residual 30.000 12 2.500
Total 120.000 14
a. Dependent Variable: Y
b. Predictors: (Constant), D2, D1

Coefficientsa
Standardized
Unstandardized Coefficients Coefficients
Model B Std. Error Beta t Sig.
1 (Constant) 3.000 .707 4.243 .001
D1 3.000 1.000 .500 3.000 .011
D2 6.000 1.000 1.000 6.000 .000
a. Dependent Variable: Y

18
Eta squared is a measure of effect size for analysis of variance
(ANOVA) models. It is a standardized estimate of an effect size,
meaning that it is comparable across outcome variables measured
.using different units

19
‫‪Tests of Regression Coefficients‬‬ ‫اختبار معامالت االنحدار‬

‫بينا سابقا أنه عند قسمة‪ b‬على الخطأ المعياري لها يعطي ‪ t‬بدرجات حرية تساوي قيم مجموع مربعات‬

‫‪ bD1‬لـ ‪ ، bD2‬وكل قيمة من ‪ t‬درجات الحرية ‪ .12‬مما‬ ‫‪،‬‬ ‫البواقي لمعادلة االنحدار األولى ‪ t=3‬لـ ‪t=6‬‬

‫سبق عن ‪ b's in a regression equation with dummy coding‬فإن اختبار ‪ b‬مكافئ الختبار‬

‫الفرق بين وسطي المجموعة التي ينتمي لها ‪ b‬مع المجموعة المقارنة‪.‬‬

‫أن قيم ة ‪ t‬المرتبط ة بـ ‪b's‬متطابق ة م ع قيم ة ‪ t‬عن دما يتم حس اب الف رق بين مجموع ة المعالج ة‬

‫والضابطة‪.‬مثل هذه االختبارات يتم عملها وفق‪ ANOVA‬كما يأتي‪:‬‬

‫‪20‬‬
‫الح ظ أن قيم تي ‪ t‬متط ابقتين م ع م ا تم الحص ول علي ه س ابقا من ‪two b's associated with the‬‬

‫‪ .dummy vectors of Table 11.5‬وتم تعيين قيم ‪ O's‬لـ ‪ A3‬في كال العمودين‪ ، vectors‬وبهذا تخدم‬

‫كمجموعة مقارنة أو ضابطة‪.‬‬

‫‪ R‬هي اختبار‬ ‫‪2‬‬


‫عند استخدام ترميز المتغيرات الوهمية لترميز المتغيرات التصنيفية ‪ ،‬فإن قيمة ‪ F‬لفحص‬

‫الفرضية الصفرية حول تساوي أوساط المجموعات‪.‬‬

‫‪21‬‬
‫إن الترميز الوهمي ليس محدودا فقط للتصاميم التي تحوي مجموعة مقارنة أو ضابطة‪ .‬يمكن استخدامه‬

‫لترميز أي متغير تصنيفي‪.‬حيث حينما ال يحوي التصميم مجموعة مقارنة‪ ،‬سيكون تعيين المجموعة التي‬

‫تعطى القيم صفر ‪ O's‬اعتباطيا ‪.arbitrary‬‬

‫أما إذا احتوى التصميم عدة مجموعات معالجة مع واحدة ضابطة ‪ ،‬يتم تعيين القيم ‪O's in all vectors‬‬

‫للمجموعة الضابطة في كل ال‪.vectors‬‬

‫ترميز األثر ‪EFFECT CODING‬‬

‫س مي ترم يز األث ر بس‪----‬بب أن مع‪----‬امالت االنح‪----‬دار المرتبط‪----‬ة م‪----‬ع ‪ vectors‬المرم‪----‬زة تعكس آث‪----‬ار‬

‫المعالجات‪.‬األعداد المس تخدمة في الترميز هي( ‪ .)s, O's, and -1 's' 1‬وبهذا فإن ترميز األثر شبيه‬

‫بالترميز الوهمي‪ .‬الفرق يكون في أنه في الترميز الوهمي مجموعة واحدة أو فئة تعطى القيمة ‪O's in‬‬

‫‪ ،all the vectors‬بينم ا في ترم يز األث ر مجموع ة واح دة أو فئ ة تعطى القيم ة‪s in all the' 1-‬‬

‫)‪ ،vectors،(See the -1 's assigned to A3, in Table 11.6.‬وم ع أن ه ال ف رق أي مجموع ة‬

‫س تأخذ القيم ة‪ ،1-‬لكن من المالئم أن تك ون للمجموع ة األخ يرة‪ .‬وكم ا في الترم يز ال وهمي يتم تولي د‪k ,‬‬

‫‪.(the number of groups minus one) coded vectors‬ويتم تعريف كل ‪ vector‬بالقيم ة‪' 1‬‬

‫‪.s‬وكل األفراد يأخذوا العدد ‪ O's‬ما عدا أفراد المجموعة األخيرة يأخذوا القيمة‪.s' 1-‬‬

‫‪Table 11.6 displays effect coding for the data I analyzed earlier by dummy‬‬

‫‪coding. Analogous to my notation in dummy coding, I use E to stand for effect‬‬

‫‪coding along with a number indicating the group identified in the given vector.‬‬

‫‪Thus, in vector E1 of Table 11.6 I assigned 1 's to members of group At. O's to‬‬

‫‪22‬‬
members of group A2, and -1 's to members of group A3 . In vector E2, I

assigned O's to members of AI, 1 's to those of A2, and -1 's to those of A3• As

in the case of dummy coding, I use REGRESSION of SPSS to analyze the data

of Table 11.6

23
E2 E1 Y
0 1 4
0 1 5
0 1 6
0 1 7
0 1 8
1 0 7
1 0 8

24
1 0 9
1 0 10
1 0 11
-1 -1 1
-1 -1 2
-1 -1 3
-1 -1 4
-1 -1 5

Model Summaryb
Change Statistics
R Adjusted R Std. Error of the R Square F Sig. F
Model R Square Square Estimate Change Change df1 df2 Change
a
1 .866 .750 .708 1.581 .750 18.000 2 12 .000
a. Predictors: (Constant), E2, E1
b. Dependent Variable: Y

ANOVAa
Model Sum of Squares df Mean Square F Sig.
1 Regression 90.000 2 45.000 18.000 .000b
Residual 30.000 12 2.500
Total 120.000 14
a. Dependent Variable: Y
b. Predictors: (Constant), E2, E1

Coefficientsa
Model Unstandardized Coefficients Standardized t Sig.
Coefficients

25
‫‪B‬‬ ‫‪Std. Error‬‬ ‫‪Beta‬‬
‫‪1‬‬ ‫)‪(Constant‬‬ ‫‪6.000‬‬ ‫‪.408‬‬ ‫‪14.697‬‬ ‫‪.000‬‬
‫‪E1‬‬ ‫‪.000‬‬ ‫‪.577‬‬ ‫‪.000‬‬ ‫‪.000‬‬ ‫‪1.000‬‬
‫‪E2‬‬ ‫‪3.000‬‬ ‫‪.577‬‬ ‫‪.866‬‬ ‫‪5.196‬‬ ‫‪.000‬‬
‫‪a. Dependent Variable: Y‬‬

‫النموذج الخطي ثابت األثار ‪The Fixed Effects Linear Model‬‬

‫تحليل التباين ثابت األثار تم التعرض له في شكل نموذج خطي‬

‫ونموذج خطي يعني أن عالمة الفرد تكون تركيب خطي لعدد من العناصر‪.‬في معادلة(‪ )11.8‬تكونت من‬
‫ثالثة أجزاء(‪) grand mean, a treatment effect, and an error‬‬
‫وبإعادة صياغة للمعادلة(‪ )11.8‬فإن الخطأ جزء من ‪ Y ij‬غير مفسر من ‪ grand mean‬و ‪a treatment‬‬
‫‪effect‬‬

‫‪26‬‬
27
28
29
‫المقارنات المتعددة بين األوساط ‪MULTIPLE COMPARISONS AMONG MEANS‬‬

‫إذا كانت قيمة ‪ F‬دالة لـ ‪ ،R2‬هذا يقود لرفض الفرضية الصفرية (ال يوجد عالقة بين عض وية المجموع ة أو‬
‫المعالجات واألداء على المتغير التابع‪.‬‬

‫‪30‬‬
‫بالنسبة للمتغير التصنيفي الداللة اإلحصائية لـ ‪R2 μ1=μ2=μ3=…..μg(g = number of groups or‬‬
‫)‪ categories‬تعني رفض الفرضية‪.‬‬
‫رفض الفرضية الصفرية ال يعني أن جميع األوساط مختلفة عن بعضها‪.‬لتحدي د موض ع االختالف نحت اج إلى‬
‫إجراء مقارنات متعددة‪.‬‬
‫إن موضوع المقارن ات المتع ددة موض وع معق د وج دلي‪(.‬هن اك مناقش ات لب احثين تع رض لهم لمن يري د‬

‫التوسع في الكتاب)‬

‫هناك نوعين من المقارنات المتعددة ‪:‬المخطط لها ‪ ,Planned, or a priori‬والبعدية ‪,Post hoc‬‬

‫‪posteriori,‬‬ ‫‪or a‬‬

‫المقارنات البعدية ‪POST HOC COMPARISONS‬‬

‫‪31‬‬
‫س وف أقتص ر في الش رح على طريق ة ش افيه لص الحيتها لك ل المقارن ات الممكن ة(الثنائي ة والمركب ة)‪ ،‬وفي‬

‫ح ال تس اوي الحج وم بين المجموع ات أو عدم تس اويها ولكنه ا األك ثر تحفظ ا(بمع نى األق ل من بين الط رق‬

‫األخرى في إظهار فرق دال) لذلك يوصي الباحثون باستخدام طرق أخرى في المقارنات الثنائية‪.‬‬

‫‪32‬‬
33
34
‫الترميز المتعامد ‪Orthogonal Coding‬‬

‫تستخدم المعامالت من المقارنات المتعامدة في الترميز في الأعمدة ‪vectors‬المرمزة‪.‬إن الترميز في تحليل‬

‫االنحدار يعطي نتائج مباشرة وقابلة للتفسير ‪.‬‬

‫‪O2‬‬ ‫‪O1‬‬ ‫‪Y‬‬

‫‪1‬‬ ‫‪-1‬‬ ‫‪4‬‬


‫‪1‬‬ ‫‪-1‬‬ ‫‪5‬‬
‫‪1‬‬ ‫‪-1‬‬ ‫‪6‬‬
‫‪1‬‬ ‫‪-1‬‬ ‫‪7‬‬
‫‪1‬‬ ‫‪-1‬‬ ‫‪8‬‬
‫‪1‬‬ ‫‪1‬‬ ‫‪7‬‬
‫‪1‬‬ ‫‪1‬‬ ‫‪8‬‬
‫‪1‬‬ ‫‪1‬‬ ‫‪9‬‬
‫‪1‬‬ ‫‪1‬‬ ‫‪10‬‬
‫‪1‬‬ ‫‪1‬‬ ‫‪11‬‬
‫‪-2‬‬ ‫‪0‬‬ ‫‪1‬‬
‫‪-2‬‬ ‫‪0‬‬ ‫‪2‬‬
‫‪-2‬‬ ‫‪0‬‬ ‫‪3‬‬
‫‪-2‬‬ ‫‪0‬‬ ‫‪4‬‬
‫‪-2‬‬ ‫‪0‬‬ ‫‪5‬‬

‫‪35‬‬
Model Summaryb
Change Statistics
R Adjusted R Std. Error of the R Square F Sig. F
Model R Square Square Estimate Change Change df1 df2 Change
a
1 .866 .750 .708 1.581 .750 18.000 2 12 .000
a. Predictors: (Constant), O1, O2
b. Dependent Variable: Y

ANOVAa
Model Sum of Squares df Mean Square F Sig.
1 Regression 90.000 2 45.000 18.000 .000b
Residual 30.000 12 2.500
Total 120.000 14
a. Dependent Variable: Y
b. Predictors: (Constant), O1, O2

Coefficientsa
Standardized
Unstandardized Coefficients Coefficients
Model B Std. Error Beta t Sig.
1 (Constant) 6.000 .408 14.697 .000
O2 1.500 .289 .750 5.196 .000
O1 1.500 .500 .433 3.000 .011
a. Dependent Variable: Y

36
‫تحليل االنحدار مع الترميز المتعامد ‪Regression Analysis with Orthogonal Coding‬‬

‫سوف استخدام الترميز المتعامد لتحليل البيانات التي سبق حللتها بالترميز الوهمي‪.‬حيث أن استخدام نفس‬

‫المثال للطرق الثالثة يظهر الخاصية المميزة لكل طريقة في الترميز‪ .‬يبين جدول‪ 11.9‬يكرر العمود ‪Y‬‬
‫‪ vector‬الذي تم عرضه في الجدولين(‪ 11.5‬و‪ .)11.6‬وت ذكر أن ه ذا العم ود ‪vector‬عب ارة عن العالم ات‬

‫للمتغير التابع لثالث مجموعات ‪ .A1 A2, and A3‬ويمثل الرم زان ‪ and 02 01‬المقارنتين المتعامدتين‬
‫بينهما‪meanAl and meanA2 (01); the average of means A 1 and A2 with the mean of :‬‬
‫)‪.A3 (02‬‬
‫المقارنت ان اللت ان تم اختبارهم ا س ابقا هم ا نفس المق ارنتين في ج دول‪.11.8‬الحظ في المقارنة ‪2‬في جدول‬
‫‪ 11.8‬معاملين اثنين كسور‪ .‬وكما كان سابقا قمت بعملية تحويل للمعامالت بضربها بأقل مق ام مش ترك بينهم ا‬
‫(قاسم) (‪ ،)2‬أفرز المعامالت ‪ ،,and -2 ,1 ,1‬تم استخدامهم كرموز لـ ‪ 02‬لجدول ‪.11.9‬هذا التحويل لتسهيل‬
‫الحسابات اليدوية‪.‬‬

‫‪37‬‬
‫إن نتائج تحليل االنحدار واختبار الداللة سيكون نفس الشيء ‪ ،‬سواء معامالت على شكل كسور أو أعداد صحيحة ‪.‬‬

‫سأقوم بتحليل البيانات في جدول‪ 11.9‬يدويا ‪) Note carefully that in the present example there is‬‬

‫)‪.only one independent variable (group membership in A, whatever the grouping‬‬

‫‪38‬‬
‫ومبينا من خالل الحسابات اليدوية سهولة التحليل عندما تكون المتغيرات المستقلة غير مترابطة‬

(in the present example there is only one independent variable, but it is
represented by two vectors that are not correlated).

Notes

1-The simplest and most efficient method is the use of matrix operations. Recall

that a solution is sought for b = (X'X)-1X'y (see Chapter 6). With orthogonal

coding, (X'X) is a diagonal matrix; that is, all the off-diagonal elements are O.

The inverse of a diagonal matrix is a diagonal matrix whose elements are

reciprocals of the diagonal elements of the matrix to be inverted.You may wish to

analyze the present example by matrix operations to appreciate the ease with

which this can bedone when orthogonal coding is used. For guidance in doing

this, see Chapter 6.

2-Later in this chapter, I show how to revise the input file I used earlier for the

analysis of the same example with dummy and effect coding to do also an

analysis with orthogonal coding. For comparative purposes, I give excerpts of the

output

39
40
‫ولقد تم الحصول على قيم ) ‪ F (1 and 12 df‬سابقا ‪ ,18 = 2/)27 + 9( , .‬حيث قيمة ‪F‬‬

‫معادلة االنحدار ‪The Regression Equation‬‬

‫ألن ‪ ، ro l,02 = 0‬فإن حسابات كل معامل من معامالت االنحدار كما هو في تحليل االنحدار البسيط‬

‫‪41‬‬
42
‫إن فحص اختبار‪ b‬يؤكد ما قلته سابقا ‪:‬إن ضرب أو قسمة ال‪ vector‬المرمز ‪ coded vector‬بعدد ثابت‬
‫يؤثر على مقدار ‪ b‬لكن ال يؤثر ال اختبار الداللة ‪ (.‬أثر التحويل موضح بمث ال ع ددي لمن يري د االطالع في‬
‫الكتاب ص ‪.)384‬‬

‫‪43‬‬
:‫ملخص لما سبق‬
- When a priori orthogonal comparisons among a set of means are hypothesized, it
is necessary to generate orthogonally coded vectors, each of which reflects one of
the hypotheses. Regressing Y on the coded vectors, proportions of variance (or ss)
due to each comparison may be obtained.
-These may be tested separately for significance. But the tests of the b's provide the
same information; that is, each t ratio is a test of the comparison reflected in the
vector with which the b is associated.
-Thus, when a computer program is used for multiple regression analysis, one need
only to inspect the t ratios for the b's to note which hypotheses were supported.

-Recall that the number of possible orthogonal comparisons among g groups is


g - 1. Assume that a researcher is working with five groups. Four orthogonal
comparisons are therefore possible.
-Suppose, however, that the researcher has only two a priori hypotheses that are
orthogonal.These can still be tested in the manner I outlined previously provided
that, in addition to the two orthogonal vectors representing these hypotheses, two
additional orthogonal vectors are included in the analysis. This is necessary to
exhaust the information about group membership (recall that for g groups g - 1 = k

44
coded vectors are necessary; this is true regardless of the coding method). Having
done this, the researcher will examine only the t ratios associated with the b's
that reflect the a priori hypotheses. In addition, post hoc comparisons among
means (e.g., Scheffe) may be pursued.

UNEQUAL SAMPLE SIZES ‫الحجوم غير المتساوية للعينات‬

UNEQUAL SAMPLE SIZES

Among major reasons for having equal sample sizes, or equal n's, in

experimental designs, are that

(1) statistical tests presented in this chapter are more sensitive .

(2) distortions that may occur because of departures from certain assumptions

underlying these tests are minimized.

. The preceding issues aside, it is necessary to examine briefly other matters

relevant to the use of unequal n's as they may have serious implications for valid

interpretation of results.

Unequal n's may occur by design or because of loss of subjects in the course of

an investigation, frequently referred to as subject mortality or subject attrition. I

examine, in tum, these two types of occurrences in the context of experimental

and nonexperimental research.

In experimental research, a researcher may find it necessary or desirable to

randomly assign subjects in varying numbers to treatments differing in, say, cost.

45
Other reasons for designing experiments with unequal n's come readily to mind.

The use of unequal n's by design does not pose threats to the internal validity of

the experiment, that is, to valid conclusions about treatment effects.

Subject mortality may pose very serious threats to internal validity. The degree of

bias introduced by subject mortality is often difficult, if not impossible, to assess,

as it requires a thorough knowledge of the reasons for the loss of subjects.

Assume that an experiment was begun with equal n's but that in the course of its

implementation subjects were lost. This may have occurred for myriad reasons,

from simple and tractable ones such as errors in the recording of scores or

the malfunctioning of equipment, to very complex and intractable ones that may

relate to the subjects' motivations or reactions to specific treatments. Threats to

internal validity are not diminished when subject attrition results in groups of equal

n's, though such an occurrence may generally be more reasonably attributed to a

random process. Clearly, subject mortality may reflect a process of self-selection

leading to groups composed of different kinds of people, thereby raising questions

as to whether the results are due to treatment effects or to differences among

46
subjects in the different treatment conditions. The less one is able to discern the

reasons for subject mortality, the greater is its potential threat to the internal

validity of the experiment.

In nonexperimental research, too, unequal n's may be used by design or they

may be a consequence of subject mortality. The use of equal or unequal n's by

design is directly related to the sampling plan and to the questions the study is

designed to answer. Thus, when the aim is to study the relation between a

categorical and a continuous variable in a defined population, it is imperative that

the categories, or subgroups, that make up the categorical variable be

representedaccording to their proportions in the population. For example, if the

purpose is to study the relation between race and income in the United States, it

is necessary that the sample include all racial groups in the same proportions as

such groups are represented in the population, thereby resulting in a categorical

variable with unequal n's.

Probably more often, researchers are interested in making comparisons among

subgroups, orstrata in sampling terminology. Thus, the main interest may be in

comparing the incomes of different racial groups. For such purposes it is

desirable to have equal n's in the subgroups. This is accomplished by

47
disproportionate, or unequal probabilities, sampling. Disproportionate sampling of

racial or ethnic groups is often used in studies on the effects of schooling.

The preceding brief review of situations that may lead to unequal n's and the

potential threats some of them pose to the validity of the results should alert you

to the hazards of not being attentive to these issues. I will now consider the

regression analysis of a continuous variable on a categorical variable whose

categories are composed of unequal n's. First, I present dummy and effect coding

together. Then, I address the case of orthogonal coding.

Dummy and Effect Coding for Unequal ‫الترميز الوهمي وترميز األثر للحجوم غير المتساوية‬

N's

‫سوف‬.‫إن الترميز الوهمي وترميز األثر للحجوم غير المتساوية يكون كما هي في حال الحجوم المتساوية‬

‫ سوف أقوم‬،‫أوضح ذلك من خالل المثال الذي تم مناقشته سابقا وكانت األعداد في المجموعات متساوية‬

‫بالنسبة للترم يز ال وهمي‬.‫ العالمات للمجموعات بعد الحذف‬11.11‫ي بين ج دول‬. ‫بحذف عالمات المجموعات‬

‫ وبالنسبة‬. D2 ‫ بعنوان‬A2 ‫ الوهمي في‬vector‫ ويكون ال‬،D1 ‫ بعنوان‬A1 ‫ الوهمي في‬vector‫يكون ال‬

.El and E2 ‫ي الترميز هما‬vector ‫لترميز األثر سيكون‬

48
‫وبعد تحليل البيانات في الجدول أعاله في ‪ SPSS‬كانت النتائج كاآلتي‬

‫‪49‬‬
Note that the properties of this equation are the same as those of the regression
equation for dummy coding with equal n's: a (CONSTANT) is equal to the mean
of the group assigned O's throughout (A3), bDl is equal to the deviation of the
mean of Al from the mean of A3 (5.0 - 3.0 = 2.0), and bD2 is equal to the deviation
of the mean of A2 from the mean of A3 (8.5 - 3.0 = 5.5).
When there is no control group and dummy coding is used for convenience, tests

of the b'snare ignored. Instead, multiple comparisons among means are done.

50
51
52
53
54
55
56
57
MULTIPLE REGRESSION VERSUS ‫تحليل االنحدار المتعدد مقابل تحليل التباين‬

ANALYSIS OF VARIANCE

‫بينت س ابقا أن تحلي ل االنح دار و تحلي ل التب اين األح ادي عن دما يك ون المتغ ير المس تقل تص نيفي يكون ا‬

.‫متكافئين‬

‫ وطري ق ع ام في التحلي ل‬، ‫ أن ه أك ثر ش موال‬ANOVA ‫ مفض ال على‬MR ‫من أهم األس باب ال تي تجع ل‬

‫ ويوفر معلومات‬،‫ بمعنى كل المتغيرات سواء تصنيفية أو متصلة يتم عرضها في نفس االطار‬،‫المفاهيمي‬

‫ للمتغيرات المستقلة التصنيفية فقط‬ANOVA ‫ في المقابل يتحدد استخدام‬. ‫عندما نريد التفسير أو التنبؤ‬

‫ األنسب أو التحليل الوحيد‬MR ‫فيما يأتي قائمة بالمواقف التي يكون فيها استخدام تحليل االنحدار المتعدد‬

:‫المناسب‬

(1) when the independent variables are continuous

(2) when some of the independent variables are continuous and some are
categorical, as in analysis of covariance, aptitude-treatment
interactions, or treatments by levels designs
(3) when cell frequencies in a factorial design are unequal and
disproportionate
(4) when studying trends in the data linear, quadratic, and so on

CONCLUDING REMARKS
In this chapter, I presented three methods of coding a categorical variable:
dummy, effect, and orthogonal.
1-Whatever the coding method used, results of the overall analysis are the
same. When a regression analysis is done with Y as the dependent variable and
k coded vectors (k = number of groups minus one) reflecting group membership

58
as the independent variables, the overall R 2, regression sum of squares, residual
sum of squares, and the F ratio are the same with any coding method.
2-Predictions based on the regression equations resulting from the different
coding methods are also identical. In each case, the predicted score is equal to
the mean of the group to which the subject belongs. The coding methods do
differ in the properties of their regression equations.
A brief summary of the major properties of each method follows.

With dummy coding, k coded vectors consisting of 1 's and O's are generated.
In each vector, in turn, subjects of one group are assigned 1 's and all others are
assigned O's. As k is equal to the number of groups minus one, it follows that
members of one of the groups are assigned O's in all the vectors. This group is
treated as a control group in the analysis. In the regression equation, the
intercept, a, is equal to the mean of the control group. Each regression
coefficient, b, is equal to the deviation of the mean of the group identified in the
vector with which it is associated from the mean of the control group. Hence, the
test of significance of a given b is a test of significance between the mean of the
group associated with the b and the mean of the control group. Although dummy
coding is particularly useful when the design consists of several experimental
groups and a control group, it may also be used in situations in which no
particular group serves as a control for all others. The properties of dummy
coding are the same for equal or unequal sample sizes.
Effect coding is similar to dummy coding, except that in dummy coding one
group is assigned O's in all the coded vectors, whereas in effect coding one
group is assigned -1 's in all the vectors. As a result, the regression equation
reflects the linear model. That is, the intercept, a, is equal to the grand mean of
the dependent variable, Y, and each b is equal to the treatment effect for the
group with which it is associated, or the deviation of the mean of the group from

59
the grand mean. When effect coding is used with unequal sample sizes, the
intercept of the regression equation is equal to the unweighted mean of the group
means. Each b is equal to the deviation of the mean of the group with which it is
associated from the unweighted mean.
Orthogonal coding consists of k coded vectors of orthogonal coefficients. I
discussed and illustrated the selection of orthogonal coefficients for equal and
unequal sample sizes. In the regression equation, a is equal to the grand mean,
Y, for equal and unequal sample sizes. Each b reflects the specific comparison
with which it is related. Testing a given b for significance is tantamount
to testing the specific hypothesis that the comparison reflects.
The choice of a coding method depends on one's purpose and interest. When
one wishes to compare several treatment groups with a control group,
dummy coding is the preferred method.
Orthogonal coding is most efficient when one's sole interest is in
orthogonal comparisons among means. As I showed, however, the different
types of multiple comparisons-orthogonal, planned nonorthogonal, and post hoc-
can be easily done by testing the differences among regression coefficients
obtained from effect coding.
Consequently, effect coding is generally the preferred method of coding
categorical variables.

‫انتهت المحاضرة‬

60

You might also like