Code:
version 16
cls
webuse nlswork, clear
gen prop_wks_work = wks_work / (wks_work + wks_ue)
label variable prop_wks_work "Proportion of weeks worked last year"
assert 0<=prop_wks_work & prop_wks_work<=1 if !missing(prop_wks_work) // The dependent variable takes values between zero and one.
regress prop_wks_work age grade, vce(cluster idcode)
quietly duplicates report idcode if e(sample)==1 // Store number of unique values of "idcode" in the sample.
assert `e(N_clust)'==`r(unique_value)' // Number of clusters is equal to the number of unique values.
fracreg logit prop_wks_work age grade, vce(cluster idcode)
quietly duplicates report idcode if e(sample)==1
display `e(N_clust)'
display `r(unique_value)'
0 Response to Number of clusters in fracreg
Post a Comment