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_1r.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 > > plot(x1,y,xlab="Days",ylab="Density of Algae") > > > x <- cbind(x0,x1,x2,x3) > xf8_2 <- x[1:14,1:4] > y8_2 <- y[1:14] > > betaf8_2 <- solve(t(xf8_2) %*% xf8_2) %*% t(xf8_2) %*% y8_2 > > ssef8_2 <- t(y8_2 - xf8_2%*%betaf8_2) %*% (y8_2 - xf8_2%*%betaf8_2) > s2f8_2 <- ssef8_2/(nrow(xf8_2)-ncol(xf8_2)) > > varbetaf8_2 <- s2f8_2[1,1]*solve(t(xf8_2) %*% xf8_2) > sebetaf8_2 <- sqrt(diag(varbetaf8_2)) > > print(round(cbind(betaf8_2,sebetaf8_2),5)) sebetaf8_2 0.00948 0.16761 x1 0.53074 0.09343 x2 0.00595 0.01422 x3 -0.00119 0.00062 > > tbeta3 <- betaf8_2[4]/sebetaf8_2[4] > tcritb3 <- qt(.975,nrow(xf8_2)-ncol(xf8_2)) > probtb3 <- 2*(1-pt(abs(tbeta3),nrow(xf8_2)-ncol(xf8_2))) > > print(cbind(tbeta3,tcritb3,probtb3)) tbeta3 tcritb3 probtb3 x3 -1.910112 2.228139 0.08518918 > > xr8_2 <- x[1:14,1:2] > > betar8_2 <- solve(t(xr8_2) %*% xr8_2) %*% t(xr8_2) %*% y8_2 > > sser8_2 <- t(y8_2 - xr8_2%*%betar8_2) %*% (y8_2 - xr8_2%*%betar8_2) > > ssef8_2 [,1] [1,] 0.1365819 > sser8_2 [,1] [1,] 1.458121 > > fbeta23 <- ((sser8_2-ssef8_2)/(ncol(xf8_2)-ncol(xr8_2)))/(ssef8_2/(nrow(xf8_2)-ncol(xf8_2))) > fcritb23 <- qf(.95,ncol(xf8_2)-ncol(xr8_2),nrow(xf8_2)-ncol(xf8_2)) > fprobb23 <- 1-pf(fbeta23,ncol(xf8_2)-ncol(xr8_2),nrow(xf8_2)-ncol(xf8_2)) > > print(cbind(fbeta23,fcritb23,fprobb23)) fcritb23 [1,] 48.37897 4.102821 7.21106e-06 > > > dev.off() null device 1 >