Simulate a spatial beta random variable with a specific mean and covariance structure.
sprbeta(
spcov_params,
dispersion = 1,
mean = 0,
samples = 1,
data,
randcov_params,
partition_factor,
...
)An spcov_params() object.
The dispersion value.
A numeric vector representing the mean. mean must have length 1
(in which case it is recycled) or length equal
to the number of rows in data. The default is 0.
The number of independent samples to generate. The default
is 1.
A data frame or sf object containing spatial information.
A randcov_params() object.
A formula indicating the partition factor.
Additional arguments passed to sprnorm().
If samples is 1, a vector of random variables for each row of data
is returned. If samples is greater than one, a matrix of random variables
is returned, where the rows correspond to each row of data and the columns
correspond to independent samples.
The values of spcov_params, mean, and randcov_params
are assumed to be on the link scale. They are used to simulate a latent normal (Gaussian)
response variable using sprnorm(). This latent variable is the
conditional mean used with dispersion to simulate a beta random variable.
spcov_params_val <- spcov_params("exponential", de = 0.2, ie = 0.1, range = 1)
sprbeta(spcov_params_val, data = caribou, xcoord = x, ycoord = y)
#> [1] 0.1035737357 0.0003097179 0.5418869469 0.6269276217 0.3949375651
#> [6] 0.0382430325 0.5269492046 0.9955020389 0.5604255878 0.9383468587
#> [11] 0.3116608125 0.5993523671 0.9647539654 0.9999990000 0.9946007900
#> [16] 0.9651714842 0.0168316036 0.5798667483 0.3967142477 0.9774689532
#> [21] 0.0003952688 0.0134588677 0.0389676237 0.4180814637 0.0350628303
#> [26] 0.0315082844 0.3871114553 0.6395554688 0.4406188468 0.4493427944
sprbeta(spcov_params_val, samples = 5, data = caribou, xcoord = x, ycoord = y)
#> 1 2 3 4 5
#> [1,] 0.933343454 0.850826604 0.6131231336 0.9967425253 0.130460419
#> [2,] 0.482562147 0.009506814 0.5645041512 0.8874646717 0.075238661
#> [3,] 0.763460403 0.742827672 0.0266035318 0.7008545641 0.907097301
#> [4,] 0.464232434 0.952104441 0.0009609875 0.1620757379 0.981396042
#> [5,] 0.019600146 0.125663737 0.9993986009 0.2477825726 0.789921163
#> [6,] 0.086697289 0.526698361 0.6003321822 0.9886299471 0.397886149
#> [7,] 0.174488768 0.958118635 0.6815091565 0.4703989170 0.399529794
#> [8,] 0.934126476 0.888932907 0.9457971645 0.1649723592 0.042459874
#> [9,] 0.297380285 0.007200123 0.0208153932 0.3415544392 0.358674435
#> [10,] 0.392678299 0.001359850 0.3665863391 0.3550631388 0.866844517
#> [11,] 0.929272590 0.205060823 0.7910560692 0.9682676976 0.935679110
#> [12,] 0.286242425 0.896873244 0.9845512399 0.0244888561 0.599014743
#> [13,] 0.474896290 0.823453620 0.0560489075 0.0800663650 0.009448305
#> [14,] 0.999900000 0.298384219 0.5207054701 0.0703587196 0.000100000
#> [15,] 0.221288125 0.892257956 0.2138840764 0.7292453179 0.125753897
#> [16,] 0.026366360 0.990789236 0.4487999795 0.9068647000 0.658043276
#> [17,] 0.895916155 0.118643689 0.7713276731 0.0852352555 0.016869424
#> [18,] 0.928027154 0.999900000 0.2987034230 0.5672839702 0.535551529
#> [19,] 0.764752385 0.697934194 0.1443190595 0.0001932503 0.158771847
#> [20,] 0.008457757 0.373490344 0.0077756701 0.9045792934 0.034518659
#> [21,] 0.095758467 0.690608813 0.4734365191 0.5661446638 0.218370526
#> [22,] 0.624365122 0.667609319 0.9379949567 0.7410764936 0.742126476
#> [23,] 0.275102482 0.193775196 0.9835120153 0.4874712633 0.997072972
#> [24,] 0.962624091 0.867227346 0.9999000000 0.0952560008 0.004332665
#> [25,] 0.146875347 0.960381178 0.9440199242 0.7445854587 0.957359402
#> [26,] 0.099471483 0.205514817 0.1865352649 0.1012981545 0.000100000
#> [27,] 0.626078244 0.175062763 0.3973967516 0.6598920186 0.655446410
#> [28,] 0.009552013 0.016873356 0.3432454759 0.0011177184 0.149790328
#> [29,] 0.407182571 0.996462600 0.7171345520 0.0001000000 0.999900000
#> [30,] 0.936215994 0.940166376 0.7836118752 0.0168827816 0.035337193