optimization_machine_probit_bush106.c

Similar documents
Xamoeba_xpowell_probit.c

Health Disparities (HD): It s just about comparing two groups

Panel Data 4: Fixed Effects vs Random Effects Models

schooling.log 7/5/2006

Bivariate (Simple) Regression Analysis

THE LINEAR PROBABILITY MODEL: USING LEAST SQUARES TO ESTIMATE A REGRESSION EQUATION WITH A DICHOTOMOUS DEPENDENT VARIABLE

. predict mod1. graph mod1 ed, connect(l) xlabel ylabel l1(model1 predicted income) b1(years of education)

texdoc 2.0 An update on creating LaTeX documents from within Stata Example 2

Creating LaTeX and HTML documents from within Stata using texdoc and webdoc. Example 2

Dr. Barbara Morgan Quantitative Methods

Linear regression Number of obs = 6,866 F(16, 326) = Prob > F = R-squared = Root MSE =

Computing Murphy Topel-corrected variances in a heckprobit model with endogeneity

Stata Training. AGRODEP Technical Note 08. April Manuel Barron and Pia Basurto

Introduction to STATA 6.0 ECONOMICS 626

ECON Introductory Econometrics Seminar 4

Page 1. Notes: MB allocated to data 2. Stata running in batch mode. . do 2-simpower-varests.do. . capture log close. .

Week 9: Modeling II. Marcelo Coca Perraillon. Health Services Research Methods I HSMP University of Colorado Anschutz Medical Campus

Programming MLE models in STATA 1

Week 4: Simple Linear Regression III

Missing Data Part II: Multiple Imputation Richard Williams, University of Notre Dame, Last revised January 24, 2015

Regression. Dr. G. Bharadwaja Kumar VIT Chennai

MODULE ONE, PART THREE: READING DATA INTO STATA, CREATING AND RECODING VARIABLES, AND ESTIMATING AND TESTING MODELS IN STATA

Missing Data Part II: Multiple Imputation & Maximum Likelihood

Stata versions 12 & 13 Week 4 Practice Problems

Linear Model Selection and Regularization. especially usefull in high dimensions p>>100.

Multiple-imputation analysis using Stata s mi command

Week 11: Interpretation plus

range: [1,20] units: 1 unique values: 20 missing.: 0/20 percentiles: 10% 25% 50% 75% 90%

Week 4: Simple Linear Regression II

Lab 2: OLS regression

An Introductory Guide to Stata

Logistic Regression. (Dichotomous predicted variable) Tim Frasier

Show how the LG-Syntax can be generated from a GUI model. Modify the LG-Equations to specify a different LC regression model

Instrumental variables, bootstrapping, and generalized linear models

Week 5: Multiple Linear Regression II

Introduction to Computing for Sociologists Neustadtl

Chapter 7 Heteroscedastic Tobit Model Code

Week 10: Heteroskedasticity II

Introduction to Bayesian Analysis in Stata

Package intreg. R topics documented: February 15, Version Date Title Interval Regression

run ld50 /* Plot the onserved proportions and the fitted curve */ DATA SETR1 SET SETR1 PROB=X1/(X1+X2) /* Use this to create graphs in Windows */ gopt

API-202 Empirical Methods II Spring 2004 A SHORT INTRODUCTION TO STATA 8.0

25 Working with categorical data and factor variables

Getting Started Using Stata

Heteroskedasticity and Homoskedasticity, and Homoskedasticity-Only Standard Errors

PubHlth 640 Intermediate Biostatistics Unit 2 - Regression and Correlation. Simple Linear Regression Software: Stata v 10.1

Dummy variables for categorical predictive attributes

Beta-Regression with SPSS Michael Smithson School of Psychology, The Australian National University

Robust Linear Regression (Passing- Bablok Median-Slope)

Chapter 10: Extensions to the GLM

Generalized ordered logit/partial proportional odds models for ordinal dependent variables

AcaStat User Manual. Version 8.3 for Mac and Windows. Copyright 2014, AcaStat Software. All rights Reserved.

Introduction to Hierarchical Linear Model. Hsueh-Sheng Wu CFDR Workshop Series January 30, 2017

Unit 5 Logistic Regression Practice Problems

Missing Data and Imputation

piecewise ginireg 1 Piecewise Gini Regressions in Stata Jan Ditzen 1 Shlomo Yitzhaki 2 September 8, 2017

Two-Stage Least Squares

Performing Cluster Bootstrapped Regressions in R

I Launching and Exiting Stata. Stata will ask you if you would like to check for updates. Update now or later, your choice.

Source:

Xamoeba_general.c. func is the user defined function being minimized/maximized;

Introduction to Stata Toy Program #1 Basic Descriptives

Statistical Analysis of List Experiments

Applied Multivariate Analysis

Exercise: Graphing and Least Squares Fitting in Quattro Pro

Statistical and Econometric Methods for Transportation Data Analysis

Multiple Imputation for Missing Data. Benjamin Cooper, MPH Public Health Data & Training Center Institute for Public Health

Lecture 3: The basic of programming- do file and macro

Review of Stata II AERC Training Workshop Nairobi, May 2002

SOCY7706: Longitudinal Data Analysis Instructor: Natasha Sarkisian. Panel Data Analysis: Fixed Effects Models

Getting Started Using Stata

Using Machine Learning to Optimize Storage Systems

Orange Juice data. Emanuele Taufer. 4/12/2018 Orange Juice data (1)

/* Parametric models: AFT modeling */ /* Data described in Chapter 3 of P. Allison, "Survival Analysis Using the SAS System." */

Introduction to Stata: An In-class Tutorial

Session 8. Statistical analysis Using Gauss Applications

HDs with 1-on-1 Matching

TYPES OF VARIABLES, STRUCTURE OF DATASETS, AND BASIC STATA LAYOUT

CH5: CORR & SIMPLE LINEAR REFRESSION =======================================

Moving Beyond Linearity

Stata Session 2. Tarjei Havnes. University of Oslo. Statistics Norway. ECON 4136, UiO, 2012

Fitting adjusted limited dependent variable mixture models to EQ-5D

Telephone Survey Response: Effects of Cell Phones in Landline Households

Centering and Interactions: The Training Data

May 24, Emil Coman 1 Yinghui Duan 2 Daren Anderson 3

Package RegressionFactory

xsmle - A Command to Estimate Spatial Panel Data Models in Stata

Introduction to Programming in Stata

An introduction to SPSS

Conditional and Unconditional Regression with No Measurement Error

STM103 Spring 2008 INTRODUCTION TO STATA 8.0

A QUICK INTRODUCTION TO STATA

Lecture 1: Statistical Reasoning 2. Lecture 1. Simple Regression, An Overview, and Simple Linear Regression

Factorial ANOVA. Skipping... Page 1 of 18

Ben Baumer Instructor

Coding Categorical Variables in Regression: Indicator or Dummy Variables. Professor George S. Easton

Missing Data Part 1: Overview, Traditional Methods Page 1

Zero-Inflated Poisson Regression

An Econometric Study: The Cost of Mobile Broadband

LIST OF TABLES. Page Title No.

Transcription:

optimization_machine_probit_bush106.c. probit ybush black00 south hispanic00 income owner00 dwnom1n dwnom2n Iteration 0: log likelihood = -299.27289 Iteration 1: log likelihood = -154.89847 Iteration 2: log likelihood = -134.46169 Iteration 3: log likelihood = -130.43351 Iteration 4: log likelihood = -130.12954 Iteration 5: log likelihood = -130.12789 Iteration 6: log likelihood = -130.12789 Probit regression Number of obs = 432 LR chi2(7) = 338.29 Prob > chi2 = 0.0000 Log likelihood = -130.12789 Pseudo R2 = 0.5652 ybush Coef. Std. Err. z P> z [95% Conf. Interval] black00 -.0285973.0097913-2.92 0.003 -.0477878 -.0094067 south.7695862.2545783 3.02 0.003.2706219 1.268551 hispanic00 -.0089458.0069163-1.29 0.196 -.0225015.0046099 income -.0241489.0126394-1.91 0.056 -.0489217.0006239 owner00.0235461.0143687 1.64 0.101 -.0046161.0517083 dwnom1n 2.761974.2619813 10.54 0.000 2.2485 3.275448 dwnom2n 1.136417.2339829 4.86 0.000.6778186 1.595015 _cons -.9697998 1.077738-0.90 0.368-3.082127 1.142528 double keithrules(double x[]) int i, j, k1, k0, l1, l0; double sum=0; double phi=0.0; double xphi=0.0; double sumsquared=0; k1=0; k0=0; for(i=0;i<nrowx;i++) sum=0.0; Kludge for Intercept Term sum=x[1]; sum=sum+x[i+j*nrowx]*x[j+2]; Note Change Here phi = (erf(fabs(sum)/sqrt(2.0)))/2.0 + 0.5; if(sum < 0.0)phi=1.0-xphi; 1

Voted for Bush if(y[i] == 1.0) l1=1; l0=0; k1=k1+1; Voted for Gore if(y[i]!= 1.0) l1=0; l0=1; k0=k0+1; sumsquared = sumsquared + log(1.0 - phi); printf("%lf\n",-sumsquared); return -sumsquared; 2

optimization_machine_logit_bush106.c. logit ybush black00 south hispanic00 income owner00 dwnom1n dwnom2n Iteration 0: log likelihood = -299.27289 Iteration 1: log likelihood = -158.05142 Iteration 2: log likelihood = -136.72201 Iteration 3: log likelihood = -131.48217 Iteration 4: log likelihood = -130.9258 Iteration 5: log likelihood = -130.9181 Iteration 6: log likelihood = -130.91809 Logistic regression Number of obs = 432 LR chi2(7) = 336.71 Prob > chi2 = 0.0000 Log likelihood = -130.91809 Pseudo R2 = 0.5625 ybush Coef. Std. Err. z P> z [95% Conf. Interval] black00 -.0464407.0172166-2.70 0.007 -.0801846 -.0126969 south 1.299006.4635389 2.80 0.005.3904866 2.207526 hispanic00 -.0151759.0117134-1.30 0.195 -.0381337.007782 income -.0447155.0224499-1.99 0.046 -.0887165 -.0007144 owner00.0451916.0258457 1.75 0.080 -.0054651.0958483 dwnom1n 4.839516.5025589 9.63 0.000 3.854518 5.824513 dwnom2n 1.98889.422375 4.71 0.000 1.16105 2.81673 _cons -1.941606 1.944121-1.00 0.318-5.752014 1.868802 double keithrules(double x[]) int i, j; double sum=0; double phi=0.0; double xphi=0.0; double sumsquared=0; k1=0; k0=0; for(i=0;i<nrowx;i++) Kludge for Intercept Term sum=x[1]; sum=sum+x[i+j*nrowx]*x[j+2]; Note Change Here Logit Setup phi=1.0/(1.0 + exp(-sum)); Voted for Bush if(y[i] == 1.0) 3

Voted for Gore if(y[i]!= 1.0) sumsquared = sumsquared + log(1.0 - phi); printf("%lf\n",-sumsquared); return -sumsquared; 4

junk_probit_2.c. summ Variable Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- partyid 1421 2.377903 2.06071 0 6 incomecat 1421 21.12386 7.76314 10 35 incomequint 1421 3.001407 1.415208 1 5 race 1421.1491907.3564018 0 1 sex 1421.5622801.4962807 0 1 -------------+-------------------------------------------------------- south 1421.3019001.4592438 0 1 education 1421 1.414497.7154538 1 3 age 1421 46.00774 16.05494 20 90 voted 1421 1.231527.9310102 0 3. oprobit partyid incomequint race sex south education age Iteration 0: log likelihood = -2633.5601 Iteration 1: log likelihood = -2494.5207 Iteration 2: log likelihood = -2494.0641 Iteration 3: log likelihood = -2494.0641 Ordered probit regression Number of obs = 1421 LR chi2(6) = 278.99 Prob > chi2 = 0.0000 Log likelihood = -2494.0641 Pseudo R2 = 0.0530 partyid Coef. Std. Err. z P> z [95% Conf. Interval] incomequint.0141518.0226314 0.63 0.532 -.0302049.0585086 race -1.130843.0903177-12.52 0.000-1.307862 -.9538234 sex.0239784.057164 0.42 0.675 -.088061.1360178 south -.3237482.0632066-5.12 0.000 -.4476307 -.1998656 education.232688.0417371 5.58 0.000.1508848.3144911 age.0032912.0018515 1.78 0.075 -.0003377.00692 /cut1 -.5671707.1471578 -.8555948 -.2787466 /cut2.2302907.1451673 -.054232.5148135 /cut3.4976995.1452729.2129699.7824291 /cut4.794375.146057.5081085 1.080642 /cut5 1.084038.14739.7951585 1.372917 /cut6 1.735149.1525477 1.436161 2.034137 Set up for Ordered Probit -- N-chotomous Probit double keithrules(double x[]) int i, j, jj; double sum=0; double phi=0.0; double erfarg; double xphi=0.0; double sumsquared=0; double *phicuts; double *phicutsmu; phicuts = (double *) malloc ((nkotp+1)*sizeof(double)); phicutsmu = (double *) malloc ((nkotp+1)*sizeof(double)); for(i=0;i<nrowx;i++) 5

/* Setup For Ordinary dichotomous Probit here * */ if(nkotp==2) /* 2-Choice Probit Uses an Intercept Term*/ sum=x[1]; sum=sum+x[i+j*nrowx]*x[j+2]; Note Change Here phi = (erf(fabs(sum)/sqrt(2.0)))/2.0 + 0.5; if(sum < 0.0)phi=1.0-xphi; Choice 1 if(y[i] == 1.0) Choice 0 if(y[i]!= 1.0) sumsquared = sumsquared + log(1.0 - phi); There is No intercept Term in ordered Probit -- the first ncolx entries in x[] -- x[1] to x[ncolx] -- are the coefficients on the independent variables if(nkotp > 2) phicutsmu[1] = -.5671707; phicutsmu[2] =.2302907; phicutsmu[3] =.4976995; phicutsmu[4] =.794375; phicutsmu[5] = 1.084038; phicutsmu[6] = 1.735149; sum=0.0; sum=sum+x[i+j*nrowx]*x[j+1]; Note Change Here In Ordered Probit y_hat is treated as the MEAN of the normal -- the cutpoints are treated like "x's" for(jj=1;jj<nkotp;jj++) /* Compute Probability from -oo to (cutpoint - Y_hat) * */ erfarg = (phicutsmu[jj]-sum); phi = (erf(fabs(erfarg)/sqrt(2.0)))/2.0 + 0.5; if(erfarg < 0.0)phi=1.0-xphi; phicuts[jj]=phi; phicuts[nkotp]=1.0; if(y[i] == 0)phi = phicuts[1]; 6

phicuts[(int)y[i]]; if(1 <= Y[i] <= nkotp-1)phi = phicuts[(int)y[i]+1]- printf("%lf\n",-sumsquared); free(phicuts); free(phicutsmu); return -sumsquared; 7