Skip to main content
10 events
when toggle format what by license comment
Jan 8, 2018 at 17:30 comment added jbowman ... or you could just do something like increment each successive one by one, so, for example, instead of $[30, 30, 30, ... ]$ you get $[30, 31, 32, ...]$, at the lower end.
Jan 8, 2018 at 17:28 comment added user929304 no, they are integer. But in any case, you're right it's easiest to just remove the duplicates. Thanks again.
Jan 8, 2018 at 1:14 comment added jbowman In your application, do those values need to be integers? I made them so because I had to generate an integer number of random values, but maybe you don't.
Jan 7, 2018 at 21:34 comment added jbowman Well, I'd just eliminate the duplicate values myself, leaving you with one copy of each value.
Jan 7, 2018 at 21:09 comment added jbowman That looks right to me, with the caveat that the maximum i you have is 29, so your maximum x[i] will be exp(29*logmax/30), not exp(logmax). This is because you need n+1 steps to get both the endpoints of the interval [lower, upper], so i <= 30 would do the job. Otherwise, if you want 30 values, you need interval = logmax/29;.
Jan 7, 2018 at 20:35 comment added user929304 I am still a bit struggling in my attempt. I m writing the routine in c++, in your case the max value is 10000, and to sample you re linearly picking values between 0 to log(10000), and then you exponentiate the values so they range from 1 to 10000 again but logarithmically separated now. Right? My way of implementing your seq function has been to set logmax = log(10000);, interval=logmax/30; and then for (int i=0; i<30; i++){ x[i]=round(exp(i*interval)); } is this a correct way of recreating basically what you had shown in R? Many thanks for your help in advance
Dec 28, 2017 at 18:07 comment added jbowman Yes, they are in R. seq basically just creates a vector of equally-spaced numbers starting with from, ending with to, and with length.out entries in it. So, seq(from=0, to=1.5, length.out=4) would create (0, 0.5, 1.0, 1.5). To add some possibly-useful information, rpareto creates random numbers ~ Pareto, with the first parameter (x[i]) being the number of them created - so you could think of that function call as being x[i] executions of the underlying simulation, with mean(.) as being the function that aggregates the x[i] simulation results.
Dec 28, 2017 at 17:32 vote accept user929304
Dec 28, 2017 at 17:32 comment added user929304 Dear jbowman, this is exactly what I was looking for, thank you very much for taking the time to write this up. Are the sample codes in R? What does seq do here?
Dec 23, 2017 at 19:20 history answered jbowman CC BY-SA 3.0