Ayuda con un árbol de regresión

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Ayuda con un árbol de regresión

Miguel angel Lopez Martinez
ARBOL<-tree(PRECIO~CILINDRAJE_DEL_MOTOR+MODELO,data=CARROST)
ARBOL
plot(ARBOL)
text(ARBOL,cex=0.9)

 este es el código que utilizamos las variables cilindraje y modelo son
categóricas transformadas por que si utilizamos las varibales como factor
no las reconoce

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Ayuda con un árbol de regresión

Michael Dewey
Miguel, si prefieres escribir en espanol

https://stat.ethz.ch/mailman/listinfo/r-help-es

(This is the address of the Spanish language mailing list)

On 23/03/2015 20:13, Miguel angel Lopez Martinez wrote:

> ARBOL<-tree(PRECIO~CILINDRAJE_DEL_MOTOR+MODELO,data=CARROST)
> ARBOL
> plot(ARBOL)
> text(ARBOL,cex=0.9)
>
>   este es el código que utilizamos las variables cilindraje y modelo son
> categóricas transformadas por que si utilizamos las varibales como factor
> no las reconoce
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2015.0.5751 / Virus Database: 4315/9373 - Release Date: 03/24/15
>

--
Michael
http://www.dewey.myzen.co.uk

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Ayuda con un árbol de regresión

Jose Iparraguirre

Miguel,

Sin tus datos es imposible brindarte una respuesta precisa pero ten en cuenta que la descripción del argumento 'fórmula' en la función tree del paquete del mismo nombre dice que la variable dependiente -PRECIO en tu caso- debe ser un vector numérico si quieres estimar un árbol de regressión o un factor si deseas producir un árbol de clasificación. No veo términos de interacción en tu fórmula, cuya presencia no es permitida, por lo que te sugiero revises qué clase de objeto es PRECIO, para lo cual puedes escribir str(CARROST$PRECIO). Puede que necesites modificar la clase a vector numérico.

Without any of your data we can't give you a precise answer, but take into account that the description of the formula argument of the tree function (package tree) reads: "The left-hand-side (response) should be either a numerical vector when a regression tree will be fitted or a factor, when a classification tree is produced. The right-hand-side should be a series of numeric or factor variables separated by +; there should be no interaction terms". Your formula contains no interaction terms, so I'd suggest you should check what class of object PRECIO is -type str(CARROST$PRECIO). You may need to change it to a numerical vector.

José



-----Original Message-----
From: R-help [mailto:[hidden email]] On Behalf Of Michael Dewey
Sent: 24 March 2015 18:16
To: Miguel angel Lopez Martinez; [hidden email]
Subject: Re: [R] Ayuda con un árbol de regresión

Miguel, si prefieres escribir en espanol

https://stat.ethz.ch/mailman/listinfo/r-help-es

(This is the address of the Spanish language mailing list)

On 23/03/2015 20:13, Miguel angel Lopez Martinez wrote:

> ARBOL<-tree(PRECIO~CILINDRAJE_DEL_MOTOR+MODELO,data=CARROST)
> ARBOL
> plot(ARBOL)
> text(ARBOL,cex=0.9)
>
>   este es el código que utilizamos las variables cilindraje y modelo
> son categóricas transformadas por que si utilizamos las varibales como
> factor no las reconoce
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2015.0.5751 / Virus Database: 4315/9373 - Release Date:
> 03/24/15
>

--
Michael
http://www.dewey.myzen.co.uk

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see 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.

Age UK Group

Age UK is a registered charity and company limited by guarantee, (registered charity number 1128267, registered company number 6825798) Registered office: Tavis House, 1-6 Tavistock Square, London WC1H 9NA.

For the purposes of promoting Age UK Insurance, Age UK is an Appointed Representative of Age UK Enterprises Limited. Age UK Enterprises Limited is authorised and regulated by the Financial Conduct Authority.

Charitable Services are offered through Age UK (the Charity) and commercial products and services are offered by the Charity’s subsidiary companies. The Age UK Group comprises of Age UK, and its subsidiary companies and charities, dedicated to improving the lives of people in later life. Our network includes the three national charities Age Cymru, Age NI and Age Scotland and more than 160 local Age UK charities.

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you receive a message in error, please advise the sender and delete immediately.

Except where this email is sent in the usual course of our business, any opinions expressed in this email are those of the author and do not necessarily reflect the opinions of Age UK or its subsidiaries and associated companies. Age UK monitors all e-mail transmissions passing through its network and may block or modify mails which are deemed to be unsuitable.
______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.