Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Logistics Models

Solution to Exercises

December 15, 2021

Question One (Exercise 6.1)

()
¿
πR
(a) We are to find a prediction equation for log ¿
πD

() ( )
¿ ¿ ¿
πR π R/ πI
log ¿ =log ¿ ¿
πD π D /π I

() ()
¿ ¿
πR πD
¿ log ¿ −log ¿
πI πI

This gives

1.0+0.3 x−(3.3−0.2 x)=−2.3+0.5 x


Interpretation: The predictive equation above indicates that as the annual income
increases, the voters are more likely to vote for a republican president than for a democrat
president. This is because the slope value = 0.5 is a positive ratio. 
¿ ¿
(b) Find the range of x for which π R > π D  
The blue line in the figure above represents the prediction equation −2.3+0.5 x . The yellow
shaded region accompanied by the green lines indicates the region
¿ ¿
where π R > π D . The intercept of this line at x-axis is 4.6 which

is equivalent to $46,000. For tis reason, we can conclude that the x range for which
¿ ¿
π R > π D is x > $46,000

¿
(c) State the prediction equation for π I

Note that for i=1,2 , ⋯ , I


α i + βi x
¿
e
π i= I

∑ e α +β x i i

i=1

This then means that


¿ α I + βI x
e
πI =
eα R +β R x
+ eα D +β D x
+ eα + β x
I I

0+ 0 x
e
¿ 1.0 +0.3 x 3.3−0.2 x 0+0 x
e +e +e
1
¿ 1.0 +0.3 x 3.3−0.2 x
e +e +1
Since I is the baseline category, we take α I and β I as zero
Question Two (Exercise 6.2)
We want to use the model fit to estimate the odd ratio that describes the effect of length on
primary food choice being either invertebrate or other.
require(foreign)

## Loading required package: foreign

require(nnet)

## Loading required package: nnet

food= read.csv("Alligator.csv")
test=multinom(y ~ x, data=food)

## # weights: 9 (4 variable)
## initial value 64.818125
## iter 10 value 49.170710
## final value 49.170622
## converged

summary(test)

## Call:
## multinom(formula = y ~ x, data = food)
##
## Coefficients:
## (Intercept) x
## I 4.079701 -2.3553303
## O -1.617713 0.1101012
##
## Std. Errors:
## (Intercept) x
## I 1.468640 0.8032870
## O 1.307274 0.5170823
##
## Residual Deviance: 98.34124
## AIC: 106.3412

summary(test)$coefficients/summary(test)$standard.errors

## (Intercept) x
## I 2.777877 -2.9321155
## O -1.237471 0.2129279

To estimate the odd ratio:


exp(coef(test))
## (Intercept) x
## I 59.1277917 0.09486217
## O 0.1983518 1.11639109

Interpretation: The odd ratio/ risk ratio of one unit increase in length is 0.0948 for food
choice being Invertebrate and the old ratio of a unit increase in the length is 1.116 for food
choice being others
#Extra Point
require(foreign)
require(nnet)
food2= read.csv("attachment.csv")
test2= multinom(Naltrexone~ Sex, data= food2)

## # weights: 3 (2 variable)
## initial value 604.424341
## final value 604.220528
## converged

summary(test2)$coefficients/summary(test2)$standard.errors

## (Intercept) Sex
## -0.3819357 0.1898454

plot(test2$residuals)

plot(test2$fitted.values)
Question Three (Exercise 6.20)
(a) FALSE. Although it is better for one to treat an ordinal variable with methods that use
the ordering in testing effects, the Chi-square statistic does not put ordering into
considerartion because even if any row is interchanged for the the other, the test
statistic remain unchanged. Therefore chi-square is not the most powerful tool here
just because of its lower degree of freedom.

(b) TRUE. The assumption holds that the cummulative logit takes Y as ordinal and
therfore a nominal Y shouldn't be used.

(c) TRUE. This is becasue the catogories indicate that Y is ordinal (i.e a categorical
variable); hence, the proportional odd assumption will fit well here.

Question Four (Exercise 6.6)


Report of the prediction equation from the given result
Let 1 = Not Happy, 2 = Pretty Happy, and 3 = Not Happy which will be the baseline-
category. Then,
¿
e−2.5551−0.2275 x
π 1=
e−2.5551−0.2275 x +e−0.3513−0.0962 x +1
¿ −0.3513−0.0962x
e
π 2= −2.5551−0.2275 x −0.3513−0.0962 x
e +e +1
¿
1
π 3= −2.5551−0.2275 x −0.3513−0.0962 x
e +e +1
¿
Interpretation: It can be seen from the model that if we plot the graph of π 1, it will
decrease as X increases. This means that as the income increases, the subjects tend to be
less happy even as the income increases.

You might also like