## Things I Love About Stata — egen mean

egen mean I work a lot with clustered data, including group psychotherapy data (people clustered in groups), individual psychotherapy data (people clustered within therapists), and longitudinal data (observations clustered within people). Consequently, I often need to create cluster-level means and grand means for graphing and modeling. The egen mean function makes creating means easy. CombiningContinue reading “Things I Love About Stata — egen mean”

## Stata: Using generate to create new variables

The primary method for creating new variables in Stata is the generate command. Load the auto dataset. New Variable from Existing Variables Let’s create a new variable that is the sum of weight and length (ignore for the moment that summing weights and lengths doesn’t make a ton of sense). The syntax of generate is:Continue reading “Stata: Using generate to create new variables”

## Beginning and Advanced SEM

This page provides Mplus input and output files, as well as data files, for the examples I use in the Structural Equation Modeling (SEM) workshop. I also provide a link for the lecture slides. The Mplus files and data are stored on GitHub. For any who are interested, feel free to clone the directory andContinue reading “Beginning and Advanced SEM”

## Stata: Predicted Scores and Residuals

Predicted Scores in Stata As we discussed in class, the predicted value of the outcome variable can be created using the regression model. For example, we can use the auto dataset from Stata to look at the relationship between miles per gallon and weight across various cars. We estimate the follow equation Thus, we seeContinue reading “Stata: Predicted Scores and Residuals”

## Resources for Power in SEM

References for Power in Structural Equation Modeling Kaplan, D. (1995). Statistical power in structural equation modeling. In R. H. Hoyle (Ed.), Structural Equation Modeling: Concepts, Issues, and Applications (pp. 100-117). Thousand Oaks, CA: Sage. Kaplan, D. & Wegner, R. N. (1993). Asymptotic independence and separability in covariance structure models: Implications for specification error, power, andContinue reading “Resources for Power in SEM”

## Stata: Dummy Coding

This post will illustrate how to: Use the generate and replace commands to create dummy variables. A second use of the generate command to create dummy variables that is simpler that #1. Using tabluate to create dummy variables. Dummy coding is used when you have nominal categories, meaning the groups are assigned a value forContinue reading “Stata: Dummy Coding”

## Stata: Labeling & Recoding Data

Labeling Data In order to assign labels to values of your variable, you can use either the variables manager or command syntax. For example, if you wanted to assign labels to each condition, where 1 represents No treatment, 2 represents Treatment A, 3 represents Treatment B, and 4 represents Treatment C, you could double-click onContinue reading “Stata: Labeling & Recoding Data”

## Stata: Do-files and Log-files

As you begin to work with datasets, there are two record and save your commands and actions in Stata. Creating do-files Do-files allow you to record all of your commands. There are a number of benefits to using do-files. By using do-files to run your commands, you have a copy of what you did, whichContinue reading “Stata: Do-files and Log-files”

## Stata: Reshaping Data

You will often have to reshape your data or change the name or values of your data to analyze it more easily. First, we’ll show you how to transform your data between “long” format, where there are multiple lines of data for every person, and “wide” format, where each subject has only one row andContinue reading “Stata: Reshaping Data”

## Stata: Planned Comparisons with the test command

This post will show you how to: Run a one-way ANOVA using an independent variable with four levels. Use planned comparisons to contrast levels of the independent variable. We will use the built-in dataset systolic. Examining the data We will treat the systolic variable as the outcome and drug as the independent variable. Let’s lookContinue reading “Stata: Planned Comparisons with the test command”

Loading…

Something went wrong. Please refresh the page and/or try again.

### Follow My Blog

Get new content delivered directly to your inbox.