Generating 60 random samples that sum to 1, each subject to a unique lower and upper limit
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
RaFa
el 19 de En. de 2023
Comentada: Bruno Luong
el 8 de Sept. de 2023
0
I am looking for a method to generate uniform(ish) random samples for 60 variables that sum to 1, with each variable being subject to a unique lower and upper limit.
On the MATLAB file exchange, I found a algorithm capable of this, called randFixedLinearCombination. However, it is limited to ~20-25 dimensions before the hypercube array size becomes too large.
I should note that the samples generated does not have to be perfectly uniform, as they will be used for generating data for training a machine learning model. If necessary, one possible compromise would be to group the variables into e.g. 6 groups, with each group of 10 variables having the same lower and upper limits. I do not know if this approach would simplify the problem, just a comment.
2 comentarios
Jan
el 19 de En. de 2023
"I should note that the samples generated does not have to be perfectly uniform" - of course, otherwise they could not have a fixed sum.
Bruno Luong
el 19 de En. de 2023
I think 60 dimension is quite hard. randFixedLinearCombination is based on decomposing the convex set in non-overlapping simplex, randfixedsum muts raise to the power the # od dimension some to compute te conditioning probability. Both will have difficulty to handle dimension up to 60.
Respuesta aceptada
RaFa
el 8 de Sept. de 2023
Editada: RaFa
el 8 de Sept. de 2023
1 comentario
Bruno Luong
el 8 de Sept. de 2023
But this way of generation does not give uniform distribution and does not work for general case.
This would work for only versy specfic case of the configuration you describe.
So this meets your need, but does not really asnwer the question you asked in January.
Más respuestas (1)
Jan
el 19 de En. de 2023
Isn't this a job for: https://www.mathworks.com/matlabcentral/fileexchange/9700-random-vectors-with-fixed-sum ?
% [x,v] = randfixedsum(n,m,s,a,b)
%
% This generates an n by m array x, each of whose m columns
% contains n random values lying in the interval [a,b], but
% subject to the condition that their sum be equal to s.
3 comentarios
Jan
el 19 de En. de 2023
@Bruno Luong, @RaFa: Thanks. I misunderstood "with each variable being subject to a unique lower and upper limit." If all variables have different limits, the tool is not matching. Sorry.
Ver también
Categorías
Más información sobre Random Number Generation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!