predict.tfunHDDC {TFunHDDC} | R Documentation |
predict.tfunHDDC: Predicting Function for t-funHDDC Objects
Description
Provides the matrix of classification probabilities and the classification vector for inputted observations assuming the model provided by the tfunHDDC
object.
Usage
## S3 method for class 'tfunHDDC'
predict(object, data=NULL, ...)
Arguments
object |
An object of class |
data |
Data frame (univariate funtional data) or a list (multivariate functional data) of new observations on the same variables used in the fitting of the |
... |
Arguments to be passed to other functions. |
Value
t |
Matrix of classification probabilities |
class |
Vector of maximum a posteriori classifications |
Author(s)
Cristina Anton, Iain Smith
References
-Andrews JL, McNicholas PD (2012) Model-based clustering, classication, and discriminant analysis via mixtures of multivariate t-distributions: The teigen family. Stat Comput 22:10211029. <doi.org/10.1007/ s11222-011-9272-x>
-Andrews JL, Wickins JR, Boers NM, et al (2018) An R package for modelbased clustering and classication via the multivariate t distribution. Journal of Statistical Software 83(7):1-32
- Cristina Anton, Iain Smith Model-based clustering of functional data via mixtures of t
distributions. Advances in Data Analysis and Classification (to appear).
See Also
Examples
set.seed(1027)
#simulataed univariate data
data = genModelFD(ncurves=300, nsplines=35, alpha=c(0.9,0.9,0.9),
eta=c(10, 7, 17))
plot(data$fd, col = data$groupd)
clm = data$groupd
model1=c("AkjBkQkDk", "AkjBQkDk", "AkBkQkDk", "ABkQkDk", "AkBQkDk", "ABQkDk")
####################classification example with predictions
training=c(1:50,101:150, 201:250)
test=c(51:100,151:200, 251:300)
known1=clm[training]
t4<-tfunHDDC(data$fd[training],K=3,threshold=0.2,init="kmeans",nb.rep=1,
dfconstr="no", dfupdate="numeric", model=model1[1],known=known1,
itermax = 10)
if (!is.null(t4$class)) {
table(clm[training], t4$class)
p1<-predict.tfunHDDC(t4,data$fd[test] )
if (!is.null(p1$class)) table(clm[test], p1$class)
}
###########################NOX data
data1=fitNOxBenchmark(15)
plotNOx(data1)
###example for prediction
training=c(1:50)
test=c(51:115)
known1=data1$groupd[training]
t1<-tfunHDDC(data1$fd[training],K=2,threshold=0.6,init="kmeans",nb.rep=10,
dfconstr="no", model=c("AkjBkQkDk", "AkjBQkDk", "AkBkQkDk",
"ABkQkDk", "AkBQkDk", "ABQkDk"),known=known1)
if (!is.null(t1$class)) {
table(data1$groupd[training], t1$class)
p1<-predict.tfunHDDC(t1,data1$fd[test] )
if (!is.null(p1$class)) table(data1$groupd[test], p1$class)
}