Questions tagged [weighted]

questions about problems that use a weight function, e.g. weighted mean, weighted sampling

A weight function is a mathematical device used when performing a sum, integral, or average to give some elements more "weight" or influence on the result than other elements in the same set. The result of this application of a weight function is a weighted sum or weighted average.

Weight functions occur frequently in statistics and analysis, and are closely related to the concept of a measure. Weight functions can be employed in both discrete and continuous settings.

615 questions
0
votes
1 answer

calculate mean and variance for weighted discrete random variables in R

I have the following data frame: dat <- read.table(text=" X prob 1 1 0.1 2 2 0.2 3 3 0.4 4 4 0.3", header=TRUE) Is there any built-in function or elegant way to calulate mean and variance for discrete random variables in R?
Qiang Li
  • 10,593
  • 21
  • 77
  • 148
0
votes
2 answers

How do I calculate the importance/weight of input based on users reputation?

I have a couple systems which contain a users' table along with some form of karma/weight/reputation. Sometimes it's the number of posts a user has made, sometimes it's the number of up/down votes a user has received across all their activity on the…
Xeoncross
  • 55,620
  • 80
  • 262
  • 364
0
votes
1 answer

Over Partition By not working for Weighted AVG Calc

I don't know how I am missing this, but I am sure it's from late nights! Any help appreciated let's say we are using NorthWind to Calculate Weighted AVG USE NORTHWIND Select OD.UnitPrice,OD.Quantity, sum(OD.UnitPrice*OD.Quantity)/sum(OD.Quantity)…
philbeat
  • 53
  • 9
0
votes
1 answer

Relevance algorithm

Let's say I want to order some products based on two variables: rating and the number of ratings. For example, let's say I have these 2 products: Product A 4.9 of 10000 Product B 5.0 of 1 It's kind obviously that the product A should come first.…
user1320990
0
votes
1 answer

Matlab+ Graph theory+ specific weight assignment

I want to assign weights to the edges such that the Sum of (the weights coming to a node) and its own weight add to one. here is what I tried: clear all; close all; clc; %% building the graph g=graph; for k=1:6 …
happyme
  • 233
  • 2
  • 5
  • 16
0
votes
1 answer

Calculate weighted mean point from array of 3D points

I am writing the program in Cocoa but I think that the solution must be quite universal. I have a set of points represented by 3D vectors. Each point has a weight assigned to it. The weight is in the range from 0 to 1. The sum of all weights isn't…
BartoNaz
  • 2,743
  • 2
  • 26
  • 42
0
votes
2 answers

Algorithm to perform weighted shuffle with gradual bubbling up of list items

I'm wondering if anyone knows of a simple algorithm for performing a shuffle of a list that permits a weight bias so that each item in the list works its way toward the top of the list at the same time. I am working on a site with business listings…
Rob
  • 10,004
  • 5
  • 61
  • 91
0
votes
1 answer

Finding path of zero/Negative weight between Two Nodes on Graph by Utilizing Negative Cycles

I really struggled with describing this in the title but I'll give it a go in a longer format. I'm really stumped on this problem and I'm not looking for answers, just a little help or some specific topics to read up on. What I have is a directed…
0
votes
2 answers

Django multi-criteria weighted rating

I've started building an app in Django that will require multi-criteria weighted ratings. My issue is the exact same as this one from a few years ago, which unfortunately did not have any answer. If anybody out there can give me some hints on how…
Alb Dum
  • 1,121
  • 3
  • 11
  • 26
-1
votes
1 answer

multiply a column by a calculated/measure of weight score in power bi dax

I am trying to calculate the alphabetic grade based on the product of the column weight and the sum of count. I had the following dax code: weight = IF ( CONTAINSROW ( {"FirstName", "LastName", "Birthdate"}, table[columns]), 2, 1 ) after the above,…
budding pro
  • 135
  • 1
  • 2
  • 10
-1
votes
1 answer

Generating from a collection based on weight but also having weight bonus and removal

I'm working on a Minecraft spigot hobbyp roject and decided to add openable chests and boss drops. Generating elements by weight is something I did before so it wasn't a hard task for me and I already finished it, but looking to improve. While I was…
-1
votes
1 answer

Finding heaviest path (biggest sum of weights) of an undirected weighted graph? Bellman Ford --

There's a matrix, each of its cell contains an integer value (both positive and negative). You're given an initial position in the matrix, now you have to find a path that the sum of all the cells you've crossed is the biggest. You can go up, down,…
TYTA
  • 3
  • 1
-1
votes
1 answer

How to find all minimal winning coalitions in a weighted-majority voting game in a fast way?

EDIT: I found a solution thanks to the paper A survey of algorithms for calculating power indices of weighted majority games I'd like to solve the following problem: Given a set N={1,..,n} with a vector of weights W={w_1,..,w_n}, sorted in…
pier
  • 1
  • 1
-1
votes
1 answer

Error with svyglm function in survey package in R: "all variables must be in design=argument"

New to stackoverflow. I'm working on a project with NHIS data, but I cannot get the svyglm function to work even for a simple, unadjusted logistic regression with a binary predictor and binary outcome variable (ultimately I'd like to use multiple…
-1
votes
1 answer

Generate a list of weighted words from a .txt file randomly with Python

I need a code that generates a list of significant words of a conversation, randomly, according to the statistical distribution of the formed corpus, that is, they will be generated respecting the frequencies consigned in that corpus. I start from…
Adrián
  • 111
  • 10
1 2 3
40
41