#### Example 1 ###################################################################################
# Weight of cut grass data (Pattinson 1981)
# References:
# Clarke, G.P.Y. (1987) Approximate confidence limits for a parameter function in nonlinear
# regression. J. Am. Stat. Assoc. 82, 221-230.
# Gebremariam, B. (2014) Is nonlinear regression throwing you a curve?
# New diagnostic and inference tools in the NLIN Procedure. Paper SAS384-2014.
# http://support.sas.com/resources/papers/proceedings14/SAS384-2014.pdf
# Pattinson, N.B. (1981) Dry Matter Intake: An Estimate of the Animal
# Response to Herbage on Offer. unpublished M.Sc. thesis, University
# of Natal, Pietermaritzburg, South Africa, Department of Grassland Science.
# 'x4' is the vector of weeks after commencement of grazing in a pasture
# 'y4' is the vector of weight of cut grass from 10 randomly sited quadrants
x4 <- 1:13
y4 <- c(3.183, 3.059, 2.871, 2.622, 2.541, 2.184,
2.110, 2.075, 2.018, 1.903, 1.770, 1.762, 1.550)
# Define the first case of Mitscherlich equation
MitA <- function(P, x){
P[3] + P[2]*exp(P[1]*x)
}
# Define the second case of Mitscherlich equation
MitB <- function(P2, x){
if(P2[3] <= 0)
temp <- mean(y4)
if(P2[3] > 0)
temp <- log(P2[3]) + exp(P2[2] + P2[1]*x)
return( temp )
}
# Define the third case of Mitscherlich equation
MitC <- function(P3, x, x1=1, x2=13){
theta1 <- P3[1]
beta2 <- P3[2]
beta3 <- P3[3]
theta2 <- (beta3 - beta2)/(exp(theta1*x2)-exp(theta1*x1))
theta3 <- beta2/(1-exp(theta1*(x1-x2))) - beta3/(exp(theta1*(x2-x1))-1)
theta3 + theta2*exp(theta1*x)
}
ini.val3 <- c(-0.1, 2.5, 1)
RESU1 <- confcurves( MitA, x=x4, y=y4, ini.val=ini.val3, fig.opt = TRUE,
fold=5, np=20, alpha=seq(1, 0.001, by=-0.001),
show.CI=c(0.8, 0.9, 0.95, 0.99) )
ini.val4 <- c(-0.10, 0.90, 2.5)
RESU2 <- confcurves( MitB, x=x4, y=y4, ini.val=ini.val4, fig.opt = TRUE,
fold=5, np=200, alpha=seq(1, 0.001, by=-0.001),
show.CI=c(0.8, 0.9, 0.95, 0.99) )
ini.val6 <- c(-0.15, 2.5, 1)
RESU3 <- confcurves( MitC, x=x4, y=y4, ini.val=ini.val6, fig.opt = TRUE,
fold=5, np=20, alpha=seq(1, 0.001, by=-0.001),
show.CI=c(0.8, 0.9, 0.95, 0.99) )
##################################################################################################
graphics.off()
Run the code above in your browser using DataLab