Say that you want to look at the relationship between how much a child talks on the phone and the age of the child. You get a random sample of…
Read More
Search Results for: what stat should i use
How can I extract a portion of a string variable using regular expressions? | Stata FAQ
String processing is fairly easy in Stata because of the many built-in string functions. Among these string functions are three functions that are related to regular expressions, regexm for matching,…
Read More
How can I estimate relative risk using glm for common outcomes in cohort studies? | Stata FAQ
Credits This page was developed and written by Karla Lindquist, Senior Statistician in the Division of Geriatrics at UCSF. We are very grateful to Karla for taking the time to…
Read More
How can I get an R2 with robust regression (rreg)? | Stata FAQ
Some Stata users have found that there are values of e(r2) and e(r2_a) after running the rreg. You can see it in the example below using the crime dataset. We…
Read More
How can I draw a random sample of my data? | Stata FAQ
There are many instances when you may want to take a random sample of your dataset. For example, you may have a very large data set, and you are trying…
Read More
How do I document and search a Stata dataset? | Stata FAQ
When going through data management steps in Stata, there are several documentation features available that allow you to attach information to the dataset. This approach to documenting allows you to…
Read More
What are the saturated and baseline models in sem? | Stata FAQ
Below is the diagram of a simple structural equation model. The dependent variable is a latent variable Acad with three observed indicators, math, science and socst. There are two additional…
Read More
How can I do tests of simple main effects in Stata? | Stata FAQ
Stata does not have a built-in command to do tests of simple main effects, however ATS has developed a program that will perform them. You can you can the sme…
Read More
How to Separate a Stata Single File into Multiple Data files for Analysis in HLM Software? | Stata FAQ
For a 2-level hierarchical model, HLM requires two files for a 2-level model, one for level-1 and one for level-2. Similarly, for a 3-level hierarchical model, HLM requires three data…
Read More
How can I detect duplicate observations? | Stata FAQ
This Stata FAQ shows how to check if a dataset has duplicate observations. There are two methods available for this task. The first example will use commands available in base…
Read More
