


下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 股權(quán)轉(zhuǎn)讓及人才引進(jìn)與培養(yǎng)計(jì)劃合同
- 股東向公司無息借款及知識(shí)產(chǎn)權(quán)合作開發(fā)合同
- 疫苗接種監(jiān)管合同樣本:公共衛(wèi)生監(jiān)管及服務(wù)合作協(xié)議
- 溫州商學(xué)院《藝術(shù)治療》2023-2024學(xué)年第二學(xué)期期末試卷
- 南京審計(jì)大學(xué)《創(chuàng)新研究與訓(xùn)練》2023-2024學(xué)年第二學(xué)期期末試卷
- 寧夏衛(wèi)生健康職業(yè)技術(shù)學(xué)院《產(chǎn)品語義學(xué)》2023-2024學(xué)年第二學(xué)期期末試卷
- 塔里木大學(xué)《運(yùn)營管理實(shí)訓(xùn)》2023-2024學(xué)年第二學(xué)期期末試卷
- 天津仁愛學(xué)院《計(jì)算機(jī)繪圖(CAD)》2023-2024學(xué)年第二學(xué)期期末試卷
- 西安鐵路職業(yè)技術(shù)學(xué)院《音樂論文寫作》2023-2024學(xué)年第二學(xué)期期末試卷
- 上海對外經(jīng)貿(mào)大學(xué)《護(hù)理基礎(chǔ)技能(二)》2023-2024學(xué)年第二學(xué)期期末試卷
- 協(xié)和專家孕產(chǎn)大百科
- 2022年湖北宜昌高新區(qū)社區(qū)專職工作人員招聘24人筆試備考題庫及答案解析
- 無人機(jī)應(yīng)用技術(shù)專業(yè)人才培養(yǎng)方案(中職)
- 科技成果-電解鋁煙氣脫硫脫氟除塵一體化技術(shù)
- YS/T 273.12-2006冰晶石化學(xué)分析方法和物理性能測定方法 第12部分:火焰原子吸收光譜法測定氧化鈣含量
- GB/T 39171-2020廢塑料回收技術(shù)規(guī)范
- 2015山東高考英語試題及答案
- GB/T 18964.2-2003塑料抗沖擊聚苯乙烯(PS-I)模塑和擠出材料第2部分:試樣制備和性能測定
- GA/T 1661-2019法醫(yī)學(xué)關(guān)節(jié)活動(dòng)度檢驗(yàn)規(guī)范
- 資料交接移交確認(rèn)單
- 風(fēng)對起飛和著陸影響及修正和風(fēng)切變完整版課件
評(píng)論
0/150
提交評(píng)論