Skip to content
This repository has been archived by the owner on Oct 21, 2021. It is now read-only.

Commit

Permalink
fixed electivity and changed analysis to tree cover
Browse files Browse the repository at this point in the history
changed electivity analysis to use a more restrictive inclusion criterion for electivity anlaysis. TODO: revert to delta_pdc. Finish making effects plots for individual functional types
  • Loading branch information
flakesw committed Jul 30, 2020
1 parent b3a6533 commit 9e3103d
Show file tree
Hide file tree
Showing 44 changed files with 2,100 additions and 995 deletions.
Binary file modified .RData
Binary file not shown.
722 changes: 361 additions & 361 deletions .Rhistory

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .Rproj.user/EAEB7255/console06/INDEX001
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"allow_restart":true,"alt_buffer":false,"autoclose":1,"buffered_output":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","caption":"Terminal 1","channel_id":"7526","channel_mode":1,"child_procs":false,"cols":93,"cwd":"","exit_code":15,"handle":"98DD95A6","interaction_mode":2,"max_output_lines":1000,"restarted":false,"rows":48,"shell_type":3,"show_on_output":false,"terminal_sequence":1,"title":"","track_env":false,"zombie":false}]
[{"allow_restart":true,"alt_buffer":false,"autoclose":1,"buffered_output":"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","caption":"Terminal 1","channel_id":"7526","channel_mode":1,"child_procs":false,"cols":93,"cwd":"","exit_code":15,"handle":"98DD95A6","interaction_mode":2,"max_output_lines":1000,"restarted":false,"rows":48,"shell_type":3,"show_on_output":false,"terminal_sequence":1,"title":"","track_env":false,"zombie":false}]
2 changes: 1 addition & 1 deletion .Rproj.user/EAEB7255/pcs/source-pane.pper
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"activeTab" : 4
"activeTab" : 1
}
12 changes: 6 additions & 6 deletions .Rproj.user/EAEB7255/pcs/windowlayoutstate.pper
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"left" : {
"panelheight" : 779,
"splitterpos" : 324,
"panelheight" : 763,
"splitterpos" : 317,
"topwindowstate" : "NORMAL",
"windowheight" : 817
"windowheight" : 801
},
"right" : {
"panelheight" : 779,
"splitterpos" : 487,
"panelheight" : 763,
"splitterpos" : 477,
"topwindowstate" : "NORMAL",
"windowheight" : 817
"windowheight" : 801
}
}
4 changes: 2 additions & 2 deletions .Rproj.user/EAEB7255/sources/prop/2A13C8B0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"cursorPosition" : "44,0",
"scrollLine" : "32"
"cursorPosition" : "10,14",
"scrollLine" : "0"
}
4 changes: 2 additions & 2 deletions .Rproj.user/EAEB7255/sources/prop/8DF0DCEC
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"cursorPosition" : "74,42",
"scrollLine" : "53"
"cursorPosition" : "3,46",
"scrollLine" : "0"
}
2 changes: 1 addition & 1 deletion .Rproj.user/EAEB7255/sources/prop/A1FFFDE6
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"cursorPosition" : "97,3",
"cursorPosition" : "106,47",
"scrollLine" : "0"
}
4 changes: 4 additions & 0 deletions .Rproj.user/EAEB7255/sources/prop/A30485D9
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"cursorPosition" : "3,46",
"scrollLine" : "0"
}
4 changes: 4 additions & 0 deletions .Rproj.user/EAEB7255/sources/prop/AA116D9C
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"cursorPosition" : "239,15",
"scrollLine" : "256"
}
2 changes: 1 addition & 1 deletion .Rproj.user/EAEB7255/sources/prop/D455C530
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"cursorPosition" : "17,54",
"cursorPosition" : "13,32",
"scrollLine" : "0",
"tempName" : "Untitled1"
}
2 changes: 2 additions & 0 deletions .Rproj.user/EAEB7255/sources/prop/INDEX
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ C%3A%2FUsers%2FSam%2FGoogle%20Drive%2FThesis%20related%2FUnderstory%2Funderstory
~%2FResearch%2FMS%20Thesis%2FUnderstory%2Fplot_level_understory_082418.R="25B4B1DC"
~%2FResearch%2FMS%20Thesis%2FUnderstory%2Fplot_level_understory_090618.R="B04D5E6E"
~%2FResearch%2FMS%20Thesis%2FUnderstory%2Fplot_level_understory_112817.R="5E4621F"
~%2FResearch%2FMS%20Thesis%2FUnderstory%2Fplot_level_understory_tc.R="AA116D9C"
~%2FResearch%2FMS%20Thesis%2FUnderstory%2Funderstory_data_prep.R="A1FFFDE6"
~%2FResearch%2FMS%20Thesis%2FUnderstory%2Funderstory_effects_plots.R="8DF0DCEC"
~%2FResearch%2FMS%20Thesis%2FUnderstory%2Funderstory_effects_plots_tc.R="A30485D9"
~%2FResearch%2FMS%20Thesis%2FUnderstory%2Funderstory_electivity.R="D455C530"
~%2FResearch%2FMS%20Thesis%2FUnderstory%2Funderstory_electivity010819.R="8CD3B36B"
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
"collab_server" : "",
"contents" : "",
"created" : 1547225685816.000,
"dirty" : true,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "88|48|165|0|\n",
"hash" : "0",
"id" : "9E5C163F",
"lastKnownWriteTime" : 1593721425,
"last_content_update" : 1593723732579,
"path" : "~/Research/MS Thesis/Understory/plot_level_understory.R",
"project_path" : "plot_level_understory.R",
"lastKnownWriteTime" : 1596053285,
"last_content_update" : 1596053285119,
"path" : "~/Research/MS Thesis/Understory/plot_level_understory_tc.R",
"project_path" : "plot_level_understory_tc.R",
"properties" : {
"cursorPosition" : "44,0",
"scrollLine" : "32"
"cursorPosition" : "239,15",
"scrollLine" : "256"
},
"relative_order" : 1,
"source_on_save" : false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ library("plyr")

# import data created by data prep script
plot_data <- read.csv("./clean data/plot_data.csv")
plot_data$Delta_tc <- plot_data$Tree_cover - plot_data$Total_cover
plot_data$Delta_tc <- (plot_data$Tree_cover*100 - plot_data$Total_cover)
plot_data$Delta_ba <- plot_data$Live_ba - plot_data$Live_ba_2005
plot_data <- plot_data[plot_data$Cluster != "NPELECTRICEEL", ]

Expand Down Expand Up @@ -267,54 +267,78 @@ par(opar)

## all understory vegetation

all_plot <- lmer(asin(sqrt(All/100)) ~ scale(Tree_cover) + scale(Delta_tc)*scale(cwd_normal_cum) +
all_plot_tc <- lmer(asin(sqrt(All/100)) ~ scale(Tree_cover) + scale(Delta_tc)*scale(cwd_normal_cum) +
scale(AWC) + (1|Cluster), data = plot_data)
summary(all_plot, ddf = "Kenward-Roger")
r.squaredGLMM(all_plot)
plot(allEffects(all_plot, partial.residuals = TRUE))
plot(all_plot)
AICc(all_plot)
scatter.smooth(residuals(all_plot) ~ predict(all_plot))


all_plot_noscale_tc <- lmer(asin(sqrt(All/100)) ~ Tree_cover + Delta_tc*cwd_normal_cum +
AWC + (1|Cluster), data = plot_data)

summary(all_plot_tc, ddf = "Kenward-Roger")
r.squaredGLMM(all_plot_tc)
plot(allEffects(all_plot_tc, partial.residuals = TRUE))
plot(all_plot_tc)
AICc(all_plot_tc)
scatter.smooth(residuals(all_plot_tc) ~ predict(all_plot_tc))

## Cheatgrass

cheatgrass_plot <- lmer(asin(sqrt(Cheatgrass/100)) ~ scale(Tree_cover) + scale(Delta_tc)*scale(cwd_normal_cum) +
cheatgrass_plot_tc <- lmer(asin(sqrt(Cheatgrass/100)) ~ scale(Tree_cover) + scale(Delta_tc) * scale(cwd_normal_cum) +
scale(AWC) + (1|Cluster), data = plot_data)
summary(cheatgrass_plot, ddf = "Kenward-Roger")
r.squaredGLMM(cheatgrass_plot)
plot(allEffects(cheatgrass_plot, partial.residuals = TRUE))
plot(cheatgrass_plot)
AICc(cheatgrass_plot)
scatter.smooth(residuals(cheatgrass_plot) ~ predict(cheatgrass_plot))

cheatgrass_plot_noscale_tc <- lmer(asin(sqrt(Cheatgrass/100)) ~ Tree_cover + Delta_tc*cwd_normal_cum +
AWC + (1|Cluster), data = plot_data)

summary(cheatgrass_plot_tc, ddf = "Kenward-Roger")
r.squaredGLMM(cheatgrass_plot_tc)
plot(allEffects(cheatgrass_plot_noscale_tc, partial.residuals = TRUE))
plot(cheatgrass_plot_tc)
AICc(cheatgrass_plot_tc)
scatter.smooth(residuals(cheatgrass_plot_tc) ~ predict(cheatgrass_plot_tc))

## Perr grass

pgrass_plot <- lmer(asin(sqrt(Pgrass/100)) ~ scale(Tree_cover) + scale(Delta_tc)*scale(cwd_normal_cum) +
pgrass_plot_tc <- lmer(asin(sqrt(Pgrass/100)) ~ scale(Tree_cover) + scale(Delta_tc)*scale(cwd_normal_cum) +
scale(AWC) + (1|Cluster), data = plot_data)
summary(pgrass_plot, ddf = "Kenward-Roger")
r.squaredGLMM(pgrass_plot)
plot(allEffects(pgrass_plot, partial.residuals = TRUE))
plot(pgrass_plot)

pgrass_plot_noscale_tc <- lmer(asin(sqrt(Pgrass/100)) ~ Tree_cover + Delta_tc*cwd_normal_cum +
AWC + (1|Cluster), data = plot_data)

summary(pgrass_plot_tc, ddf = "Kenward-Roger")
r.squaredGLMM(pgrass_plot_tc)
plot(allEffects(pgrass_plot_tc, partial.residuals = TRUE))
plot(pgrass_plot_tc)
scatter.smooth(residuals(pgrass_plot_tc) ~ predict(pgrass_plot_tc))


## Perr forbs

pforb_plot <- lmer(asin(sqrt(Pforb/100)) ~ scale(Tree_cover) + scale(Delta_tc)*scale(cwd_normal_cum) +
pforb_plot_tc <- lmer(asin(sqrt(Pforb/100)) ~ scale(Tree_cover) + scale(Delta_tc)*scale(cwd_normal_cum) +
scale(AWC) + (1|Cluster), data = plot_data)
summary(pforb_plot, ddf = "Kenward-Roger")
r.squaredGLMM(pforb_plot)
plot(allEffects(pforb_plot, partial.residuals = TRUE))
plot(inv.as(predict(pforb_plot)) ~ I(plot_data$Pforb/100))
pforb_plot_noscale_tc <- lmer(asin(sqrt(Pforb/100)) ~ Tree_cover + Delta_tc*cwd_normal_cum +
AWC + (1|Cluster), data = plot_data)

summary(pforb_plot_tc, ddf = "Kenward-Roger")
r.squaredGLMM(pforb_plot_tc)
plot(allEffects(pforb_plot_tc, partial.residuals = TRUE))
plot(inv.as(predict(pforb_plot_tc)) ~ I(plot_data$Pforb/100))
abline(0,1)
plot(pforb_plot)
plot(pforb_plot_tc)
scatter.smooth(residuals(pforb_plot_tc) ~ predict(pforb_plot_tc))


## Shrubs
shrub_plot <- lmer(asin(sqrt(Shrub_cover_li)) ~ scale(Tree_cover) + scale(Delta_tc)*scale(cwd_normal_cum) +
shrub_plot_tc <- lmer(asin(sqrt(Shrub_cover_li)) ~ scale(Tree_cover) + scale(Delta_tc)*scale(cwd_normal_cum) +
scale(AWC) + (1|Cluster), data = plot_data)
summary(shrub_plot, ddf = "Kenward-Roger")
r.squaredGLMM(shrub_plot)
plot(allEffects(shrub_plot, partial.residuals = TRUE))
plot(inv.as(predict(shrub_plot)) ~ I(plot_data$Shrub_cover_li))

shrub_plot_noscale_tc <- lmer(asin(sqrt(Shrub_cover_li)) ~ Tree_cover + Delta_tc*cwd_normal_cum +
AWC + (1|Cluster), data = plot_data)


summary(shrub_plot_tc, ddf = "Kenward-Roger")
r.squaredGLMM(shrub_plot_tc)
plot(allEffects(shrub_plot_tc, partial.residuals = TRUE))
plot(inv.as(predict(shrub_plot_tc)) ~ I(plot_data$Shrub_cover_li))
abline(0,1)

#-----------------------------------------------
Expand All @@ -340,7 +364,7 @@ compare <- compare[-c(5, 10), ] #outlier to remove?

cg_change_lm <- lm(I((Cheatgrass - Cheatgrass.Cover)/100) ~ Delta_tc*cwd_normal_cum, data= compare)
cg_change_lm_no_outliers <- lm(I((Cheatgrass - Cheatgrass.Cover)/100) ~
Delta_tc*cwd_normal_cum, data= compare[-c(5,10), ])
Delta_tc + cwd_normal_cum, data= compare[-c(5,10), ])

summary(cg_change_lm)
plot(cg_change_lm)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"folds" : "",
"hash" : "0",
"id" : "BA4339",
"lastKnownWriteTime" : 1579016181,
"last_content_update" : 1579016181197,
"lastKnownWriteTime" : 1596127268,
"last_content_update" : 1596127268334,
"path" : "~/Research/MS Thesis/Understory/understory_electivity.R",
"project_path" : "understory_electivity.R",
"properties" : {
"cursorPosition" : "17,54",
"cursorPosition" : "13,32",
"scrollLine" : "0",
"tempName" : "Untitled1"
},
Expand Down
Loading

0 comments on commit 9e3103d

Please sign in to comment.