PrecipPlots.R

model10 — Nov 14, 2013, 1:59 PM

env <- read.csv("rs_env_plot 2.csv")
install.packages("ggplot2")
Installing package into 'C:/Users/model10/Documents/R/win-library/3.0'
(as 'lib' is unspecified)
Error: trying to use CRAN without setting a mirror
require(ggplot2)
Loading required package: ggplot2

mod = lm(env$NDVI.mean ~ env$Precip)
summary(mod)

Call:
lm(formula = env$NDVI.mean ~ env$Precip)

Residuals:
    Min      1Q  Median      3Q     Max 
-0.3271 -0.0421  0.0152  0.0579  0.1590 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept) 3.35e-01   1.10e-01    3.06   0.0099 **
env$Precip  3.00e-04   9.59e-05    3.13   0.0087 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.122 on 12 degrees of freedom
Multiple R-squared:  0.449, Adjusted R-squared:  0.403 
F-statistic: 9.78 on 1 and 12 DF,  p-value: 0.00872

ggplot(env, aes(x=env$Precip, y=env$NDVI.mean)) + 
  geom_point(col="red") + 
  ylab("mean NDVI") + 
  xlab("Precipitation") + geom_smooth(method = "lm", se = FALSE)+ 
  annotate("text", label = "Adjusted R-squared = 0.4032", x = 1000, y = 2) +
  annotate("text", label = "P-value = 0.008725", x = 1000, y = 1.8) + 
  annotate("text", label = "S", x = 1000, y = 1.6)

plot of chunk Precipitation Reg Plots


mod2 = lm(env$Species.Richness ~ env$Precip)
summary(mod2)

Call:
lm(formula = env$Species.Richness ~ env$Precip)

Residuals:
   Min     1Q Median     3Q    Max 
 -3.65  -2.00  -0.93   2.77   3.86 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept) -0.43403    2.53141   -0.17   0.8667    
env$Precip   0.00970    0.00222    4.38   0.0009 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.82 on 12 degrees of freedom
Multiple R-squared:  0.615, Adjusted R-squared:  0.583 
F-statistic: 19.2 on 1 and 12 DF,  p-value: 0.000902
ggplot(env, aes(x=env$Precip, y=env$Species.Richness)) + 
  geom_point(col="red") + 
  ylab("Species Richness") + 
  xlab("Precipitation") + geom_smooth(method = "lm", se = FALSE)+ 
  annotate("text", label = "Adjusted R-squared = 0.5827", x = 1000, y = 20) +
  annotate("text", label = "P-value = 0.0009015", x = 1000, y = 19) + 
  annotate("text", label = "S", x = 1000, y = 18)

plot of chunk Precipitation Reg Plots


mod3 = lm(env$Density ~ env$Precip)
summary(mod3)

Call:
lm(formula = env$Density ~ env$Precip)

Residuals:
    Min      1Q  Median      3Q     Max 
-121.31  -59.19    2.09   50.42  152.62 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)  
(Intercept)  22.8525    73.4331    0.31    0.761  
env$Precip    0.1438     0.0643    2.24    0.045 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 81.8 on 12 degrees of freedom
Multiple R-squared:  0.294, Adjusted R-squared:  0.235 
F-statistic:    5 on 1 and 12 DF,  p-value: 0.0451

ggplot(env, aes(x=env$Precip, y=env$Density)) + 
  geom_point(col="red") + 
  ylab("Density") + 
  xlab("Precipitation") + geom_smooth(method = "lm", se = FALSE)+ 
  annotate("text", label = "Adjusted R-squared = 0.2354", x = 1500, y = 100) +
  annotate("text", label = "P-value = 0.04508", x = 1500, y = 80) + 
  annotate("text", label = "S", x = 1500, y = 60)

plot of chunk Precipitation Reg Plots


mod4 = lm(env$Canopy.Height ~ env$Precip)
summary(mod4)

Call:
lm(formula = env$Canopy.Height ~ env$Precip)

Residuals:
   Min     1Q Median     3Q    Max 
-3.108 -1.264 -0.544  0.972  4.540 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)  
(Intercept)  2.67820    1.83362    1.46    0.170  
env$Precip   0.00414    0.00161    2.58    0.024 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.04 on 12 degrees of freedom
Multiple R-squared:  0.356, Adjusted R-squared:  0.303 
F-statistic: 6.64 on 1 and 12 DF,  p-value: 0.0242

ggplot(env, aes(x=env$Precip, y=env$Canopy.Height)) + 
  geom_point(col="red") + 
  ylab("Canopy Height") + 
  xlab("Precipitation") + geom_smooth(method = "lm", se = FALSE)+ 
  annotate("text", label = "Adjusted R-squared = 0.3025", x =1500, y = 6) +
  annotate("text", label = "P-value = 0.02425", x = 1500, y = 5.5) + 
  annotate("text", label = "S", x =1500, y = 5.0)

plot of chunk Precipitation Reg Plots


mod5 = lm(env$Basal.Area ~ env$Precip)
summary(mod5)

Call:
lm(formula = env$Basal.Area ~ env$Precip)

Residuals:
    Min      1Q  Median      3Q     Max 
-1.6701 -0.7246 -0.0175  0.6655  2.1040 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept) -0.24202    0.93684   -0.26   0.8005   
env$Precip   0.00292    0.00082    3.56   0.0039 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.04 on 12 degrees of freedom
Multiple R-squared:  0.514, Adjusted R-squared:  0.473 
F-statistic: 12.7 on 1 and 12 DF,  p-value: 0.00392

ggplot(env, aes(x=env$Precip, y=env$Basal.Area)) + 
  geom_point(col="red") + 
  ylab("mean NDVI") + 
  xlab("Precipitation") + geom_smooth(method = "lm", se = FALSE)+ 
  annotate("text", label = "Adjusted R-squared = 0.5827", x = 1000, y = 6) +
  annotate("text", label = "P-value = 0.0009015", x = 1000, y = 5.7) + 
  annotate("text", label = "S", x = 1000, y = 5.4)

plot of chunk Precipitation Reg Plots


mod6 = lm(env$Substrate.Age ~ env$Precip)
summary(mod6)

Call:
lm(formula = env$Substrate.Age ~ env$Precip)

Residuals:
   Min     1Q Median     3Q    Max 
-2.572 -0.108  0.550  0.881  1.637 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)  
(Intercept) -1.25556    1.28066   -0.98    0.346  
env$Precip   0.00329    0.00112    2.93    0.013 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.43 on 12 degrees of freedom
Multiple R-squared:  0.417, Adjusted R-squared:  0.369 
F-statistic: 8.59 on 1 and 12 DF,  p-value: 0.0126

ggplot(env, aes(x=env$Precip, y=env$Substrate.Age)) + 
  geom_point(col="red") + 
  ylab("Substrate Age") + 
  xlab("Precipitation") + geom_smooth(method = "lm", se = FALSE)+ 
  annotate("text", label = "Adjusted R-squared = 0.3688", x = 1500, y = 2) +
  annotate("text", label = "P-value = 0.01257", x = 1500, y = 1.5) + 
  annotate("text", label = "S", x = 1500, y = 1)

plot of chunk Precipitation Reg Plots


mod6 = lm(env$pca.structure ~ env$Precip)
summary(mod6)

Call:
lm(formula = env$pca.structure ~ env$Precip)

Residuals:
   Min     1Q Median     3Q    Max 
-1.922 -0.582  0.206  0.788  1.066 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)   
(Intercept) -3.454470   0.860281   -4.02   0.0017 **
env$Precip   0.003168   0.000753    4.21   0.0012 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.958 on 12 degrees of freedom
Multiple R-squared:  0.596, Adjusted R-squared:  0.562 
F-statistic: 17.7 on 1 and 12 DF,  p-value: 0.00122

ggplot(env, aes(x=env$Precip, y=env$pca.structure)) + 
  geom_point(col="red") + 
  ylab("pca.structure") + 
  xlab("Precipitation") + geom_smooth(method = "lm", se = FALSE)+ 
  annotate("text", label = "Adjusted R-squared = 0.5622", x = 1500, y = -.5) +
  annotate("text", label = "P-value = 0.001218", x = 1500, y = -1) + 
  annotate("text", label = "S", x = 1500, y = -1.5)

plot of chunk Precipitation Reg Plots