Showing posts with label Beta. Show all posts
Showing posts with label Beta. Show all posts

Monday, June 8, 2015

Four Bayesian model comparison

I now have four different Bayesian models for estimating the two-party preferred (TPP) vote share for the Coalition from multiple polling house sources.

  • A dynamic linear model with input from TPP polling data
  • A dynamic linear model with input from the primary voting intention polling data
  • A Beta-walk model with input from TPP polling data; and
  • A Dirichlet-walk model with input from the primary voting intention polling data

While each is a hidden Markov model, they use different input data (the TPP estimate or the primary vote estimates from the polling houses), and they use different distributions to propagate the Markov process in the hidden Markov model (the Normal, Dirichlet, or Beta distributions). The models based on the Normal distribution are dynamic linear models (DLM).

Because of size constraints, only the models which use the pollsters' TPP input data have a daily hidden Markov model. In these models, we estimate the hidden Coalition TPP vote share for each day in the period under analysis.

The models that use the primary vote data from the pollsters track a weekly hidden Markov model. In these models, we estimate the hidden Coalition TPP vote share for each week in the period under analysis. The weeks in these models begin on the first day of the earliest poll in the input.

All of the models are processed using the free JAGS software. The fastest model is the TPP dynamic linear model. The slowest model (by a country mile) is the primary vote share dynamic linear model. In the context of model speed, I am thinking of testing the Biips software, which claims to be faster than JAGS. But any move from JAGS will take some time.

Differences can arise between the models for a host of reasons. Comparing the models can be useful for better understanding the underlying trends in voting preferences (and whether there are issues that need to be factored into future analysis).

At the moment there is a substantial divergence between the TPP models and the primary vote share models. My suspicion is that this has come about because of the collapse of the Palmer United Party, and the way in which pollsters allocate preferences based on preference-flows at the last election and the stated voting intention of poll respondents, but I will need to do some work to test this hypothesis.




Sunday, June 7, 2015

Charting the collapse of the Palmer United Party

There was a time when the Palmer United Party (PUP) looked like a force to be reckoned with. It commanded 6.5 per cent of the primary vote, a seat in the House of Representatives, and Senate seats for Queensland, Tasmania and Western Australia. But since then, the PUP share of the primary vote has fallen dramatically.



For those who are interested in these things, I aggregated the Palmer primary vote polls using a Beta-walk model. The Beta-walk model follows.

model {

    #### -- observational model
    for(poll in 1:NUMPOLLS) { # for each poll result - rows
        adjusted_poll[poll] <- walk[pollDay[poll]] + houseEffect[house[poll]]
        palmerVotes[poll] ~ dbin(adjusted_poll[poll], n[poll])
    }

    #### -- temporal model (a daily walk where this today is much like yesterday)
    tightness <- 50000 # tightness of fit parameter
    for(day in 2:PERIOD) { # rows
        binomial[day] <- walk[day-1] * tightness
        walk[day] ~ dbeta(binomial[day], tightness - binomial[day])
    }

    ## -- weakly informative priors for first day in the temporal model
    alpha ~ dunif(1, 1500)
    walk[1] ~ dbeta(alpha, 10000-alpha)

    #### -- sum-to-zero constraints on house effects
    for(house in 2:HOUSECOUNT) { # for each house ...
        houseEffect[house] ~ dnorm(0, pow(0.1, -2))
    }
    houseEffect[1] <- -sum(houseEffect[2:HOUSECOUNT])
}

I did not include Palmer United in my primary vote models because Newspoll does not publish a primary vote estimate for Palmer United. Newspoll includes Palmer United in its other parties count.