# NOT RUN {
##Load the data
data(Oil)
##Define non linear function
nlf<-function(x,betas){
resp<- betas[1]/(1 +betas[2]*exp(-betas[3]*x))
return(resp)
}
##Set the response y and covariate x
y <- Oil$y
x <- Oil$x
##Set initial values
betas <- c(37,4.81,0.78)
sigma2 <- 2.95
shape <- -2
nu <- 3
## Skew.normal regression
analysis.sn <- smsn.nl(y=y, x=x, betas=betas, sigma2=sigma2,
shape = shape, nlf = nlf, criteria = TRUE,
family = "Skew.normal", iter.max = 200)
## Skew.t regression
analysis.st <- smsn.nl(y=y, x=x, betas=betas, sigma2=sigma2, shape = shape,
nu = nu, nlf = nlf, criteria = TRUE,
family = "Skew.t", iter.max = 200)
# }
Run the code above in your browser using DataLab