plot_comp | R Documentation |
FactorSCGLR generic plot
plot_comp(x, thresold = 0, plan = c(1, 2), theme = 1, lin.pred = FALSE)
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 |
an object of class ggplot2
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.