I have a multiple cross-sectional dataset, where I am trying to create the following index:
Dit = (Sum all dit until k)/Kt
In other words, sum the values for all d variables and then divide by the number d variables for that year.
In my dataset, i have 4 variables that i need to look at but for some years only three or two are present so to calculate my index I don't want to just include individuals that had all four. I don't want them to be treated as missing. Instead, i want the aggregated variables to be divided by say 3 instead of 4 if only 3 variables are present. How do i go about creating this Kt?
My four variables are: racmar, racpeers, racpres and racseg. They are byte variables (not string) and are non binary.
Related Posts with How to count the number of relevant variables present for an individual
kappaetc / Krippendorff's alpha with missing values and across multiple variablesMy research team coded/classified a large set of documents. I took a random subset of 1000 from the …
Contrast tablesHi all, New Statalist user here with a simple question (I'm a long time Stata user who is trying to…
Panel data: Creating a bilateral dataset with countries and years (replicating the dataset for each panel)Hi everyone, I have a panel dataset of exchange rate with 200 countries and 16 years, please find b…
Balance an unbalanced datasetHi all, I have a strongly unbalanced dataset of countries observed by year. I would like to balance…
Estimating risk difference for binary outcome in cluster RCTI am analysing data from a cluster RCT looking at the effect of an intervention (int) in health cent…
Subscribe to:
Post Comments (Atom)
0 Response to How to count the number of relevant variables present for an individual
Post a Comment