Questions tagged [weighting]
81 questions
0
votes
1 answer
Adding weights to dataftrame after ebalance
I am trying to add weights produced with the entropy balancing reweighting ebal package to a dataframe in order to use them thereafter in regression analysis with balanced samples.
The code that that I used for weighting is:
#…

user6530195
- 1
- 1
0
votes
0 answers
Covariate balance after weighting by the inverse of the propensity score
My analysis focuses on causal inference. I am using the inverse of the propensity scores to form weights (Propensity score is the probability of receiving a treatment (or intervention) given a set of covariates).
My question is, does anyone know how…

Aura
- 49
- 7
0
votes
0 answers
Is there a more efficient way to create weights in R?
I am trying to create weights for an analysis based on the number of distinct combinations of variable values in a dataset. I tried using the distinct() and count() functions but the order of the rows is disrupted (same with using rle(). The…

gecko
- 109
- 5
0
votes
1 answer
Android ImageViews not working correctly when weighted
This piece of XML will correctly display a button which covers the entire row then 2 buttons which are weighted evenly and share 50% of the space like so:
__________________________
|________________________|
|| ButtonA …

Dororo
- 3,420
- 2
- 30
- 46
0
votes
0 answers
Marginal structrual model: how to incorporate time-varying treatment and condition on past treatment
This is my first post in stackoverflow. I've tried to ask the question according to the guidelines.
I am currently working on a marginal structural model. I've read most of the articles by Hernan on this topic and worked through his book What if and…

Schulthe
- 1
0
votes
1 answer
How do I calculate equal weighted portfolio returns with NA using PerformanceAnalytics?
I am struggling to calculate equal weighted portfolio returns. I am currently using Return.portfolio from the PerformanceAnalytics package and I encounter problems when dealing with NAs.
To give a reproduceable example:
structure(c(5.49295774647889,…

atairsaw
- 15
- 4
0
votes
1 answer
anesrake error: "no variables are off by more than ____" when they are
I need to weight the observations in a sample based on the marginal distributions of four demographic characteristics from a broader population. I'm currently using the package anesrake to do so.
The population info is stored in targets. This is a…

J.Q
- 971
- 1
- 14
- 29
0
votes
1 answer
Include survey weighting variable
I am working with survey data in Python.
There is a weighting variable based on age, gender and region which should be included in the calculations (to make the data representative of the population).
The weighting variable is a simple decimal…

Florian Seliger
- 421
- 4
- 16
0
votes
2 answers
An alternative to arithmetic mean for scores/ratings
The arithmetic mean or average is easy to implement since it's often integrated as a function in most programming languages.
However, it's not really appropriate for ratings as several 5 out of 10s would "drag" down the average whereas a single…

James P.
- 19,313
- 27
- 97
- 155
0
votes
2 answers
Applying a weighting variable to an entire survey dataset in R
I have a large dataset from a survey. I already have a column/variable that is a weight that should be applied to the whole data set. This is simply achieved by in SPSS, but I would like to do this in R as well. What I already know is how to apply…

cam417
- 13
- 1
- 6
0
votes
1 answer
Applying a population total variable in R?
I have a weighting variable that I'd like to apply to my dataset so that I have weighted totals. In SPSS, this is straightforward enough. However, in R, I've been multiplying the variable by the weight variable to create a new variable as shown in…

John Wildman
- 81
- 5
0
votes
1 answer
Missing levels when weightig (raking) data using ANESRake
I have a survey data set and some quotes:
The population quotes are:
(1 = up to 29 years 0,00%)
2 = 30 to 39 years 18,10%
3 = 40 to 49 years 28,77%
4 = 50 to 59 years 33,11%
5 = 60 and more years 20,01%
In the data set, I have to weight…

Banjo
- 1,191
- 1
- 11
- 28
0
votes
1 answer
Cannot fit function in R
I wanted to make a quick test:
Create a function having lots of points. Add some random noise to the data.
For every n points, calculate the mean and sd.
Display the new ("blocked") data using error bars (which are something like…
user9949797
0
votes
0 answers
Weighting using predict function
I have used 'predict' find a fit line for a linear model(lm) I have created. Because the lm was built on only 2 data points and needs to have a positive slope, I have forced it to go thru the origin (0,0). I have also weighted the function by the…

Lumi
- 13
- 5
0
votes
0 answers
weighting methodology. 0 sample cell merging
Input DataFrame looks like
enter image description here
In the above case, i need to write a code saying If we have cell with sample 0, then merge it with immediate above cell, and divide the universe and allot the weight accordingly.
Final Weights…

Srikanth Ayithy
- 99
- 9