data frame with sample probabilities # in your case the rows are 1000 and the columns 4, # but it is just to show the procedure samp_prob <- data.frame(A = rep(.25, 4), B = c(.5, .1, .2, .2), C = c(.3, .6, .05, .05)) data frame of values to sample...

python,numpy,statistics,mean,weighted

You actually have 2 different questions. How to make data discrete, and How to make a weighted average. It's usually better to ask 1 question at a time, but anyway. Given your specification: xmin = -100 xmax = 100 binsize = 20 First, let's import numpy and make some data:...

algorithm,theory,graph-theory,weighted

This is an NP-hard optimization problem. For example, the Partition problem can be reduced into this easily (the planarity property does not cause a problem). So an algorithm that calculates an optimal solution (and you seem to ask for an optimal solution in your comment) is unlikely to be practical...

java,graph,nullpointerexception,weighted

You're shadowing the variable Latitude (and Longitude) double[] Latitude = new double[size]; should be Latitude = new double[size]; Note: Java naming conventions suggest that variables start with a lowercase letter, e.g. latitude and longitude...

You can use the using parameter to specify a column for the errors. With three using specifiers, the third one is interpreted as standard deviation s and is used to compute a weight 1/s**2 for the corresponding value: f(x) = mean_y fit f(x) "data" using 1:2:3 via mean_y That assumes,...