Description Usage Arguments Details Value Author(s) Examples

View source: R/DAMisc_functions.R

Makes surface plots to display interactions between two continuous variables

1 |

`obj` |
A model object of class |

`varnames` |
A two-element character vector where each element is the name of a variable involved in a two-way interaction. |

`theta` |
Angle defining the azimuthal viewing direction to be passed to |

`phi` |
Angle defining the colatitude viewing direction to be passed to |

`xlab` |
Optional label to put on the x-axis, otherwise if |

`ylab` |
Optional label to put on the y-axis, otherwise if |

`zlab` |
Optional label to put on the z-axis, otherwise if |

`...` |
Other arguments to be passed down to the initial call to |

This function makes a surface plot of an interaction between two continuous covariates. If the model is

*y = b[0] + b[1]x1 + b[2]x2 + b[3]x1*x2 + ... + e[i],*

this function plots *b[1]x1 + b[2]x2 + b[3]x1*x2* for values over the range of *X1* and *X2*. The highest 75%, 50% and 25% of the bivariate density of *X1* and *X2* (as calculated by `sm.density`

from the `sm`

package) are colored in with colors of increasing gray-scale.

`x1` |
Values of the first element of |

`x2` |
Values of the second element of |

`pred` |
The predictions based on the values |

`graph` |
A graph is produced, but no other information is returned. |

Dave Armstrong (UW-Milwaukee, Department of Political Science)

1 2 3 4 5 6 7 8 9 10 11 | ```
data(InteractionEx)
mod <- lm(y ~ x1*x2 + z, data=InteractionEx)
DAintfun(mod, c("x1", "x2"))
## Make interactive with:
# mypanel <- function(panel){
# DAintfun(mod, c("x1", "x2"), theta=panel$theta, phi=panel$phi)
# panel}
# panel <- rp.control(theta=0, phi=25)
# rp.slider(panel, theta, -360, 360, mypanel, showvalue=TRUE)
# rp.slider(panel, phi, 0, 90, mypanel, showvalue=TRUE)
``` |

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.