knitr::opts_chunk$set(echo = TRUE)
library(SCGLR) # load sample data data(genus) # get variable names from dataset n <- names(genus) ny <- n[grep("^gen",n)] # Y <- names that begins with "gen" nx <- n[-grep("^gen",n)] # X <- remaining names # remove "geology" and "surface" from nx # as surface is offset and we want to use geology as additional covariate nx <-nx[!nx%in%c("geology","surface")] # build multivariate formula # we also add "lat*lon" as computed covariate to catch spatial spatial patterns form <- multivariateFormula(ny,c(nx,"I(lat*lon)"),A=c("geology")) # define family fam <- rep("poisson",length(ny)) genus.scglr <- scglr(formula=form,data = genus,family=fam, K=4, offset=genus$surface)
summary(genus.scglr)
screeplot(genus.scglr)
plot(genus.scglr, title="Correlation plot showing covariates") plot(genus.scglr,predictors=TRUE,covariates=FALSE, title="Correlation plot showing predictors")
pairs(genus.scglr,ncol=2)
n <- names(genus) n <-n[!n%in%c("geology","surface","lon","lat","forest","altitude")] ny <- n[grep("^gen",n)] # Y <- names that begins with "gen" nx1 <- n[grep("^evi",n)] # theme 1 with EVI covariates nx2 <- n[-c(grep("^evi",n),grep("^gen",n))] # theme 2 with pluviometry covariates form <- multivariateFormula(ny,nx1,nx2,A=c("geology")) print(form) testthm <-scglrTheme(form,data=genus,H=c(2,3),family="poisson",offset = genus$surface)
screeplot(testthm)
plot(testthm)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.