Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    So I want to be able to determine in which years did a county go from having zero FQHCs to at least 1 FQHC and identify the list of counties that did this.
    First, am I correct in assuming that the variable fqhc indicates the number of FQHCs the observation's county has in that year? If so, what do the missing values mean?

    Next, what exactly does this mean? Do you want to identify counties that started at 0 in their very first observation and ended up at 1 or more in their final observation? Or do you mean you want to identify counties that at some time had 0 and then at some later time had 1 or more? Or perhaps even something else?

    do I have to use the xi prefix for any of the analysis?
    Probably not. The -xi- prefix is close to obsolete and you should almost forget you ever knew it. It has been almost entirely replaced by factor variable notation. So if you want to run a regression with a categorical variable X, just use i.X in the regression command. No -xi:- needed for that. If you want an interaction between X and Z, use i.X##i.Z, again, no -xi:- needed. Read -help fvvarlist- for fuller information about factor variable notation. There do remain a few situations where -xi:- is needed, but they are limited to a) archaic commands that don't support factor variable notation but whose operations can be carried out with newer commands that do, or b) a few exotic situations that are uncommon (e.g. random slopes on categorical variables in a mixed effects model). So it is very unlikely you will need to use -xi- in this project, or, for that matter, ever again.

    Let me know if I should start a new topic for this question.
    It would have been better. But since you didn't, let's just wrap this one up with your responses to my questions and then a response to your response. The importance of starting new topics is that people come and search the Forum for answers to questions. The searches are based on keywords and titles. If the thread veers off topic, then people searching for something in line with the later direction of the thread won't be able to find it, and those who are searching for thing not in line with the later direction of the thread will be misdirected here. Going forward, start new topics when the subject of the question changes appreciably.

    Comment


    • #17
      Thank you so much Clyde for responding.
      First, am I correct in assuming that the variable fqhc indicates the number of FQHCs the observation's county has in that year? If so, what do the missing values mean
      Yes, the FQHC variable of 1 or more means that there is (or was) an FQHC in the county for that year. In running the analysis there is also zero reported in which the codebook is silent on but I assumed was no FQHC reported for those counties and for the ones missing - then it wasn't that they were no FQHCs but that the presence of an FQHC was not reported.


      Next, what exactly does this mean? Do you want to identify counties that started at 0 in their very first observation and ended up at 1 or more in their final observation? Or do you mean you want to identify counties that at some time had 0 and then at some later time had 1 or more? Or perhaps even something else?
      My thinking is that it would be helpful to determine which health centers went from 0 FQHCs at their very first observation and then went to 1...not necessary in their final observation or maybe, I have yet to determine. The thought was that I would be able to look the outcome variables of interest in the county prior to the FQHCs presence (pre-period) and then look at the period when they had at least 1 FQHC to measure change. Also I want to identify a few of those counties for analysis outside of dataset.

      I will start a new topic after I hear back from you. Thank you so much.

      Comment


      • #18
        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        *dataex md_pcnf15 md_pcnf14 year fqhc n_county
        clear
        input double(md_pcnf15 md_pcnf14) int(year fqhc) float n_county
         25  23    0 . 1
         25  23    5 . 1
         25  23    6 . 1
         25  23    7 . 1
         25  23    8 . 1
         25  23    9 . 1
         25  23   10 1 1
         25  23   11 2 1
         25  23   12 2 1
         25  23   13 2 1
         25  23   14 2 1
         25  23   15 2 1
         25  23   16 2 1
         25  23   17 2 1
         25  23   18 . 1
         25  23 2010 . 1
         25  23 2015 . 1
         25  23 2016 . 1
        148 148    0 . 2
        148 148    5 . 2
        148 148    6 . 2
        148 148    7 . 2
        148 148    8 . 2
        148 148    9 . 2
        148 148   10 3 2
        148 148   11 3 2
        148 148   12 3 2
        148 148   13 3 2
        148 148   14 3 2
        148 148   15 3 2
        148 148   16 3 2
        148 148   17 4 2
        148 148   18 . 2
        148 148 2010 . 2
        148 148 2015 . 2
        148 148 2016 . 2
         11  11    0 . 3
         11  11    5 . 3
         11  11    6 . 3
         11  11    7 . 3
         11  11    8 . 3
         11  11    9 . 3
         11  11   10 3 3
         11  11   11 3 3
         11  11   12 3 3
         11  11   13 3 3
         11  11   14 3 3
         11  11   15 3 3
         11  11   16 3 3
         11  11   17 3 3
         11  11   18 . 3
         11  11 2010 . 3
         11  11 2015 . 3
         11  11 2016 . 3
         12   9    0 . 4
         12   9    5 . 4
         12   9    6 . 4
         12   9    7 . 4
         12   9    8 . 4
         12   9    9 . 4
         12   9   10 1 4
         12   9   11 1 4
         12   9   12 1 4
         12   9   13 1 4
         12   9   14 1 4
         12   9   15 2 4
         12   9   16 2 4
         12   9   17 2 4
         12   9   18 . 4
         12   9 2010 . 4
         12   9 2015 . 4
         12   9 2016 . 4
         12  11    0 . 5
         12  11    5 . 5
         12  11    6 . 5
         12  11    7 . 5
         12  11    8 . 5
         12  11    9 . 5
         12  11   10 1 5
         12  11   11 1 5
         12  11   12 1 5
         12  11   13 1 5
         12  11   14 1 5
         12  11   15 1 5
         12  11   16 1 5
         12  11   17 1 5
         12  11   18 . 5
         12  11 2010 . 5
         12  11 2015 . 5
         12  11 2016 . 5
          3   3    0 . 6
          3   3    5 . 6
          3   3    6 . 6
          3   3    7 . 6
          3   3    8 . 6
          3   3    9 . 6
          3   3   10 1 6
          3   3   11 1 6
          3   3   12 1 6
          3   3   13 1 6
        end
        label values n_county n_county
        label def n_county 1 "Alabama Autauga", modify
        label def n_county 2 "Alabama Baldwin", modify
        label def n_county 3 "Alabama Barbour", modify
        label def n_county 4 "Alabama Bibb", modify
        label def n_county 5 "Alabama Blount", modify
        label def n_county 6 "Alabama Bullock", modify
        
        replace fqhc = 0 if missing(fqhc)
        by n_county (year), sort: egen ever_had_fqhc = max(fqhc > 0)
        by n_county (year): gen wanted = (fqhc[1] == 0 & ever_had_fqhc)
        Note: In this example data, all of the counties qualify: all start at 0 FQHCs and eventually get one. But the code should work correctly with counties that either start out with an FQHC or start at 0 and stay there.

        Comment


        • #19
          Thank you so much Clyde. I am assuming that the use of md_pcnf15 and md_pcnf14 is just as an example variable and not necessarily the use of the dataset in wide format?

          I used
          Code:
           
           replace fqhc = 0 if missing(fqhc) by n_county (year), sort: egen ever_had_fqhc = max(fqhc > 0) by n_county (year): gen wanted = (fqhc[1] == 0 & ever_had_fqhc)
          I understand the first part of the code to mean
          fqhc variable is categorized as 0 for when missing and or zero.
          - sort county by year and generate the variable "ever_had_fqhc" for the maximum value of 'fqhc' when greater than 1.
          The second part seems a bit confusing:
          Is it that generate the variable 'wanted" when the first value of 'fqhc' is zero and 'ever_had_fqhc' is at least 1.

          I am having a hard time understanding the second part, but in the analysis I understood it to provide me with the number of counties that went from zero to at least 1 FQHC over the time period in my data set.

          I got the following:

          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          dataex off_nfpcmd year fqhc n_county ever_had_fqhc wanted
          clear
          input double off_nfpcmd byte year int fqhc float(n_county ever_had_fqhc wanted)
           27 10 1  1 1 0
           29 11 2  1 1 0
           28 12 2  1 1 0
           28 13 2  1 1 0
           30 14 2  1 1 0
           30 15 2  1 1 0
           30 16 2  1 1 0
            . 17 2  1 1 0
            . 18 0  1 1 0
          309 10 3  2 1 0
          319 11 3  2 1 0
          322 12 3  2 1 0
          325 13 3  2 1 0
          333 14 3  2 1 0
          333 15 3  2 1 0
          334 16 3  2 1 0
            . 17 4  2 1 0
            . 18 0  2 1 0
           13 10 3  3 1 0
           13 11 3  3 1 0
           12 12 3  3 1 0
           11 13 3  3 1 0
           12 14 3  3 1 0
           12 15 3  3 1 0
           11 16 3  3 1 0
            . 17 3  3 1 0
            . 18 0  3 1 0
            4 10 1  4 1 0
            4 11 1  4 1 0
            5 12 1  4 1 0
            7 13 1  4 1 0
            8 14 1  4 1 0
           11 15 2  4 1 0
           10 16 2  4 1 0
            . 17 2  4 1 0
            . 18 0  4 1 0
           16 10 1  5 1 0
           14 11 1  5 1 0
           20 12 1  5 1 0
           20 13 1  5 1 0
           14 14 1  5 1 0
           15 15 1  5 1 0
           15 16 1  5 1 0
            . 17 1  5 1 0
            . 18 0  5 1 0
            7 10 1  6 1 0
            3 11 1  6 1 0
            4 12 1  6 1 0
            4 13 1  6 1 0
            2 14 1  6 1 0
            2 15 1  6 1 0
            2 16 1  6 1 0
            . 17 1  6 1 0
            . 18 0  6 1 0
           12 10 1  7 1 0
            9 11 1  7 1 0
            7 12 1  7 1 0
            9 13 1  7 1 0
           11 14 1  7 1 0
            8 15 1  7 1 0
            9 16 1  7 1 0
            . 17 1  7 1 0
            . 18 0  7 1 0
          177 10 2  8 1 0
          180 11 2  8 1 0
          175 12 2  8 1 0
          174 13 2  8 1 0
          172 14 3  8 1 0
          173 15 3  8 1 0
          171 16 3  8 1 0
            . 17 3  8 1 0
            . 18 0  8 1 0
           22 10 1  9 1 0
           23 11 1  9 1 0
           24 12 1  9 1 0
           25 13 1  9 1 0
           26 14 1  9 1 0
           25 15 1  9 1 0
           27 16 1  9 1 0
            . 17 2  9 1 0
            . 18 0  9 1 0
            8 10 0 10 1 1
            7 11 1 10 1 1
            8 12 1 10 1 1
            7 13 1 10 1 1
            8 14 1 10 1 1
           11 15 1 10 1 1
           10 16 1 10 1 1
            . 17 1 10 1 1
            . 18 0 10 1 1
           11 10 0 11 1 1
           10 11 1 11 1 1
           10 12 1 11 1 1
           11 13 1 11 1 1
           12 14 1 11 1 1
           14 15 2 11 1 1
           14 16 2 11 1 1
            . 17 2 11 1 1
            . 18 0 11 1 1
            5 10 1 12 1 0
          end
          label values n_county n_county
          label def n_county 1 "Alabama Autauga", modify
          label def n_county 2 "Alabama Baldwin", modify
          label def n_county 3 "Alabama Barbour", modify
          label def n_county 4 "Alabama Bibb", modify
          label def n_county 5 "Alabama Blount", modify
          label def n_county 6 "Alabama Bullock", modify
          label def n_county 7 "Alabama Butler", modify
          label def n_county 8 "Alabama Calhoun", modify
          label def n_county 9 "Alabama Chambers", modify
          label def n_county 10 "Alabama Cherokee", modify
          label def n_county 11 "Alabama Chilton", modify
          label def n_county 12 "Alabama Choctaw", modify
          I plan to start a new thread if I have a follow up. I will link this thread for users to refer too.

          Thank you in advance

          Comment


          • #20
            I am assuming that the use of md_pcnf15 and md_pcnf14 is just as an example variable and not necessarily the use of the dataset in wide format?
            Yes, that's right. I just pulled one of the example data sets from earlier in the thread. The only relevant variables for present purposes are n_county, year, and fqhc.

            - sort county by year and generate the variable "ever_had_fqhc" for the maximum value of 'fqhc' when greater than 1.
            Not exactly. The expression fqhc > 1 in that line of code is not a condition on its application. It is a logical expression. It is an expression that, in any observation, is either true or false. In Stata (and many other programming languages) logical expressions are evaluated numerically as 1 for true and 0 for false. So this line of code determines at each observation for a given n_county, whether or not fqhc > 1 in that observation and calls it 1 if it is, and 0 if not. Then it goes back and says, of all those values of 0 and 1, what is the largest. If any of those values is 1, then that will be the largest value (since 0 and 1 are the only possibilities). If none of those values is 1, then they are all 0, and the largest is 0. So, if there is any observation where fqhc > 1, then we get 1 for the value of ever_had_fqhc, and if there aren't any where fqhc > 1 we get 0 for the value of ever_had_fqhc. So, putting all of that together, the value of ever_had_fqhc will be 1 for all observations of any n_county that has had 1 or more fqhc's at any point in time in the data, and 0 for all observations of any n_county that never has any fqhc's.

            Is it that generate the variable 'wanted" when the first value of 'fqhc' is zero and 'ever_had_fqhc' is at least 1.
            Yes. Let's think about what that means. The data are sorted by year within n_county, so the first observation corresponds to the earliest year in the data. So the first value of fqhc = 0 means that the county started out with no FQHC. Then, as we've already figured out, ever_had_fqhc will be 1 if and only if at some point in time, the county did have at least 1 FQHC. So, wanted will be 1 for any county that started out with no FQHC but at some point in time did get one (or more). And it will be 0 in the other circumstances, i.e. if it either started out with at least 1 FQHC, or it started out with none and never got one later. And that is what you said you were looking for in #17.

            Comment


            • #21
              Thank you so much Clyde Schechter. I will be starting a new thread that expands on the new topic I introduced. Thank you,

              Comment

              Working...
              X