Discussion: View Thread

Repeated Injections in an Anatomical Site

  • 1.  Repeated Injections in an Anatomical Site

    Posted 07-05-2014 16:02

    I have seen people post analysis questions to this forum and receive awesome feedback.  I am hoping to get some direction myself now...  J I am working on a project that looks at anatomical site where injections are received.  Each case/patient has 1 to 800+ injections.  We are interested in looking for "sequences" of 5 or more injections in the same site, e.g. 10 injections in a row in the left arm.  The data came to me in a "long" layout and I have transposed it to a "wide" layout with one row for each case with a variable/column for each injection.  I am a little bit more familiar with the type of code required for this in SAS, but currently only have access to SPSS.  I have been working with index variables and do-loops to attempt to do this, but am feeling rather stumped...  I don't think the code I have is even fit to share...  Thanks in advance for any suggestions for resources, references, or coding. 

     

    Thank you!

    Alicia


    -------------------------------------------
    Alicia Hansen, MS
    Statistical Consultant
    -------------------------------------------


  • 2.  RE: Repeated Injections in an Anatomical Site

    Posted 07-05-2014 21:21
    Hello Alicia,

    It sounds like you have a data management issue, but, though you have not mentioned it, you probably have a statistical question, too. I think that it would help all of us to help you if we could hear more about what you are trying to do. What question or hypothesis are you trying to address? It would also help if you describe how the data were collected. Who or what population is being sampled? How do people get into your database? Also, kindly be more specific about your wide and long layouts. We might guess correctly, but the definitive answer from you would be helpful.

    Since you are our client, we asking the client, "tell us more about this interesting problem." It does sound unique. My goodness! 800 injections! Wow! I am intrigued! I don't know that I will be the person to give the answers to you, but whomever it is will want to know more about this. 

    And, indeed, this forum has seen very kind and helpful responses from the participants. 

    Best wishes,

    Nayak




    -------------------------------------------
    Nayak Polissar
    Principal Statistician
    The Mountain-Whisper-Light Statistics
    -------------------------------------------




  • 3.  RE: Repeated Injections in an Anatomical Site

    Posted 07-07-2014 20:41

    Dear Nayak,

    Thanks for your response.  You are correct that right now I have a data management issue.  I believe that eventually I will have a statistical question, but we are still basically "exploring" the data. At this point, I am not even sure what I want to ask.  J  The interest is in the physical issues that can be caused by repeated injections in one site.  The data is for people receiving health care treatment and specific medications.  The longer the treatment, the more injections...  The "long" layout has a row for each injection.  The "wide" layout has a record for each patient.

    I have received some great feedback to my question.  It is wonderful to be part of a professional community that is willing to help each other.

    Have a great day!

    Thanks,
    Alicia


    -------------------------------------------
    Alicia Hansen, MS
    Statistical Consultant
    -------------------------------------------




  • 4.  RE: Repeated Injections in an Anatomical Site

    Posted 07-08-2014 00:05
    Looking for lengths of runs of the same hand reminds me of the statistical analyses of "hot hands"/streakiness
    in sports.  You might want to take a look at some of the work in that area to get some ideas of what might be
    of interest as variables:

    http://www.stat.berkeley.edu/~aldous/157/Papers/albert_streaky.pdf
    http://www.nessis.org/presentations/albert.pdf
    http://stat.duke.edu/courses/Spring12/sta10.1/Labs/lab8.pdf
    http://statgames.ucr.edu/streakybaseball/statistics.html
    http://www.amstat.org/publications/jse/v15n3/datasets.adolph.html

    http://en.wikipedia.org/wiki/Wald%E2%80%93Wolfowitz_runs_test
    http://en.wikipedia.org/wiki/Turning_point_test
    http://en.wikipedia.org/wiki/Ljung%E2%80%93Box_test
    http://homepages.ulb.ac.be/~dpaindav/stuff/Articles/Article28/runs.pdf

    And while I'm here, I'll third the suggestion for learning a scripting language like Python (or, for old-fashioned
    types like me, Perl) for data cleaning, reformatting, and recoding quickly.  R can also do a lot of this, if you're
    already using it.

    http://stackoverflow.com/questions/16940276/maximum-and-mean-lengths-of-streaks-runs-of-identical-responses
    http://stackoverflow.com/questions/18669123/calculate-run-length-sequence-and-maximum-by-subject-id

    -------------------------------------------
    Katherine Godfrey
    -------------------------------------------




  • 5.  RE: Repeated Injections in an Anatomical Site

    Posted 07-08-2014 00:43
    Does anyone use/remember the scripting language Awk?  I used it a lot (and liked it) while I was at Bell Labs, but never since (as far as I know it was only a Unix tool).  I was just wondering if it is still something useful to recommend to someone.

    -------------------------------------------
    [Daniel] [Jeske]
    [Professor and Chair]
    [Department of Statistics]
    [University of California - Riverside]
    -------------------------------------------




  • 6.  RE: Repeated Injections in an Anatomical Site

    Posted 07-08-2014 08:57
    unix tools, including awk under the gawk, are available using the Cygwin system. This ports unix tools to windows environments.

    -------------------------------------------
    Paul Thompson
    Director, Methodology and Data Analysis Center
    Sanford Research/USD
    -------------------------------------------




  • 7.  RE: Repeated Injections in an Anatomical Site

    Posted 07-08-2014 11:14
    If you're a Windows-using fan of UNIX tools in general, I also recommend Cygwin.

    If you just want awk, there's also a standalone GNU version (gawk, naturally).
    Cygwin has both awk and gawk, as well as sed.

    http://www.drdobbs.com/open-source/gnu-awk-this-is-not-your-fathers-awk/240158351

    To answer the OP's question, I haven't used sed or awk outside of shell scripts in years.
    My sense is that PC Windows users either used .bat files or Perl one-liners to do the
    sorts of things that sed and awk one-liners were used for.

    -------------------------------------------
    Katherine Godfrey
    -------------------------------------------




  • 8.  RE: Repeated Injections in an Anatomical Site

    Posted 07-08-2014 11:13
    Thanks, Katherine.  What an interesting idea!  I'll take a look at the links you sent.  I have just started using R a little, but have a lot to learn.  I would like to learn both R and Python.

    -------------------------------------------
    Alicia Hansen, MS
    Statistical Consultant
    -------------------------------------------




  • 9.  RE: Repeated Injections in an Anatomical Site

    Posted 07-06-2014 12:57
    Actually, the long format might be better. Sort by the subject id and the date/time of the injection. Use the lag function to indicate when the injection site changes or the id changes. Then create a cumulative sum of that indicator variable. That cumulative sum will be constant during stretches in which the injection site does not change. Tabulate the cumulative sum and note which values are 5 or greater. These are the sites you want. You might have to do more, but this should get you started.

    If you like, you might consider using Python within SPSS to get the job done. I have never used Python, but it sounds like it has all the tools that you need to make complex data manipulations simple.

    -------------------------------------------
    Stephen Simon
    Independent Statistical Consultant
    P. Mean Consulting
    -------------------------------------------




  • 10.  RE: Repeated Injections in an Anatomical Site

    Posted 07-06-2014 13:23
    I really like Stephen's suggestions regarding data management. As for analysis you have a bunch of options though I would stick with trying to fit a model to the data. Your broad options are Count Regression models, OLS, or logistic regression. All depending on the distribution of your data. Cutting things off at 5 sticks or more and fitting the logit model is a quick and easy start. It is also kind of dirty and the effects that shake out of that are usually the ones with a strong signal. Good for clinicians though, the effects may not be linear but more threshold in nature. People who have this are more associated with high sticks. If a normal assumption is reasonable (prob not) you will find OLS a surprisingly nice fit. Most likely you want to rely on count regression models (Poisson or Neg Binomial). SPSS fits these in the Generalized Linear Models function but make sure you self select the distribution stuff. Especially for the NB because SPSS default is to force the over dispersion parameter to be 1 which is ludicrous. If you are studying counts around 5 but observations go up to 800 then you really do have some potential dist issues. If most of your data are zeroes then zero models are a good choice (not in SPSS though). More likely you may want to self truncate the data for a truncated type fit. Again the big concern here is that those handful of individuals will drive all the analysis. If you and the clinicians can agree on some clinically reasonable cutoffs then you could bin the counts into ordinal groups and fit an ordinal regression model which SPSS does well. SPSS seems better developed for logit models than count models. Hope this helps. ------------------------------------------- Jason Brinkley East Carolina University -------------------------------------------


  • 11.  RE: Repeated Injections in an Anatomical Site

    Posted 07-07-2014 12:51
    Thank you so much for the feedback, Jason.  At this point, we are basically "exploring" the data to see if there is any evidence to support a lack of site rotation.  Modeling will likely be the next step, so I appreciate your suggestions.  I will be speaking with the researcher to see where we will go from here.  Have a great day!

    Thank you!
    Alicia

    -------------------------------------------
    Alicia Hansen, MS
    Statistical Consultant
    -------------------------------------------




  • 12.  RE: Repeated Injections in an Anatomical Site

    Posted 07-06-2014 13:32
    I am learning Python this weekend. It has a lot of stuff. The book "Python in 24 hours" can teach you basic stuff quickly. As per usual with open source projects, its a massive massive monument. Like the Borg in Star Trek, such projects are massive, overwhelming, and impenetrable to the outsider. They seem to have many capabilities, however. I am trying not to be assimilated.

    -------------------------------------------
    Paul Thompson
    Director, Methodology and Data Analysis Center
    Sanford Research/USD
    -------------------------------------------




  • 13.  RE: Repeated Injections in an Anatomical Site

    Posted 07-07-2014 12:46
    Thank you for the feedback, Paul.  I have been thinking of learning Python, but wasn't sure where to start...  It is a massive project...  I will check out the book you mentioned.  Good luck in avoiding assimilation!

    Thanks!
    Alicia

    -------------------------------------------
    Alicia Hansen, MS
    Statistical Consultant
    -------------------------------------------




  • 14.  RE: Repeated Injections in an Anatomical Site

    Posted 07-07-2014 12:43
    Thanks so much for the feedback, Stephen.  I hadn't thought to use the "long" layout, but will look into lag variables.  I have been considering learning Python, so maybe I will check out that approach too.

    Thank you!
    Alicia

    -------------------------------------------
    Alicia Hansen, MS
    Statistical Consultant
    -------------------------------------------