data(ais)
m1 <- selm(log(Fe) ~ BMI + LBM, family="SN", data=ais)
print(m1)
summary(m1)
s<- summary(m1, "DP", cov=TRUE, cor=TRUE)
plot(m1)
plot(m1, param.type="DP")
logLik(m1)
coef(m1)
coef(m1, "DP")
var <- vcov(m1)
#
m1a <- selm(log(Fe) ~ BMI + LBM, family="SN", method="MPLE", data=ais)
m1b <- selm(log(Fe) ~ BMI + LBM, family="ST", fixed.param=list(nu=8), data=ais)
#
data(barolo)
attach(barolo)
A75 <- (reseller=="A" & volume==75)
logPrice <- log(price[A75],10)
m <- selm(logPrice ~ 1, family="ST")
summary(m)
plot(m, which=2, col=4, main="Barolo log10(price)")
# cfr Figure 4.7 of Azzalini & Capitanio (2014), p.107
detach(barolo)
#-----
# examples with multivariate response
#
m3 <- selm(cbind(BMI, LBM) ~ WCC + RCC, family="SN", data=ais)
plot(m3, col=2, which=2)
summary(m3, "dp")
coef(m3)
coef(m3, vector=FALSE)
#
data(wines)
m28 <- selm(cbind(chloride, glycerol, magnesium) ~ 1, family="ST", data=wines)
dp28 <- coef(m28, "DP", vector=FALSE)
pcp28 <- coef(m28, "pseudo-CP", vector=FALSE)
# the next statement takes a little more time than others
plot(m28)
# example of computation and plot of a (relative twice) profile log-likelihood;
# to save time, set a coarse grid of nu values
nu.vector <- seq(3, 8, by=0.5)
logL <- numeric(length(nu.vector))
for(k in 1:length(nu.vector)) {
m28.f <- selm(cbind(chloride, glycerol, magnesium) ~ 1, family="ST",
fixed=list(nu=nu.vector[k]), data=wines)
logL[k] <- logLik(m28.f)
cat(format(c(nu.vector[k], logL[k])), "")
}
plot(nu.vector, 2*(logL-max(logL)), type="b")
ok <- which.max(logL)
abline(v=nu.vector[ok], lty=2)
# compare maximum of this curve with MLE of nu in summary(m28, 'dp')
#
#
m4 <- selm(cbind(alcohol,sugar)~1, family="ST", data=wines)
m5 <- selm(cbind(alcohol,sugar)~1, family="ST", data=wines, fixed=list(alpha=0))
print(1 - pchisq(2*as.numeric(logLik(m4)-logLik(m5)), 2)) # test for symmetry
#
# illustrate final passage of 'Warning' section above:
# the execution of the next selm command is known to produce warning messages
# although the optimized declare successful convergence
m31 <- selm(cbind(BMI, LBM)~ Ht + Wt, family="ST", data=ais)
# Warning message...
slot(m31, "opt.method")$convergence # a 0 value indicates success
# the next case is similar
m32 <- selm(cbind(BMI, LBM)~ Ht + Wt, family="ST", data=ais, opt.method="BFGS")
# Warning message...
slot(m32, "opt.method")$convergenceRun the code above in your browser using DataLab