Hello,
Here are your tests and the random numbers' histograms.
one_vec <- function(a, b, s) {
repeat{
repeat{
u <- runif(1, a[1], b[1])
if(s - u > 0) break
}
v <- s - u
if(a[2] < v && v < b[2]) break
}
c(u, v)
}
gen_mat <- function(m, a, b, s) {
replicate(m,
Hello,
Inline.
Às 17:55 de 22/04/2025, Brian Smith escreveu:
i.e. we should have
all elements of Reduce("+", res) should be equal to s = 0.05528650577311
My assertion is that it is not happing here.
You are right, that's not what is happening. The output is n vectors of
2 elements each. I
i.e. we should have
all elements of Reduce("+", res) should be equal to s = 0.05528650577311
My assertion is that it is not happing here.
On Tue, 22 Apr 2025 at 22:20, Brian Smith wrote:
>
> Hi Rui,
>
> Thanks for the explanation.
>
> But in this case, are we looking at the correct solution a
Hi Rui,
Thanks for the explanation.
But in this case, are we looking at the correct solution at all?
My goal is to generate random vector where:
1) the first element is bounded by (a[1], b[1]) and second element is
bounded by (a[2], b[2])
2) sum of the element is s
According to the outcome,
The
Às 12:39 de 22/04/2025, Brian Smith escreveu:
Hi Rui,
Many thanks for your time and insight.
However, I am not sure if I could understand the code. Below is what I
tried based on your code
library(Surrogate)
a <- c(0.015, 0.005)
b <- c(0.070, 0.045)
set.seed(2025)
res <- mapply(\(a, b, s, n, m
Hi Rui,
Many thanks for your time and insight.
However, I am not sure if I could understand the code. Below is what I
tried based on your code
library(Surrogate)
a <- c(0.015, 0.005)
b <- c(0.070, 0.045)
set.seed(2025)
res <- mapply(\(a, b, s, n, m) RandVec(a, b, s, n, m),
MoreArg
6 matches
Mail list logo