###################################################################################
################## European rabbits Data - a log-Student-t model #############
###################################################################################
data("Erabbits", package="ssym")
fit <- ssym.nl(log(wlens) ~ b1 - b2/(b3 + age) | ncs(age), start=c(b1=5.6,
b2=128, b3=36.4), data=Erabbits, family='Student', xi=11,
local.influence=TRUE)
summary(fit)
################## Plot of the fitted model ##################
par(mfrow=c(1,2))
plot(Erabbits$age, Erabbits$wlens, xlim=range(Erabbits$age),
ylim=range(Erabbits$wlens), ylab="", cex=0.3, lwd=3, xlab="age")
par(new=TRUE)
plot(Erabbits$age,exp(fitted(fit)$mu), xlim=range(Erabbits$age),
ylim=range(Erabbits$wlens), ylab="", type="l", main="Median", xlab="")
np.graph(fit, which=2, exp=TRUE, xlab="age", main="Skewness")
################## Plot of deviance-type residuals ##################
plot(fit)
################## Plot of local influence measures ##################
ilm <- influence.ssym(fit)
###################################################################################
################## Biaxial Fatigue Data - a Birnbaum-Saunders model #############
###################################################################################
data("Biaxial", package="ssym")
fit <- ssym.nl(log(Life) ~ b1*Work^b2, start=c(b1=16,b2=-0.2), data=Biaxial,
family='Sinh-normal', xi=0.41, local.influence=TRUE)
summary(fit)
################## Plot of the fitted model ##################
attach(Biaxial)
xl <- "Work per cycle"
rx <-range(Biaxial$Work)
ry <- range(Biaxial$Life)
plot(Biaxial$Work, Biaxial$Life, xlim=rx, ylim=ry, type="p", cex=0.3, lwd=3,
ylab="", xlab="")
par(new=TRUE)
ids <- sort(Biaxial$Work,index=TRUE)$ix
plot(Biaxial$Work[ids], exp(fitted(fit)$mu[ids]), xlim=rx, ylim=ry, type="l",
ylab="Life", xlab=xl)
################## Plot of deviance-type residuals ##################
plot(fit)
################## Plot of local influence measures ##################
ilm <- influence.ssym(fit)
###################################################################################
######### Gross Domestic Product per capita Data - a Birnbaum-Saunders model ######
###################################################################################
data("gdp", package="ssym")
fit <- ssym.nl(log(gdp2010) ~ b1, start=c(b1=mean(log(gdp$gdp2010))), data=gdp,
family='Sinh-normal', xi=2.2)
summary(fit)
################## Plot of the fitted model ##################
xl <- "GDP per capita 2010"
par(mfrow=c(1,2))
hist(gdp$gdp2010, xlim=range(gdp$gdp2010), ylim=c(0,0.00015), prob=TRUE, breaks=55,
col="light gray", border="dark gray",xlab="",main="",ylab="")
par(new=TRUE)
plot(gdp$gdp2010, exp(fit$lpdf)/gdp$gdp2010, xlim=range(gdp$gdp2010), ylim=c(0,0.00015),
type="l", xlab=xl, ylab="", main="Histogram")
plot(gdp$gdp2010, fit$cdfz, xlim=range(gdp$gdp2010), ylim=c(0,1), type="l", xlab="",
ylab="")
par(new=TRUE)
plot(ecdf(gdp$gdp2010), xlim=range(gdp$gdp2010), ylim=c(0,1), verticals=TRUE, do.points=FALSE,
col="dark gray", xlab=xl, main="Empirical Cumulative Distribution Function")
################## Plot of deviance-type residuals ##################
plot(fit)
Run the code above in your browser using DataLab