H:\public_html\sta6208\rpd>C:\R-2.9.0\bin\Rterm --vanilla R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > pdf("rpd8_4r.pdf") > > xy<- matrix(c( 1, 0.53, + 2, 1.183, + 3, 1.603, + 4, 1.994, + 5, 2.708, + 6, 3.006, + 7, 3.867, + 8, 4.059, + 9, 4.349, + 10, 4.699, + 11, 4.983, + 12, 5.1, + 13, 5.288, + 14, 5.374, + 1, 0.184, + 2, 0.664, + 3, 1.553, + 4, 1.91, + 5, 2.585, + 6, 3.009, + 7, 3.403, + 8, 3.892, + 9, 4.367, + 10, 4.551, + 11, 4.656, + 12, 4.754, + 13, 4.842, + 14, 4.969),byrow=T,ncol=2) > > nobs <- nrow(xy) > y <- xy[,2] > x1 <- xy[,1] > x0 <- matrix(rep(1,nobs),ncol=1) > x2 <- x1*x1 > x3 <- x1*x2 > > x <- cbind(x0,x1,x2,x3) > xf8_2 <- x[1:14,1:4] > y8_2 <- y[1:14] > > orp0 <- x0[1:14,] > orp1 <- 2*x1[1:14]-15 > orp2 <- 0.5*x2[1:14]-7.5*x1[1:14]+20 > orp3 <- (5/3)*x3[1:14]-37.5*x2[1:14]+(698.5/3)*x1[1:14]-340 > > orpx3 <- cbind(orp0,orp1,orp2,orp3) > > orpx3 orp0 orp1 orp2 orp3 [1,] 1 -13 13 -143 [2,] 1 -11 7 -11 [3,] 1 -9 2 66 [4,] 1 -7 -2 98 [5,] 1 -5 -5 95 [6,] 1 -3 -7 67 [7,] 1 -1 -8 24 [8,] 1 1 -8 -24 [9,] 1 3 -7 -67 [10,] 1 5 -5 -95 [11,] 1 7 -2 -98 [12,] 1 9 2 -66 [13,] 1 11 7 11 [14,] 1 13 13 143 > > > betaorp <- solve(t(orpx3) %*% orpx3) %*% t(orpx3) %*% y8_2 > yhat <- orpx3 %*% betaorp > > sseorp <- t(y8_2 - orpx3 %*% betaorp) %*% (y8_2 - orpx3 %*% betaorp) > s2orp <- sseorp/(nrow(orpx3)-ncol(orpx3)) > > varbetaorp <- s2orp[1,1]*solve(t(orpx3) %*% orpx3) > sebetaorp <- sqrt(diag(varbetaorp)) > > print(round(cbind(betaorp,sebetaorp),5)) sebetaorp orp0 3.48164 0.03123 orp1 0.19198 0.00387 orp2 -0.04180 0.00433 orp3 -0.00072 0.00037 > > tbeta3orp <- betaorp[4,]/sebetaorp[4] > tcritb3orp <- qt(.975,nrow(orpx3)-ncol(orpx3)) > probtb3orp <- 2*(1-pt(abs(tbeta3orp),nrow(orpx3)-ncol(orpx3))) > > print(cbind(tbeta3orp,tcritb3orp,probtb3orp)) tbeta3orp tcritb3orp probtb3orp orp3 -1.910112 2.228139 0.08518918 > > dev.off() null device 1 > >