This example uses the hsb2 data file to illustrate how to visualize a logistic model with a continuous variable by continuous variable interaction. Variable y is the dependent variable and…
Read More
Search Results for: stata
Graphing predicted probabilities with an interaction of a binary variable and a continuous variable | Stata Code Fragments
This example uses the hsb2 data file to illustrate how to graph predicted probabilities based on a logistic regression model with an interaction of a binary variable with a continuous…
Read More
Graphing predicted probabilities with two interaction terms | Stata Code Fragments
This example uses the hsb2 data file to illustrate how to graph predicted probabilities against a predictor variable with two interaction terms. use https://stats.idre.ucla.edu/stat/stata/notes/hsb2, clear gen hon = (write>60) xi:…
Read More
Reading and Analyzing the Hospital Doctor Patient Dataset | Stata Code Fragments
You can read the Hospital Doctor Patient Dataset into Stata and run many linear and generalized linear mixed effects models into Stata using this code. The output is not included,…
Read More
A code fragment for combining a histogram and boxplot in one graph | Stata Code Fragments
This page presents a code fragment for producing a graph combining a histogram with a boxplot. There is also a Stata FAQ page on the histbox ado program. use hsb2,…
Read More
Making many boxplots in one graph | Stata Code Fragments
* lets make a data file with one Y variable and 4 yes/no variables use hsb2, clear gen q1 = female gen q2 = ses == 1 gen q3 =…
Read More
“Why don’t my regression coefficients make sense?” (signs of model misspecification) | Stata Code Fragments
If your regression coefficients do not seem to make sense, it is quite possible your model is misspecified. For example, it is possible to see the direction of one predictor’s…
Read More
Using ml commands to maximize a user specified likelihood function | Stata Code Fragments
* This code produces an ordered logit model for a y variable with 3 levels. * First write what Stata calls the evaluator program myologit version 9 args lnf xb…
Read More
Manually generate predicted probabilities from a multinomial logistic regression in Stata | Stata Code Fragments
Occasionally, there might be a need for generating the predicted probabilities manually from a multinomial logistic regression. The code below generates the predicted probabilities using a little bit of matrix…
Read More
Choosing between nonnested models | Stata Code Fragments
The example here is taken from Chapter 7 of Greene’s Econometric Analysis, Fourth Edition. clear input year y c 1950 791.8 733.2 1951 819.0 748.7 1952 844.3 771.4 1953 880.0…
Read More
