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("rpd15_1r.pdf") > > grimes <- matrix(c( + 1, 0.45, 0.34170, + 2, 0.45, -0.00438, + 3, 0.45, 0.82531, + 4, 1.30, 1.77967, + 5, 1.30, 0.95384, + 6, 1.30, 0.64080, + 7, 2.40, 1.75136, + 8, 2.40, 1.27497, + 9, 2.40, 1.17332, + 10, 4.00, 3.12273, + 11, 4.00, 2.60958, + 12, 4.00, 2.57429, + 13, 6.10, 3.17881, + 14, 6.10, 3.00782, + 15, 6.10, 2.67061, + 16, 8.05, 3.05959, + 17, 8.05, 3.94321, + 18, 8.05, 3.43726, + 19, 11.15, 4.80735, + 20, 11.15, 3.35583, + 21, 11.15, 2.78309, + 22, 13.15, 5.13825, + 23, 13.15, 4.70274, + 24, 13.15, 4.25702, + 25, 15.00, 3.60404, + 26, 15.00, 4.15029, + 27, 15.00, 3.42484),byrow=T,ncol=3) > > t <- as.matrix(grimes[,2]) > y <- as.matrix(grimes[,3]) > > > > ca.nlreg <- nls(y ~ a*(1-exp(-(t/d)^g)),start=c(a=5,d=2,g=1)) > > summary(ca.nlreg) Formula: y ~ a * (1 - exp(-(t/d)^g)) Parameters: Estimate Std. Error t value Pr(>|t|) a 4.2835 0.4747 9.024 3.51e-09 *** d 4.7326 1.2712 3.723 0.00106 ** g 1.0156 0.2272 4.469 0.00016 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.5576 on 24 degrees of freedom Number of iterations to convergence: 6 Achieved convergence tolerance: 9.706e-07 > theta <- as.matrix(coef(ca.nlreg)) > vtheta <- vcov(ca.nlreg) > setheta <- sqrt(diag(vtheta)) > setheta <- diag(setheta) > > corrtheta <- solve(setheta) %*% vtheta %*% solve(setheta) > corrtheta [,1] [,2] [,3] [1,] 1.0000000 0.9329968 -0.7775717 [2,] 0.9329968 1.0000000 -0.7167829 [3,] -0.7775717 -0.7167829 1.0000000 > > vec <- seq(0,15,0.1) > > plot(t,y,xlim=c(0,15),ylim=c(0,6)) > lines(vec,theta[1]*(1-exp(-(vec/theta[2])^theta[3]))) > > > # Proportional Response estimates > > n <- nrow(y) > p <- nrow(theta) > > ht <- matrix(c(1,5,15),ncol=1) > > httheta <- 1-exp(-(ht/theta[2])^theta[3]) > > > dhb1 <- 0*ht > dhb2 <- -(theta[3]/theta[2])*((ht/theta[2])^theta[3])*exp(-(ht/theta[2])^theta[3]) > dhb3 <- (log(ht/theta[2]))*((ht/theta[2])^theta[3])*exp(-(ht/theta[2])^theta[3]) > > dhb <- cbind(dhb1,dhb2,dhb3) > > > > s2h <- dhb %*% vtheta %*% t(dhb) > > seh <- sqrt(diag(s2h)) > > seh <- as.matrix(seh) > > > > ciht <- qt(.975,n-p)*seh > > > > htthetalo <- httheta - ciht > htthetahi <- httheta + ciht > > print(cbind(ht,httheta,htthetalo,htthetahi)) [,1] [,2] [,3] [,4] [1,] 1 0.1863579 0.1007847 0.2719310 [2,] 5 0.6526456 0.4389562 0.8663351 [3,] 15 0.9603278 0.8293647 1.0912908 > > dev.off() null device 1 > >