Probit and Logit Models in SAS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello this video would be about profit and logic models in SAS how to do these with the SAS software so I have already opened the SAS program and here is my sass file with the program and I have already executed the program and these are the results here just a save time so let's go ahead and get started the first thing that you need to do is reading the data using proc import and I'm gonna call my new data set data and here's where my data is located on my hard drive and the file that we will use today is called profit underscore insurance dot CSV so when you use this program you can change this line right here with the exact location and the name for your file and then the rest of the program you will modify accordingly so let's go ahead and the first thing to do is look at the data here's the data already read in and in is for insurance and if I scroll down you can see 0 and once this would be our dependent variable for the profit and logit models and then we have a whole number of independent variables right here that we will use in the analysis as well ok so going back to the program we're going to summarize the data with proc means data and you read the file name and for variables I put my Y variable here and then all my X variables here and so if you highlight and execute using submit for this line this is the output that you're going to see and you can see we have three thousand two hundred six observations in the data in the mean the proportion of people with in Shirin 6.38 and these are the means for the rest of the variables next thing that we can do is proc for frequency calculating the frequencies you read data and then use the command tables and you put the independent your dependent variable here insurance and here's the result we see frequencies and the percent frequencies so basically we have 38 percent of people have insurance and that number is exactly this number up here if you can see that so the next thing we're going to do a plane oil-less or linear regression model to do that we use proc reg we read the data file and use model you put here the the name of your dependent variable and then independent variables and when you execute basically this line of code using submit these would be the results that you get right here so you have the regression procedure you see right here on top and then you have the different estimates here you have the intercept the coefficient on the retire age and so on we already discussed that that using a linear model when you have a binary dependent variable is not a good thing so I'm going to show you how to use the logit model you can use a preclude it exceeded evils and you put the name of your data file one thing that's really bizarre here is that you need to put the word descending why because otherwise SAS models the probability of y equals 0 and we typically don't think that way as economists so basically all your signs are going to be flipped and now your conclusions are going to be wrong if you forget this work right here descending so make sure you remember it then you have model you put again the name of the dependent variable and then you list all your independent variables and I have a few commands here the first one is and let me scroll down to the results here so here is the condition the the classification table that I have requested is the see table and one of the things that comes out of the see table is this number here for percent correct predictions 62.2% and you're also telling you that the predicted probabilities we're going to give it a cutoff point of cutoff value of 0.5 so for the output file we're going to output this as a file called L predicted from logit and predicted values like i gave this name and predicted because p logit these are going to be the predicted probabilities going into that file right here that would be generated okay so if i scroll back up these are the results for the logit model and you can see here basically the coefficients that I have copied and pasted and put into the table and again you can interpret these if people are retired they're more likely to have insurance make sure that you do not interpret the magnitude here of these coefficients or say if you have one more additional year they're again of schooling they're more likely to have insurance but you don't comment on the value okay so next thing that you do here is you can run also a logic model using proc Coulomb this procedure here and again you put the dependent independent variables and you put the the word discrete here for discrete distribution and the distribution would be equal to logit and one thing that we can get out of this procedure is with the output out equals and I call this M FX this will be an out put file that we're going to generate here with the marginal with the marginal effects so if I go in and run this procedure here then we're going to have this this file and if you look at the file and you open it and you scroll to get to the end you see that the marginal effects of each of these independent variables are already calculated and and put in the file for each of the observations so one thing that we're going to do here on the next one is to calculate the logic marginal effects by using proc means you reading this data file that I have created right from above and we're going to calculate the mean and the standard deviation for those and if you look at the proc means these are basically the means and the standard deviation for the marginal effects that you can now put in a table so basically if you look at these results now you can go ahead and interpret that say retired people are four percent more likely to have insurance and likewise you can say that for each additional year of schooling experience you're two percent more likely to have insurance so these are the results from right here to logit marginal effects another thing that you can do is also calculate the predicted probabilities and if you look up above here I have outputted a file called logit predictive ll predicted and if you look up this file you can basically see right here these are the estimated probabilities that you have at the end of this file and now these probabilities would be summarized into p logits for the estimated probability and you can see that on average we have 38% prediction the people with heavy insurance and that's exactly or very close to the number of the sample frequency of 38 percent having having health insurance okay so this is up to here we summarized the marginal effects of the predicted probabilities so now we're going to repeat the same thing with the profit model so you can use the prop logistic everything else is the same except that you need to put your link equals profit in order for it to calculate the profit model and you can see here that's the logistic procedure that I ran and here you have the model is the binary profit model again don't forget the word descending that's very important because otherwise all the signs are gonna be messed up okay so here are the results that you copy and paste back into the table and again you interpret that if people are retired they're more likely to have insurance notice that this coefficient is different from the one in the logit model which is 0.9 teen but again it doesn't mean the effects are different magnitude because you cannot interpret the coefficients okay so next thing oh that's that's the classification table again for the percent correctly predicted that you can pick up you can pick up from here okay next thing that we can do here is you can estimate a profit model with a proc Coulomb and you can again output the marginal marginal effects in an M effects file I guess I'm overwriting my previous file from the logit models and use the marginal command here to make sure that SAS is calculating the marginal effects and then you basically summarize them with proc means and you want the mean in the standard deviation of these and these are the marginal effects right here and if you look at them they're now very similar to the ones coming from the logit model okay so regardless of the fact that the coefficients were different the margin effects are very similar with the two models so same thing I'm doing here with the predicted probabilities I am generating this file called P profit for the predicted probabilities for the profit model actually that's coming from right here and so you're summarizing just by getting the means and again we have very good prediction on average coming from the profit model okay the final thing that we're going to do here is you can use proc profit to estimate a profit model and then the commands are a little bit different after you you read in the data you use class insurance so basically that's the dependent variable you need to put this in that procedure and then you have model this is the dependent variable and you list all the independent variables now notice this models the probability of y equals 0 so if you actually look at the results here that we have for the coefficients these would be negative which means that if you're retired you're less likely not to have insurance which is consistent with what we found before that you're more likely to have insurance okay so I think that's all I have for profit and logic models in state a in SAS and make sure that you also watch the video on how to interpret those results that we just have and how to write them up in papers thanks for watching
Info
Channel: econometricsacademy
Views: 16,688
Rating: 5 out of 5
Keywords: Logit models, Logistic regression, Probit models in SAS, Logit regression, Econometrics Sas, Logistic regression SAS, SAS, Logit models in SAS, SAS software, Probit regression, Probit models, Econometrics, Probit regression SAS, Econometrics Academy
Id: iy8nG8yIzCY
Channel Id: undefined
Length: 12min 56sec (776 seconds)
Published: Sun Jan 27 2013
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.