下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、R-practice session 8cs&ss 560Marijtje van Duijn Winter 2006The commands used in this session are available as R syntax file (Session8.R) at the website.Data input and preparationWe continue with the data used in Snijders & Bosker. For a description see Example 4.1 (p. 46). We will estimate the multi
2、variate models for the language and math scores and reproduce the tables in chapter 13.Download the data file SBch13.csv from the class website. Also get the file session8.r and execute the -by now wellknown- commands under data preparation.Transforming the data for a multivariate multilevel analysi
3、sFor a multivariate multilevel analysis, the data need to be reorganized, comparable to a repeated measures analysis, where each measurement (of each dependent variable) has its own row.This is done (see session8.r) by first creating two matrices with just one dependent variable (and identical colum
4、ns for all other variables). Note that an indicator variable is added, numbering the matrices consecutively, to be able to distinguish the dependent variables later on. In general you need as many matrices as you have dependent variables. These matrices are then stacked and reordered, using the indi
5、cator variable, so that the correct structure is obtained. This takes a bit of moving around the data in new matrices and defining data frames (maybe this can be done more efficiently), but it works. The variable used to indicate the multiple testscores is called testNR. The data matrix with which w
6、e will work further is now twice as long as the one used before.Estimating a multivariate multilevel modelWe will first estimate the empty multivariate model as specified in table 13.1. This is not so hard, the only thing we have to remember is that it is now - technically - a three-level model, whe
7、re testNR indicates the lowest level, and pupilNR and schoolNR the second and third, and that we want to estimate separate variances for each value of testNR, which we therefore treat as an (ordered) factor.model13.1model13.1ML-lme(scorefactor(testNR)-1, +random=factor(testNR)-1lschoolNR/pupilNR,dat
8、a=langaritmv,method=ML) summary(model13.1ML)VarCorr(model13.1ML)There is one important difference with the table, and that is that in addition to the level 2 (between-pupils) within-schools covariance matrix elements a level 1 residual variance (a sort of measurement variance) is estimated. This num
9、ber needs to be added to the level 2 variances to get comparable results. Try to figure out how to get to the covariances reported in the table. (We will discuss in the lab, of course.) And note that the (population) correlation coefficients at the school level and at the pupil level are reported in
10、 the model summary.The correlations between the observed variables at pupil and at school level can serve as a reference to get some idea of explained variance at both levels.For the estimation of the model in table 13.2, the random structure is unchanged, but we have to be a little more careful in
11、the specification of the fixed part where, again, we want all estimates separately for the two outcome measures.How could one test whether the effect of for instance IQ on the test scores is different for the language and arithmetic tests?A model with a random slope for IQ did not converge, unfortun
12、ately, but in principle it is possible to estimate random slopes.We continue the inspection of residuals. We explored level 1 last week, and will now continue with level 2, following section 9.6.2 in the book.The first idea is to extend the concept of Cooks distance to a multilevel model. Cooks dist
13、ance measures the influence of an observation by investigating how much the estimated parameters change in relation to the precision or uncertainty of the estimate.This can also be done for the fixed parameters in a multilevel model (see page 134 for the formula) and the explanation in session8.r. H
14、ere I did program the time consuming way of this leaving-one-out procedure, whereas approximations exist, but these are not easily accessible in R (or at least I dont know how to obtain them).The random effects analogon of Cooks distance (9.6) can also not be obtained, because we dont have a (good)
15、estimate of the covariance matrix of the variance parameters.So we are left with the Cooks distance for the fixed part, which is not so bad, because there is another way to check the random part, and that is through the standardized multivariate residual for each level 2 unit, given by equation 9.9
16、on page 136. This statistic has an approximate chi-squared distribution so we can obtain a p-value for it, where a small p-value indicates an abnormally large residual. Because we obtain a statistic and a p-value for each level 2 unit, chance capitalization is a problem, so we should be careful not to overinterpret the p-values (or use a correction).Both diagnostics give us an idea of possibly outlying level 2 units. We can order the level 2 units by both criteria to investigate the worst cases. We can also plot Cooks distances by level 2 unit size, because theoretically Cooks distance is p
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 直郵廣告解決方案
- 二零二五年度房產租賃合同終止催告通知3篇
- 二零二五年度房地產物業(yè)管理合同范本5篇
- “銀色數字鴻溝”對老年人身心健康的影響
- “雙減”背景下學校課后服務質量的問題、原因及策略
- 蜜雪冰城企業(yè)案例分析
- 四川省瀘州市龍馬潭區(qū)瀘化中學2024-2025學年九年級上學期1月期末考試化學試卷(含答案)
- 建設生物質加工利用及年產3萬噸炭素資源化利用項目可行性研究報告模板-立項拿地
- 福建省廈門市同安區(qū)2024-2025學年八年級上學期期末模擬語文試卷(含答案)
- Unit5 Humans and nature Lesson 3 Race to the pole 說課稿 -2024-2025學年高中英語北師大版(2019)必修第二冊
- 采購部績效考核
- 超短波操作流程圖
- 小學2022 年國家義務教育質量監(jiān)測工作方案
- 化學品安全技術說明(膠水)
- 南寧市中小學學籍管理系統(tǒng)數據采集表
- 中空吹塑成型課件
- 領先閱讀X計劃第四級Bug Hunt 教學設計
- 《詩詞格律》word版
- 預算第二十三講
- 高中體育與健康人教版全一冊 6.2田徑—短跑 課件(共11張PPT)
- 蔬菜供貨服務保障方案
評論
0/150
提交評論