[R] subscript out of bounds in eqscplot problem
Dear R users, I have the following problem. Suppose I have the following toy data set: > data m1 m2 m3 m4 m5 state [1,] 1 0 1 13 23 2 [2,] 0 1 0 23 94 2 [3,] 1 0 0 45 56 1 [4,] 0 1 0 35 84 2 [5,] 1 1 0 98 37 1 [6,] 1 1 0 68 1 2 where the last column is a categorical variable representing the outcome, columns m1 to m3 are binary and columns m4 and m5 are continuous. I wish to perform lda and then plot the results so I do: sc.dat<-scale(data[,-6]) sc.dat<-cbind(sc.dat,data[,6]) try<-lda(sc.dat[,1:5],sc..dat[,6]) tr.pred<-predict(try) eqscplot(tr.pred$x) and then I get the following error (I also have collinearity which I ignore because it doesnt matter): > eqscplot(tr.pred$x) Error in eqscplot(tr.pred$x) : subscript out of bounds Why am I getting this error? What does it mean? Any insight is highly appreciated. Thanks in advance, Pierre [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Re : Running random forest using different training and testing schemes
Hi Chysanthi, check out the randomForest package, with the function randomForest. It has a CV option. Sorry for not providing you with a lengthier response at the moment but I'm rather busy on a project. Let me know if you need more help. Also, to split your data into two parts- the training and the test set you can do (n the number of data points): n<-length(data[,1]) indices<-sample(rep(c(TRUE,FALSE),each=n/2),round(n/2),replace=TRUE) training_indices<-(1:n)[indices] test_indices<-(1:n)[!indices] Then, data[train,] is the training set and data[test,] is the test set. Best, Pierre De : Chrysanthi A. À : r-help@r-project.org Envoyé le : Dimanche, 12 Avril 2009, 17h26mn 59s Objet : [R] Running random forest using different training and testing schemes Hi, I would like to run random Forest classification algorithm and check the accuracy of the prediction according to different training and testing schemes. For example, extracting 70% of the samples for training and the rest for testing, or using 10-fold cross validation scheme. How can I do that? Is there a function? Thanks a lot, Chrysanthi. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Re : Running random forest using different training and testing schemes
you need to include in your code something like: tree<-rpart(result~., data, control=rpart.control(xval=10)). this xval=10 is 10-fold CV. Best, Pierre De : Chrysanthi A. À : r-help@r-project.org Envoyé le : Dimanche, 12 Avril 2009, 17h26mn 59s Objet : [R] Running random forest using different training and testing schemes Hi, I would like to run random Forest classification algorithm and check the accuracy of the prediction according to different training and testing schemes. For example, extracting 70% of the samples for training and the rest for testing, or using 10-fold cross validation scheme. How can I do that? Is there a function? Thanks a lot, Chrysanthi. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] suppress output from step function
Dear all, Is there a way of using the step function on a linear model such that all the steps are not printed out? Say I have a matrix X of 50 explanatory variables and a binary response Y. linear_model<-glm(Y~X, data=my_data, family="binomial") SS<-step(linear_model) This last step produces all the output that would have been produced even if I hadn't named the result SS. SS<-step(linear_model,print=FALSE) - this doesnt work either. Does anyone have any ideas? Thank you all in advance. Best, Pierre [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.