README.md

ggmodel – Visualize Base R Models with ggplot2 🚧

ggmodel is an R package aimed at transforming model outputs from base R into beautiful 2D visualizations using ggplot2. πŸ“Š Currently, the package is in beta and includes one core function – ggsurface – designed to generate 2D surface plots from linear, generalized linear, and loess models.

✨ Features

πŸ“₯ Installation

Install the development version of ggmodel from GitHub:

# Install remotes package if not already installed
install.packages("remotes")

# Install ggmodel (beta)
remotes::install_github("wilsonfrantine/ggmodel")

πŸš€ Quick Demo

Here’s what you can do with the current version of ggmodel:

# Load necessary libraries
library(ggmodel)

# Fit a basic linear model
model <- lm(mpg ~ wt + hp, data = mtcars)

# Visualize model surface
ggsurface(model, x.var = "wt", y.var = "hp", legend.title = "Miles per Gallon")

The plot will show how weight (wt) and horsepower (hp) interact to influence miles per gallon (mpg). πŸ‘‰ For a full tutorial, visit the ggmodel project page.

πŸ› οΈ Function Details

ggsurface() – The Core of ggmodel

ggsurface is a versatile function that generates 2D model surface plots for regression models in R.

Supported Models: - lm – Linear Models - glm – Generalized Linear Models - loess – Local Polynomial Regression

Key Arguments: - m – Model object (lm, glm, or loess). - x.var – Name of the predictor variable for the x-axis. - y.var – Name of the predictor variable for the y-axis. - legend.title – Title for the legend (default: response variable name). - xgrid.size / ygrid.size – Grid resolution (default: 15). - low.col / high.col – Gradient colors for low and high surface values. - n.bins – Number of bins for discretizing the surface (default: 10). - scale.type – Prediction scale (link or response).

πŸ”¨ Roadmap

πŸ”§ Although ggmodel currently focuses on surface plots, future updates will include: - πŸ“Š Coefficient Plots – Visualize model coefficients with confidence intervals. - πŸ“ˆ Residual Analysis – Expanded diagnostic plots for GLMs. - 🧩 Support for More Models – Compatibility with gam (Generalized Additive Models) and mixed models.

🀝 Contributing

Since ggmodel is in early development, contributions are encouraged and highly appreciated!

πŸ“œ License

This project is licensed under the GPL License.

🚧 Disclaimer

ggmodel is in beta. While functional, the package currently offers limited features. Expect new additions soon!



wilsonfrantine/ggmodel documentation built on Dec. 28, 2024, 6:48 a.m.