1,609 questions
2 votes
0 answers
83 views
How to uniformly sample from a nonlinearly transformed simplex?
The following algorithm is intended to uniformly sample priority (or criterion) vectors from a transformed version of the simplex (which is a surface in 3d space). The transformation involves taking ...
0 votes
0 answers
52 views
Sampling characteristics of nRF52840 SAADC
According to the documentation, the SAADC (ADC) device has a maximum sampling rate of 200kHz (ksps), a value that is the sum of a minimum TACQ (acquisition time) of 3us and a conversion time of "&...
0 votes
0 answers
79 views
Implement a Custom Sampler in Mitsuba
I am trying to implement a basic custom sampler, and here is the code that I have been working with. As I attempt to render the scene, I encounter an error stating that the traverse() method is not ...
5 votes
3 answers
170 views
How to consistently retain an exact percentage of elements from a List in Java?
I'm currently filtering a Java List to keep approximately a percentage of its elements using a random approach: import java.util.List; import java.util.Random; public class Main { public static ...
1 vote
1 answer
57 views
Sampling from discrete probability distribution over all natural numbers
I'd like to sample a from the distribution c^a / (-a log (1-c)) where a is a natural number (1 to infinity) and c < 1. How can I do this in Python? I've looked at scipy.stats.rv_discrete, but it ...
1 vote
2 answers
76 views
Sampling with replacement in Rust
The following snippet samples elements with replacement from a vector: use rand::seq::IteratorRandom; fn main() { let mut rng = rand::rng(); let values = vec![1, 2, 3, 4, 5] as Vec<i32>;...
2 votes
3 answers
276 views
Stratified sampling using SQL given an absolute sample size
I have the following population: a b b c c c c I am looking for a SQL statement to generate a the stratified sample of arbitrary size. Let's say for this example, I would like a sample size of 4. I ...
3 votes
2 answers
177 views
What is causing some points to fail sampling an enclosing mesh? / How do I prevent points from failing to sample an enclosing mesh?
I am using the PyVista package to resample a .vtk mesh of nonconforming rectangular prisms onto a grid of points. However, some of the points fail to sample the dataset, which results in a "0&...
0 votes
0 answers
43 views
How can I plot information from Adafruit ADS1115 smoothly on matplotlib using python
See attached my waveform of input to channel of ADS1115, my code, and my output that I am getting I cannot get the output matplotlib waveform to plot smoothly like my input waveform from oscilloscope ...
1 vote
1 answer
57 views
Stratified sampling based on multiple predictors in R
I have a dataset with two groups of people: vaccinated and unvaccinated. In the vaccinated group, each row represents a unique ID with a corresponding unique T0. In the unvaccinated group, each ID may ...
0 votes
0 answers
37 views
Correcting sampling bias (looking for data science or statistical approach)?
Lets say I am looking at a sample of students and their grades achieved across 5 subjects. 90% of my sample is biased towards worst performing students and 10% of my sample is random. What is a simple ...
0 votes
1 answer
89 views
How to sample point using LatinHyper Cube sampling in a random volume
I have a a dataset composed of XYZ coordinates, which can be rendered in 3D bar chart as the picture below. The main question I have is: how to generate X points (X being a user input) inside said ...
1 vote
1 answer
51 views
Sampling from joint probability mass function in python
I have a non-negative normalized vector p. I would like to sample an index from the index set of the vector. The probability getting sample k is p[k]. Using np.random.choice function, I can write the ...
1 vote
2 answers
183 views
How to sample values based on probabilities with Polars like numpy.random.choice?
I'm working with the Polars library in Python and would like to sample values from a list based on associated probabilities, similar to how numpy.random.choice works. Here's what I'd like to achieve: ...
0 votes
1 answer
95 views
How to save survey designed dataset for other analysis (preferred R)
Is there any way to save weighted survey with strata and fpc as dataframe? For example, here is the simple dataframe: Data <- data.frame( X =c(1,4,6,4,1,7,3,2,2), Y = c(6,5,9,9,43,65,45,67,90), ...