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
2
votes
2 answers

Why is this T-SQL query throwing an "aggregate function" error message?

I am using SQL Server 2014 and I have the following SQL query which runs fine and gives the following output: SELECT [PropertyCode], [BkgLeadTime], COUNT([Bkg Lead Time]) AS 'BLT COUNT' FROM BOOKINGLEADTIME_CTE GROUP BY …
user3115933
  • 4,303
  • 15
  • 54
  • 94
2
votes
1 answer

How do I figure the weighted mean of headings?

Get mean heading of neighboring turtles to-report mean-heading [ headings ] let mean-x mean map sin headings let mean-y mean map cos headings report atan mean-x mean-y end from that answer gets me part way there but I want is each of the…
King-Ink
  • 2,096
  • 12
  • 18
2
votes
1 answer

Volume-weighted average price for a missing quatinty

I'm writing a Java code to Calculate the amount of Quantity we have to buy so that the weighted average is equal to the Target avg Price. Example : Lets say a product p Q1 = 310; // This much quantity I already have. P1 = 16.40; // I bought Q1…
maddy man
  • 89
  • 4
  • 10
2
votes
1 answer

Weighted Average by Year in ragged data frame in R

I have a data frame with eight variables. I would like to calculate the average mean of annual weighted average percent loss. However, not all variables exist for each year in my dataset. What would be the simplest method to do so? Included below is…
Expat_Canuck
  • 113
  • 8
2
votes
1 answer

3 Variable Weighted Average in Excel

I have 3 variables that I need to take a weighted average of. I want to excel to calculate all possible combination of weights by .01 increments. I have three columns in excel. Weight A, Weight B and Weight C. Weight A = 1-sum(Weight B + Weight…
mathie
  • 23
  • 3
2
votes
1 answer

Image filtering by changing weighted elements along an edge

So basically I would like to apply a filter to a binary image that takes a weighted average of the values of the neighboring cells. This part I have set up already. My problem now is I have an "edge" in my image (which is not the edge of the…
2
votes
4 answers

R weighted arithmetic mean

Suppose I have this data.frame in R: ages <- data.frame(Indiv = numeric(), Age = numeric(), W = numeric()) ages[1,] <- c(1,10,2) ages[2,] <- c(1,15,5) ages[3,] <- c(2,5,1) ages[4,] <- c(2,100,2) ages Indiv Age W 1 1 10 2 2 1 15…
Rodrigo
  • 4,706
  • 6
  • 51
  • 94
2
votes
6 answers

Random amount calculator

I'm trying to figure out a random amount calculator but by rarity for example: choices = [10,100,1000,10000] 10 being the most common, 100 more common, 1000 rare, and 10000 extremely rare I've tried this import random def getAmmounts(): choices…
user2925490
  • 512
  • 2
  • 5
  • 11
2
votes
0 answers

Can images be weighted averaging to obtain one image in RGB color space?

all I have a few images of one object taken from different perspectives, so some part of the object may be in the shadow. I hope to stitch the images to get one big image. I find the color in the resultant image doesn't appear correct. Maybe I…
Jogging Song
  • 573
  • 6
  • 28
2
votes
1 answer

How to calculate a post's score based on user's reputation?

I have read many topics on reputation but none of them fits my needs. I am implementing a Q & A site. Each post (question/answer) can be voted. Each user has a reputation score. Depending on user's reputation, the vote for each post caries more…
ipkiss
  • 13,311
  • 33
  • 88
  • 123
2
votes
2 answers

How to use ddply to get weighted-mean of class in dataframe?

I'm new to plyr and want to take the weighted mean of values within a class to reshape a dataframe for multiple variables. Using the following code, I know how to do this for one variable, such as x2: set.seed(123) frame <-…
coding_heart
  • 1,245
  • 3
  • 25
  • 46
2
votes
1 answer

MySQL Rating/Voting system (accurratly ordering by best rated taking into account number of votes)

Let's say I have a MySQL table that is something like this: software table: id int name text votes int rating int Where votes would be the number of times someone has voted for that item and rating would be the average of those votes. Example…
Christopher Tarquini
  • 11,176
  • 16
  • 55
  • 73
2
votes
1 answer

Numpy - Regrid with Averaging redux

I'm trying to implement something similar to what was answered in this post about regridding in python. The question in that post involved regridding an array such that an output cell would contain the average of all the input cells that…
Blas
  • 77
  • 2
  • 6
2
votes
1 answer

Weighted sum of series in Graphite

I'm working with series of response times from different servers in Graphite, and I have separate series showing the number of requests from each server. Now what I'd like to do is compute a weighted average of these, i.e. avg = ((weight1 * value1)…
thomson_matt
  • 7,473
  • 3
  • 39
  • 47
2
votes
1 answer

Multiplicative Filter or more standard Additive Weighting

I have several features which can vote of whether a certain data item is worthy of showing to my users. You can think of each of them as a number between 0 and 1 where 1 means it is good and 0 means not worthy of showing to my users. I had just…