Post-Estimation Uncertainty

Size: px
Start display at page:

Download "Post-Estimation Uncertainty"

Transcription

1 Post-Estimation Uncertainty Brad 1 1 Department of Political Science University of California, Davis May 12, 2009

2

3 Simulation Methods and Estimation Uncertainty Common approach to presenting statistical analysis is no longer acceptable

4 Simulation Methods and Estimation Uncertainty Common approach to presenting statistical analysis is no longer acceptable The basic problem

5 Simulation Methods and Estimation Uncertainty Common approach to presenting statistical analysis is no longer acceptable The basic problem Recognize there is a lot of uncertainty around our point estimates and...

6 Simulation Methods and Estimation Uncertainty Common approach to presenting statistical analysis is no longer acceptable The basic problem Recognize there is a lot of uncertainty around our point estimates and... EVEN uncertainty around our estimates of uncertainty

7 Simulation Methods and Estimation Uncertainty Consider a probit function Pr(y = 1 x) = F (xβ) = Φ(xβ) (1)

8 Simulation Methods and Estimation Uncertainty Consider a probit function Pr(y = 1 x) = F (xβ) = Φ(xβ) (1) Φ is the cdf for the standard normal.

9 Simulation Methods and Estimation Uncertainty Consider a probit function Pr(y = 1 x) = F (xβ) = Φ(xβ) (1) Φ is the cdf for the standard normal. Probit model thus given by: Φ 1 (p i ) = ˆβ k x ik (2)

10 Simulation Methods and Estimation Uncertainty Consider a probit function Pr(y = 1 x) = F (xβ) = Φ(xβ) (1) Φ is the cdf for the standard normal. Probit model thus given by: Φ 1 (p i ) = ˆβ k x ik (2) Coefficients are scale by inverse normal

11 Simulation Methods and Estimation Uncertainty Consider a probit function Pr(y = 1 x) = F (xβ) = Φ(xβ) (1) Φ is the cdf for the standard normal. Probit model thus given by: Φ 1 (p i ) = ˆβ k x ik (2) Coefficients are scale by inverse normal That is, they re z-scores

12 > z.out <- glm( tempwork ~ education + libcon + latino + income + rep, + data = fp, family = binomial(link = "probit")) > summary(z.out) Call: glm(formula = tempwork ~ education + libcon + latino + income + rep, family = binomial(link = "probit"), data = fp) Deviance Residuals: Min 1Q Median 3Q Max Coefficients: Estimate Std. Error z value Pr(> z ) (Intercept) education libcon latino e-05 *** income rep ** --- Signif. codes: 0 *** ** 0.01 * (Dispersion parameter for binomial family taken to be 1) Null deviance: on 450 degrees of freedom Residual deviance: on 445 degrees of freedom (549 observations deleted due to missingness) AIC: Number of Fisher Scoring iterations: 4

13 Simulation Methods and Estimation Uncertainty Coefficients may be starred and reported.

14 Simulation Methods and Estimation Uncertainty Coefficients may be starred and reported. As is, not a whole lot of information.

15 Simulation Methods and Estimation Uncertainty Coefficients may be starred and reported. As is, not a whole lot of information. The real work begins post-estimation

16 Simulation Methods and Estimation Uncertainty Coefficients may be starred and reported. As is, not a whole lot of information. The real work begins post-estimation And we know how to do all of this stuff... right?

17 Quantities of Interest In general, there are a variety of quantities of interest (QI) to us.

18 Quantities of Interest In general, there are a variety of quantities of interest (QI) to us. E(Y X ), Pr(Y = 1 X ), Ŷ X, E(Y X 1) E(Y X ), Pr(Y = 1 X 1 )/ Pr(Y = 1 X )... and so forth.

19 Quantities of Interest In general, there are a variety of quantities of interest (QI) to us. E(Y X ), Pr(Y = 1 X ), Ŷ X, E(Y X 1) E(Y X ), Pr(Y = 1 X 1 )/ Pr(Y = 1 X )... and so forth. The issue is that there is considerable uncertainty around any of these quantities.

20 Quantities of Interest In general, there are a variety of quantities of interest (QI) to us. E(Y X ), Pr(Y = 1 X ), Ŷ X, E(Y X 1) E(Y X ), Pr(Y = 1 X 1 )/ Pr(Y = 1 X )... and so forth. The issue is that there is considerable uncertainty around any of these quantities. A predicted probability, or any predicted quantity from a stochastic model has a stochastic component around it.

21 Quantities of Interest In general, there are a variety of quantities of interest (QI) to us. E(Y X ), Pr(Y = 1 X ), Ŷ X, E(Y X 1) E(Y X ), Pr(Y = 1 X 1 )/ Pr(Y = 1 X )... and so forth. The issue is that there is considerable uncertainty around any of these quantities. A predicted probability, or any predicted quantity from a stochastic model has a stochastic component around it. That is, there are standard errors around all of this stuff.

22 Backing out these Quantities: Zelig Part of today s class is devoted to considering software developed by Imai, King, and Lau: Zelig

23 Backing out these Quantities: Zelig Part of today s class is devoted to considering software developed by Imai, King, and Lau: Zelig We don t need Zelig to do the stuff discussed in the previous slide; however, it makes life a lot easier if we consider it (or something like it... spost, for example, in Stata).

24 Backing out these Quantities: Zelig Part of today s class is devoted to considering software developed by Imai, King, and Lau: Zelig We don t need Zelig to do the stuff discussed in the previous slide; however, it makes life a lot easier if we consider it (or something like it... spost, for example, in Stata). Some theory first (these next few slides draw heavily from King)

25 Backing out these Quantities: Zelig Part of today s class is devoted to considering software developed by Imai, King, and Lau: Zelig We don t need Zelig to do the stuff discussed in the previous slide; however, it makes life a lot easier if we consider it (or something like it... spost, for example, in Stata). Some theory first (these next few slides draw heavily from King) Basic idea: Y i f (y i θ i, α (3)

26 Backing out these Quantities: Zelig Part of today s class is devoted to considering software developed by Imai, King, and Lau: Zelig We don t need Zelig to do the stuff discussed in the previous slide; however, it makes life a lot easier if we consider it (or something like it... spost, for example, in Stata). Some theory first (these next few slides draw heavily from King) Basic idea: Y i f (y i θ i, α (3) This gives a model where Y has a stochastic component with some pdf (f ( )), model parameters (θ), and ancillary parameter(s) α.

27 GLMs The random component is linked to a systematic component given by θ i = g(x i β) (4)

28 GLMs The random component is linked to a systematic component given by θ i = g(x i β) (4) This is the systematic component because it relates the mean of the response variable to the linear predictor. As such, (.) is the systematic component.

29 GLMs The random component is linked to a systematic component given by θ i = g(x i β) (4) This is the systematic component because it relates the mean of the response variable to the linear predictor. As such, (.) is the systematic component. This could be log-odds, OLS, probit, or anything else.

30 GLMs The random component is linked to a systematic component given by θ i = g(x i β) (4) This is the systematic component because it relates the mean of the response variable to the linear predictor. As such, (.) is the systematic component. This could be log-odds, OLS, probit, or anything else. The systematic component can be non-linear:

31 GLMs The random component is linked to a systematic component given by θ i = g(x i β) (4) This is the systematic component because it relates the mean of the response variable to the linear predictor. As such, (.) is the systematic component. This could be log-odds, OLS, probit, or anything else. The systematic component can be non-linear: E(Y ) = Pr(Y = 1) = exp(x i β) 1+exp(x i β)

32 GLMs The random component is linked to a systematic component given by θ i = g(x i β) (4) This is the systematic component because it relates the mean of the response variable to the linear predictor. As such, (.) is the systematic component. This could be log-odds, OLS, probit, or anything else. The systematic component can be non-linear: E(Y ) = Pr(Y = 1) = exp(x i β) 1+exp(x i β) In the probabilities, this logit is non-linear.

33 Modeling We can linearize logit (or probit) by suitable transformation...

34 Modeling We can linearize logit (or probit) by suitable transformation... But when we do, the E(Y ) becomes more difficult to interpret.

35 Modeling We can linearize logit (or probit) by suitable transformation... But when we do, the E(Y ) becomes more difficult to interpret. i.e. see the probit results from before.

36 Modeling We can linearize logit (or probit) by suitable transformation... But when we do, the E(Y ) becomes more difficult to interpret. i.e. see the probit results from before. What we normally do: Take a supposed random sample to understand some population Use the sample to estimate some features from the population Estimates will be highly sensitive to the sample size (bigger samples produce more precise estimates).

37 Modeling using Simulations Suppose we estimate our model and then simulate quantities of interest from that particular model?

38 Modeling using Simulations Suppose we estimate our model and then simulate quantities of interest from that particular model? Under this approach we try to understand a distribution by taking draws from the observed sample. And, like we did with bootstrapping or MC methods, we approximate features of the distribution (marginal changes, expected values, and so forth). The more replicates, the more precise our approximation.

39 Modeling using Simulations Suppose we estimate our model and then simulate quantities of interest from that particular model? Under this approach we try to understand a distribution by taking draws from the observed sample. And, like we did with bootstrapping or MC methods, we approximate features of the distribution (marginal changes, expected values, and so forth). The more replicates, the more precise our approximation. Analogous to what we think we re doing using classical statistical theory.

40 Modeling using Simulations Suppose we estimate our model and then simulate quantities of interest from that particular model? Under this approach we try to understand a distribution by taking draws from the observed sample. And, like we did with bootstrapping or MC methods, we approximate features of the distribution (marginal changes, expected values, and so forth). The more replicates, the more precise our approximation. Analogous to what we think we re doing using classical statistical theory. Do we need specialized software to do this?

41 Modeling using Simulations Suppose we estimate our model and then simulate quantities of interest from that particular model? Under this approach we try to understand a distribution by taking draws from the observed sample. And, like we did with bootstrapping or MC methods, we approximate features of the distribution (marginal changes, expected values, and so forth). The more replicates, the more precise our approximation. Analogous to what we think we re doing using classical statistical theory. Do we need specialized software to do this? Not really, but it helps.

42 Simulation In regression context, draw simulations of β.

43 Simulation In regression context, draw simulations of β. Calculate the systematic component: θ = g(x i β i )

44 Simulation In regression context, draw simulations of β. Calculate the systematic component: θ = g(x i β i ) These two components are what King calls estimation uncertainty. Draw from the density, f ( θ, α), to account for fundamental uncertainty.

45 Simulation In regression context, draw simulations of β. Calculate the systematic component: θ = g(x i β i ) These two components are what King calls estimation uncertainty. Draw from the density, f ( θ, α), to account for fundamental uncertainty. What is the difference? (It s an important distinction)

46 Simulation Do what we did on the previous slide over and over!

47 Simulation Do what we did on the previous slide over and over! Sounds like what we did with the bootstrap.

48 Simulation Do what we did on the previous slide over and over! Sounds like what we did with the bootstrap. That is, create replicates B and compute some quantity we called θ. We can implement this approach via boostrapping.

49 Simulation Do what we did on the previous slide over and over! Sounds like what we did with the bootstrap. That is, create replicates B and compute some quantity we called θ. We can implement this approach via boostrapping. Important result: n, estimation uncertainty tends toward 0; however, fundamental uncertainty always remains.

50 Simulation Do what we did on the previous slide over and over! Sounds like what we did with the bootstrap. That is, create replicates B and compute some quantity we called θ. We can implement this approach via boostrapping. Important result: n, estimation uncertainty tends toward 0; however, fundamental uncertainty always remains. Essentially, we re building up a sampling distribution.

51 Logit Simulation Are income levels related to support for guest worker program?

52 Logit Simulation Are income levels related to support for guest worker program? Highest income level is 5; lowest is 1.

53 Logit Simulation Are income levels related to support for guest worker program? Highest income level is 5; lowest is 1. What does the logit estimator look like:

54 Logit Simulation Are income levels related to support for guest worker program? Highest income level is 5; lowest is 1. What does the logit estimator look like: In the probabilities, logit is a non-linear model.

55 Logit Simulation Are income levels related to support for guest worker program? Highest income level is 5; lowest is 1. What does the logit estimator look like: In the probabilities, logit is a non-linear model. E(y) = P(y = 1 x) = β k x ik, and y is binary. Pr(y = 1 x) = exp( β k x ik )

56 Logit Simulation Are income levels related to support for guest worker program? Highest income level is 5; lowest is 1. What does the logit estimator look like: In the probabilities, logit is a non-linear model. E(y) = P(y = 1 x) = β k x ik, and y is binary. Z = β k x ik, then Pr(y = 1 x) = Pr(y = 1 x) = exp( β k x ik ) exp( Z) = exp(z) 1 + exp(z)

57 Logit Simulation We estimate the model in this form: ( ) pi log = Z 1 p i

58 Logit Simulation We estimate the model in this form: ( ) pi log = Z 1 p i More formally Y i Bernoulli(y i π i ) implying π y i i (1 π i ) 1 y i

59 Logit Simulation We estimate the model in this form: ( ) pi log = Z 1 p i More formally Y i Bernoulli(y i π i ) implying Obviously, π i = Pr(y i = 1). π y i i (1 π i ) 1 y i

60 Logit Simulation We estimate the model in this form: ( ) pi log = Z 1 p i More formally Y i Bernoulli(y i π i ) implying Obviously, π i = Pr(y i = 1). π y i i (1 π i ) 1 y i This is the stochastic component to the logit estimator (it s in the binomial family)

61 Logit Simulation We estimate the model in this form: ( ) pi log = Z 1 p i More formally Y i Bernoulli(y i π i ) implying Obviously, π i = Pr(y i = 1). π y i i (1 π i ) 1 y i This is the stochastic component to the logit estimator (it s in the binomial family) The systematic component is Pr(y = 1 x) = exp( Z) = exp(z) 1 + exp(z)

62 Logit Simulation Step 1: simulate the regressors in Z ( β)

63 Logit Simulation Step 1: simulate the regressors in Z ( β) Calculate θ = 1 1+exp( x i β) for some covariate profile.

64 Logit Simulation Step 1: simulate the regressors in Z ( β) Calculate θ = 1 1+exp( x i β) for some covariate profile. Here, set income to it s highest and lowest values.

65 Logit Simulation Step 1: simulate the regressors in Z ( β) Calculate θ = 1 1+exp( x i β) for some covariate profile. Here, set income to it s highest and lowest values. Draw simulations of Y i from the binomial.

66 Logit Simulation How to simulate?

67 Logit Simulation How to simulate? Asymptotic Normal

68 Logit Simulation How to simulate? Asymptotic Normal Non-parametric bootstrapping

69 Logit Simulation How to simulate? Asymptotic Normal Non-parametric bootstrapping Bayesian simulation

70 The Basic Idea We can t repeatedly sample from the real world...

71 The Basic Idea We can t repeatedly sample from the real world... But we can from our observed data.

72 The Basic Idea We can t repeatedly sample from the real world... But we can from our observed data. Central limit theorem tells us with repeated samples, even from a non-normal population, the sampling distribution of some statistic will tend to the normal.

73 The Basic Idea We can t repeatedly sample from the real world... But we can from our observed data. Central limit theorem tells us with repeated samples, even from a non-normal population, the sampling distribution of some statistic will tend to the normal. We approximate this with simulations instead of samples.

74 The Basic Idea We can t repeatedly sample from the real world... But we can from our observed data. Central limit theorem tells us with repeated samples, even from a non-normal population, the sampling distribution of some statistic will tend to the normal. We approximate this with simulations instead of samples. Recall the result that the empirical CDF with tend to the true CDF with enough replicates.

75 Illustration Use the Zelig package with R

76 Illustration Use the Zelig package with R Zelig is a wrapper that allows a variety of simulations to be conducted post-estimation.

77 Illustration Use the Zelig package with R Zelig is a wrapper that allows a variety of simulations to be conducted post-estimation. Works with many of the models we teach here in our methods sequence including matching models.

78 Illustration Use the Zelig package with R Zelig is a wrapper that allows a variety of simulations to be conducted post-estimation. Works with many of the models we teach here in our methods sequence including matching models. Illustration using California Field Poll Data.

79 z.out <- zelig(tempwork ~ education + libcon + latino + income + dem, model = "logit", data = fp) x.out <- setx(z.out) s.out <- sim(z.out, x = x.out) x.lo <- setx(z.out, income = 1, education = 1:10) x.hi <- setx(z.out, income = 5, education = 1:10) s.out <- sim(z.out, x = x.lo, x1 = x.hi, bootstrap = TRUE, num=1000)

80 Model: logit Number of simulations: 1000 Mean Values of X (n = 10) (Intercept) education libcon latino income dem Mean Values of X1 (n = 10) (Intercept) education libcon latino income dem Pooled Expected Values: E(Y X) mean sd 2.5% 97.5% Pooled Predicted Values: Y X Pooled First Differences in Expected Values: E(Y X1)-E(Y X) mean sd 2.5% 97.5% Pooled Risk Ratios: P(Y=1 X1)/P(Y=1 X) mean sd 2.5% 97.5% >

81 Uncertainty Estimation: More Details Imagine y regressed on X giving us parameters b = (X X ) 1 X y.

82 Uncertainty Estimation: More Details Imagine y regressed on X giving us parameters b = (X X ) 1 X y. Standard linear model.

83 Uncertainty Estimation: More Details Imagine y regressed on X giving us parameters b = (X X ) 1 X y. Standard linear model. Often interested in some quantity of interest, like a prediction.

84 Uncertainty Estimation: More Details Imagine y regressed on X giving us parameters b = (X X ) 1 X y. Standard linear model. Often interested in some quantity of interest, like a prediction. Suppose y p is a prediction based on some X p.

85 Uncertainty Estimation: More Details Imagine y regressed on X giving us parameters b = (X X ) 1 X y. Standard linear model. Often interested in some quantity of interest, like a prediction. Suppose y p is a prediction based on some X p. Two kinds of uncertainty: Estimation Uncertainty: Related to sample size. Fundamental Uncertainty: E(Y p ) = µ = X p β.

86 Uncertainty Estimation: More Details In regression setting, variability decomposes as: Y p = X p b + ɛ p = var(x p b) + var(ɛ p ) = X p var(b)(x p ) + σ 2 I = σ 2 X p ((X p ) X p ) 1 + σ 2 I = estimation uncertainty + fundamental uncertainty (5)

87 Uncertainty Estimation: More Details In regression setting, variability decomposes as: Y p = X p b + ɛ p = var(x p b) + var(ɛ p ) = X p var(b)(x p ) + σ 2 I = σ 2 X p ((X p ) X p ) 1 + σ 2 I = estimation uncertainty + fundamental uncertainty (5) Distribution of ˆ Y p is Ŷ p N(X p β, X p var(b)(x p ) )

88 Uncertainty Estimation: More Details In regression setting, variability decomposes as: Y p = X p b + ɛ p = var(x p b) + var(ɛ p ) = X p var(b)(x p ) + σ 2 I = σ 2 X p ((X p ) X p ) 1 + σ 2 I = estimation uncertainty + fundamental uncertainty (5) Distribution of ˆ Y p is Unconditional distribution is: Ŷ p N(X p β, X p var(b)(x p ) ) Ŷ p N(X p β, X p var(b)(x p ) + σ 2 I )

89 Uncertainty Estimation: More Details Because quantities are estimated with uncertainty, these quantities have standard errors around them.

90 Uncertainty Estimation: More Details Because quantities are estimated with uncertainty, these quantities have standard errors around them. Recall in regression setting that s.e. around predicted y include the variance ɛ.

91 Uncertainty Estimation: More Details Because quantities are estimated with uncertainty, these quantities have standard errors around them. Recall in regression setting that s.e. around predicted y include the variance ɛ. Therefore, prediction interval is larger than standard confidence interval.

92 Uncertainty Estimation: More Details Because quantities are estimated with uncertainty, these quantities have standard errors around them. Recall in regression setting that s.e. around predicted y include the variance ɛ. Therefore, prediction interval is larger than standard confidence interval. Quick illustration using standard approaches.

93 > m1<-lm(votes1st~spend_total + incumb + spend_total:incumb) > summary(m1)$coeff Estimate Std. Error t value Pr(> t ) (Intercept) e-03 spend_total e-51 incumb e-19 spend_total:incumb e-06 > > #Five-Number Summary (good to use to understand typical covariate profile) > fivenum(dail$spend_total) [1] > > x0 <- c(1, 75000, 1, 75000) # set some predictor values (cons, spend, incumb, s:i) > (y0 <- sum(x0*coef(m1))) # compute predicted response [1] > fivenum(dail$votes1st) # how typical is this response? [1] > quantile(dail$votes1st,.99, na.rm=t) # versus 99th percentile 99% > x0.df <- data.frame(incumb=1, spend_total=75000) > predict(m1, x0.df) > predict(m1, x0.df, interval="confidence") fit lwr upr > predict(m1, x0.df, interval="prediction") fit lwr upr

94 Uncertainty Estimation: More Details C.I. is much narrower than prediction interval.

95 Uncertainty Estimation: More Details C.I. is much narrower than prediction interval. Predicted y may be a q.i. for us.

96 Uncertainty Estimation: More Details C.I. is much narrower than prediction interval. Predicted y may be a q.i. for us. Estimation uncertainty in non-linear models... two examples

97 Uncertainty Estimation: More Details C.I. is much narrower than prediction interval. Predicted y may be a q.i. for us. Estimation uncertainty in non-linear models... two examples Mean and Variance of Poisson: E(Y ) = e X β, var(y ) = λ

98 Uncertainty Estimation: More Details C.I. is much narrower than prediction interval. Predicted y may be a q.i. for us. Estimation uncertainty in non-linear models... two examples Mean and Variance of Poisson: Mean and Variance of Logit E(Y ) = E(Y ) = e X β, var(y ) = λ 1, var(y ) = π(1 π) 1 + e X β

99 Uncertainty Estimation: More Details Estimation uncertainty requires the Delta Method.

100 Uncertainty Estimation: More Details Estimation uncertainty requires the Delta Method. Taylor series approximation can be applied: ŷ p = g(b) = g(β) + g (β)(b β) +...

101 Uncertainty Estimation: More Details Estimation uncertainty requires the Delta Method. Taylor series approximation can be applied: ŷ p = g(b) = g(β) + g (β)(b β) +... here, g (β) is the first derivative of g(β) wrt β.

102 Uncertainty Estimation: More Details Estimation uncertainty requires the Delta Method. Taylor series approximation can be applied: ŷ p = g(b) = g(β) + g (β)(b β) +... here, g (β) is the first derivative of g(β) wrt β. Dropping all but the first two terms gives var var[g(β)] + var[g (β)(b β)] = g (β)var(b)g (β) (6)

103 Uncertainty Estimation: More Details Estimation uncertainty requires the Delta Method. Taylor series approximation can be applied: ŷ p = g(b) = g(β) + g (β)(b β) +... here, g (β) is the first derivative of g(β) wrt β. Dropping all but the first two terms gives var var[g(β)] + var[g (β)(b β)] = g (β)var(b)g (β) (6) This is the DELTA METHOD.

104 Delta Method and Poisson Poisson: Y e λ λ y y!

105 Delta Method and Poisson Poisson: Y e λ λ y y! This gives the random component.

106 Delta Method and Poisson Poisson: Y e λ λ y y! This gives the random component. Systematic component: λ = e X β

107 Delta Method and Poisson Poisson: Y e λ λ y y! This gives the random component. Systematic component: Fundamental variability: λ = e X β var(y λ) = λ

108 Delta Method and Poisson Estimation variability (score matrix): g (β) = ex β β = X e X β (7) Which gives the element-by-element multiplication.

109 Delta Method and Poisson Estimation variability (score matrix): g (β) = ex β β = X e X β (7) Which gives the element-by-element multiplication. Variance of Ŷ p is: var(ŷ p = (X p e X pb )var(b)(x p e X pb ))

110 Delta Method and Poisson Estimation variability (score matrix): g (β) = ex β β = X e X β (7) Which gives the element-by-element multiplication. Variance of Ŷ p is: var(ŷ p = (X p e X pb )var(b)(x p e X pb )) If we solved this, we d be using the delta method to analytically find the variance of the function.

111 Delta Method and Poisson Estimation variability (score matrix): g (β) = ex β β = X e X β (7) Which gives the element-by-element multiplication. Variance of Ŷ p is: var(ŷ p = (X p e X pb )var(b)(x p e X pb )) If we solved this, we d be using the delta method to analytically find the variance of the function. In turn, c.i. or standard errors could be computed around qi.

112 Or, use simulation methods This is where we were at last week.

113 Or, use simulation methods This is where we were at last week. Stochastic component: Y i f (θ i, α)

114 Or, use simulation methods This is where we were at last week. Stochastic component: Y i f (θ i, α) Systematic Component: θ i = g(x i, β)

115 Or, use simulation methods This is where we were at last week. Stochastic component: Y i f (θ i, α) Systematic Component: θ i = g(x i, β) OLS: Y i = N(µ i, σ 2 ) and µ i = X i β

116 Or, use simulation methods This is where we were at last week. Stochastic component: Y i f (θ i, α) Systematic Component: θ i = g(x i, β) OLS: Y i = N(µ i, σ 2 ) and µ i = X i β Simulated parameter vector: ˆλ = ( ˆβ, ˆα).

117 Or, use simulation methods This is where we were at last week. Stochastic component: Y i f (θ i, α) Systematic Component: θ i = g(x i, β) OLS: Y i = N(µ i, σ 2 ) and µ i = X i β Simulated parameter vector: ˆλ = ( ˆβ, ˆα). By central limit theorem, simulate λ as: ˆλ N(ˆλ, ˆV (ˆλ)).

118 Poisson Example: Benoit data on Frequency of War Issue: Number of wars as a function of democratization levels.

119 Poisson Example: Benoit data on Frequency of War Issue: Number of wars as a function of democratization levels. Original study published in 1996.

120 Poisson Example: Benoit data on Frequency of War Issue: Number of wars as a function of democratization levels. Original study published in Compare simulated q.i. to point-estimates.

121 > #Poisson Model using Zelig > > ## predicted values on Weede dataset from Benoit (1996) > weede <- read.dta("weede.dta") > z.out <- zelig(ssal6080 ~ + fh73+lpopln70+lmilwp70, model="poisson", data=weede) > (x.out <- setx(z.out, fh73=2:14)) (Intercept) fh73 lpopln70 lmilwp > s.out <- sim(z.out, x=x.out) > summary(s.out) Model: poisson Number of simulations: 1000 Mean Values of X (n = 13) (Intercept) fh73 lpopln70 llmilwp Pooled Expected Values: E(Y X) mean sd 2.5% 97.5% Pooled Predicted Values: Y X mean sd 2.5% 97.5%

122 > ## replicate part of Table 3 from Benoit (1996) > z.tab2nbpoldem <- zelig(butterw ~ poldem65, model="negbin", data=weede) > x.tab2nbpoldem <- setx(z.tab2nbpoldem, poldem65=c(0,20,55,85,100)) > s.tab2nbpoldem <- sim(z.tab2nbpoldem, x=x.tab2nbpoldem) > cbind(apply(s.tab2nbpoldem$qi$ev, 2, mean), + apply(s.tab2nbpoldem$qi$ev, 2, sd)) [,1] [,2] [1,] < POLDEM Estimates from Simulations [2,] [3,] [4,] [5,] > z.tab2nbfh73 <- zelig(butterw ~ fh73, model="negbin", data=weede) > x.tab2nbfh73 <- setx(z.tab2nbfh73, fh73=c(2,4,7,12,14)) > s.tab2nbfh73 <- sim(z.tab2nbfh73, x=x.tab2nbfh73) > cbind(apply(s.tab2nbfh73$qi$ev, 2, mean), + apply(s.tab2nbfh73$qi$ev, 2, sd)) [,1] [,2] [1,] < Freedom House Estimates from [2,] Simulations [3,] [4,] [5,] >

123

124 Poisson Example: Benoit data on Frequency of War Estimates based on simulation differ slightly from those reported in original article.

125 Poisson Example: Benoit data on Frequency of War Estimates based on simulation differ slightly from those reported in original article. Why might this be the case?... Delta method vs. nonparametric simulation.

126 Poisson Example: Benoit data on Frequency of War Estimates based on simulation differ slightly from those reported in original article. Why might this be the case?... Delta method vs. nonparametric simulation. Useful to show graphical displays of expected counts.

127 Poisson Example: Benoit data on Frequency of War Estimates based on simulation differ slightly from those reported in original article. Why might this be the case?... Delta method vs. nonparametric simulation. Useful to show graphical displays of expected counts. Plotting c.i. using Zelig with a poisson.

128 > ## replicate top part of Figure 1 from Benoit (1996) > x.tab2nbpoldem <- setx(z.tab2nbpoldem, poldem65=seq(0,100,1)) > s.tab2nbpoldem <- sim(z.tab2nbpoldem, x=x.tab2nbpoldem) > x.tab2nbfh73 <- setx(z.tab2nbfh73, fh73=2:14) > s.tab2nbfh73 <- sim(z.tab2nbfh73, x=x.tab2nbfh73) > par(mfrow=c(2,2), mar=c(4,4,1,1)) > plot.ci(s.tab2nbpoldem, xlab="poldem 1965", ylab="butterworth Wars", + ylim=c(0,7)) > points(weede$poldem65, weede$butterw) > plot.ci(s.tab2nbfh73, xlab="freedom House 1973", ylab="butterworth Wars", + ylim=c(0,7)) > points(weede$fh73, weede$butterw) > par(mfrow=c(2,2)) >

129

130 Post-Estimation Uncertainty: Probit Consider a probit model.

131 Post-Estimation Uncertainty: Probit Consider a probit model. Winning, spending, and incumbency in parliamentary system.

132 Post-Estimation Uncertainty: Probit Consider a probit model. Winning, spending, and incumbency in parliamentary system. Compute first differences, etc. for various scenarios.

133 > ## replicate Table 5 Benoit and Marsh (2009) PRQ > # note: convert.factors=f since this makes dummy vars 0/1 numeric > dail <- read.dta("dailprobit.dta", convert.factors=f) > > z.out <- zelig(wonseat ~ pspend_total*incumb+m, model="probit", data=dail) > > x.lo <- setx(z.out, pspend_total=5, incumb=0, m=4) > x.hi <- setx(z.out, pspend_total=15, incumb=0, m=4) > summary(s.out <- sim(z.out, x=x.lo, x1=x.hi)) Model: probit Number of simulations: 1000 Values of X (Intercept) pspend_total incumb m pspend_total:incumb Values of X1 (Intercept) pspend_total incumb m pspend_total:incumb Expected Values: E(Y X) mean sd 2.5% 97.5% Predicted Values: Y X First Differences in Expected Values: E(Y X1)-E(Y X) mean sd 2.5% 97.5% Risk Ratios: P(Y=1 X1)/P(Y=1 X)

134 mean sd 2.5% 97.5% > > x.lo <- setx(z.out, pspend_total=0, incumb=1, m=4) > x.hi <- setx(z.out, pspend_total=5, incumb=1, m=4) > summary(s.out <- sim(z.out, x=x.lo, x1=x.hi)) Model: probit Number of simulations: 1000 Values of X (Intercept) pspend_total incumb m pspend_total:incumb Values of X1 (Intercept) pspend_total incumb m pspend_total:incumb Expected Values: E(Y X) mean sd 2.5% 97.5% Predicted Values: Y X First Differences in Expected Values: E(Y X1)-E(Y X) mean sd 2.5% 97.5% Risk Ratios: P(Y=1 X1)/P(Y=1 X) mean sd 2.5% 97.5% > > x.lo <- setx(z.out, pspend_total=5, incumb=1, m=4)

135 > x.hi <- setx(z.out, pspend_total=10, incumb=1, m=4) > summary(s.out <- sim(z.out, x=x.lo, x1=x.hi)) Model: probit Number of simulations: 1000 Values of X (Intercept) pspend_total incumb m pspend_total:incumb Values of X1 (Intercept) pspend_total incumb m pspend_total:incumb Expected Values: E(Y X) mean sd 2.5% 97.5% Predicted Values: Y X First Differences in Expected Values: E(Y X1)-E(Y X) mean sd 2.5% 97.5% Risk Ratios: P(Y=1 X1)/P(Y=1 X) mean sd 2.5% 97.5% > > x.lo <- setx(z.out, pspend_total=10, incumb=1, m=4) > x.hi <- setx(z.out, pspend_total=15, incumb=1, m=4) > summary(s.out <- sim(z.out, x=x.lo, x1=x.hi)) Model: probit

136 Number of simulations: 1000 Values of X (Intercept) pspend_total incumb m pspend_total:incumb Values of X1 (Intercept) pspend_total incumb m pspend_total:incumb Expected Values: E(Y X) mean sd 2.5% 97.5% Predicted Values: Y X First Differences in Expected Values: E(Y X1)-E(Y X) mean sd 2.5% 97.5% Risk Ratios: P(Y=1 X1)/P(Y=1 X) mean sd 2.5% 97.5% > > x.lo <- setx(z.out, pspend_total=5, incumb=1, m=4) > x.hi <- setx(z.out, pspend_total=15, incumb=1, m=4) > summary(s.out <- sim(z.out, x=x.lo, x1=x.hi)) Model: probit Number of simulations: 1000 Values of X (Intercept) pspend_total incumb m pspend_total:incumb

137 Values of X1 (Intercept) pspend_total incumb m pspend_total:incumb Expected Values: E(Y X) mean sd 2.5% 97.5% Predicted Values: Y X First Differences in Expected Values: E(Y X1)-E(Y X) mean sd 2.5% 97.5% Risk Ratios: P(Y=1 X1)/P(Y=1 X) mean sd 2.5% 97.5% >

138 Post-Estimation Uncertainty: Probit Graphical displays

139 Post-Estimation Uncertainty: Probit Graphical displays Incumbents vs. Non-Incumbents.

140

141 Graphical Displays This figure conveys a lot of information.

142 Graphical Displays This figure conveys a lot of information. We can see where the estimated relationship separates between the two groups and where it converges, given some value of x.

143 Graphical Displays This figure conveys a lot of information. We can see where the estimated relationship separates between the two groups and where it converges, given some value of x. In general, much easier to visualize.

144 Graphical Displays This figure conveys a lot of information. We can see where the estimated relationship separates between the two groups and where it converges, given some value of x. In general, much easier to visualize. Let s consider some plot-based approaches to analysis.

145 Graphical Displays This figure conveys a lot of information. We can see where the estimated relationship separates between the two groups and where it converges, given some value of x. In general, much easier to visualize. Let s consider some plot-based approaches to analysis. First, ROC then effects displays.

146 Graphical Displays This figure conveys a lot of information. We can see where the estimated relationship separates between the two groups and where it converges, given some value of x. In general, much easier to visualize. Let s consider some plot-based approaches to analysis. First, ROC then effects displays. ROC receiver operator characteristcs

147 Receiver Operator Characteristic Curves: Basic Ideas Useful to understanding predictive power of models.

148 Receiver Operator Characteristic Curves: Basic Ideas Useful to understanding predictive power of models. Developed in Britain during World War II

149 Receiver Operator Characteristic Curves: Basic Ideas Useful to understanding predictive power of models. Developed in Britain during World War II Radar receiver operators were assessed on their ability to differentiate signal from noise.

150 Receiver Operator Characteristic Curves: Basic Ideas Useful to understanding predictive power of models. Developed in Britain during World War II Radar receiver operators were assessed on their ability to differentiate signal from noise. i.e. Germans versus flocks of birds.

151 Receiver Operator Characteristic Curves: Basic Ideas Useful to understanding predictive power of models. Developed in Britain during World War II Radar receiver operators were assessed on their ability to differentiate signal from noise. i.e. Germans versus flocks of birds. What factors influenced skill were important (gain levels, for example.)

152 ROC Curves If we care about prediction, or even if we don t, have to recognize binary GLMs entail classification problems.

153 ROC Curves If we care about prediction, or even if we don t, have to recognize binary GLMs entail classification problems. Think Type-1 and Type-II errors.

154 ROC Curves If we care about prediction, or even if we don t, have to recognize binary GLMs entail classification problems. Think Type-1 and Type-II errors. Suppose p is prediction of success; q is prediction of failure. Let p and q denote the true value. With binary classification we have four possible outcomes: p p True Positive q p False Negative p q False Positive q q True Negative

155

156 ROC Curves Imagine two rates: a true positive rate (TPR) and a false positive rate (FPR).

157 ROC Curves Imagine two rates: a true positive rate (TPR) and a false positive rate (FPR). ROC curves plot the relationship between these two rates.

158 ROC Curves Imagine two rates: a true positive rate (TPR) and a false positive rate (FPR). ROC curves plot the relationship between these two rates. In this sense, it is sensitivity analysis: TPR is sensitivity rate and FPR is 1 sensitivity.

159 ROC Curves Imagine two rates: a true positive rate (TPR) and a false positive rate (FPR). ROC curves plot the relationship between these two rates. In this sense, it is sensitivity analysis: TPR is sensitivity rate and FPR is 1 sensitivity. These curves are sometimes called sensitivity vs. 1-sensitivity graphs.

160 ROC Curves Can use ROC curves to evaluate competing models or compare models on subgroups.

161 ROC Curves Can use ROC curves to evaluate competing models or compare models on subgroups. Implemented in Stata and in R.

162 ROC Curves Can use ROC curves to evaluate competing models or compare models on subgroups. Implemented in Stata and in R. In R, packages ROCR and Zelig will work.

163 ROC Curves Can use ROC curves to evaluate competing models or compare models on subgroups. Implemented in Stata and in R. In R, packages ROCR and Zelig will work. In Zelig, the ROC plot will return a plot of the probability of 0 against the probability of 1.

164 ROC Curves Can use ROC curves to evaluate competing models or compare models on subgroups. Implemented in Stata and in R. In R, packages ROCR and Zelig will work. In Zelig, the ROC plot will return a plot of the probability of 0 against the probability of 1. Imagine the two extremes in such a plot.

165 ROC Curves Can use ROC curves to evaluate competing models or compare models on subgroups. Implemented in Stata and in R. In R, packages ROCR and Zelig will work. In Zelig, the ROC plot will return a plot of the probability of 0 against the probability of 1. Imagine the two extremes in such a plot. Then imagine a 45-degree line connecting these two points.

166 ROC Curves Can use ROC curves to evaluate competing models or compare models on subgroups. Implemented in Stata and in R. In R, packages ROCR and Zelig will work. In Zelig, the ROC plot will return a plot of the probability of 0 against the probability of 1. Imagine the two extremes in such a plot. Then imagine a 45-degree line connecting these two points. Models falling on this line would essentially be equivalent to random guesses.

167

168 ROC Curves and Effects Displays Departures from the 45-degree line suggests the model s improvement over merely guessing on the 45-degree line.

169 ROC Curves and Effects Displays Departures from the 45-degree line suggests the model s improvement over merely guessing on the 45-degree line. Covariates seem to do a better job accounting for challengers than for incumbents.

170 ROC Curves and Effects Displays Departures from the 45-degree line suggests the model s improvement over merely guessing on the 45-degree line. Covariates seem to do a better job accounting for challengers than for incumbents. Why? Potentially useful question to try and answer.

171 ROC Curves and Effects Displays Departures from the 45-degree line suggests the model s improvement over merely guessing on the 45-degree line. Covariates seem to do a better job accounting for challengers than for incumbents. Why? Potentially useful question to try and answer. Comparing alternative models.

172 ROC Curves and Effects Displays Departures from the 45-degree line suggests the model s improvement over merely guessing on the 45-degree line. Covariates seem to do a better job accounting for challengers than for incumbents. Why? Potentially useful question to try and answer. Comparing alternative models. Illustration: California field poll data on Prop. 86 (2006)

173 ROC Curves and Effects Displays Departures from the 45-degree line suggests the model s improvement over merely guessing on the 45-degree line. Covariates seem to do a better job accounting for challengers than for incumbents. Why? Potentially useful question to try and answer. Comparing alternative models. Illustration: California field poll data on Prop. 86 (2006) Begin with Zelig model.

174 > #Setting education to its mean and adjusting the Latino covariate > > x.lo <- setx(z.out, conservative=0, liberal=1, latino=0) > x.hi <- setx(z.out, conservative=0, liberal=1, latino=1) > summary(s.out <- sim(z.out, x=x.lo, x1=x.hi)) Model: logit Number of simulations: 1000 Values of X (Intercept) logage conservative liberal latino education smoke100 latino:education Values of X1 (Intercept) logage conservative liberal latino education smoke100 latino:education Expected Values: E(Y X) mean sd 2.5% 97.5% Predicted Values: Y X First Differences in Expected Values: E(Y X1)-E(Y X) mean sd 2.5% 97.5% Risk Ratios: P(Y=1 X1)/P(Y=1 X) mean sd 2.5% 97.5% >

175 Call: zelig(formula = yeson86 ~ logage + conservative + liberal + latino * education + smoke100, model = "logit", data = fp) Deviance Residuals: Min 1Q Median 3Q Max Coefficients: Estimate Std. Error z value Pr(> z ) (Intercept) ** logage *** conservative ** liberal *** latino e-05 *** education * smoke e-06 *** latino:education ** --- Signif. codes: 0 *** ** 0.01 * (Dispersion parameter for binomial family taken to be 1) Null deviance: on 707 degrees of freedom Residual deviance: on 700 degrees of freedom AIC: Number of Fisher Scoring iterations: 4

176 ROC Curves, Effects Displays Difficult with interaction to understand effect.

177 ROC Curves, Effects Displays Difficult with interaction to understand effect. We see the conditioning effect is negative.

178 ROC Curves, Effects Displays Difficult with interaction to understand effect. We see the conditioning effect is negative. As education increases, probability of support decreases among Latinos

179 ROC Curves, Effects Displays Difficult with interaction to understand effect. We see the conditioning effect is negative. As education increases, probability of support decreases among Latinos Side-by-side plots (non-pretty)

180

181

182 ROC Curves Back to ROC plots.

183 ROC Curves Back to ROC plots. Illustrate with reduced model.

184 ROC Curves Back to ROC plots. Illustrate with reduced model. Smokers only!

185 ROC Curves Back to ROC plots. Illustrate with reduced model. Smokers only! Let s inspect a ROC plot.

186

187

188 Effects Displays Lots of our models have higher order terms.

189 Effects Displays Lots of our models have higher order terms. Polynomials Quadratics Interactions

190 Effects Displays Lots of our models have higher order terms. Polynomials Quadratics Interactions Difficult to present results in tabular form sometimes.

191 Effects Displays Lots of our models have higher order terms. Polynomials Quadratics Interactions Difficult to present results in tabular form sometimes. John Fox has developed an R package called effects

192 Effects Displays Lots of our models have higher order terms. Polynomials Quadratics Interactions Difficult to present results in tabular form sometimes. John Fox has developed an R package called effects Useful with higher order terms or with multiequation models.

193 Effects Displays As learned in POL 212, higher order terms yield complicated standard errors.

194 Effects Displays As learned in POL 212, higher order terms yield complicated standard errors. Effects may be conditional.

195 Effects Displays As learned in POL 212, higher order terms yield complicated standard errors. Effects may be conditional. Plots w/predicted effects on the higher-order relative might be useful to do.

196 Effects Displays As learned in POL 212, higher order terms yield complicated standard errors. Effects may be conditional. Plots w/predicted effects on the higher-order relative might be useful to do. Quick illustration using the Prop 86 data.

197 Effects Displays As learned in POL 212, higher order terms yield complicated standard errors. Effects may be conditional. Plots w/predicted effects on the higher-order relative might be useful to do. Quick illustration using the Prop 86 data. Estimate model with conditional effect.

198 Effects Displays As learned in POL 212, higher order terms yield complicated standard errors. Effects may be conditional. Plots w/predicted effects on the higher-order relative might be useful to do. Quick illustration using the Prop 86 data. Estimate model with conditional effect. Inspect the coefficients and plot them.

199 > support.mod <- glm(yeson86 ~ logage + conservative + liberal + latino * education + smoke100, + family=binomial(link="logit"), data=fp) > > summary(support.mod) Call: glm(formula = yeson86 ~ logage + conservative + liberal + latino * education + smoke100, family = binomial(link = "logit"), data = fp) Deviance Residuals: Min 1Q Median 3Q Max Coefficients: Estimate Std. Error z value Pr(> z ) (Intercept) ** logage *** conservative ** liberal *** latino e-05 *** education * smoke e-06 *** latino:education ** --- Signif. codes: 0 *** ** 0.01 * (Dispersion parameter for binomial family taken to be 1) Null deviance: on 707 degrees of freedom Residual deviance: on 700 degrees of freedom AIC: Number of Fisher Scoring iterations: 4

200 > > Anova(support.mod) Anova Table (Type II tests) Response: yeson86 LR Chisq Df Pr(>Chisq) logage *** conservative ** liberal *** latino *** education smoke e-07 *** latino:education ** --- Signif. codes: 0 *** ** 0.01 * >

201 Effects Displays Conditional effect holds.

202 Effects Displays Conditional effect holds. Consider ROC plot

203

204 Effects Displays Use effects package to plot conditional effect of education by Latino.

205 eff <- effect("latino:education", support.mod, xlevels=list(latino=0:1, education=1:10)) plot(eff, multiline=false, ylab="probability(support)", rug=false) (Thanks AKM for the help!)

206

207 Effects Displays Illustration using Fox s data on race and arrests.

208 Effects Displays Illustration using Fox s data on race and arrests. Data available in effects package.

209 Effects Displays Illustration using Fox s data on race and arrests. Data available in effects package. Some code.

210 > data(arrests) > Arrests$year <-as.factor(arrests$year) > arrests.mod <- glm(released ~ employed + citizen + checks + colour*year + colour*age, + family=binomial, data=arrests_ + summary(arrests.mod) Error: unexpected symbol in: " family=binomial, data=arrests_ summary" > data(arrests) > Arrests$year <-as.factor(arrests$year) > arrests.mod <- glm(released ~ employed + citizen + checks + colour*year + colour*age, + family=binomial, data=arrests) > summary(arrests.mod) Call: glm(formula = released ~ employed + citizen + checks + colour * year + colour * age, family = binomial, data = Arrests) Deviance Residuals: Min 1Q Median 3Q Max Coefficients: Estimate Std. Error z value Pr(> z ) (Intercept) employedyes < 2e-16 *** citizenyes e-07 *** checks < 2e-16 *** colourwhite *** year year year year year

Linear Regression Models P8111

Linear Regression Models P8111 Linear Regression Models P8111 Lecture 25 Jeff Goldsmith April 26, 2016 1 of 37 Today s Lecture Logistic regression / GLMs Model framework Interpretation Estimation 2 of 37 Linear regression Course started

More information

Day 2: Rethinking regression as a predictive tool

Day 2: Rethinking regression as a predictive tool Day 2: Rethinking regression as a predictive tool Kenneth Benoit Data Mining and Statistical Learning February 25, 2015 Classification and prediction as goals Machine learning focuses on identifying classes

More information

Inference. ME104: Linear Regression Analysis Kenneth Benoit. August 15, August 15, 2012 Lecture 3 Multiple linear regression 1 1 / 58

Inference. ME104: Linear Regression Analysis Kenneth Benoit. August 15, August 15, 2012 Lecture 3 Multiple linear regression 1 1 / 58 Inference ME104: Linear Regression Analysis Kenneth Benoit August 15, 2012 August 15, 2012 Lecture 3 Multiple linear regression 1 1 / 58 Stata output resvisited. reg votes1st spend_total incumb minister

More information

1 gamma.mixed: Mixed effects gamma regression

1 gamma.mixed: Mixed effects gamma regression gamma.mixed: Mixed effects gamma regression Use generalized multi-level linear regression if you have covariates that are grouped according to one or more classification factors. Gamma regression models

More information

7/28/15. Review Homework. Overview. Lecture 6: Logistic Regression Analysis

7/28/15. Review Homework. Overview. Lecture 6: Logistic Regression Analysis Lecture 6: Logistic Regression Analysis Christopher S. Hollenbeak, PhD Jane R. Schubart, PhD The Outcomes Research Toolbox Review Homework 2 Overview Logistic regression model conceptually Logistic regression

More information

0.1 blogit: Bivariate Logistic Regression for Two Dichotomous

0.1 blogit: Bivariate Logistic Regression for Two Dichotomous 0.1 blogit: Bivariate Logistic Regression for Two Dichotomous Dependent Variables Use the bivariate logistic regression model if you have two binary dependent variables (Y 1, Y 2 ), and wish to model them

More information

Logit Regression and Quantities of Interest

Logit Regression and Quantities of Interest Logit Regression and Quantities of Interest Stephen Pettigrew March 4, 2015 Stephen Pettigrew Logit Regression and Quantities of Interest March 4, 2015 1 / 57 Outline 1 Logistics 2 Generalized Linear Models

More information

Generalized linear models for binary data. A better graphical exploratory data analysis. The simple linear logistic regression model

Generalized linear models for binary data. A better graphical exploratory data analysis. The simple linear logistic regression model Stat 3302 (Spring 2017) Peter F. Craigmile Simple linear logistic regression (part 1) [Dobson and Barnett, 2008, Sections 7.1 7.3] Generalized linear models for binary data Beetles dose-response example

More information

Generalized Linear Models. Last time: Background & motivation for moving beyond linear

Generalized Linear Models. Last time: Background & motivation for moving beyond linear Generalized Linear Models Last time: Background & motivation for moving beyond linear regression - non-normal/non-linear cases, binary, categorical data Today s class: 1. Examples of count and ordered

More information

SCHOOL OF MATHEMATICS AND STATISTICS. Linear and Generalised Linear Models

SCHOOL OF MATHEMATICS AND STATISTICS. Linear and Generalised Linear Models SCHOOL OF MATHEMATICS AND STATISTICS Linear and Generalised Linear Models Autumn Semester 2017 18 2 hours Attempt all the questions. The allocation of marks is shown in brackets. RESTRICTED OPEN BOOK EXAMINATION

More information

Exam Applied Statistical Regression. Good Luck!

Exam Applied Statistical Regression. Good Luck! Dr. M. Dettling Summer 2011 Exam Applied Statistical Regression Approved: Tables: Note: Any written material, calculator (without communication facility). Attached. All tests have to be done at the 5%-level.

More information

Checking the Poisson assumption in the Poisson generalized linear model

Checking the Poisson assumption in the Poisson generalized linear model Checking the Poisson assumption in the Poisson generalized linear model The Poisson regression model is a generalized linear model (glm) satisfying the following assumptions: The responses y i are independent

More information

The Classical Linear Regression Model

The Classical Linear Regression Model The Classical Linear Regression Model ME104: Linear Regression Analysis Kenneth Benoit August 14, 2012 CLRM: Basic Assumptions 1. Specification: Relationship between X and Y in the population is linear:

More information

Classification. Chapter Introduction. 6.2 The Bayes classifier

Classification. Chapter Introduction. 6.2 The Bayes classifier Chapter 6 Classification 6.1 Introduction Often encountered in applications is the situation where the response variable Y takes values in a finite set of labels. For example, the response Y could encode

More information

UNIVERSITY OF TORONTO Faculty of Arts and Science

UNIVERSITY OF TORONTO Faculty of Arts and Science UNIVERSITY OF TORONTO Faculty of Arts and Science December 2013 Final Examination STA442H1F/2101HF Methods of Applied Statistics Jerry Brunner Duration - 3 hours Aids: Calculator Model(s): Any calculator

More information

Regression models. Generalized linear models in R. Normal regression models are not always appropriate. Generalized linear models. Examples.

Regression models. Generalized linear models in R. Normal regression models are not always appropriate. Generalized linear models. Examples. Regression models Generalized linear models in R Dr Peter K Dunn http://www.usq.edu.au Department of Mathematics and Computing University of Southern Queensland ASC, July 00 The usual linear regression

More information

0.1 oprobit: Ordinal Probit Regression for Ordered Categorical Dependent Variables

0.1 oprobit: Ordinal Probit Regression for Ordered Categorical Dependent Variables 0.1 oprobit: Ordinal Probit Regression for Ordered Categorical Dependent Variables Use the ordinal probit regression model if your dependent variables are ordered and categorical. They may take on either

More information

Clinical Trials. Olli Saarela. September 18, Dalla Lana School of Public Health University of Toronto.

Clinical Trials. Olli Saarela. September 18, Dalla Lana School of Public Health University of Toronto. Introduction to Dalla Lana School of Public Health University of Toronto olli.saarela@utoronto.ca September 18, 2014 38-1 : a review 38-2 Evidence Ideal: to advance the knowledge-base of clinical medicine,

More information

0.1 poisson.bayes: Bayesian Poisson Regression

0.1 poisson.bayes: Bayesian Poisson Regression 0.1 poisson.bayes: Bayesian Poisson Regression Use the Poisson regression model if the observations of your dependent variable represents the number of independent events that occur during a fixed period

More information

0.1 ologit: Ordinal Logistic Regression for Ordered Categorical Dependent Variables

0.1 ologit: Ordinal Logistic Regression for Ordered Categorical Dependent Variables 0.1 ologit: Ordinal Logistic Regression for Ordered Categorical Dependent Variables Use the ordinal logit regression model if your dependent variable is ordered and categorical, either in the form of integer

More information

STA102 Class Notes Chapter Logistic Regression

STA102 Class Notes Chapter Logistic Regression STA0 Class Notes Chapter 0 0. Logistic Regression We continue to study the relationship between a response variable and one or more eplanatory variables. For SLR and MLR (Chapters 8 and 9), our response

More information

Logit Regression and Quantities of Interest

Logit Regression and Quantities of Interest Logit Regression and Quantities of Interest Stephen Pettigrew March 5, 2014 Stephen Pettigrew Logit Regression and Quantities of Interest March 5, 2014 1 / 59 Outline 1 Logistics 2 Generalized Linear Models

More information

Logistic Regression. James H. Steiger. Department of Psychology and Human Development Vanderbilt University

Logistic Regression. James H. Steiger. Department of Psychology and Human Development Vanderbilt University Logistic Regression James H. Steiger Department of Psychology and Human Development Vanderbilt University James H. Steiger (Vanderbilt University) Logistic Regression 1 / 38 Logistic Regression 1 Introduction

More information

POLI 8501 Introduction to Maximum Likelihood Estimation

POLI 8501 Introduction to Maximum Likelihood Estimation POLI 8501 Introduction to Maximum Likelihood Estimation Maximum Likelihood Intuition Consider a model that looks like this: Y i N(µ, σ 2 ) So: E(Y ) = µ V ar(y ) = σ 2 Suppose you have some data on Y,

More information

Regression Methods for Survey Data

Regression Methods for Survey Data Regression Methods for Survey Data Professor Ron Fricker! Naval Postgraduate School! Monterey, California! 3/26/13 Reading:! Lohr chapter 11! 1 Goals for this Lecture! Linear regression! Review of linear

More information

Introduction to the Generalized Linear Model: Logistic regression and Poisson regression

Introduction to the Generalized Linear Model: Logistic regression and Poisson regression Introduction to the Generalized Linear Model: Logistic regression and Poisson regression Statistical modelling: Theory and practice Gilles Guillot gigu@dtu.dk November 4, 2013 Gilles Guillot (gigu@dtu.dk)

More information

Week 7 Multiple factors. Ch , Some miscellaneous parts

Week 7 Multiple factors. Ch , Some miscellaneous parts Week 7 Multiple factors Ch. 18-19, Some miscellaneous parts Multiple Factors Most experiments will involve multiple factors, some of which will be nuisance variables Dealing with these factors requires

More information

0.1 normal.bayes: Bayesian Normal Linear Regression

0.1 normal.bayes: Bayesian Normal Linear Regression 0.1 normal.bayes: Bayesian Normal Linear Regression Use Bayesian regression to specify a continuous dependent variable as a linear function of specified explanatory variables. The model is implemented

More information

Statistical Methods III Statistics 212. Problem Set 2 - Answer Key

Statistical Methods III Statistics 212. Problem Set 2 - Answer Key Statistical Methods III Statistics 212 Problem Set 2 - Answer Key 1. (Analysis to be turned in and discussed on Tuesday, April 24th) The data for this problem are taken from long-term followup of 1423

More information

Statistics Boot Camp. Dr. Stephanie Lane Institute for Defense Analyses DATAWorks 2018

Statistics Boot Camp. Dr. Stephanie Lane Institute for Defense Analyses DATAWorks 2018 Statistics Boot Camp Dr. Stephanie Lane Institute for Defense Analyses DATAWorks 2018 March 21, 2018 Outline of boot camp Summarizing and simplifying data Point and interval estimation Foundations of statistical

More information

0.1 ARIMA: ARIMA Models for Time Series Data

0.1 ARIMA: ARIMA Models for Time Series Data 0.1 ARIMA: ARIMA Models for Time Series Data Use auto-regressive, integrated, moving-average (ARIMA) models for time series data. A time series is a set of observations ordered according to the time they

More information

9 Generalized Linear Models

9 Generalized Linear Models 9 Generalized Linear Models The Generalized Linear Model (GLM) is a model which has been built to include a wide range of different models you already know, e.g. ANOVA and multiple linear regression models

More information

A Generalized Linear Model for Binomial Response Data. Copyright c 2017 Dan Nettleton (Iowa State University) Statistics / 46

A Generalized Linear Model for Binomial Response Data. Copyright c 2017 Dan Nettleton (Iowa State University) Statistics / 46 A Generalized Linear Model for Binomial Response Data Copyright c 2017 Dan Nettleton (Iowa State University) Statistics 510 1 / 46 Now suppose that instead of a Bernoulli response, we have a binomial response

More information

Logistic & Tobit Regression

Logistic & Tobit Regression Logistic & Tobit Regression Different Types of Regression Binary Regression (D) Logistic transformation + e P( y x) = 1 + e! " x! + " x " P( y x) % ln$ ' = ( + ) x # 1! P( y x) & logit of P(y x){ P(y

More information

R 2 and F -Tests and ANOVA

R 2 and F -Tests and ANOVA R 2 and F -Tests and ANOVA December 6, 2018 1 Partition of Sums of Squares The distance from any point y i in a collection of data, to the mean of the data ȳ, is the deviation, written as y i ȳ. Definition.

More information

Generalized linear models

Generalized linear models Generalized linear models Douglas Bates November 01, 2010 Contents 1 Definition 1 2 Links 2 3 Estimating parameters 5 4 Example 6 5 Model building 8 6 Conclusions 8 7 Summary 9 1 Generalized Linear Models

More information

Fall 2017 STAT 532 Homework Peter Hoff. 1. Let P be a probability measure on a collection of sets A.

Fall 2017 STAT 532 Homework Peter Hoff. 1. Let P be a probability measure on a collection of sets A. 1. Let P be a probability measure on a collection of sets A. (a) For each n N, let H n be a set in A such that H n H n+1. Show that P (H n ) monotonically converges to P ( k=1 H k) as n. (b) For each n

More information

Section 4.6 Simple Linear Regression

Section 4.6 Simple Linear Regression Section 4.6 Simple Linear Regression Objectives ˆ Basic philosophy of SLR and the regression assumptions ˆ Point & interval estimation of the model parameters, and how to make predictions ˆ Point and interval

More information

Logistic Regressions. Stat 430

Logistic Regressions. Stat 430 Logistic Regressions Stat 430 Final Project Final Project is, again, team based You will decide on a project - only constraint is: you are supposed to use techniques for a solution that are related to

More information

Machine Learning Linear Classification. Prof. Matteo Matteucci

Machine Learning Linear Classification. Prof. Matteo Matteucci Machine Learning Linear Classification Prof. Matteo Matteucci Recall from the first lecture 2 X R p Regression Y R Continuous Output X R p Y {Ω 0, Ω 1,, Ω K } Classification Discrete Output X R p Y (X)

More information

Review of Statistics 101

Review of Statistics 101 Review of Statistics 101 We review some important themes from the course 1. Introduction Statistics- Set of methods for collecting/analyzing data (the art and science of learning from data). Provides methods

More information

0.1 weibull: Weibull Regression for Duration Dependent

0.1 weibull: Weibull Regression for Duration Dependent 0.1 weibull: Weibull Regression for Duration Dependent Variables Choose the Weibull regression model if the values in your dependent variable are duration observations. The Weibull model relaxes the exponential

More information

Using R in 200D Luke Sonnet

Using R in 200D Luke Sonnet Using R in 200D Luke Sonnet Contents Working with data frames 1 Working with variables........................................... 1 Analyzing data............................................... 3 Random

More information

Exercise 5.4 Solution

Exercise 5.4 Solution Exercise 5.4 Solution Niels Richard Hansen University of Copenhagen May 7, 2010 1 5.4(a) > leukemia

More information

Visualizing Inference

Visualizing Inference CSSS 569: Visualizing Data Visualizing Inference Christopher Adolph University of Washington, Seattle February 23, 2011 Assistant Professor, Department of Political Science and Center for Statistics and

More information

Matched Pair Data. Stat 557 Heike Hofmann

Matched Pair Data. Stat 557 Heike Hofmann Matched Pair Data Stat 557 Heike Hofmann Outline Marginal Homogeneity - review Binary Response with covariates Ordinal response Symmetric Models Subject-specific vs Marginal Model conditional logistic

More information

Advanced Quantitative Methods: limited dependent variables

Advanced Quantitative Methods: limited dependent variables Advanced Quantitative Methods: Limited Dependent Variables I University College Dublin 2 April 2013 1 2 3 4 5 Outline Model Measurement levels 1 2 3 4 5 Components Model Measurement levels Two components

More information

STA 4504/5503 Sample Exam 1 Spring 2011 Categorical Data Analysis. 1. Indicate whether each of the following is true (T) or false (F).

STA 4504/5503 Sample Exam 1 Spring 2011 Categorical Data Analysis. 1. Indicate whether each of the following is true (T) or false (F). STA 4504/5503 Sample Exam 1 Spring 2011 Categorical Data Analysis 1. Indicate whether each of the following is true (T) or false (F). (a) T In 2 2 tables, statistical independence is equivalent to a population

More information

Visualizing Inference

Visualizing Inference CSSS 569: Visualizing Data Visualizing Inference Christopher Adolph University of Washington, Seattle February 23, 2011 Assistant Professor, Department of Political Science and Center for Statistics and

More information

Part 8: GLMs and Hierarchical LMs and GLMs

Part 8: GLMs and Hierarchical LMs and GLMs Part 8: GLMs and Hierarchical LMs and GLMs 1 Example: Song sparrow reproductive success Arcese et al., (1992) provide data on a sample from a population of 52 female song sparrows studied over the course

More information

Statistics 203 Introduction to Regression Models and ANOVA Practice Exam

Statistics 203 Introduction to Regression Models and ANOVA Practice Exam Statistics 203 Introduction to Regression Models and ANOVA Practice Exam Prof. J. Taylor You may use your 4 single-sided pages of notes This exam is 7 pages long. There are 4 questions, first 3 worth 10

More information

Linear Regression. Data Model. β, σ 2. Process Model. ,V β. ,s 2. s 1. Parameter Model

Linear Regression. Data Model. β, σ 2. Process Model. ,V β. ,s 2. s 1. Parameter Model Regression: Part II Linear Regression y~n X, 2 X Y Data Model β, σ 2 Process Model Β 0,V β s 1,s 2 Parameter Model Assumptions of Linear Model Homoskedasticity No error in X variables Error in Y variables

More information

Logistic Regression - problem 6.14

Logistic Regression - problem 6.14 Logistic Regression - problem 6.14 Let x 1, x 2,, x m be given values of an input variable x and let Y 1,, Y m be independent binomial random variables whose distributions depend on the corresponding values

More information

Generalized Linear Models

Generalized Linear Models Generalized Linear Models Methods@Manchester Summer School Manchester University July 2 6, 2018 Generalized Linear Models: a generic approach to statistical modelling www.research-training.net/manchester2018

More information

Generalized Linear Models. stat 557 Heike Hofmann

Generalized Linear Models. stat 557 Heike Hofmann Generalized Linear Models stat 557 Heike Hofmann Outline Intro to GLM Exponential Family Likelihood Equations GLM for Binomial Response Generalized Linear Models Three components: random, systematic, link

More information

Today. HW 1: due February 4, pm. Aspects of Design CD Chapter 2. Continue with Chapter 2 of ELM. In the News:

Today. HW 1: due February 4, pm. Aspects of Design CD Chapter 2. Continue with Chapter 2 of ELM. In the News: Today HW 1: due February 4, 11.59 pm. Aspects of Design CD Chapter 2 Continue with Chapter 2 of ELM In the News: STA 2201: Applied Statistics II January 14, 2015 1/35 Recap: data on proportions data: y

More information

1. Logistic Regression, One Predictor 2. Inference: Estimating the Parameters 3. Multiple Logistic Regression 4. AIC and BIC in Logistic Regression

1. Logistic Regression, One Predictor 2. Inference: Estimating the Parameters 3. Multiple Logistic Regression 4. AIC and BIC in Logistic Regression Logistic Regression 1. Logistic Regression, One Predictor 2. Inference: Estimating the Parameters 3. Multiple Logistic Regression 4. AIC and BIC in Logistic Regression 5. Target Marketing: Tabloid Data

More information

Recap. HW due Thursday by 5 pm Next HW coming on Thursday Logistic regression: Pr(G = k X) linear on the logit scale Linear discriminant analysis:

Recap. HW due Thursday by 5 pm Next HW coming on Thursday Logistic regression: Pr(G = k X) linear on the logit scale Linear discriminant analysis: 1 / 23 Recap HW due Thursday by 5 pm Next HW coming on Thursday Logistic regression: Pr(G = k X) linear on the logit scale Linear discriminant analysis: Pr(G = k X) Pr(X G = k)pr(g = k) Theory: LDA more

More information

Logistic Regression 21/05

Logistic Regression 21/05 Logistic Regression 21/05 Recall that we are trying to solve a classification problem in which features x i can be continuous or discrete (coded as 0/1) and the response y is discrete (0/1). Logistic regression

More information

Regression and Models with Multiple Factors. Ch. 17, 18

Regression and Models with Multiple Factors. Ch. 17, 18 Regression and Models with Multiple Factors Ch. 17, 18 Mass 15 20 25 Scatter Plot 70 75 80 Snout-Vent Length Mass 15 20 25 Linear Regression 70 75 80 Snout-Vent Length Least-squares The method of least

More information

Review of Panel Data Model Types Next Steps. Panel GLMs. Department of Political Science and Government Aarhus University.

Review of Panel Data Model Types Next Steps. Panel GLMs. Department of Political Science and Government Aarhus University. Panel GLMs Department of Political Science and Government Aarhus University May 12, 2015 1 Review of Panel Data 2 Model Types 3 Review and Looking Forward 1 Review of Panel Data 2 Model Types 3 Review

More information

12 Modelling Binomial Response Data

12 Modelling Binomial Response Data c 2005, Anthony C. Brooms Statistical Modelling and Data Analysis 12 Modelling Binomial Response Data 12.1 Examples of Binary Response Data Binary response data arise when an observation on an individual

More information

Generalized Linear Models for Non-Normal Data

Generalized Linear Models for Non-Normal Data Generalized Linear Models for Non-Normal Data Today s Class: 3 parts of a generalized model Models for binary outcomes Complications for generalized multivariate or multilevel models SPLH 861: Lecture

More information

Lecture 14: Introduction to Poisson Regression

Lecture 14: Introduction to Poisson Regression Lecture 14: Introduction to Poisson Regression Ani Manichaikul amanicha@jhsph.edu 8 May 2007 1 / 52 Overview Modelling counts Contingency tables Poisson regression models 2 / 52 Modelling counts I Why

More information

Modelling counts. Lecture 14: Introduction to Poisson Regression. Overview

Modelling counts. Lecture 14: Introduction to Poisson Regression. Overview Modelling counts I Lecture 14: Introduction to Poisson Regression Ani Manichaikul amanicha@jhsph.edu Why count data? Number of traffic accidents per day Mortality counts in a given neighborhood, per week

More information

Introduction to the Analysis of Tabular Data

Introduction to the Analysis of Tabular Data Introduction to the Analysis of Tabular Data Anthropological Sciences 192/292 Data Analysis in the Anthropological Sciences James Holland Jones & Ian G. Robertson March 15, 2006 1 Tabular Data Is there

More information

STAT 526 Spring Midterm 1. Wednesday February 2, 2011

STAT 526 Spring Midterm 1. Wednesday February 2, 2011 STAT 526 Spring 2011 Midterm 1 Wednesday February 2, 2011 Time: 2 hours Name (please print): Show all your work and calculations. Partial credit will be given for work that is partially correct. Points

More information

Regression modeling for categorical data. Part II : Model selection and prediction

Regression modeling for categorical data. Part II : Model selection and prediction Regression modeling for categorical data Part II : Model selection and prediction David Causeur Agrocampus Ouest IRMAR CNRS UMR 6625 http://math.agrocampus-ouest.fr/infogluedeliverlive/membres/david.causeur

More information

Checking, Selecting & Predicting with GAMs. Simon Wood Mathematical Sciences, University of Bath, U.K.

Checking, Selecting & Predicting with GAMs. Simon Wood Mathematical Sciences, University of Bath, U.K. Checking, Selecting & Predicting with GAMs Simon Wood Mathematical Sciences, University of Bath, U.K. Model checking Since a GAM is just a penalized GLM, residual plots should be checked, exactly as for

More information

Various Issues in Fitting Contingency Tables

Various Issues in Fitting Contingency Tables Various Issues in Fitting Contingency Tables Statistics 149 Spring 2006 Copyright 2006 by Mark E. Irwin Complete Tables with Zero Entries In contingency tables, it is possible to have zero entries in a

More information

Truck prices - linear model? Truck prices - log transform of the response variable. Interpreting models with log transformation

Truck prices - linear model? Truck prices - log transform of the response variable. Interpreting models with log transformation Background Regression so far... Lecture 23 - Sta 111 Colin Rundel June 17, 2014 At this point we have covered: Simple linear regression Relationship between numerical response and a numerical or categorical

More information

Final Exam. Name: Solution:

Final Exam. Name: Solution: Final Exam. Name: Instructions. Answer all questions on the exam. Open books, open notes, but no electronic devices. The first 13 problems are worth 5 points each. The rest are worth 1 point each. HW1.

More information

Regression so far... Lecture 21 - Logistic Regression. Odds. Recap of what you should know how to do... At this point we have covered: Sta102 / BME102

Regression so far... Lecture 21 - Logistic Regression. Odds. Recap of what you should know how to do... At this point we have covered: Sta102 / BME102 Background Regression so far... Lecture 21 - Sta102 / BME102 Colin Rundel November 18, 2014 At this point we have covered: Simple linear regression Relationship between numerical response and a numerical

More information

Linear Regression With Special Variables

Linear Regression With Special Variables Linear Regression With Special Variables Junhui Qian December 21, 2014 Outline Standardized Scores Quadratic Terms Interaction Terms Binary Explanatory Variables Binary Choice Models Standardized Scores:

More information

STA 303 H1S / 1002 HS Winter 2011 Test March 7, ab 1cde 2abcde 2fghij 3

STA 303 H1S / 1002 HS Winter 2011 Test March 7, ab 1cde 2abcde 2fghij 3 STA 303 H1S / 1002 HS Winter 2011 Test March 7, 2011 LAST NAME: FIRST NAME: STUDENT NUMBER: ENROLLED IN: (circle one) STA 303 STA 1002 INSTRUCTIONS: Time: 90 minutes Aids allowed: calculator. Some formulae

More information

Statistical Prediction

Statistical Prediction Statistical Prediction P.R. Hahn Fall 2017 1 Some terminology The goal is to use data to find a pattern that we can exploit. y: response/outcome/dependent/left-hand-side x: predictor/covariate/feature/independent

More information

Linear models and their mathematical foundations: Simple linear regression

Linear models and their mathematical foundations: Simple linear regression Linear models and their mathematical foundations: Simple linear regression Steffen Unkel Department of Medical Statistics University Medical Center Göttingen, Germany Winter term 2018/19 1/21 Introduction

More information

Generalized Linear Models

Generalized Linear Models Generalized Linear Models Advanced Methods for Data Analysis (36-402/36-608 Spring 2014 1 Generalized linear models 1.1 Introduction: two regressions So far we ve seen two canonical settings for regression.

More information

ˆπ(x) = exp(ˆα + ˆβ T x) 1 + exp(ˆα + ˆβ T.

ˆπ(x) = exp(ˆα + ˆβ T x) 1 + exp(ˆα + ˆβ T. Exam 3 Review Suppose that X i = x =(x 1,, x k ) T is observed and that Y i X i = x i independent Binomial(n i,π(x i )) for i =1,, N where ˆπ(x) = exp(ˆα + ˆβ T x) 1 + exp(ˆα + ˆβ T x) This is called the

More information

A strategy for modelling count data which may have extra zeros

A strategy for modelling count data which may have extra zeros A strategy for modelling count data which may have extra zeros Alan Welsh Centre for Mathematics and its Applications Australian National University The Data Response is the number of Leadbeater s possum

More information

Chapter 11. Regression with a Binary Dependent Variable

Chapter 11. Regression with a Binary Dependent Variable Chapter 11 Regression with a Binary Dependent Variable 2 Regression with a Binary Dependent Variable (SW Chapter 11) So far the dependent variable (Y) has been continuous: district-wide average test score

More information

Week 2: Review of probability and statistics

Week 2: Review of probability and statistics Week 2: Review of probability and statistics Marcelo Coca Perraillon University of Colorado Anschutz Medical Campus Health Services Research Methods I HSMP 7607 2017 c 2017 PERRAILLON ALL RIGHTS RESERVED

More information

Econometrics II. Seppo Pynnönen. Spring Department of Mathematics and Statistics, University of Vaasa, Finland

Econometrics II. Seppo Pynnönen. Spring Department of Mathematics and Statistics, University of Vaasa, Finland Department of Mathematics and Statistics, University of Vaasa, Finland Spring 2018 Part III Limited Dependent Variable Models As of Jan 30, 2017 1 Background 2 Binary Dependent Variable The Linear Probability

More information

401 Review. 6. Power analysis for one/two-sample hypothesis tests and for correlation analysis.

401 Review. 6. Power analysis for one/two-sample hypothesis tests and for correlation analysis. 401 Review Major topics of the course 1. Univariate analysis 2. Bivariate analysis 3. Simple linear regression 4. Linear algebra 5. Multiple regression analysis Major analysis methods 1. Graphical analysis

More information

Generalised linear models. Response variable can take a number of different formats

Generalised linear models. Response variable can take a number of different formats Generalised linear models Response variable can take a number of different formats Structure Limitations of linear models and GLM theory GLM for count data GLM for presence \ absence data GLM for proportion

More information

The Simple Linear Regression Model

The Simple Linear Regression Model The Simple Linear Regression Model Lesson 3 Ryan Safner 1 1 Department of Economics Hood College ECON 480 - Econometrics Fall 2017 Ryan Safner (Hood College) ECON 480 - Lesson 3 Fall 2017 1 / 77 Bivariate

More information

LOGISTIC REGRESSION Joseph M. Hilbe

LOGISTIC REGRESSION Joseph M. Hilbe LOGISTIC REGRESSION Joseph M. Hilbe Arizona State University Logistic regression is the most common method used to model binary response data. When the response is binary, it typically takes the form of

More information

Modeling Overdispersion

Modeling Overdispersion James H. Steiger Department of Psychology and Human Development Vanderbilt University Regression Modeling, 2009 1 Introduction 2 Introduction In this lecture we discuss the problem of overdispersion in

More information

Generalized Linear Models

Generalized Linear Models York SPIDA John Fox Notes Generalized Linear Models Copyright 2010 by John Fox Generalized Linear Models 1 1. Topics I The structure of generalized linear models I Poisson and other generalized linear

More information

BMI 541/699 Lecture 22

BMI 541/699 Lecture 22 BMI 541/699 Lecture 22 Where we are: 1. Introduction and Experimental Design 2. Exploratory Data Analysis 3. Probability 4. T-based methods for continous variables 5. Power and sample size for t-based

More information

Causal Mediation Analysis in R. Quantitative Methodology and Causal Mechanisms

Causal Mediation Analysis in R. Quantitative Methodology and Causal Mechanisms Causal Mediation Analysis in R Kosuke Imai Princeton University June 18, 2009 Joint work with Luke Keele (Ohio State) Dustin Tingley and Teppei Yamamoto (Princeton) Kosuke Imai (Princeton) Causal Mediation

More information

Applied Statistics. J. Blanchet and J. Wadsworth. Institute of Mathematics, Analysis, and Applications EPF Lausanne

Applied Statistics. J. Blanchet and J. Wadsworth. Institute of Mathematics, Analysis, and Applications EPF Lausanne Applied Statistics J. Blanchet and J. Wadsworth Institute of Mathematics, Analysis, and Applications EPF Lausanne An MSc Course for Applied Mathematicians, Fall 2012 Outline 1 Motivation: Why Applied Statistics?

More information

First Year Examination Department of Statistics, University of Florida

First Year Examination Department of Statistics, University of Florida First Year Examination Department of Statistics, University of Florida August 20, 2009, 8:00 am - 2:00 noon Instructions:. You have four hours to answer questions in this examination. 2. You must show

More information

0.1 gamma.mixed: Mixed effects gamma regression

0.1 gamma.mixed: Mixed effects gamma regression 0. gamma.mixed: Mixed effects gamma regression Use generalized multi-level linear regression if you have covariates that are grouped according to one or more classification factors. Gamma regression models

More information

Lecture 18: Simple Linear Regression

Lecture 18: Simple Linear Regression Lecture 18: Simple Linear Regression BIOS 553 Department of Biostatistics University of Michigan Fall 2004 The Correlation Coefficient: r The correlation coefficient (r) is a number that measures the strength

More information

Tento projekt je spolufinancován Evropským sociálním fondem a Státním rozpočtem ČR InoBio CZ.1.07/2.2.00/

Tento projekt je spolufinancován Evropským sociálním fondem a Státním rozpočtem ČR InoBio CZ.1.07/2.2.00/ Tento projekt je spolufinancován Evropským sociálním fondem a Státním rozpočtem ČR InoBio CZ.1.07/2.2.00/28.0018 Statistical Analysis in Ecology using R Linear Models/GLM Ing. Daniel Volařík, Ph.D. 13.

More information

Multiple regression: Categorical dependent variables

Multiple regression: Categorical dependent variables Multiple : Categorical Johan A. Elkink School of Politics & International Relations University College Dublin 28 November 2016 1 2 3 4 Outline 1 2 3 4 models models have a variable consisting of two categories.

More information

Non-Gaussian Response Variables

Non-Gaussian Response Variables Non-Gaussian Response Variables What is the Generalized Model Doing? The fixed effects are like the factors in a traditional analysis of variance or linear model The random effects are different A generalized

More information

Review: what is a linear model. Y = β 0 + β 1 X 1 + β 2 X 2 + A model of the following form:

Review: what is a linear model. Y = β 0 + β 1 X 1 + β 2 X 2 + A model of the following form: Outline for today What is a generalized linear model Linear predictors and link functions Example: fit a constant (the proportion) Analysis of deviance table Example: fit dose-response data using logistic

More information

cor(dataset$measurement1, dataset$measurement2, method= pearson ) cor.test(datavector1, datavector2, method= pearson )

cor(dataset$measurement1, dataset$measurement2, method= pearson ) cor.test(datavector1, datavector2, method= pearson ) Tutorial 7: Correlation and Regression Correlation Used to test whether two variables are linearly associated. A correlation coefficient (r) indicates the strength and direction of the association. A correlation

More information