楼主: lucy_xue
5529 5

请教HLM变量设置 [推广有奖]

  • 3关注
  • 0粉丝

大专生

85%

还不是VIP/贵宾

-

威望
0
论坛币
2547 个
通用积分
33.3410
学术水平
6 点
热心指数
1 点
信用等级
1 点
经验
1209 点
帖子
32
精华
0
在线时间
47 小时
注册时间
2011-12-21
最后登录
2018-11-13

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
各位:我做HLM分析,做完全模型显示The model specified for the covariance components was:
---------------------------------------------------------
         Tau dimensions
               INTRCPT1


Summary of the model specified (in equation format)
---------------------------------------------------

Level-1 Model

        Prob(Y=1|B) = P

        log[P/(1-P)] = B0 + B1*(BMI) + B2*(EQ5DUK) + B3*(CHRONICD) + B4*(URB_RURG)

Level-2 Model
        B0 = G00 + G01*(AVINPER) + G02*(HPROFE) + G03*(AVBED) + G04*(AVEQUIP) + U0
        B1 = G10
        B2 = G20
        B3 = G30
        B4 = G40

Level-1 variance = 1/[P(1-P)]

Run-time deletion has reduced the number of level-1 records to 24512

There is a problem in the fixed portion of the model.  A near singularity is
likely.  Possible sources are a collinearity or multicollinearity among the predictors.  We suggest that you examine a correlation matrix among the fixed effect predictors.
说共线什么的。。如何解决。。
另外在HLM的变量建立是不能像以往做分析,设立虚拟变量?必须分别建立变量?

多谢!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:变量设置 HLM Collinearity fixed effect correlation specified equation 模型

已有 1 人评分经验 论坛币 学术水平 收起 理由
Lisrelchen + 20 + 20 + 5 精彩帖子

总评分: 经验 + 20  论坛币 + 20  学术水平 + 5   查看全部评分

本帖被以下文库推荐

HLM does not have data management capability,One has to use other stat package(s) to clean the data and to create variables, such as dummy variables and within-level interaction terms.

http://www.ats.ucla.edu/stat/hlm/seminars/hlm6/outline_hlm_seminar.pdf

使用道具

This error message indicates that there are some of the fixed effects that have essentially the same relationship with the outcome variable. In order to perform iterations, the design matrix of predictors included in the analysis must be independent. In the example below, an example is given for a level-2 unit with 5 level-1 units nested within the level-2 unit. The first column represents the intercept term, which is by default included in any HLM model. The second column represents the scores of the 5 respondents from this level-2 unit. As the scores of all 5 respondents are very similar, the second column is almost a multiple of the first.

Intercept Score 1 20
1 20
1 20
1 20
1 21

Solution
This problem can be resolved in the following ways:
  • If retaining a variable that is a multiple of the intercept term is essential, the intercept term may be deleted from the model.

  • Use a correlation matrix of predictors within each higher level unit to find the pair or pairs of variables responsible for this problem. If, for example, a correlation close to 1 is observed for the predictors representing age and income, only one of the two predictors should be used in the model. Alternatively, a transformation of income could be considered in order to keep both variables in the model.

使用道具

板凳
lucy_xue 发表于 2014-6-22 13:55:30 |只看作者 |坛友微信交流群
农村固定观察点 发表于 2014-6-22 11:52
This error message indicates that there are some of the fixed effects that have essentially the same ...
thank you very much! I will try to correct it..

By the way how could I make dummy variable  for example education level: no school, primary school,  junior high school, senior high school, college,could I only use one variable- edu, for example,let it equal 0,1,2,3 and 4 represent different levels,or I need made 3 variables  edu0 edu1 edu2 edu3?
confused.. Thank you again!

使用道具

Dummy Coding Nominal Variables

Dichotomously coded nominal variables can always be used in a linear model (as in multiple regression and discriminant analysis).  However, variables that have more than two levels, can not be used as coded as predictors in such models.  Thus, gender coded, for instance, as 0=male and 1=female, presents no problem nor does political party coded as 1=democrat and 2=republican.  But if we wished to have three or more political parties, the variable coded as 1=democrat, 2=republican, and 3=independent could not be used.  If we did use political party coded in this way, SPSS would happily do our analysis, but the answer would be meaningless as our coding implies that republican is "more" than democrat and that independent is "more" than republican or democrat.  We imply at least an ordinal scale by our coding, which, as political party is nominal, is incorrect.

If the variable IS ordinal, such as class standing (Freshman, Sophomore, Junior, Senior), you can use it coded ordinally (e.g.., 1, 2, 3, 4), and the method discussed herein should NOT be applied.

As we can use dichotomous variables, what we must do is to transform our polychotomous nominal variable into a set of dichotomous, or binary, variables.  Fortunately, we can always transform a k-level nominal variable into a set of k-1 binary variables that contain the same information.  Thus in this case, we can transform the 3-level nominal political party variable into 2 binary variables, and then use the two binary variables as the representation for political party in any modeling procedure, such as multiple regression, discriminant analysis, etc.

There is more than one way to create these binary variables; the procedure illustrated herein is often referred to as "dummy coding."  What we do is to create k-1 variables each representing, by "0" or "1", whether the subject is a member of each of  k-1 groups, thus we elect to not represent this information for one of the groups as to do so would be redundant.  For our political party example, let's say that we have a variable PARTY,coded as 1, 2, or 3 as prescribed above.  It is arbitrary which party we "leave out" in creating k-1 binary variables, but for this example, lets code whether the subject is a democrat, "D," and whether the subject is a republican, R.   The point is that if there is a "0" for both of these, then the subject is a member of the remaining Independent group.  That is why we do not need to code k binary variables -- only k-1.  The coding for Ss of all types would look something like this:

S#          Party          D         R

1               1              1         0

2                2             0         1

3                3             0         0

Although this represents the coding for a subject of each type, all subjects would be coded similarly for PARTY.

Although we could manually create the dummy coded variables, we will have SPSS create the dummy coded variables for us.  We assume that the nominal variable, as in PARTY,  is already extant in the file as in the example below (the file, DUMMY.sav, is included in this folder):

You will note that we also have the variable age in this example.  I included this so that I can show you how the dummy codes can be used, and an additional statistical concept, but it has nothing to do with dummy coding.

Now, to get the required two dummy coded variables for the three category nominal variable, PARTY, we use the SPSS "Recode into Different Variables" command.

What we need to do is to create two binary dummy coded variables, each representing membership or not in two of the three levels of PARTY.  We choose to represent membership in the democratic party or not with the dummy coded variable D, and the same for the republican party with R.  In order to accomplish this we click "Transform/Recode/Into Different Variables..."  This opens a dialog box.  We move the variable PARTY to the Input Variable box, and type D in the Output Variable box.  The window should look something like this:

Next, click the Old and New Values button, and another dialog box opens.  Enter the value "1" in the Old Value box (this represents the value of  PARTY for Democrat), and "1" in the New Value box.  Then click theAdd button.  The transformation of that value (although it is from the same value to the same value) appears in the window recording such changes to the left of the dialog box.   Next click the All other values selection on the left, "0" on the right, and the Add button.  This causes the rest of the values of  PARTY (ELSE) to be transformed to "0" in the new variable D.  Thus these two transformations create a new variable, D, that is "1" if the subject is a democrat and "0" otherwise, just as we wished.  The screen should look something like this:

Next click the Continue button.  You will go back to the former "Recode into Different Variables" window.  You must click the Change button for the changes to take effect.  You could also enter a Label for the variableD if you wish.  Click OK and the new variable, D, will be created and added to the end of the data file.  You can do the same thing to create the R dummy coded variable, except that the transformation consists of 2 > 1, and ELSE > 0, as it is to be a binary variable registering whether the subject is a republican or not.  Before creating the R variable, you will need to "clear out" the "party > D" entry in the "Recode into Different Variables" dialog box  (as it will still be there from creating the D variable) by highlighting it and clicking the left arrow.  You will also need to clear the coding selections that you made for D in the "Old and New Values" dialog box by highlighting and clicking the Remove button.  I leave that exercise for you.  You can also enter Variable Values for D and R if you wish.  I did so in the DUMMY.sav file.  They were "democrat" and "not democrat" and similarly for R.

After creating both dummy coded variables the file looks like this:

Here you can see that we have the two desired new variables, D and R, and that a democrat is coded 1, 0, a republican is 0, 1, and an independent is 0, 0; thus, we have all of the information that was in the nominal variable, PARTY.

The k-1 dummy codes that represent the k-level nominal variable (but not the original nominal variable) would now be added into any linear modeling technique (such as multiple regression or discriminant analysis) together, and they together represent the predictive power of the nominal variable.  Though you will typically have many variables in a model, some of which are dummy coded and some which are continuous variables, I illustrate using just these dummy coded variables in predicting age, thus we are considering how well we can predict age from political party.

To illustrate how we would use these two dummy coded variables together to represent PARTY, let's run a regression predicting age from D and R.  We would set up the regression as usual, including D and R as Independents and age as the Dependent variable (note that PARTY is not included in the analysis).  The relevant window looks like this:

The basic output is:

ANOVA


Model

Sum of Squares

df

Mean Square

F

Sig.

1

Regression

79.000

2

39.500

.562

.621(a)

Residual

211.000

3

70.333

Total

290.000

5

a Predictors: (Constant), R, D

b Dependent Variable: AGE

As an alternative, let's set up  the ONEWAY ANOVA procedure, testing the null hypothesis that the means of the political parties are the same (here we can use PARTY in its original state, and we have no use for D andR) as ANOVA expects a nominal independent variable .  The window looks like this:

The output from this ANOVA is:

ANOVA


AGE

Sum of Squares

df

Mean Square

F

Sig.

Between Groups

79.000

2

39.500

.562

.621

Within Groups

211.000

3

70.333

Total

290.000

5

We see that the result is the same whether we are asking the question of how well we can predict age from political party, or is there a difference in mean age across political parties -- the question is the same statistically.

One would not go through the trouble of recoding the PARTY variable if it were the only variable of interest, as in this example; we could just do an ANOVA.  However, when there are multiple variables, some of which are nominal and some of which are not, we can dummy code those that are nominal and use the dummy coded variables to represent the nominal variable in a model utilizing all predictors.








使用道具

地板
lucy_xue 发表于 2014-7-27 08:22:50 |只看作者 |坛友微信交流群
Thank you very much!

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-27 21:44