Test 3, St590 2015, Dickey

When exponentials or natural logarithms needed, use e0=1, e0.69 =2, e1.10=3, e1.39=4, e1.61=5 (so ln(2)=0.69 etc.) and assume no priors are used.

1. (5 points) For what value of x, if any, is the hyperbolic tangent of x equal to 1.10? x=______

2. (20 pts.) Here is a neural network diagram for a continuous response Y.

In neural network terminology,

How many hidden units ____ are there? X1

How many hidden layers ____ are there? H1

How many total biases ____ and X2 Y

weights____ are involved in going from H2

the inputs to the output Y? X3

3. (25 pts.) A logistic regression for the probability p that someone will pay off their loan (Y=1) rather than default (Y=0) gives the logit L as L=0.02 -0.01*age + 0.025*income, where age is in years and income is in thousands of dollars.

(a) find the income ($______thousand) that would make L=0.69 for a person 50 years old.

(b) Using the list of exponentials at the top of the page, give the probability p=______and the odds ______that a 50 year old with the income you computed in part (a) will pay off their loan.

(c) For that same 50 year old, what increase in income would triple the predicted odds of paying off the loan?

Answer increase income by $_____ thousand

(d) According to this model are young people more or less likely to pay off their loan than older people with the same salary?

4. (50 pts.) I ran a simple logistic regression for the probability p that Y=1 as a function of X, that is, I assumed logit(p)=a+bX. I printed the X and Y values and predicted probability (p_hat), sorted in increasing order of X, to get this:

Obs X Y p_hat

1 2 1 0.77

2 3 0 0.73

3 7 1 0.55

4 9 0 0.45

5 10 1 0.40

6 12 1 0.31

7 13 0 0.27

8 15 0 0.20

9 15 0 0.20

10 19 0 0.10

Answer these questions if possible. If any is not possible mark it “NP”.

(a) Is the logit’s slope b positive or negative?

(b) How many concordant pairs _____ discordant pairs _____ and tied pairs ____ are there?

(c) Compute the cumulative lift at depth 25 ______

(d) If I predict that Y will be 1 whenever X is less than 11 and that Y will be 0 otherwise, what will be the corresponding vertical ____ and horizontal ____ coordinates for the resulting point on the ROC curve? What will be the specificity______?

Answers with detailed explanation

1. Hyperbolic tangents range from -1 to 1 so no x will give H(x)=1.10.

2. Each X connects to each H so there are 3 weights for each of two H’s for 6 weights. Each of these two H equations has an intercept (2 bias terms). Each H then connects to Y so we have 2 more weights and 1 more bias term. There is 1 hidden layer of 2 hidden units, 8 total weights and 3 bias terms.

3. We want to solve log(2)=0.69=0.02 -0.01*(50) + 0.025*income so 0.025(income)=0.69-0.02+0.50=1.17 and thus income = 1.17/0.025 = $46.8 thousand ($46,800). Since e0.69=2 from the list, the probability is 2/(2+1)=2/3 so the odds would be (2/3)/(1-2/3)=2 (i.e. “2 to 1 odds”). To make (new odds)/(old odds)=3, we would have ln(new odds)-ln(old odds)=ln(3) or new logit – old logit = ln(3). The change in logits is the change in income (delta) multiplied by 0.025 so 0.025delta = ln(3) and, using the list of exponentials, delta=ln(3)/0.025 = 1.10/0.025=$44 so an extra 44 thousand would triple the odds. This is the same logic as for the doubling amount discussed in class and our notes but using ln(3) rather than ln(2). Because of the negative coefficient on age, young people of the same income as older people will be more likely to pay off the loans. Perhaps younger people have to take out loans to get started and then pay them off while an older person still carrying those loans may be in financial difficulty.

4. The probabilities decrease with increasing X so the slope must be negative. The first 1 is concordant with all the 6 0s to its right on the X axis (below it in the list). The next 1 is concordant with the 5 0s to its right and the other two 1s each give 4 concordant pairs for 6+5+4+4=19 concordant pairs in all. Even though there are two observations at X=15, they both have Y=0 and are not counted in the pairs having Y=1 for one element and Y=0 for the other. Thus there are no ties and with 4 1s and 6 0s there are 24 total pairs. With no ties, 24-19=5 of them must be discordant.

Column C: # 0s below each 1

Column D: # 1s below each 0

C D

Obs X Y p_hat

1 2 1 6 0.77

2 3 0 0.73 3

3 7 1 5 0.55

4 9 0 0.45 2

5 10 1 4 0.40

6 12 1 4 0.31

7 13 0 0.27 0

8 15 0 0.20 0

9 15 0 0.20 0

10 19 0 0.10 0

19 5

The 25th percentile cuts off the first two observations where the response rate is 0.50 whereas the overall response rate is 0.40 so the lift is the ratio 0.50/0.40 = 1.25 (and the gain is 25%). Using a cutoff at X=11, we correctly identify the first 3 ones (they have X<11) so we’ve identified 3 of the 4 Y=1 values for a sensitivity of 0.75, the vertical coordinate. For X larger than 11, there are 4 of the 6 Y=0 values so we have specificity 2/3 and thus the horizontal coordinate is 1/3.