Giter Club home page Giter Club logo

Comments (6)

tghoward avatar tghoward commented on August 27, 2024

image

correlation matrix of 69 terrestrial env vars (on left), plot of one pair (percent forested with 10 cell radius vs 100 cell radius) on the right.

from regional_sdm.

ChristopherTracey avatar ChristopherTracey commented on August 27, 2024

That's a pretty correlation diagram--how does one make it?

I used an r2 of 0.64, for a correlation value of 0.8.

from regional_sdm.

tghoward avatar tghoward commented on August 27, 2024

Excellent. Thank you. Do you have code for that? Didn't you use clustering of some sort?

The package qtlcharts:
http://kbroman.org/qtlcharts/assets/vignettes/userGuide.html

from regional_sdm.

ChristopherTracey avatar ChristopherTracey commented on August 27, 2024

from regional_sdm.

ChristopherTracey avatar ChristopherTracey commented on August 27, 2024

It was attached to the bottom of an aquatic variable prep script--that's why I couldn't find it. The igraph package did the clustering.

# run correlation analysis
#correlationtree <- varclus(data.matrix(MoBI_FlowEnvVar_Update[3:173]), similarity="spear")
correlationtree <- varclus(data.matrix(MoBI_FlowEnvVar_Update[c(80:82,105:110,121,174:178)]), similarity="spear")
# plot the data
#pdf("file.pdf",width=24,height=12)
plot(correlationtree, cex=0.6)
abline(h=0.1, col="blue")
abline(h=0.2, col="red")
#dev.off()


# prevent duplicated pairs
var.corelation <- correlationtree$sim*lower.tri(correlationtree$sim)
check.corelation <- which(var.corelation>0.64, arr.ind=TRUE)
graph.cor <- graph.data.frame(check.corelation, directed = FALSE)
groups.cor <- split(unique(as.vector(check.corelation)),         clusters(graph.cor)$membership)
a <- lapply(groups.cor,FUN=function(list.cor){rownames(var.corelation)[list.cor]})
correlated_groups <- do.call("rbind", lapply(a, data.frame))
correlated_groups$group <- rownames(correlated_groups)
correlated_groups$group <- gsub("\\..*","",correlated_groups$group)  #use to join up with the lkupenvvars table
rm(a, var.corelation, check.corelation, groups.cor, graph.cor)

# sqlite loading
db_aqua_lotic <- dbConnect(SQLite(),"MoBI_Aquatic_EnvVars.sqlite")
dbWriteTable(db_aqua_lotic, "envvar_lotic", MoBI_FlowEnvVar_Update)
dbDisconnect(db_aqua_lotic)

# envvar descriptions
envvars <- colnames(MoBI_FlowEnvVar)
ev_desc <- as.data.frame(envvars)
for(i in 1:length(ev_desc$envvars)){
  ev_desc$mean <- mean(get(MoBI_FlowEnvVar)$ev_desc$envvars[i])
  #get(paste('r',i,collapse='',sep=''))$speed
}

ev_desc <- lapply(MoBI_FlowEnvVar[25:262], function(x) rbind( mean = mean(x, na.rm=TRUE) ,
                                         sd = sd(x, na.rm=TRUE) ,
                                         median = median(x, na.rm=TRUE) ,
                                         minimum = min(x, na.rm=TRUE) ,
                                         maximum = max(x, na.rm=TRUE) ,
                                         s.size = length(x) ) )



from regional_sdm.

tghoward avatar tghoward commented on August 27, 2024

Thanks!

from regional_sdm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.