下載本文檔
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024版企業(yè)總經(jīng)理聘用協(xié)議
- 2025年進(jìn)口熱帶水果專供協(xié)議書(shū)3篇
- 2025年度纖維原料加工合作合同模板3篇
- 2025年度船舶抵押貸款服務(wù)協(xié)議范本3篇
- 2025版二零二五年度消防設(shè)備租賃合同3篇
- 現(xiàn)代科技下的中醫(yī)家庭健康服務(wù)
- 教育與科技創(chuàng)新的未來(lái)路徑
- 電力行業(yè)從業(yè)人員安全用電培訓(xùn)教程
- 二零二五年度創(chuàng)新型民間車輛抵押貸款合同范本4篇
- 基于2025年度計(jì)劃的研發(fā)合作與專利權(quán)共享協(xié)議3篇
- 部編版六年級(jí)下冊(cè)道德與法治全冊(cè)教案教學(xué)設(shè)計(jì)
- 【高空拋物侵權(quán)責(zé)任規(guī)定存在的問(wèn)題及優(yōu)化建議7100字(論文)】
- 二年級(jí)數(shù)學(xué)上冊(cè)100道口算題大全 (每日一套共26套)
- 物流無(wú)人機(jī)垂直起降場(chǎng)選址與建設(shè)規(guī)范
- 肺炎臨床路徑
- 外科手術(shù)鋪巾順序
- 創(chuàng)新者的窘境讀書(shū)課件
- 聚焦任務(wù)的學(xué)習(xí)設(shè)計(jì)作業(yè)改革新視角
- 移動(dòng)商務(wù)內(nèi)容運(yùn)營(yíng)(吳洪貴)任務(wù)三 APP的品牌建立與價(jià)值提供
- 電子競(jìng)技范文10篇
- 食堂服務(wù)質(zhì)量控制方案與保障措施
評(píng)論
0/150
提交評(píng)論