Docsity

Logit Modeling & Principal Components: Risk Allocation Index & Dose-Response Variables, Study notes of Quantitative Techniques

Toggle sidebar
bg1
*** Lecture 14: Logit Modeling and Introduction to Principal Components Factor Analysis
clear
set mem 60m
set matsize 400
use “your file pathway here”
* Here is the calculation of something we'll call the "risk allocation index"
generate c4_35_rec=(-1*c4_35_wr)+8
table c4_35_rec
generate riskindx=(c4_34_im + c4_35_rec + c4_36_ok + c4_37_ac)/4
summarize riskindx
* Here is the dose-response certainty variable (remaned):
gen DR_cert=c4_29_ce
gen GCC_cert=c4_32_ct
* let's also rename the ideology variable
gen ideology=c4_1_ide
* And the gender variable:
gen sex=c5_4_gen
* Now let's turn to the dependent variable. The radiation dose-response
* measures needs to be recoded to order the response more intuitively.
* The recode sets the quadratic to zero, then LD-HR to 1 (all else=.).
generate DR_correct = c4_28_ra
recode DR_correct (2=0) (1=.) (3=1) (4=.)
* Check it!
tabulate DR_correct
* Now similarly recode the D-R function that is preferred for standard setting:
generate DR_standard = c4_30_pb
recode DR_standard (2=0) (1=.) (3=1) (4=.)
tabulate DR_standard if DR_correct==0
* Now we can run a simple logit model predicting the choice of quad or linear
* risk standards for those who believe the quad is the most probable dose
* response function:
logit DR_standard DR_cert ideology sex if DR_correct==0
* model fit statistics are generated using the "lstat" command:
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==0
sum sex if DR_correct==0
sum DR_cert if DR_correct==0
* these turn out to be 3.480769 for ideology and .8436658 for sex. Now plug these
docsity.com
pf2

Partial preview of the text

Download Logit Modeling & Principal Components: Risk Allocation Index & Dose-Response Variables and more Study notes Quantitative Techniques in PDF only on Docsity!

*** Lecture 14: Logit Modeling and Introduction to Principal Components Factor Analysis

clear set mem 60m set matsize 400 use “your file pathway here”

  • Here is the calculation of something we'll call the "risk allocation index"

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

  • Here is the dose-response certainty variable (remaned):

gen DR_cert=c4_29_ce gen GCC_cert=c4_32_ct

  • let's also rename the ideology variable

gen ideology=c4_1_ide

  • And the gender variable:

gen sex=c5_4_gen

  • Now let's turn to the dependent variable. The radiation dose-response
  • measures needs to be recoded to order the response more intuitively.
  • The recode sets the quadratic to zero, then LD-HR to 1 (all else=.).

generate DR_correct = c4_28_ra recode DR_correct (2=0) (1=.) (3=1) (4=.)

  • Check it!

tabulate DR_correct

  • Now similarly recode the D-R function that is preferred for standard setting:

generate DR_standard = c4_30_pb recode DR_standard (2=0) (1=.) (3=1) (4=.) tabulate DR_standard if DR_correct==

  • Now we can run a simple logit model predicting the choice of quad or linear
  • risk standards for those who believe the quad is the most probable dose
  • response function:

logit DR_standard DR_cert ideology sex if DR_correct==

  • model fit statistics are generated using the "lstat" command:

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==

  • these turn out to be 3.480769 for ideology and .8436658 for sex. Now plug these

docsity.com

  • values into a formula that generates the logit value across the range of DR_cert:

generate L1= _b[_cons] + _b[ideology]3.612639 + _b[sex].8472325 + _b[DR_cert]*DR_cert

  • Next, take the "anti-logit" using the appropriate formula:

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

  • here we'll test for, and construct, a factor score for the risk index

factor c4_34_im c4_35_rec c4_36_ok c4_37_ac, pf

rotate, varimax

score risk_factors

  • Now the new factor score, "risk_factor", can be used as an independent variable in a regression
  • or logit model, just as you used indices in prior exercises

logit DR_standard DR_cert ideology sex risk_factor if DR_correct== logit DR_standard DR_cert ideology sex riskindx if DR_correct==

docsity.com