valeriano.parravicini at unige.it
2010-Mar-09 03:40 UTC
[R] ctree - party package multivariate response variables
Hi, I have a problem with ctree of party package. I have data on distribution of more than one species (about 50 species) and I would like identify the relation of this multivariate object (species distribution) with a number of explanatory variables. rs is the name of my dataframe containing the species (columns from 2 to 51) and the explanatory variables (columns 52 and 53). Rows are my sampling sites. I wrote: species<-rs[,2:51] v1<-rs[,52] v2<-rs[53] tree<-ctree(species~v1+v2) It does not work , but when I use the same formula for the univariate case (i.e. a single column - e.g. the total number of species in each samplig sites) it works. I know that ctree can handle multivariate response variables, but I cannot figure out how to do that. Someone can help me? Thank you Valeriano
Peter Ehlers
2010-Mar-09 07:07 UTC
[R] ctree - party package multivariate response variables
Your description of your data isn't clear to me. What are the values in column 2, for example? Are you trying to construct regression or classification trees? A reproducible example would really help. -Peter Ehlers On 2010-03-08 20:40, valeriano.parravicini at unige.it wrote:> Hi, > > I have a problem with ctree of party package. > I have data on distribution of more than one species (about 50 species) and I > would like identify the relation of this multivariate object (species > distribution) with a number of explanatory variables. > > rs is the name of my dataframe containing the species (columns from 2 to 51) and > the explanatory variables (columns 52 and 53). Rows are my sampling sites. > > I wrote: > > species<-rs[,2:51] > v1<-rs[,52] > v2<-rs[53] > tree<-ctree(species~v1+v2) > > It does not work , but when I use the same formula for the univariate case (i.e. > a single column - e.g. the total number of species in each samplig sites) it > works. I know that ctree can handle multivariate response variables, but I > cannot figure out how to do that. > > Someone can help me? > > Thank you > > > > Valeriano > > ______________________________________________ > R-help at 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. > >-- Peter Ehlers University of Calgary
Henric (Nilsson) Winell
2010-Mar-10 01:40 UTC
[R] ctree - party package multivariate response variables
On 2010-03-09 04:40, valeriano.parravicini at unige.it wrote:> Hi, > > I have a problem with ctree of party package. > I have data on distribution of more than one species (about 50 species) and I > would like identify the relation of this multivariate object (species > distribution) with a number of explanatory variables. > > rs is the name of my dataframe containing the species (columns from 2 to 51) and > the explanatory variables (columns 52 and 53). Rows are my sampling sites. > > I wrote: > > species<-rs[,2:51] > v1<-rs[,52] > v2<-rs[53] > tree<-ctree(species~v1+v2) > > It does not work , but when I use the same formula for the univariate case (i.e. > a single column - e.g. the total number of species in each samplig sites) it > works. I know that ctree can handle multivariate response variables, but I > cannot figure out how to do that.The response variables needs to be explicitly specified, e.g. ctree(y1 + y2 ~ x1 + x2) gives you a bivariate response. HTH, Henric> > Someone can help me? > > Thank you > > > > Valeriano > > ______________________________________________ > R-help at 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. >