Description Usage Arguments Details Author(s) References See Also Examples

View source: R/visualize_relationship.R

Attempts to show how the relationship between y and x is being modeled in a partition or random forest model

1 2 |

`TREE` |
A partition or random forest model (though it works with many regression models as well) |

`interest` |
The name of the predictor variable for which the plot of y vs. x is to be made. |

`on` |
A dataframe giving the values of the other predictor variables for which the relationship is to be visualized. Typically this is the dataframe on which the partition model was built. |

`smooth` |
If |

`marginal` |
If |

`nplots` |
The number of rows of |

`seed` |
the seed for the random number seed if reproducibility is required |

`pos` |
the location of the legend |

`...` |
additional arguments past to |

The function shows a scatterplot of y vs. x in the `on`

dataframe, then shows how `TREE`

is modeling the relationship between y and x with predicted values of y for each row in the data and also a curve illustrating the relationship. It is useful for seeing what the relationship between y and x as modeled by `TREE`

"looks like", both as a whole and for particular combinations of other variables. If `marginal`

is `FALSE`

, then differences in the curves indicate the presence of some interaction between x and another variable.

Adam Petrie

Introduction to Regression and Modeling

1 2 3 4 5 6 7 8 9 | ```
data(SALARY)
FOREST <- randomForest(Salary~.,data=SALARY)
visualize_relationship(FOREST,interest="Experience",on=SALARY)
visualize_relationship(FOREST,interest="Months",on=SALARY,xlim=c(1,15),ylim=c(2500,4500))
data(WINE)
TREE <- rpart(Quality~.,data=WINE)
visualize_relationship(TREE,interest="alcohol",on=WINE,smooth=FALSE)
visualize_relationship(TREE,interest="alcohol",on=WINE,marginal=FALSE,nplots=7,smooth=FALSE)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.