predicor | R Documentation |
This function analyze the correlation of a predictor across different scales.
predicor(x, ...)
x |
a dataframe generated with the functions calc_lsm and tranformed with |
... |
other parameters to be passed for the stats::cor function |
A data frame containing the correlation values between scales
## Not run:
#Comparing correlation behaviour in nested and decouple multiscales:
b <- c(500, 1000, 1500, 2000, 2500, 3000)
nest.ls <- nestedscales(r, p, b)
dec.ls <- decouple(r, p, b)
#extracting percentage for each class and scale
nest.lsm <- calc_lsm(nest.ls, metric = "pland")
dec.lsm <- calc_lsm(dec.ls, metric = "pland")
#Comparing correlation for the class = 3
nestcor <- predicor(lsm2multifit(nest.lsm, level="class", class=3,
metrics="pland"))
deccor <- predicor(lsm2multifit(dec.lsm, level="class", class=3,
metrics="pland"))
corcomp <- data.frame(
strategy = factor(c(rep("nested", nrow(nestcor)),
rep("decoupled", nrow(deccor))),
levels = c("nested","decoupled")),
scales = factor(c(nestcor$scales, deccor$scales),
levels=nestcor$scales),
correlation = c(nestcor$correlation, deccor$correlation)
)
library(ggplot2)
ggplot(corcomp, aes(x=scales, y=correlation, fill=strategy))+
geom_bar(stat="identity", position="dodge")+
theme(axis.text = element_text(angle=90))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.