clear all set obs 101 generate x = (_n-51)/10 generate pr = invlogit(x) generate sd = sqrt(p*(1-p)) line pr x, name(prob) title("Cumulative Probability") line sd x, name(stddev) title("Standard Deviations") graph combine prob stddev, col(1) title("Logits") xcommon ycommon // estimated as a blocked logit generate pos = round(pr*100) // truncates exact values generate pop = 100 glm pos x, family(binomial pop) link(logit) // this should be ~ 0.5 di exp(_se[_cons])/(1+exp(_se[_cons])) // this should be a little smaller di exp(_se[x])/(1+exp(_se[x])) glm, eform // although the results show odds, the // e(b) vector is in log-odds // Probability at x=1 // should be ~ exp(1)/(1+exp(1)), about 0.73106 display exp(_b[x])/(1+exp(_b[x])) margins, at(x=(0)) // Now if our data are all in a range to the right, // we are still estimating the same logit function clear all set obs 101 generate x = (_n-1)/10 generate pr = invlogit(x) generate sd = sqrt(p*(1-p)) line pr x, name(prob) title("Cumulative Probability") line sd x, name(stddev) title("Standard Deviations") graph combine prob stddev, col(1) title("Logits") xcommon ycommon // estimated as a blocked logit generate pos = round(pr*100) // truncates exact values generate pop = 100 glm pos x, family(binomial pop) link(logit) // the first should be ~ 0.5 di exp(_se[_cons])/(1+exp(_se[_cons])) // this should be a little smaller di exp(_se[x])/(1+exp(_se[x])) // Probability at x=1 // should be ~ exp(1)/(1+exp(1)), about 0.73106 display exp(_b[x])/(1+exp(_b[x]))