Running 'test.connectivity_estimation.R' [1s]
  Running 'test.connectivity_estimation.beta.prior.R' [0s]
  Running 'test.connectivity_estimation.distributions.R' [1s]
  Running 'test.connectivity_estimation.multinomial.R' [171s]
  Running 'test.connectivity_estimation.multiple.R' [172s]
  Running 'test.dpr_model.R' [1s]
  Running 'test.laplacianConnMat.R' [167s]
  Running 'test.marked.egg.fraction.R' [0s]
  Running 'test.optimalSplitConnMat.R' [145s]
  Running 'test.retentionStats.R' [167s]
Running the tests in 'tests/test.connectivity_estimation.multinomial.R' failed.
Complete output:
  > library(ConnMatTools)
  > 
  > ps <- c(0.7,0.5) # Fraction of eggs "marked" at each source site
  > ks <- c(4,5) # Number of marked settlers among sample from each source site
  > n.sample <- 20 # Total sample size.  Must be >= sum(ks)
  > 
  > 
  > phis0 = runif(3,min=0.05)
  > phis0 = phis0 / sum(phis0)
  > phis0 = phis0[1:2] # Don't include relative connectivity of unknown sites
  > 
  > nbatch=1e4
  > 
  > library(mcmc)
  > ans = metrop(d.rel.conn.multinomial.unnorm,
  +              initial=phis0,nbatch=nbatch,scale=0.1,
  +              log=TRUE,ps=ps,ks=ks,n.sample=n.sample)
  There were 50 or more warnings (use warnings() to see the first 50)
  > # A more serious test would adjust blen and scale to improve results, and would repeat
  > # multiple times to get results from multiple MCMC chains.
  > 
  > # Plot marginal distribution of relative connectivity from first site
  > h=hist(ans$batch[,1],xlab="Rel. Conn., Site 1",
  +        main="Relative Connectivity for Source Site 1")
  > 
  > # For comparison, add on curve that would correspond to single site calculation
  > phi = seq(0,1,length.out=40)
  > d1 = d.rel.conn.beta.prior(phi,ps[1],ks[1],n.sample)
  > 
  > lines(phi,d1*nbatch*diff(h$breaks)[1],col="red",lwd=5)
  > 
  > # Image plot of bivariate probability density
  > t=table(cut(ans$batch[,1],phi),cut(ans$batch[,2],phi))
  > image(t,col=heat.colors(12)[12:1],xlab="Rel. Conn., Site 1",ylab="Rel. Conn., Site 2")
  > 
  > # Add line indicate region above which one can never find results as that would 
  > # lead to a total connectivity great than 1
  > abline(1,-1,col="black",lty="dashed",lwd=3)
  > 
  > proc.time()
     user  system elapsed 
     3.82    0.10    3.92 
Running the tests in 'tests/test.connectivity_estimation.multiple.R' failed.
Complete output:
  > library(ConnMatTools)
  > 
  > # p values have uniform probability between 0.1 and 0.4
  > p <- seq(0.1,0.8,length.out=100)
  > 
  > # Weights the same for all except first and last, which are halved
  > w <- rep(1,length(p))
  > w[1]<-0.5
  > w[length(w)]<-0.5
  > 
  > n <- 20 # Sample size
  > k <- 2 # Marked individuals in sample
  > 
  > # phi values to use for plotting distribution
  > phi <- seq(0,1,0.01)
  > 
  > prior.shape1 = 1 # Uniform prior
  > # prior.shape1 = 0.5 # Jeffreys prior
  > 
  > # Plot distribution
  > plot(phi,d.rel.conn.multiple(phi,p,k,n,w,prior.shape1=prior.shape1),
  +      main="Probability density for relative connectivity",
  +      xlab=expression(phi),
  +      ylab="Probability density",
  +      type="l")
  > 
  > # Add standard distributions for max and min p values
  > lines(phi,d.rel.conn.beta.prior(phi,min(p),k,n,prior.shape1=prior.shape1),
  +       col="red",lty="dashed")
  > lines(phi,d.rel.conn.beta.prior(phi,max(p),k,n,prior.shape1=prior.shape1),
  +       col="red",lty="dashed")
  > 
  > # Add some quantiles
  > q = q.rel.conn.multiple(c(0.025,0.25,0.5,0.75,0.975),
  +                         p,k,n,w,prior.shape1=prior.shape1)
  > abline(v=q,col="green")
  > 
  > proc.time()
     user  system elapsed 
     6.65    0.25    6.87 
Running the tests in 'tests/test.laplacianConnMat.R' failed.
Complete output:
  > library(ConnMatTools)
  > cm <- laplacianConnMat(100,10,15,"circular")
  > image(cm)
  > 
  > proc.time()
     user  system elapsed 
     0.28    0.07    0.34 
Running the tests in 'tests/test.optimalSplitConnMat.R' failed.
Complete output:
  > library(ConnMatTools)
  > data(chile.loco)
  > 
  > num <- prod(dim(chile.loco)) / sum(chile.loco)
  > betas <- betasVectorDefault(n=num,steps=4)
  > chile.loco.split <- optimalSplitConnMat(chile.loco,normalize.cols=FALSE,
  +                                         betas=betas)
  [1] "Starting cycle 1"
  [1] "beta = 7.87433911214873"
  [1] "beta = 1.35019532101316"
  [1] "beta = 7.87433911214873"
  [1] "beta = 984.292389018592"
  [1] "Starting cycle 2"
  [1] "beta = 7.87433911214873"
  [1] "beta = 1.35019532101316"
  [1] "beta = 7.87433911214873"
  [1] "beta = 984.292389018592"
  There were 50 or more warnings (use warnings() to see the first 50)
  > 
  > # Extra 3rd division
  > print(paste("Examining split with",names(chile.loco.split$best.splits)[1],
  +             "subpopulations."))
  [1] "Examining split with 1 subpopulations."
  > pops <- subpopsVectorToList(chile.loco.split$subpops[,chile.loco.split$best.splits[[1]]$index])
  > 
  > reduce.loco <- reducedConnMat(pops,chile.loco)
  > 
  > sr <- selfRecruitment(reduce.loco)
  > lr <- localRetention(reduce.loco)
  > rlr <- relativeLocalRetention(reduce.loco)
  > 
  > proc.time()
     user  system elapsed 
     0.87    0.10    0.96 
Running the tests in 'tests/test.retentionStats.R' failed.
Complete output:
  > library(ConnMatTools)
  > data(chile.loco)
  > 
  > sr <- selfRecruitment(chile.loco)
  > lr <- localRetention(chile.loco)
  > rlr <- relativeLocalRetention(chile.loco)
  > 
  > proc.time()
     user  system elapsed 
     0.23    0.06    0.28