hw3.sol - Page 1 of 3 Stat209/Ed260 D Rogosa 1/30/09...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Stat209/Ed260 D Rogosa 1/30/09 Solutions Assignment 3. Problem 1, first part > # do Blau-Duncan path analysis from correlation matrices (cf Lab 1 and week 3 handouts) # predictor correlation matrices > RxxBD1 = matrix( nrow = 2, ncol = 2, data = c(1, 0.516, .516, 1), byrow = T ) > RxxBD2 = matrix( nrow = 2, ncol = 2, data = c(1, 0.438, .438, 1), byrow = T ) > RxxBD3 = matrix( nrow = 3, ncol = 3, data = c(1, 0.438, .538, .438, 1, .417, .538,.417,1), byrow = T ) > RxxBD3 [,1] [,2] [,3] [1,] 1.000 0.438 0.538 [2,] 0.438 1.000 0.417 [3,] 0.538 0.417 1.000 # correlation matrices between outcome var and predictors > RxyBD1 = matrix( nrow = 2, ncol = 1, data = c(0.453,.438) ) > RxyBD2 = matrix( nrow = 2, ncol = 1, data = c(0.538,.417) ) > RxyBD3 = matrix( nrow = 3, ncol = 1, data = c(0.596,.405, .541) ) > #path coeffs for the 3 eqs pp.76-77 DAF text # obtain the standardized regression coefficients > pathcBD1 = t(RxyBD1)%*%solve(RxxBD1) > pathcBD2 = t(RxyBD2)%*%solve(RxxBD2) > pathcBD3 = t(RxyBD3)%*%solve(RxxBD3) > pathcBD1 [,1] [,2] [1,] 0.3093613 0.2783696 > pathcBD2 [,1] [,2] [1,] 0.4397097 0.2244072 > pathcBD3 [,1] [,2] [,3] [1,] 0.3945428 0.1151266 0.2807282 > #coeffs match well p.76 > #get Rsq and coeff for distrurbance terms > RsqBD1 = pathcBD1%*%RxyBD1 > sqrt(1-RsqBD1) [,1] [1,] 0.8590305 > RsqBD2 = pathcBD2%*%RxyBD2 > sqrt(1-RsqBD2) [,1] [1,] 0.8184488 > RsqBD3 = pathcBD3%*%RxyBD3 > sqrt(1-RsqBD3) [,1] [1,] 0.7525638 > #coeff for disturbance terms matched (DAF SD's p.79) > #Freedman does these eq's more generally all at once, which is fine and that can be written in his noatation as A1. Y = [ U X W ]' [ e f g ] + eta = M' [e f g] + eta The coefficient estimates are given by [eHat fHat gHat] = (M'M)^(-1) M'y. The matrix M'M is given by the correlation matrix of the predictors.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

hw3.sol - Page 1 of 3 Stat209/Ed260 D Rogosa 1/30/09...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online