I have a database with 1200 observations and 14 variables and I'am trying to do a classification tree for my dependent nominal variable who hase 4 modality
> table(testarbre2$Q99)
Autres Nahdha Ne pas voter Nidaa Tounes
248 351 303 298
at firt i tried to do a multinom logistic regression but i got the mojority of my predictor variables non significant. it seems that Even with 1200 people I was trying to fit a model for which I don't have sufficient data. so i tried to do a classification tree using the package rpart from R but the problem is that the error is so high about 65% and more, and the missclassification is about 70% this is the code R that i used
#preparation of the data
set.seed(26)
train=sample(1:nrow(testarbre2),nrow(testarbre2)*7/10)
test=-train
training_data=testarbre2[train,]
testing_data=testarbre2[test,]
testing_vote=vote[test]
#fitting the model
library(rpart)
library(rpart.plot)
Tree <- rpart(Q99~.,data=training_data)
rpart.plot(Tree)
printcp(Tree)
plotcp(Tree)
#Construction of the complete tree
Tree <-rpart(Q99~.,data=training_data,control=rpart.control(minsplit=50,cp=0))
#Prune the tree
treeOptimal <- prune(Tree,cp=Tree$cptable[which.min(Tree$cptable[,4]),1])
rpart.plot(treeOptimal)
#Prediction
a=predict(ptitanicOptimal,testing_data2,type = "class")
mc=table(a,testing_vote2)
I don't know if i missed a step or i used a wrong approach in the construction of my classification tree or the database is causing the problem
Please someone help me to understand what's wrong with my model