Questions tagged [weighting]
81 questions
0
votes
0 answers
Python: Binning data with a weight
I have got a dataset with strong noise, e.g.
import numpy as np
import matplotlib.pyplot as plt
N = 1000
x = np.linspace(0,10,N)
y = x + 20 * np.random.rand(N)
I want to bin the data for a given binsize (or binnumber). By that I basically just…

famfop
- 185
- 1
- 1
- 9
0
votes
1 answer
Sequence matcher in python based on priority sequence
I am trying to find closest match words from a list of stock name and I wan to put more priority to the word in front instead of word at back though the word at back may have more chars.
Eg.
"SG HOLDINGS" vs "S2 HOLDINGS"
sequence matcher will show…

Grace
- 1
0
votes
1 answer
Does SPSS adjust chi squared tests for weighted samples?
In SPSS, you can adjust summary statistics for stratified samples using
Weight by ..., and it allows you to then do a chi-squared test. I found a lot of examples of people doing a chi-squared like this, but nobody mentioning whether SPSS actually…

Ma Ba
- 148
- 9
0
votes
1 answer
r weighting complex tables - tabular
I have a series of tables created using the "tables" package in R, to allow for multiple variables, e.g.
##create sample data frame
x<-runif(1000, 0, 1)
x<-round(x,0)
y<-runif(1000, 0, 1)
y<-round(y,0)
z<-runif(1000, 1, 6)
z<-round(z,…

left_edge
- 23
- 5
0
votes
0 answers
Minimum Variance portfolio optimisation using NLOPTR
I am using SLSQP function in NLOPTR for portfolio construction using 34 low volatility stocks. The stocks are not important. What I am trying to do is being able to impose a minimum weight and a maximum weight to each stock.
The hin function,…

Nicholas Olds
- 1
- 3
0
votes
1 answer
Communicating with SAG105 METTLER TOLEDO using Cable LC-RS9 RS232 9 pin for IBM PCXT in VB.net
I'm trying to code in VB.net a SAG105 METTLER TOLEDO that is connected to a pc using the Cable LC-RS9 RS232 9 pin for IBM PCXT. I have researched on the internet but was unable to find a template code that can assist me to send data to the weighting…

Satvir Singh
- 61
- 4
- 16
0
votes
1 answer
Raking Weights on Nested Data: R Output Doesn't Match Stata Output
Introduction
I have multilevel survey data of teachers nested in schools. I have manually calculated design weights and non-response adjustment weights based on probability selection and response rate (oldwt below). Now I want to create…

coip
- 1,312
- 16
- 30
0
votes
1 answer
R function for weighting teams by strength of opponent?
I'm analyzing some sports data, and I have a set of win/loss records for about 40 teams. I would like to come up with a ranking where each win is weighted by the strength of the opponent. This would have to be some iterative/recursive sort of thing…

user3037237
- 385
- 2
- 11
0
votes
6 answers
weighted RNG speed problem in C++
Edit: to clarify, the problem is with the second algorithm.
I have a bit of C++ code that samples cards from a 52 card deck, which works just fine:
void sample_allcards(int table[5], int holes[], int players) {
int temp[5 + 2 * players];
…

ati
- 307
- 3
- 10
0
votes
1 answer
Weighting k Means Clustering by number of observations
I would like to cluster some data using k Means in R that looks as follows.
ADP NS CNTR PP2V EML PP1V ADDPS FB PP1D ADR ISV PP2D ADSEM SUMALL CONV
2 0 0 1 0 0 0 0 0 12 0 12 0 53 0
2 0 0 1 0 0 …

Simon Hayward
- 694
- 11
- 26
0
votes
1 answer
Bucketing numbers in an array
I have a list of numbers e.g 1-to 60, but not necessarily in increments of 1. E.g 1-40 in increments of 1, and 40-60 in increments of two.
I have another set of defined numbers (buckets) –e.g 2, 3, 5 , 10, 30, 50
I need to produce a two…

kkudi
- 1,625
- 4
- 25
- 47
0
votes
2 answers
Having weights shown as an unused argument in logistf R function
I kept getting a problem for the following code; "weights=weight" was shown as an unused argument. How should I solve the problem?
x_0 <- rbinom(1,100, 0.01)
x_1 <- rbinom(1,100, 0.1)
x <- c(0,0,1,1)
y <- c(0,1,0,1)
weight <- c(100-x_0, x_0,…

David Smith
- 5
- 2
0
votes
2 answers
Sorting a GridView based on weights in another database table
I have a GridView being populated from a non-SQL database that we use internally. One of those fields is a stockroom location. (Example: AAA, AAB, AAC, etc.)
In another database (SQL) I keep a list of all stockrooms and give them a weight. The…

Gary the Llama
- 321
- 1
- 4
- 15
0
votes
2 answers
classifying a weighted feature vector
I want to give weights to features of a data set before using the feature in any classification algorithm like KNN or J48, but i don't know how to evaluate a weighted feature vector.
dose any of the classification algorithms accept weights as input…

Manizheh Ghaemi
- 3
- 1
-1
votes
3 answers
Is there a correlate for Stata's 'cumul varx, gen(newvarx)' in R?
I received some example code and example data that's originally for use in Stata. I want to rewrite the code for use in R, which I'm more familiar with than Stata. The ultimate goal is to understand this code and be able to adapt it for application…

eliseabril
- 65
- 6