msco.res: Results on 'msco' illustration (presented in Lagat et al.,...

View source: R/J.occupancy.R

msco.resR Documentation

Results on msco illustration (presented in Lagat et al., 2021c)

Description

This function allows the replication of the results on msco R package illustration paper presented in Lagat et al. (2021c). Executing msco.res() therefore gives these outputs that are saved as .RDS files in msco. If the codes that produced these (saved) outcomes are desired, the codes below are made available.

Usage

msco.res()

Value

Returns all the results presented in Lagat et al. (2021c). To replicate

  • Figs. 1, 2 and Table 2, execute the following code:

     RNGkind(sample.kind = "Rejection")
     set.seed(14)
     ex.data <- read.csv(system.file("extdata", "251.csv", package = "msco"))
     j.en <- msco::Jo.eng(ex.data,
                 algo = "sim2",
                 metric = "raw",
                 nReps = 999,
                 dig = 3,
                 s.dplot = FALSE,
                 All.plots = TRUE,
                 Jo.coeff = TRUE,
                 my.AIC = TRUE,
                 my.rsq = TRUE,
                 Exp_Reg = TRUE,
                 P.law_Reg = TRUE,
                 Exp_p.l_Reg = TRUE,
                 Obs.data = FALSE,
                 Sim.data = FALSE,
                 Jo_val.sim = FALSE,
                 lab = FALSE,
                 leg = FALSE,
                 C.I_Jo_val.sim = FALSE,
                 Jo_val.obs = TRUE,
                 Metric = TRUE,
                 Algorithm = TRUE,
                 S.order = TRUE,
                 nmod_stats = TRUE,
                 Pt_Arch_Vals = TRUE,
                 Atype = TRUE,
                 p.n.plot = TRUE,
                 trans = FALSE,
                 m.n.plot = FALSE)
    
     j.en$jo.coeff ## Table 1
     j.en$AIC; j.en$r2 ## Table 2
     j.en$nmod_stats ## Table 3
     grDevices::dev.new()
     j.en$all.plots
    
    
  • Fig. 4, execute the following code:

     RNGkind(sample.kind = "Rejection")
     set.seed(14)
     grDevices::dev.new()
     msco:::nullmod_archs2()
    
    
  • Fig. 5, execute the following code:

     my.path <- system.file("extdata/gsmdat", package = "msco")
     setwd(my.path)
     s.data <- get(load("s.data.csv")) #Species-by-site matrix
     t.data <- get(load("t.data.csv")) #Species-by-trait matrix
     p.d.mat <- get(load("p.d.mat.csv")) #Species-by-species phylogenetic distance matrix
     RNGkind(sample.kind = "Rejection")
     set.seed(1)
     gb.res <- msco::gbsm_m.orders(s.data,
                 t.data,
                 p.d.mat,
                 metric = "Simpson_eqn",
                 gbsm.model,
                 orders = c(3:5, 8, 10, 15, 20),
                 d.f = 4,
                 degree = 3,
                 n = 1000,
                 k = 5,
                 p = 0.8,
                 type = "k-fold",
                 scat.plots = FALSE,
                 response.curves = TRUE,
                 j.occs.distrbn = FALSE,
                 mp.plots = FALSE,
                 max.vif = 10,
                 max.vif2 = 3,
                 start.range=c(-0.1,0)
               )
    
     gb.res$Original.VIFs$`order 3`
     gb.res$Intermediate.VIFs$`order 3` ## Resulting covariate VIFs after removing
                                           ## covariates with VIF > max.vif
     gb.res$Final.VIFs$`order 3` ## Resulting covariate VIFs after removing
                                     ## covariates with VIF > max.vif2
    
    

Note

The function msco.res is not for general use. We included it in this package to help the readers of Lagat et al. (2021c) paper, who may want to get a deeper understanding of how the results presented in this paper were arrived at. It also allows deeper scrutiny of Lagat et al. (2021c)'s findings, and broader understanding of the main functionalities of msco R package.

References

  1. Lagat, V. K., Latombe, G. and Hui, C. (2021a). A multi-species co-occurrence index to avoid type II errors in null model testing. DOI: ⁠<To be added>⁠.

  2. Lagat, V. K., Latombe, G. and Hui, C. (2021b). Dissecting the effects of random encounter versus functional trait mismatching on multi-species co-occurrence and interference with generalised B-spline modelling. DOI: ⁠<To be added>⁠.

  3. Lagat, V. K., Latombe, G. and Hui, C. (2021c). msco: an R software package for null model testing of multi-species interactions and interference with covariates. DOI: ⁠<To be added>⁠.

Examples

## Not run: 

ms.res <- msco::msco.res()
ms.res$nmod_stats ## Table 2


## End(Not run)

vitaliskim/msco documentation built on Sept. 29, 2023, 9:22 p.m.