# [R] Random Forest - partial dependence plot

Carlos M. Zambrana-Torrelio cmzambranat at gmail.com
Tue Oct 20 22:24:24 CEST 2009

```Thanks Andy,

I'm sorry, I didn't clear myself. I was talking about the y-axis, so

On Tue, Oct 20, 2009 at 9:39 AM, Liaw, Andy <andy_liaw at merck.com> wrote:
> Are you talking about the y-axis or the x-axis?  If you're talking about
> the y-axis, that range isn't really very meaningful.  The partial
> dependence function basically gives you the "average" trend of that
> variable (integrating out all others in the model).  It's the shape of
> that trend that is "important".  You may interpret the relative range of
> these plots from different predictor variables, but not the absolute
> range.  Hope that helps.
>
> Andy
>
>> -----Original Message-----
>> From: r-help-bounces at r-project.org
>> [mailto:r-help-bounces at r-project.org] On Behalf Of Carlos M.
>> Zambrana-Torrelio
>> Sent: Monday, October 19, 2009 3:47 PM
>> To: r-help at r-project.org
>> Subject: [R] Random Forest - partial dependence plot
>>
>> Hi everybody,
>>
>> I used random forest regression to explain the patterns of species
>> richness and a bunch of climate variables (e.g. Temperature,
>> precipitation, etc.) All are continuos variables. My results are
>> really interesting and my model explained 96,7% of the variance.
>>
>> Now I am  trying to take advantage of the  importance variable
>> function and depicts the observed patterns using partial dependence
>> plots.
>>
>> However, I found a really strange (at least for me...) behavior: the
>> species number ranges between 1 to 150, but when I make the partial
>> plot the graphic only represent values between 43 to 50!!
>>
>>
>> I  use the following code to get the partial plot:
>>
>> partialPlot(ampric.rf, amp.data, "Temp")
>>
>> where ampric.rf is the random forest object; amp.data are the data and
>> Temp is the variable I am interested.
>>
>> How I can have partial plot explaining all species number
>> (from 1 to 150)??
>> Also, I read the RF documentation and I was wondering what its the
>> meaning of "marginal effect of a variable"
>>
>>
>> Carlos
>>
>>
>>
>>  I found really interesting
>>
>> --
>> Carlos M. Zambrana-Torrelio
>> Department of Biology
>> University of Puerto Rico - RP
>> PO BOX 23360
>> San Juan, PR 00931-3360
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> Notice:  This e-mail message, together with any attachments, contains
> information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
> New Jersey, USA 08889), and/or its affiliates (which may be known
> outside the United States as Merck Frosst, Merck Sharp & Dohme or
> MSD and in Japan, as Banyu - direct contact information for affiliates is
> available at http://www.merck.com/contact/contacts.html) that may be
> confidential, proprietary copyrighted and/or legally privileged. It is
> intended solely for the use of the individual or entity named on this
> message. If you are not the intended recipient, and have received this
> message in error, please notify us immediately by reply e-mail and
> then delete it from your system.
>
>

--
Carlos M. Zambrana-Torrelio
Department of Biology
University of Puerto Rico - RP
PO BOX 23360
San Juan, PR 00931-3360

```