

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


*** Lecture 14: Logit Modeling and Introduction to Principal Components Factor Analysis
clear set mem 60m set matsize 400 use “your file pathway here”
generate c4_35_rec=(-1*c4_35_wr)+ table c4_35_rec
generate riskindx=(c4_34_im + c4_35_rec + c4_36_ok + c4_37_ac)/ summarize riskindx
gen DR_cert=c4_29_ce gen GCC_cert=c4_32_ct
gen ideology=c4_1_ide
gen sex=c5_4_gen
generate DR_correct = c4_28_ra recode DR_correct (2=0) (1=.) (3=1) (4=.)
tabulate DR_correct
generate DR_standard = c4_30_pb recode DR_standard (2=0) (1=.) (3=1) (4=.) tabulate DR_standard if DR_correct==
logit DR_standard DR_cert ideology sex if DR_correct==
lstat
Illustrating variable effects is best done by generating a "conditional effects plot".
For this illustration, we'll set all other independent variables at their mean, and estimate
the effect of certainty as it ranges from zero to ten.
first, calculate the mean values for ideology and sex (when DR_correct==0)
sum ideology if DR_correct== sum sex if DR_correct== sum DR_cert if DR_correct==
generate L1= _b[_cons] + _b[ideology]3.612639 + _b[sex].8472325 + _b[DR_cert]*DR_cert
generate Phat1=1/(1 + exp(-L1)) label variable Phat1 "Probability by Certainty, Other IV at Means" graph twoway mspline Phat1 DR_cert, bands(50)
**** predicting and plotting probabilities ******
predict phat label variable phat "predicted probability" histogram phat
predict dB, dbeta label variable dB "Influence"
graph twoway scatter dB phat
gsort -dB list case_no dB phat DR_standard ideology sex DR_cert in 1/
*** Fatcor Analysis
factor c4_34_im c4_35_rec c4_36_ok c4_37_ac, pf
rotate, varimax
score risk_factors
logit DR_standard DR_cert ideology sex risk_factor if DR_correct== logit DR_standard DR_cert ideology sex riskindx if DR_correct==