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.298921561 0.863224388 0.150588107 0.191437699 0.197762703 0.077908609
#> [7] 0.889664682 0.074241709 0.812568993 0.995565338 0.007594357 0.001378291
#> [13] 0.020987877 0.147117093 0.656609785 0.160276106 0.997662612 0.003922659
#> [19] 0.190645066 0.362420019 0.795007720 0.654272679 0.839332027 0.004982284
#> [25] 0.001119526 0.369104178 0.383245702 0.023917907 0.007404098 0.254007213
sprbeta(spcov_params_val, samples = 5, data = caribou, xcoord = x, ycoord = y)
#> 1 2 3 4 5
#> [1,] 0.115431398 0.616688944 0.1641359723 0.8912529292 0.07915277
#> [2,] 0.130438686 0.001089285 0.0110756879 0.2118023935 0.29692096
#> [3,] 0.217993563 0.749579184 0.5128503526 0.9159847690 0.92179973
#> [4,] 0.792226632 0.940076341 0.9205019395 0.7796577131 0.11678359
#> [5,] 0.000100000 0.608027601 0.1814309967 0.8418308407 0.32382245
#> [6,] 0.975295415 0.966593397 0.0001000000 0.0958329617 0.58440038
#> [7,] 0.733295784 0.003261746 0.1581691145 0.9622233375 0.70175967
#> [8,] 0.839885924 0.171419417 0.1327302975 0.6961117713 0.99990000
#> [9,] 0.998502940 0.933019972 0.9954530808 0.8194676808 0.99564028
#> [10,] 0.018954917 0.759435243 0.4877494252 0.0448579561 0.97240557
#> [11,] 0.952348533 0.608581529 0.9792337694 0.0001000000 0.99453941
#> [12,] 0.467773693 0.245854606 0.0388147400 0.9942323611 0.64204103
#> [13,] 0.959627045 0.412916500 0.3770488814 0.8910610518 0.99990000
#> [14,] 0.008998400 0.837555047 0.4016761796 0.9430282090 0.27462551
#> [15,] 0.998577569 0.684946613 0.4189750853 0.0277346551 0.59787397
#> [16,] 0.538580557 0.939297726 0.9301995425 0.1316371840 0.13268957
#> [17,] 0.881849920 0.378552632 0.2115328495 0.5427226920 0.91450616
#> [18,] 0.271702217 0.713810392 0.9999000000 0.1965341751 0.34559322
#> [19,] 0.573162401 0.219419487 0.6555941836 0.9313336490 0.20145115
#> [20,] 0.007815161 0.154066700 0.0660841628 0.0107903860 0.36708609
#> [21,] 0.007957369 0.081593293 0.9896823472 0.9939858552 0.09496256
#> [22,] 0.248332645 0.527132546 0.4482353240 0.9956808269 0.81838880
#> [23,] 0.302730280 0.385316744 0.9877766377 0.5590530916 0.23958657
#> [24,] 0.088256115 0.153042520 0.8797892422 0.0025217671 0.07662302
#> [25,] 0.998322753 0.055039876 0.5123833333 0.3828355639 0.40177961
#> [26,] 0.682700405 0.921108137 0.2886173210 0.9040182491 0.94852028
#> [27,] 0.007120252 0.215883350 0.3924556527 0.9363071010 0.98658825
#> [28,] 0.973290325 0.320793578 0.0003009108 0.5756982168 0.16136908
#> [29,] 0.011092143 0.234603507 0.5082550895 0.9965227583 0.57130800
#> [30,] 0.001854224 0.996093425 0.3659396466 0.0007264242 0.98794974