plot.fitRMU: Plot the synthesis of RMU fit.

plot.fitRMUR Documentation

Plot the synthesis of RMU fit.

Description

The function plot.fitRMU plots the results of fitRMU().
In most of the cases, replicate.CI can be set to 0 for what="proportions" or "numbers".
The parameter CI.RMU can be used when this function is used several times with the same data.

Usage

## S3 method for class 'fitRMU'
plot(
  x,
  ...,
  resultMCMC = NULL,
  chain = 1,
  replicate.CI = 10000,
  CI.RMU = NULL,
  what = "proportions",
  criteria = "50%",
  aggregate = "both",
  order = NULL,
  control.legend = list(),
  show.legend = TRUE,
  col = rainbow,
  border = NA,
  names.legend = NULL
)

Arguments

x

A result file generated by fitRMU

...

Parameters used by plot

resultMCMC

MCMC result for fitRUM

chain

Chain to be plotted for MCMC

replicate.CI

Number of replicates to estimate CI

CI.RMU

A result of CI.RMU()

what

Can be proportions, numbers or total

criteria

What criteria will be used for proportions or numbers: mean or 50%

aggregate

Can be model or both

order

Give the order of series in plot, from bottom to top. Can be used to not show series.

control.legend

Parameters send to legend

show.legend

If FALSE, does not show legend

col

The function used to generate colors.

border

The border of polygons used to represent the proportions.

names.legend

Names to show in legend.

Details

plot.fitRMU plots the results of a fit RMU.

Value

Return A list with result of CI.RMU()

Author(s)

Marc Girondot

See Also

Other Fill gaps in RMU: CI.RMU(), fitRMU_MHmcmc_p(), fitRMU_MHmcmc(), fitRMU(), logLik.fitRMU()

Examples

## Not run: 
library("phenology")
RMU.names.AtlanticW <- data.frame(mean=c("Yalimapo.French.Guiana", 
                                         "Galibi.Suriname", 
                                         "Irakumpapy.French.Guiana"), 
                                 se=c("se_Yalimapo.French.Guiana", 
                                      "se_Galibi.Suriname", 
                                      "se_Irakumpapy.French.Guiana"), stringsAsFactors = FALSE)
data.AtlanticW <- data.frame(Year=c(1990:2000), 
      Yalimapo.French.Guiana=c(2076, 2765, 2890, 2678, NA, 
                               6542, 5678, 1243, NA, 1566, 1566),
      se_Yalimapo.French.Guiana=c(123.2, 27.7, 62.5, 126, NA, 
                                 230, 129, 167, NA, 145, 20),
      Galibi.Suriname=c(276, 275, 290, NA, 267, 
                       542, 678, NA, 243, 156, 123),
      se_Galibi.Suriname=c(22.3, 34.2, 23.2, NA, 23.2, 
                           4.3, 2.3, NA, 10.3, 10.1, 8.9),
      Irakumpapy.French.Guiana=c(1076, 1765, 1390, 1678, NA, 
                               3542, 2678, 243, NA, 566, 566),
      se_Irakumpapy.French.Guiana=c(23.2, 29.7, 22.5, 226, NA, 
                                 130, 29, 67, NA, 15, 20), stringsAsFactors = FALSE)
                           
cst <- fitRMU(RMU.data=data.AtlanticW, RMU.names=RMU.names.AtlanticW, 
               colname.year="Year", model.trend="Constant", 
               model.SD="Zero")
expo <- fitRMU(RMU.data=data.AtlanticW, RMU.names=RMU.names.AtlanticW, 
               colname.year="Year", model.trend="Exponential", 
               model.SD="Zero")
YS <- fitRMU(RMU.data=data.AtlanticW, RMU.names=RMU.names.AtlanticW, 
             colname.year="Year", model.trend="Year-specific", 
             model.SD="Zero")
YS1 <- fitRMU(RMU.data=data.AtlanticW, RMU.names=RMU.names.AtlanticW, 
             colname.year="Year", model.trend="Year-specific", 
             model.SD="Zero", model.rookeries="First-order")
YS1_cst <- fitRMU(RMU.data=data.AtlanticW, RMU.names=RMU.names.AtlanticW, 
             colname.year="Year", model.trend="Year-specific", 
             model.SD="Constant", model.rookeries="First-order", 
             parameters=YS1$par)
YS2 <- fitRMU(RMU.data=data.AtlanticW, RMU.names=RMU.names.AtlanticW, 
             colname.year="Year", model.trend="Year-specific",
             model.SD="Zero", model.rookeries="Second-order", 
             parameters=YS1$par)
YS2_cst <- fitRMU(RMU.data=data.AtlanticW, RMU.names=RMU.names.AtlanticW, 
             colname.year="Year", model.trend="Year-specific",
             model.SD="Constant", model.rookeries="Second-order", 
             parameters=YS1_cst$par)
               
compare_AIC(Constant=cst, Exponential=expo, 
YearSpecific=YS)

compare_AIC(YearSpecific_ProportionsFirstOrder_Zero=YS1,
YearSpecific_ProportionsFirstOrder_Constant=YS1_cst)

compare_AIC(YearSpecific_ProportionsConstant=YS,
           YearSpecific_ProportionsFirstOrder=YS1,
           YearSpecific_ProportionsSecondOrder=YS2)
           
compare_AIC(YearSpecific_ProportionsFirstOrder=YS1_cst,
           YearSpecific_ProportionsSecondOrder=YS2_cst)

barplot_errbar(YS1_cst$proportions[1, ], y.plus = YS1_cst$proportions.CI.0.95[1, ], 
               y.minus = YS1_cst$proportions.CI.0.05[1, ], las=1, ylim=c(0, 0.7), 
               main="Proportion of the different rookeries in the region")

plot(cst, main="Use of different beaches along the time", what="total")
plot(expo, main="Use of different beaches along the time", what="total")
plot(YS2_cst, main="Use of different beaches along the time", what="total")

plot(YS1, main="Use of different beaches along the time")
plot(YS1_cst, main="Use of different beaches along the time")
plot(YS1_cst, main="Use of different beaches along the time", what="numbers")

parpre <- par(mar=c(4, 4, 2, 5)+0.4)
par(xpd=TRUE)
plot(YS, main="Use of different beaches along the time", 
     control.legend=list(x=2000, y=0.4, legend=c("Yalimapo", "Galibi", "Irakumpapy")))
par(mar=parpre)

# Example to modify order of series
plot(cst, order=c("Galibi.Suriname", "Irakumpapy.French.Guiana"))
plot(cst, order=c("Galibi.Suriname", "Irakumpapy.French.Guiana", "Yalimapo.French.Guiana"))

# Example to change the color
plot(cst, order=c("Galibi.Suriname", "Irakumpapy.French.Guiana", "Yalimapo.French.Guiana"), 
     col=function(n) rep(c("gray", "lightgrey"), floor(n/2)), border="black", 
     names.legend=c("Yalimapo", "Galibi", "Irakumpapy"))

## End(Not run)

phenology documentation built on Oct. 16, 2023, 9:06 a.m.