在R语言的randomForest程序包中,randomForest函数中的第一个参数是formula,文章中的解释是a formula describing the model to be fitted.
有两个例子,一个这么写的:iris.rf<-randomForest(Species~.,iris)
另一个是ozone.rf<-randomForest(Ozone~.,data=airquality)
就是说这两个例子的formula一个是Species~.,另一个是Ozone~.,
这两个例子中的Species~.,和Ozone~.,分别是什么含义?
对于我自己要跑的数据,这个formula应该怎么定义?
Call:
randomForest(formula = Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width, data = iris, importance = TRUE)
Type of random forest: classification
Number of trees: 500
No. of variables tried at each split: 2