Dear Statalist,
I am struggling to reassign records with a missing value on the categorical variable that assigns each record to a province. I would like to semi-randomly reassign those with a missing value to existing provinces based on the existing frequency within each province. Below I created an example where I had 20 records already assigned to each province, I am also reporting overall frequency for each province. I would like to reassign semi-randomly the three missing values considering the existing frequency for each province. I am using Stata 14 MP.
Thanks
clear
input float(province sex freq)
1 1 .15
1 1 .15
1 2 .15
2 1 .1
2 2 .1
3 2 .1
3 2 .1
4 2 .25
4 2 .25
4 1 .25
4 1 .25
4 1 .25
5 2 .1
5 1 .1
6 2 .1
6 1 .1
7 1 .05
8 1 .05
9 2 .1
9 2 .1
. 2 .
. 1 .
. 1 .
end
Related Posts with Reassigning records with missing values to existing categories considering the existing distribution within the population
Does the analysis of “the impact of cross-regional flows on income” require a hierarchical linear model?My thesis is the impact of labor cross-regional mobility on income. The explanatory variable “cross-…
how to examine the moderating effect and plot the figure when iv is categorical variable and moderator is continuous variableAfter the regression, how to plot the moderating effect of w on the relationship between x and y? Th…
replacing values using the loops commands in stataHi Everyone, I am trying to replace missings in the GHI varibale by using this command Code: repl…
Refering to a specific row with help of another variableDear statalist, this is a part of my dataset (the original has about 70000 rows): Code: * Examp…
Temporal decomposition - Function using data from 2 different rows of a tableI want to do a temporal decomposition using STATA. Assume the following data below where x= y*z y…
Subscribe to:
Post Comments (Atom)
0 Response to Reassigning records with missing values to existing categories considering the existing distribution within the population
Post a Comment