C:\sta6167>C:\Progra~1\R\R-2.3.1\bin\Rterm --vanilla R : Copyright 2006, The R Foundation for Statistical Computing Version 2.3.1 (2006-06-01) 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("nit.pdf") > > nit0 <- read.fwf("C:\\data\\fertyld.dat", width=c(8,8,8), + col.names=c("nit", "nit20", "yield")) > > x2=nit0$nit20^2 > > nit1 <- data.frame(y=nit0$yield, x=nit0$nit20, x2=x2) > > attach(nit1) The following object(s) are masked _by_ .GlobalEnv : x2 > > nit1 y x x2 1 24.5 0 0 2 41.5 1 1 3 52.1 2 4 4 61.4 3 9 5 73.5 4 16 6 86.0 6 36 7 92.8 8 64 8 94.0 9 81 > > > > nit.mod2 <- lm(y ~ x + x2) > > summary(nit.mod2) Call: lm(formula = y ~ x + x2) Residuals: 1 2 3 4 5 6 7 8 -0.89532 1.84744 -0.14856 -1.78330 1.04322 -0.01998 -0.13815 0.09464 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 25.39532 1.05065 24.17 2.26e-06 *** x 15.08788 0.58744 25.68 1.67e-06 *** x2 -0.83063 0.06191 -13.42 4.12e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.306 on 5 degrees of freedom Multiple R-Squared: 0.9981, Adjusted R-squared: 0.9973 F-statistic: 1314 on 2 and 5 DF, p-value: 1.571e-07 > > nit.mod3 <- nls(y ~ M - a*(R^x), start=c(M=100, a=75, R=0.5)) > > summary(nit.mod3) Formula: y ~ M - a * (R^x) Parameters: Estimate Std. Error t value Pr(>|t|) M 107.65084 3.78478 28.44 1.01e-06 *** a 83.18346 3.41301 24.37 2.17e-06 *** R 0.80888 0.01751 46.20 8.98e-08 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.689 on 5 degrees of freedom > > nit.mod4 <- nls(y ~ M*(1-C*exp(k*x)), start=c(M=100, C=.75, k=-1)) > > summary(nit.mod4) Formula: y ~ M * (1 - C * exp(k * x)) Parameters: Estimate Std. Error t value Pr(>|t|) M 107.65084 3.78478 28.443 1.01e-06 *** C 0.77272 0.01267 60.987 2.24e-08 *** k -0.21210 0.02165 -9.798 0.000188 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.689 on 5 degrees of freedom > > nit2 <- subset(nit1,x>0) > > nit.mod1 <- nls(y ~ a*(x^b), start=c(a=1, b=1), data=nit2) > > summary(nit.mod1) Formula: y ~ a * (x^b) Parameters: Estimate Std. Error t value Pr(>|t|) a 41.31743 1.63878 25.21 1.83e-06 *** b 0.38768 0.02243 17.28 1.19e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.597 on 5 degrees of freedom > > dev.off() null device 1 >