Questions tagged [weighted-average]

The weighted average or weighted mean is similar to an arithmetic mean where instead of each of the data points contributing equally to the final average, some data points contribute more than others.

If all the weights are equal, then the weighted mean is the same as the arithmetic mean.

The mathematical expression for the weighted average is

enter image description here

Read more here

476 questions
0
votes
2 answers

weighted moving average with Hive SQL

Given a Hive table like below I want to calculate a weighted moving average. In table 1 is an example of such a weighted moving average. The value of every column is col_value = (1 * n) + (0.75 * n-1) + (0.5 * n-2) + (0.25 * n-3) where n is the…
Laurens Koppenol
  • 2,946
  • 2
  • 20
  • 33
0
votes
0 answers

Computing 15 min Time Weighted Moving Average in Java8 Collections

How can i effectively compute a 15 mins time weighted moving average for a scientific data for the below data model and what data structure can be best utilized to perform the moving window calculations to prevent operations in multiple loops? Below…
0
votes
1 answer

Weighted average value in the presence of NA values

Here's a very simple example of what I'm dealing with: data_stack <- data.table(CompA_value = c(10,20,30,40), CompB_value = c(60,70,80,80), CompC_value = c(NA, NA, NA, 100), CompA_weight = c(0.2, 0.3,0.4,0.4), CompB_weight = c(0.8,0.7,0.6,0.4),…
Gin_Salmon
  • 837
  • 1
  • 7
  • 19
0
votes
1 answer

Taking the top values and averaging from data list in Excel

I have a data list in Excel, I am looking to take the top 3 values for each number, and get the average for those 3 values quickly. I often work with lists of up to 50,000 lines which at any one time could convert to over 10,000 different column A…
0
votes
1 answer

How to calculate weighted average for 0 values

I am facing an issue in performing a weighted average logic in excel. I am looking at 4 fields for different deliverables: Total, Complete, Pending and Weight. The weighted average for a particular deliverable is calculated as : (Complete/Total) *…
Rikin
  • 283
  • 3
  • 13
  • 29
0
votes
3 answers

SAS: Collapsing and weighted averages calculations

I have a SAS programming problem which I can't solve on my own and I'm thankful for any imput. I want to collapse data in a dataset by variable and summarize/average two variables based on the weights given by another variable and substract them…
MaBo88
  • 97
  • 1
  • 1
  • 9
0
votes
1 answer

Vectorize weighted sum matlab

I was trying to vectorize a certain weighted sum but couldn't figure out how to do it. I have created a simple minimal working example below. I guess the solution involves either bsxfun or reshape and kronecker products but I still have not managed…
phdstudent
  • 1,060
  • 20
  • 41
0
votes
0 answers

Spark Map Reduce performance on not so big data

I am doing PoC on Spark's Map Reduce performance for calculating weighted average over 5000 to 200,000 data and it appears to be very slow. So, just wanted to check whether I am doing something wrong here. Here is my setup details - • No. of Worker…
0
votes
1 answer

Replicating the weighted averages from polljunkie poll

How can I replicate the Result of the poll from the CSV of the polljunkie poll? example poll: Result example CSV: CSV I've split the individual results from the single cell and numbered A-E as 1-5. Then I multiplied every position with its weight…
wouter215
  • 3
  • 1
0
votes
0 answers

Finding the time or rate weighted average between peaks in Matlab?

I have some data, that basically looks like a sine wave. I run that through the peak detection function to find the peaks and mins of the data: [Maxima,MaxIdx] =…
J.Doe
  • 15
  • 8
0
votes
0 answers

Postgres Average Weighted

I looked up several finding average weight questions posted in SO but none quite match my requirement. This is what is expected. The Postgres table stores the following fields. Link to Database Table Screenshot Taking a reference from the screenshot…
0
votes
1 answer

java triangle interpolation how to aka rgb test image

So what i wanted to do is interpolate a triangle in java without any external libraries for a challenge, just using swing to display the image. I searched all over the web and i couldn't find anything. Thats why i'm making this.
David
  • 1,636
  • 19
  • 27
0
votes
2 answers

Calling a function to execute a data tree

I already have a code for weighted score. def weighted_total_score(student_scores): …
Rachel
  • 43
  • 1
  • 8
0
votes
1 answer

Calculating weighted average from a list

This is one list [74.0, 96.0, 72.0, 88.0, ['71', '80', '83', '77', '90', '88', '95', '71', '76', '94'], 80.0, 74.0, 98.0, 77.0] 74 is calculated with the weight .1, 96 with the weight .1, 72 with the weight .15, 88 with the weight .05, the average…
Rachel
  • 43
  • 1
  • 8
0
votes
2 answers

Verilog code for wighted average circuit

I am trying to synthesize a weighted sum circuit which will essentially implement the following equation, out=out+a[i]*w[i] , where i=0,1..n I have written the following code but synthesizing in design vision environment generates error as…
Snigdha203
  • 101
  • 3
  • 11