Announcement

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

  • Problems creating a single variable that represents the different conditions of my experiment

    Hi all,

    For my Master thesis, I used Qualtrics for an online experiment and within this experiment respondents are randomly distributed over two different treatment groups (condition 1 and condition 2).
    Now, I have separate variables in Stata for each condition of the experiment.
    Every respondent in condition 1, has missing values for the questions asked in condition 2 marked with (.).
    Likewise, every respondent that was in condition 2, has missing values for the questions asked in condition 1.

    Now I want to run tests to compare the data of my two groups but because of the missing values in both conditions I’m not able to do that.
    The problem is that I don’t know how to get rid of these missing values while creating a new variable that represents the different conditions of my experiment.

    I tried to find a solution on the internet and I also looked on this forum but I can’t find the solution that I’m looking for.
    I read something about first creating a binary variable for condition 1 and 2 with the command 'generate' and then combining the two binary variables into a new single variable but I don’t know if this is the right first step for my problem and I do not know which other commands I should use for my problem.

    I hope someone can help me with this because I don’t know where to start as this is my first time using Stata.
    I’m using Stata 16.1 on MacOS Catalina 10.15. I have 111 observations in my data set. Each condition has 4 variables with missing data.


    Thanks in advance!

  • #2
    Welcome to Statalist!

    If I understand correctly, Qualtrics determined if a respondent is condition 1 or 2, and based on that, the survey broke into two branches, and that's why half is always missing for each case, is that correct? If so, then we will need to know i) if those non-overlapping questions are conceptually the same question (e.g. both go through the same depression scale) or did they go through different questions, and ii) how the variable are named for any question in condition 1 versus its "copy" in condition 2.

    In short, without seeing the data sample it's difficult to give you any concrete help. If you can take a moment to read the FAQ (https://www.statalist.org/forums/for...ussion/general) and learn how to use -dataex- in Stata to extract a part of the data to post here, then we may be able to take a look.

    For the spirit of trying, let's say both conditions have a variable q17 (called q17_1 and q17_2 for conditions 1 and 2.) If they are the same, you can try to create a variable that adds up the two together. Here is a data example for demonstration:

    Code:
    clear
    input id q17_1 q17_2
    1 . 1
    2 2 .
    3 4 .
    4 . 2
    end
    
    egen q17 = rowtotal(q17_1 q17_2)
    list
    Results:
    Code:
         +--------------------------+
         | id   q17_1   q17_2   q17 |
         |--------------------------|
      1. |  1       .       1     1 |
      2. |  2       2       .     2 |
      3. |  3       4       .     4 |
      4. |  4       .       2     2 |
         +--------------------------+
    Last edited by Ken Chui; 26 May 2021, 06:48.

    Comment


    • #3
      Hi Ken,

      Yes you understand it correctly that Qualtrics determined if a respondent is condition 1 or 2, and based on that, the survey broke into two branches and that's why half is always missing for each case.

      To give an answer on your questions:
      i. Both conditions have the same questions and same scales, except one question is different for both conditions because this question is there to check if the manipulation has succeeded.
      ii.
      In condition, 1 I have the following variables:
      ApolManipulationCheck__
      ApolPostcrisisrep_overall
      ApolPostAng_1
      ApolPostCPI_

      In condition 2, I have the following variables:
      CompManipulationCheck_
      CompPostcrisis_overall
      CompPostAng_1
      CompPostCPI_1

      All variables have been converted from string into numeric.

      I tried the command 'egen' and I typed this in my do-file:

      egen Manipulationcheck_overall = rowtotal (ApolManipulationCheck__ CompManipulationCheck_)
      egen Postcrisisrep_overall = rowtotal (ApolPostcrisisrep_overall CompPostcrisis_overall)
      egen PostAng_overall = rowtotal (ApolPostAng_1 CompPostAng_1)
      egen PostCPI_overall = rowtotal (ApolPostCPI_ CompPostCPI_1)

      and I got rid of the missing values!

      Thank you very much for your help!!








      Comment

      Working...
      X