Skip to content

Commit

Permalink
Wood density, seedlings and saplings relationships
Browse files Browse the repository at this point in the history
  • Loading branch information
jmargrove committed Oct 31, 2018
1 parent 68c627d commit 43eaa32
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
Binary file modified analysis/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# does the wood density of the saplings infer that there is a tolleracne

source('./analysis/inundation_predicts_species_distributions/data/data_index.R')
sap_dden_data <- read.csv('./data/wood_density_saplings .csv')
seedling_data <- read.table('./data/data.txt', header = TRUE)
head(seedling_data)



data <- data.frame(
sap_dden = with(sap_dden_data, tapply(bottom_density, Sp, mean)),
adult_dden = with(riskratio, tapply(dden, sp, mean)),
rr = riskratio$diff_mort,
elev = riskratio$elev,
sp = levels(as.factor(seedling_data$sp)))

summary(lm(sap_dden ~ adult_dden, data))

ggplot(data, aes(x = log(sap_dden), y = log(adult_dden))) +
geom_point() +
geom_abline(intercept = 0, slope = 1) +
geom_text(aes(label = sp))

model <- (lm(log(rr) ~ log(sap_dden), data))
source('./functions/booter.R')
booter(model, coef = TRUE, n = 5000, data = data)


write.table(data, file = './analysis/inundation_wooddensity_relationship/data/data_sap_adult_rr_density.txt')


Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# r-squared for the ontogenic stages as well as the does seedling wood density predict mortality
traits <- read.table('./data/traits.txt', header = TRUE)
density_data <- read.table('./analysis/inundation_wooddensity_relationship/data/data_sap_adult_rr_density.txt', header = TRUE)
density_data <- merge(density_data, traits, by = 'sp')[,c(1,2,3,4,11)]

model <- (lm(rr ~ dden, density_data))
source('./functions/booter.R')
booter(model, density_data, n = 5000, coef = TRUE)
summary(model)
###
summary(lm(adult_dden ~ dden, density_data))
summary(lm(sap_dden ~ dden, density_data))
summary(lm(adult_dden ~ sap_dden, density_data))

0 comments on commit 43eaa32

Please sign in to comment.