# \donttest{
data(BankingCrisesDistances)
# shorthand function for COPS-C (finding configuration with copstress)
res<-cops(BankingCrisesDistances[,1:69],variant="COPS-C",
stressweight=0.98,cordweight=0.02,itmax=1000)
# Note: itmax is very small here for illustration; will give a non-convergence
# warning of the optimizer which disappears at itmax=275000
res
summary(res)
plot(res)
plot(res,"reachplot")
plot(res,"transplot")
plot(res,"Shepard")
#shorthand function for P-COPS (hyperparameter search for powerstress)
res<-cops(BankingCrisesDistances[,1:69],variant="P-COPS")
res
summary(res)
plot(res)
plot(res,"reachplot")
plot(res,"transplot")
plot(res,"Shepard")
# }
dis<-as.matrix(smacof::kinshipdelta)
#COPS-C with equal weight to stress and cordillera
res1<-cops(dis,variant="COPS-C",stressweight=0.5,cordweight=0.5,
minpts=2,itmax=500) #use higher itmax in real
res1
summary(res1)
plot(res1)
plot(res1,"reachplot")
# \donttest{
#s-stress type copstress (i.e. kappa=2, lambda=2)
res3<-cops(dis,variant="COPS-C",kappa=2,lambda=2,stressweight=0.5,cordweight=0.5)
res3
summary(res3)
plot(res3)
# power-stress type profile copstress
# search for optimal kappa and lambda between
# kappa=0.5,lambda=0.5 and kappa=2,lambda=5
# nu is fixed on -1
ws<-1/dis
diag(ws)<-1
res5<-cops(dis,variant="P-COPS",loss="powerstress",
theta=c(1.4,3,-1), lower=c(1,0.5,-1),upper=c(3,5,-1),
weightmat=ws, stressweight=0.9,cordweight=0.1)
res5
summary(res5)
plot(res5)
# }
Run the code above in your browser using DataLab