Displaying 2 results from an estimated 2 matches for "rtriang".
Did you mean:
triang
2012 Mar 17
3
rtriang using ifelse statement
...=4 simulations aren't occurring. Is there a way
to adjust the ifelse statement to fix this, or must I take an entirely
different approach? Many thanks for your help.
> matrx <- matrix(c(2, 1, 1, 2, 2,1), nc=nx)
> matrx
[,1] [,2] [,3]
[1,] 2 1 2
[2,] 1 2 1
> # rtriang from mc2d package: function (n, min = -1, mode = 0, max = 1)
>* dmatrx<- ifelse(matrx==1, rtriang(4, min=0.001, mode=matrx, max=2.001),
rtriang(4, min=2, mode=matrx, max=3))*
Warning message:
In rtriang(4, min = 2, mode = matrx, max = 3) : NaN in rtriang
> dmatrx
[,1] [,2]...
2012 Mar 10
1
Draw values from multiple data sets as inputs to a Monte-Carlo function; then apply across entire matrix
...r example, 3.5 would be cell (i,j) in the Poultry MEAN density table;
0.108 would be cell (i,j) in the Poultry STDEV table; and 47 the single
estimate for cell (i,j) of the Wild bird density table.
Poultry <- mcstoc(rnorm, type="U", 3.5, 0.108, rtrunc=TRUE, linf=0)
Wild <- mcstoc(rtriang, type="U", min=0, mode=47, max=75)
Risk <- Poultry * Wild #this is the risk function the MC is applied
to
Questions:
1) How can I edit the Poultry and Wild variables above to read the data
values directly from the 3 input tables (i.e., replacing 3.5, 0.108, and
47 with some...