Thursday, March 26, 2015

Nuggets of Information (Part One)



What is Spatial Synchrony?
Correlated fluctuations in discrete populations over localized or wide-scaled geographical area (Peltenon et al. 2002)

What is an example of regional stochasticity?
Climate, many of the climate variables are correlated over wide-scaled geographic area.

What is the Moran Effect?
Proposed by Patt Moran (1917- 1988), the Moran Theorem or the Moran Effect describe that the time correlation between two populations of the same species is equal to the correlation between the environmental variabilities. Or as described in the Peltenon et al. paper that two discrete populations with identical density-independent affects will be synchronized if they are affected by the same density-independent regional effects (such as weather).






How does dispersal affect spatial synchrony?
Dispersal links two locally regulating separate populations.


Wednesday, March 25, 2015

Just some code- species accumulation curves

SPECIES ACCUMULATION CURVE OF MEXICO AND PUERTO RICO (SHADE AND BIOMASS)

LOADING DATA

data <- read.csv("http://www.personal.psu.edu/dkp5177/PUERTORICO.SHADE.LONGDAT.csv", header=TRUE, na.strings = NA)
biomass.pr.data <- read.csv("http://www.personal.psu.edu/dkp5177/PUERTORICO.BIOMASS.LONGDAT.csv", header=TRUE, na.strings = NA)
shade.mex.data <-  read.csv("http://www.personal.psu.edu/dkp5177/MEXICO.SHADE.LONGDAT.csv", header=TRUE, na.strings = NA)
biomass.mex.data <- read.csv("http://www.personal.psu.edu/dkp5177/MEXICO.BIOMASS.LONGDAT.csv", header=TRUE, na.strings = NA)
require(ggplot2)
## Loading required package: ggplot2

PUERTO RICO

SHADE (Samples)

Species Estimation vs. Samples (Low-shade farm (blue) and High-shade farm (red) with 95% Confidence Interval)
ggplot(data, aes(x = lspr.s, y = sest,ymin = sest.lb,ymax = sest.ub, group = factor(id.low))) + 
  geom_line(aes(colour = factor(id.low)),size = 0.5) + 
  geom_ribbon(aes(fill = factor(id.low)), alpha = 0.25)+ 
  ylab(label="Species Estimated") + 
  xlab(label = "Samples") + 
  ggtitle("Estimated Species versus Sample \n Shade in Puerto Rican farms")+
  theme(
    panel.background = element_blank(),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    axis.line = element_line(colour = "black", 
                      size = 0.05, linetype = "solid")) +
  theme(axis.text=element_text(size=14),
        axis.title=element_text(size=17),
       plot.title = element_text(size = 20, lineheight=.8, face="bold"))+
scale_colour_manual("Shade", breaks=c("1","2"),
                     labels = c("Low Shade","High Shade"),
                     values = c("1" = "blue","2" = "firebrick4"))+
scale_fill_manual(guide = FALSE,values=c("1"="navyblue","2"="red"))

SHADE(Individuals)

Species Estimation vs. Individuals (Low-shade farm(blue) and High-shade farm (red) with 95% Confidence Interval)
ggplot(data, aes(x = individuals, y = sest,ymin = sest.lb,ymax = sest.ub, group = factor(id.low))) + 
  geom_line(aes(colour = factor(id.low)),size = 0.5) + 
  geom_ribbon(aes(fill = factor(id.low)), alpha = 0.25)+ 
  ylab(label="Species Estimated") + 
  xlab(label = "Samples") + 
  ggtitle("Estimated Species versus Individuals \n Shade in Puerto Rican farms")+
  theme(
    panel.background = element_blank(),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    axis.line = element_line(colour = "black", 
                      size = 0.05, linetype = "solid")) +
  theme(axis.text=element_text(size=14),
        axis.title=element_text(size=17),
       plot.title = element_text(size = 20, lineheight=.8, face="bold"))+
scale_colour_manual("Shade", breaks=c("1","2"),
                     labels = c("Low Shade","High Shade"),
                     values = c("1" = "blue","2" = "firebrick4"))+
scale_fill_manual(guide = FALSE,values=c("1"="navyblue","2"="red"))

BIOMASS(Samples)

Species Estimation vs. Samples (Low-biomass farm (blue) and High-biomass farm (red) with 95% Confidence Interval)
ggplot(biomass.pr.data, aes(x = samples, y = sest,ymin = sest.lb,ymax = sest.ub, group = factor(id.biomass.pr))) + 
  geom_line(aes(colour = factor(id.biomass.pr)),size = 0.5) + 
  geom_ribbon(aes(fill = factor(id.biomass.pr)), alpha = 0.25)+ 
  ylab(label="Species Estimated") + 
  xlab(label = "Samples") + 
  ggtitle("Estimated Species versus Sample \n Biomass in Puerto Rican farms")+
  theme(
    panel.background = element_blank(),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    axis.line = element_line(colour = "black", 
                      size = 0.05, linetype = "solid")) +
  theme(axis.text=element_text(size=14),
        axis.title=element_text(size=17),
       plot.title = element_text(size = 20, lineheight=.8, face="bold"))+
scale_colour_manual("Shade", breaks=c("1","2"),
                     labels = c("Low Biomass","High Biomass"),
                     values = c("1" = "blue","2" = "firebrick4"))+
scale_fill_manual(guide = FALSE,values=c("1"="navyblue","2"="red"))

BIOMASS(Individuals)

Species Estimation vs. Individuals (Low-Biomass farm(blue) and High-Biomass farm (red) with 95% Confidence Interval)
ggplot(biomass.pr.data, aes(x = individuals, y = sest,ymin = sest.lb,ymax = sest.ub, group = factor(id.biomass.pr))) + 
  geom_line(aes(colour = factor(id.biomass.pr)),size = 0.5) + 
  geom_ribbon(aes(fill = factor(id.biomass.pr)), alpha = 0.25)+ 
  ylab(label="Species Estimated") + 
  xlab(label = "Samples") + 
  ggtitle("Estimated Species versus Individuals \n Biomass in Puerto Rican farms")+
  theme(
    panel.background = element_blank(),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    axis.line = element_line(colour = "black", 
                      size = 0.05, linetype = "solid")) +
  theme(axis.text=element_text(size=14),
        axis.title=element_text(size=17),
       plot.title = element_text(size = 20, lineheight=.8, face="bold"))+
scale_colour_manual("Shade", breaks=c("1","2"),
                     labels = c("Low Biomass","High biomass"),
                     values = c("1" = "blue","2" = "firebrick4"))+
scale_fill_manual(guide = FALSE,values=c("1"="navyblue","2"="red"))

MEXICO

SHADE(Samples)

Species Estimation vs. Samples (Low-shade farm (blue) and High-shade farm (red) with 95% Confidence Interval)
ggplot(shade.mex.data, aes(x = Samples, y = Sest,ymin = sest.lb,ymax = sest.ub, group = factor(id.shade))) + 
  geom_line(aes(colour = factor(id.shade)),size = 0.5) + 
  geom_ribbon(aes(fill = factor(id.shade)), alpha = 0.25)+ 
  ylab(label="Species Estimated") + 
  xlab(label = "Samples") + 
  ggtitle("Estimated Species versus Sample \n Shade in Mexican farms")+
  theme(
    panel.background = element_blank(),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    axis.line = element_line(colour = "black", 
                      size = 0.05, linetype = "solid")) +
  theme(axis.text=element_text(size=14),
        axis.title=element_text(size=17),
       plot.title = element_text(size = 20, lineheight=.8, face="bold"))+
scale_colour_manual("Shade", breaks=c("1","2"),
                     labels = c("Low Shade","High Shade"),
                     values = c("1" = "blue","2" = "firebrick4"))+
scale_fill_manual(guide = FALSE,values=c("1"="navyblue","2"="red"))

SHADE(Individuals)

Species Estimation vs. Individuals (Low-shade farm(blue) and High-shade farm (red) with 95% Confidence Interval)
ggplot(shade.mex.data, aes(x = Individuals..computed., y = Sest,ymin = sest.lb,ymax = sest.ub, group = factor(id.shade))) + 
  geom_line(aes(colour = factor(id.shade)),size = 0.5) + 
  geom_ribbon(aes(fill = factor(id.shade)), alpha = 0.25)+ 
  ylab(label="Species Estimated") + 
  xlab(label = "Samples") + 
  ggtitle("Estimated Species versus Individuals \n Shade in Mexican farms")+
  theme(
    panel.background = element_blank(),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    axis.line = element_line(colour = "black", 
                      size = 0.05, linetype = "solid")) +
  theme(axis.text=element_text(size=14),
        axis.title=element_text(size=17),
       plot.title = element_text(size = 20, lineheight=.8, face="bold"))+
scale_colour_manual("Shade", breaks=c("1","2"),
                     labels = c("Low Shade","High Shade"),
                     values = c("1" = "blue","2" = "firebrick4"))+
scale_fill_manual(guide = FALSE,values=c("1"="navyblue","2"="red"))

BIOMASS(Samples)

Species Estimation vs. Samples (Low-biomass farm (blue) and High-biomass farm (red) with 95% Confidence Interval)
ggplot(biomass.mex.data, aes(x = Samples, y = sest,ymin = sest.lb,ymax = sest.ub, group = factor(id.biomass))) + 
  geom_line(aes(colour = factor(id.biomass)),size = 0.5) + 
  geom_ribbon(aes(fill = factor(id.biomass)), alpha = 0.25)+ 
  ylab(label="Species Estimated") + 
  xlab(label = "Samples") + 
  ggtitle("Estimated Species versus Sample \n Biomass in Mexican farms")+
  theme(
    panel.background = element_blank(),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    axis.line = element_line(colour = "black", 
                      size = 0.05, linetype = "solid")) +
  theme(axis.text=element_text(size=14),
        axis.title=element_text(size=17),
       plot.title = element_text(size = 20, lineheight=.8, face="bold"))+
scale_colour_manual("Shade", breaks=c("1","2"),
                     labels = c("Low Biomass","High Biomass"),
                     values = c("1" = "blue","2" = "firebrick4"))+
scale_fill_manual(guide = FALSE,values=c("1"="navyblue","2"="red"))

BIOMASS(Individuals)

Species Estimation vs. Individuals (Low-Biomass farm(blue) and High-Biomass farm (red) with 95% Confidence Interval)
ggplot(biomass.mex.data, aes(x = Individuals, y = sest,ymin = sest.lb,ymax = sest.ub, group = factor(id.biomass))) + 
  geom_line(aes(colour = factor(id.biomass)),size = 0.5) + 
  geom_ribbon(aes(fill = factor(id.biomass)), alpha = 0.25)+ 
  ylab(label="Species Estimated") + 
  xlab(label = "Samples") + 
  ggtitle("Estimated Species versus Individuals \n Biomass in Mexican farms")+
  theme(
    panel.background = element_blank(),
    panel.grid.major = element_blank(),
    panel.grid.minor = element_blank(),
    axis.line = element_line(colour = "black", 
                      size = 0.05, linetype = "solid")) +
  theme(axis.text=element_text(size=14),
        axis.title=element_text(size=17),
       plot.title = element_text(size = 20, lineheight=.8, face="bold"))+
scale_colour_manual("Shade", breaks=c("1","2"),
                     labels = c("Low Biomass","High biomass"),
                     values = c("1" = "blue","2" = "firebrick4"))+
scale_fill_manual(guide = FALSE,values=c("1"="navyblue","2"="red"))