plot_comp: FactorSCGLR generic plot

View source: R/plot.R

plot_compR Documentation

FactorSCGLR generic plot

Description

FactorSCGLR generic plot

Usage

plot_comp(x, thresold = 0, plan = c(1, 2), theme = 1, lin.pred = FALSE)

Arguments

x

an object from FactorSCGLR

thresold

correlations with the two components of the plane lower than this threshold will be ignored

plan

a size-2 vector indicating which components are plotted

theme

a integer indicating the theme

lin.pred

a logical. Should we draw linear predictor

Value

an object of class ggplot2

Examples

# load sample data
data <- genus
# get variable names from dataset
n <- names(data)
ny <- n[grep("^gen",n)]
nx1 <- n[grep("^evi",n)]
nx2 <- n[grep("^pluvio",n)]
na <- c("geology", "altitude", "forest", "lon", "lat")
# build multivariate formula
form <- multivariateFormula(Y = ny, X = list(nx1, nx2), A = na)
# define family
fam <- rep("poisson", length(ny))
# run function
H <- c(2,2)
J <- 2
met <- methodSR(l=4, s=0.5)
res <- FactorSCGLR(formula=form, data=data, H=H, J=J,
                   family=fam, method=met, offset = data$surface)

# show the correlation plot
plot_comp(x=res, thresold=0.5, theme=1, plan=c(1,2), lin.pred=TRUE)

julien-gibaud/FactorsSCGLR documentation built on March 27, 2024, 8:17 a.m.