The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
library(greta.dynamics)
Loading required package: greta
Attaching package: 'greta'
The following objects are masked from 'package:stats':
binomial, cov2cor, poisson
The following objects are masked from 'package:base':
%*%, apply, backsolve, beta, chol2inv, colMeans, colSums, diag,
eigen, forwardsolve, gamma, identity, rowMeans, rowSums, sweep,
tapply
greta_sitrep()
ℹ checking if python available
✔ python (version 3.7) available
ℹ checking if TensorFlow available
✔ TensorFlow (version 1.14.0) available
ℹ checking if TensorFlow Probability available
✔ TensorFlow Probability (version 0.7.0) available
ℹ checking if greta conda environment available
✔ greta conda environment available
ℹ greta is ready to use!
# simulate from a probabilistic 4-stage transition matrix model
<- 4
k
# component variables
# survival probability for all stages
<- uniform(0, 1, dim = k)
survival # conditional (on survival) probability of staying in a stage
<- c(uniform(0, 1, dim = k - 1), 1)
stasis # marginal probability of staying/progressing
<- survival * stasis
stay <- (survival * (1 - stay))[1:(k - 1)]
progress # recruitment rate for the largest two stages
<- exponential(c(3, 5)) recruit
# combine into a matrix:
<- zeros(k, k)
tmat diag(tmat) <- stay
<- row(tmat) - col(tmat) == 1
progress_idx <- progress
tmat[progress_idx] 1, k - (1:0)] <- recruit tmat[
# analyse this to get the intrinsic growth rate and stable state
<- iterate_matrix(tmat)
iterations $lambda iterations
greta array (operation)
[,1]
[1,] ?
$stable_distribution iterations
greta array (operation)
[,1]
[1,] ?
[2,] ?
[3,] ?
[4,] ?
$all_states iterations
greta array (operation)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14]
[1,] ? ? ? ? ? ? ? ? ? ? ? ? ? ?
[2,] ? ? ? ? ? ? ? ? ? ? ? ? ? ?
[3,] ? ? ? ? ? ? ? ? ? ? ? ? ? ?
[4,] ? ? ? ? ? ? ? ? ? ? ? ? ? ?
[,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26]
[1,] ? ? ? ? ? ? ? ? ? ? ? ?
[2,] ? ? ? ? ? ? ? ? ? ? ? ?
[3,] ? ? ? ? ? ? ? ? ? ? ? ?
[4,] ? ? ? ? ? ? ? ? ? ? ? ?
[,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38]
[1,] ? ? ? ? ? ? ? ? ? ? ? ?
[2,] ? ? ? ? ? ? ? ? ? ? ? ?
[3,] ? ? ? ? ? ? ? ? ? ? ? ?
[4,] ? ? ? ? ? ? ? ? ? ? ? ?
[,39] [,40] [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50]
[1,] ? ? ? ? ? ? ? ? ? ? ? ?
[2,] ? ? ? ? ? ? ? ? ? ? ? ?
[3,] ? ? ? ? ? ? ? ? ? ? ? ?
[4,] ? ? ? ? ? ? ? ? ? ? ? ?
[,51] [,52] [,53] [,54] [,55] [,56] [,57] [,58] [,59] [,60] [,61] [,62]
[1,] ? ? ? ? ? ? ? ? ? ? ? ?
[2,] ? ? ? ? ? ? ? ? ? ? ? ?
[3,] ? ? ? ? ? ? ? ? ? ? ? ?
[4,] ? ? ? ? ? ? ? ? ? ? ? ?
[,63] [,64] [,65] [,66] [,67] [,68] [,69] [,70] [,71] [,72] [,73] [,74]
[1,] ? ? ? ? ? ? ? ? ? ? ? ?
[2,] ? ? ? ? ? ? ? ? ? ? ? ?
[3,] ? ? ? ? ? ? ? ? ? ? ? ?
[4,] ? ? ? ? ? ? ? ? ? ? ? ?
[,75] [,76] [,77] [,78] [,79] [,80] [,81] [,82] [,83] [,84] [,85] [,86]
[1,] ? ? ? ? ? ? ? ? ? ? ? ?
[2,] ? ? ? ? ? ? ? ? ? ? ? ?
[3,] ? ? ? ? ? ? ? ? ? ? ? ?
[4,] ? ? ? ? ? ? ? ? ? ? ? ?
[,87] [,88] [,89] [,90] [,91] [,92] [,93] [,94] [,95] [,96] [,97] [,98]
[1,] ? ? ? ? ? ? ? ? ? ? ? ?
[2,] ? ? ? ? ? ? ? ? ? ? ? ?
[3,] ? ? ? ? ? ? ? ? ? ? ? ?
[4,] ? ? ? ? ? ? ? ? ? ? ? ?
[,99] [,100]
[1,] ? ?
[2,] ? ?
[3,] ? ?
[4,] ? ?
# Can also do this simultaneously for a collection of transition matrices
<- 2
k <- 10
n <- uniform(0, 1, dim = c(n, k))
survival <- cbind(uniform(0, 1, dim = n), rep(1, n))
stasis <- survival * stasis
stay <- (survival * (1 - stasis))[, 1]
progress <- 1 / seq(0.1, 5, length.out = n)
recruit_rate <- exponential(recruit_rate, dim = n)
recruit <- zeros(10, 2, 2)
tmats 1, 1] <- stasis[, 1]
tmats[, 2, 2] <- stasis[, 2]
tmats[, 2, 1] <- progress
tmats[, 1, 2] <- recruit tmats[,
<- iterate_matrix(tmats)
iterations $lambda iterations
greta array (operation)
[,1]
[1,] ?
[2,] ?
[3,] ?
[4,] ?
[5,] ?
[6,] ?
[7,] ?
[8,] ?
[9,] ?
[10,] ?
$stable_distribution iterations
greta array (operation)
, , 1
[,1] [,2]
[1,] ? ?
[2,] ? ?
[3,] ? ?
[4,] ? ?
[5,] ? ?
[6,] ? ?
[7,] ? ?
[8,] ? ?
[9,] ? ?
[10,] ? ?
dim(iterations$all_states)
[1] 10 2 100
$all_states[, , 1] iterations
greta array (operation)
, , 1
[,1] [,2]
[1,] ? ?
[2,] ? ?
[3,] ? ?
[4,] ? ?
[5,] ? ?
[6,] ? ?
[7,] ? ?
[8,] ? ?
[9,] ? ?
[10,] ? ?
$all_states[, , 100] iterations
greta array (operation)
, , 1
[,1] [,2]
[1,] ? ?
[2,] ? ?
[3,] ? ?
[4,] ? ?
[5,] ? ?
[6,] ? ?
[7,] ? ?
[8,] ? ?
[9,] ? ?
[10,] ? ?
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.