modelplot: Plot good of fitness multi-scale models

View source: R/modelplot.R

modelplotR Documentation

Plot good of fitness multi-scale models

Description

this function takes the output from fitscales and plot the good of fitness acording to a given criterion. The criterion vary among model types, but any column from broom::glance() function will works. The output is a tibble with two new columns "plot.id" and "ggplot". The former holds the ggplot output which can be edited with ggplot2 API.

Usage

modelplot(x, criterion = NULL, plot = T)

Arguments

x

the output of fitscale function

criterion

a collumn name from the x$glance tibble. By default the function looks for 'r.squared', 'AIC', 'BIC', and 'logLik', respectively.

plot

a logical (defaut is TRUE), indicating whether to print the plots.

Details

By defaut the function plots the criterion by response and predictors. When one has too many predictors, the plot might looks unreadable and filtering is recomended. In addition, the function always highlights with balck dots the p.values lower than 0.05 if such a column is summarized by the "broom"'s API.

This 'p.value' means that an specific model is different than NULL, not different each other. For comparing models, users must perform further analysis. Besides NA values are ploted but filled with red color.

Users are free to change any of theses features directlly in ggplot objecs from ggplot column. It can be accessed by myobject$ggplot[plot.id] with 'plot.id' equal to the desired plot id.

It's important to highlight that the ouputed tibble has the same data as inputed, which is stored into the collumn "data" and can be unnested with the command: myobject %>% unnest(data)

This function returns a ggplot2 object that might be fully customizable. Users might find more details with ?broom::glance. As an alternative, users may also extract any information from models using model.apply() function.

Author(s)

Wilson Frantine-Silva

See Also

model.apply() fitscales()

Examples

## Not run: 
ls <- decouple(r,p,c(1000,2000,3000))
lsm <- calc_lsm(ls, c("pland","shdi"))
bio <- euglossini
mod <- fitscales(lsm, bio, "lm")
m.plot <- modelplot(mod, "r.squared", plot=F)
m.plot

## End(Not run)

wilsonfrantine/landscapeDecoupler documentation built on Oct. 31, 2024, 3:45 a.m.