Title: | Nash Optimal Party Positions |
---|---|
Description: | Estimation of party/candidate ideological positions that correspond to a Nash equilibrium along a one-dimensional space as in Curini and Iacus (2017) <doi:10.18637/jss.v081.i11>. |
Authors: | Luigi Curini, Stefano M. Iacus |
Maintainer: | Stefano M. Iacus <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.1.3 |
Built: | 2024-11-03 03:49:52 UTC |
Source: | https://github.com/siacus/nopp |
Estimation of party/candidate ideological positions that correspond to a Nash equilibrium along a one-dimensional space
Package: | nopp |
Type: | Package |
Version: | 1.0 |
Date: | 2012-06-26 |
License: | GPL (>= 2) |
nopp
is a package for R
which enables to compute party/candidate ideological positions that correspond to a Nash Equilibrium along a one-dimensional space. It accommodates alternative motivations in (each) party strategy while allowing to estimate the uncertainty around their optimal positions through two different procedures (bootstrap and MC).
Luigi Curini, Stefano M. Iacus
Maintainer: Luigi Curini <[email protected]>, Stefano M. Iacus <[email protected]>
Adams, James F., Samuel Merrill III, and Bernard Grofman (2005). A Unified Theory of Party Competition. Cambridge: Cambridge University Press
Merrill, Samuel III, and James Adams (2001), Computing Nash Equilibria in Probabilistic, Multiparty Spatial Models with Nonpolicy Components, Political Analysis, 9, 347–61
Curini, L., and Iacus, S.M. (2017) Nash Optimal Party Positions: The nopp R Package, Journal of Statistical Software, 81(11), 1–25
Nash Optimal Party Positions
equilibrium(start, model, data, tolerance = 1e-05, max.iter = 100, coal = 0, alpha = 0, margin = NULL, fixed = NULL, gamma = 0, boot = 0, MC = 0, self.var = "self", prox.var="prox", position=NULL, votes=NULL, quadratic=TRUE, conf.level = 0.95)
equilibrium(start, model, data, tolerance = 1e-05, max.iter = 100, coal = 0, alpha = 0, margin = NULL, fixed = NULL, gamma = 0, boot = 0, MC = 0, self.var = "self", prox.var="prox", position=NULL, votes=NULL, quadratic=TRUE, conf.level = 0.95)
start |
initial party positions. Numerical vector. Optional. |
model |
the |
data |
the data set |
tolerance |
tolerance in the convergence of Nash equilibrium. Default |
max.iter |
max iteration to convergence in Nash equilibrium. Default |
coal |
a |
alpha |
the weight of coalition vote-share in party utility function. Default = 0. See Details. |
margin |
a |
fixed |
a |
gamma |
the weight among nash and fixed arty position. Default=0. See Details. |
boot |
number of boostrap replications. See Details. |
MC |
number of Monte Carlo replications. See Details. |
self.var |
|
prox.var |
|
position |
a named |
votes |
a named |
quadratic |
a logical value: if |
conf.level |
significant level for empirical Monte Carlo or bootstrap confidence intervals. |
See vignette.
an object of class nash.eq
See the vignette for detailed explanations and other working examples.
Luigi Curini, Stefano M. Iacus
Adams, James F., Samuel Merrill III, and Bernard Grofman (2005). A Unified Theory of Party Competition. Cambridge: Cambridge University Press
Merrill, Samuel III, and James Adams (2001), Computing Nash Equilibria in Probabilistic, Multiparty Spatial Models with Nonpolicy Components, Political Analysis, 9, 347–61
Curini, L., and Iacus, S.M. (2017) Nash Optimal Party Positions: The nopp R Package, Journal of Statistical Software, 81(11), 1–25
See Also as plot.nash.eq
## Not run: data(italy2006) str(italy2006) italy2006[1:2,1:14] election <- set.data(italy2006 , shape="wide", choice="vote", varying=c(5:14), sep="_") str(election) m <- mlogit(vote~prox+partyID | gov_perf+sex+age+education, election, reflevel = "UL") summary(m) true.pos <- list(FI=7.59, UL=3.50, RC=1.95, AN=8.08, UDC=5.66) true.votes <- list(FI=.24, UL=.40, RC=.10, AN=.18, UDC=.08) # model 1: comparison against true votes and party positions nash.eq <- equilibrium(model=m, data=election, pos=true.pos, votes=true.votes) nash.eq par(mfrow=c(3,1)) plot(nash.eq) par(mfrow=c(1,1)) # model 2: colation behaviours coal1 <- list(FI=1, UL=2, RC=2, AN=1, UDC=1) alpha1 <- list(FI=0.5, UL=0.5, RC=0.5, AN=0.5, UDC=0.5) nash.eq <- equilibrium(model=m, data=election, coal=coal1, alpha=alpha1) nash.eq # model 3: colation behaviours coal1 <- list(FI=1, UL=2, RC=2, AN=1, UDC=1) alpha1 <- list(FI=0.7, UL=0.8, RC=0.1, AN=0.5, UDC=0.9) nash.eq <- equilibrium(model=m, data=election, coal=coal1, alpha=alpha1) nash.eq # model 4: rivals tends to separate each other nash.eq <- equilibrium(model=m, data=election, margin=list(FI="UL", UL="FI")) nash.eq # model 5: fixed position averaged with Nash equilibrium solution nash.eq <- equilibrium(model=m, data=election, fixed=list(RC=1), gamma=0.2) nash.eq # model 6: rivals tends to separate each other with # fixed position averaged with Nash equilibrium solution nash.eq <- equilibrium(model=m, data=election, margin=list(FI="UL", UL="FI"), fixed=list(RC=1), gamma=0.2) nash.eq # model 7: coalition and fixed position averaged with # Nash equilibrium solution coal1 <- list(FI=1, UL=2, RC=2, AN=1, UDC=1) alpha1 <- list(FI=0.7, UL=0.8, RC=0.5, AN=0.5, UDC=0.5) nash.eq <- equilibrium(model=m, data=election, coal=coal1, alpha=alpha1, fixed=list(RC=1), gamma=0.2) nash.eq # model 8: Bootstrap analysis set.seed(280715) nash.eq <- equilibrium(model=m, data=election, boot=10) nash.eq # model 9: Monte Carlo simulation set.seed(280715) nash.eq <- equilibrium(model=m, data=election, MC=10) nash.eq ## End(Not run)
## Not run: data(italy2006) str(italy2006) italy2006[1:2,1:14] election <- set.data(italy2006 , shape="wide", choice="vote", varying=c(5:14), sep="_") str(election) m <- mlogit(vote~prox+partyID | gov_perf+sex+age+education, election, reflevel = "UL") summary(m) true.pos <- list(FI=7.59, UL=3.50, RC=1.95, AN=8.08, UDC=5.66) true.votes <- list(FI=.24, UL=.40, RC=.10, AN=.18, UDC=.08) # model 1: comparison against true votes and party positions nash.eq <- equilibrium(model=m, data=election, pos=true.pos, votes=true.votes) nash.eq par(mfrow=c(3,1)) plot(nash.eq) par(mfrow=c(1,1)) # model 2: colation behaviours coal1 <- list(FI=1, UL=2, RC=2, AN=1, UDC=1) alpha1 <- list(FI=0.5, UL=0.5, RC=0.5, AN=0.5, UDC=0.5) nash.eq <- equilibrium(model=m, data=election, coal=coal1, alpha=alpha1) nash.eq # model 3: colation behaviours coal1 <- list(FI=1, UL=2, RC=2, AN=1, UDC=1) alpha1 <- list(FI=0.7, UL=0.8, RC=0.1, AN=0.5, UDC=0.9) nash.eq <- equilibrium(model=m, data=election, coal=coal1, alpha=alpha1) nash.eq # model 4: rivals tends to separate each other nash.eq <- equilibrium(model=m, data=election, margin=list(FI="UL", UL="FI")) nash.eq # model 5: fixed position averaged with Nash equilibrium solution nash.eq <- equilibrium(model=m, data=election, fixed=list(RC=1), gamma=0.2) nash.eq # model 6: rivals tends to separate each other with # fixed position averaged with Nash equilibrium solution nash.eq <- equilibrium(model=m, data=election, margin=list(FI="UL", UL="FI"), fixed=list(RC=1), gamma=0.2) nash.eq # model 7: coalition and fixed position averaged with # Nash equilibrium solution coal1 <- list(FI=1, UL=2, RC=2, AN=1, UDC=1) alpha1 <- list(FI=0.7, UL=0.8, RC=0.5, AN=0.5, UDC=0.5) nash.eq <- equilibrium(model=m, data=election, coal=coal1, alpha=alpha1, fixed=list(RC=1), gamma=0.2) nash.eq # model 8: Bootstrap analysis set.seed(280715) nash.eq <- equilibrium(model=m, data=election, boot=10) nash.eq # model 9: Monte Carlo simulation set.seed(280715) nash.eq <- equilibrium(model=m, data=election, MC=10) nash.eq ## End(Not run)
2006 Italian General Election survey, with quadratic ideological proximity.
data(italy2006)
data(italy2006)
A data frame with 438 observations on the following 18 variables.
country
country name
id
id of respondent
vote
a factor with levels FI
UL
AN
UDC
RC
for each party voted
self
self-placement of respondent on a 0 to 10 left-right scale
prox_FI
see Details.
prox_UL
see Details.
prox_AN
see Details.
prox_UDC
see Details.
prox_RC
see Details.
partyID_FI
see Details.
partyID_UL
see Details.
partyID_AN
see Details.
partyID_UDC
see Details.
partyID_RC
see Details.
sex
gender variable 1
= female
age
see Details.
education
see Details.
gov_perf
see Details.
In this survey respondents were asked to indicate which party they voted for in the 2006 Election. The data concerns 5 parties: UL (Ulivo), RC (Communist Refoundation party), FI (Forza Italia), AN (National Alliance) and UDC (Union of Christian Democrats).
prox_*
quadratic ideological distance between the respondent and a party *
placement
partyID_*
binary variable equals to 1
if the respondent declares to feel herself close to party *
age
: 1 = "18-24 years", 2 = "25-34", 3 = "35-44", 4 = "45-54", 5 = "55-64", 6 = "65 +"
education
: 0 = "up to primary school", 1 = "incomplete secondary", 2 = "secondary completed", 3 = "post-secondary trade", 4 = "university undergraduate degree inc", 5 = "university undergraduate degree comp"
gov_perf
: 1 = "very good job", 2 = "good job", 3 = "bad job", 4 = "very bad job"
CSES - Comparative Study of Electoral Systems: https://cses.org/).
data(italy2006) head(italy2006)
data(italy2006) head(italy2006)
2006 Italian General Election survey, with linear ideological proximity.
data(italy2006.lin)
data(italy2006.lin)
A data frame with 438 observations on the following 18 variables.
country
country name
id
id of respondent
vote
a factor with levels FI
UL
AN
UDC
RC
for each party voted
self
self-placement of respondent on a 0 to 10 left-right scale
proxlin_FI
see Details.
proxlin_UL
see Details.
proxlin_AN
see Details.
proxlin_UDC
see Details.
proxlin_RC
see Details.
partyID_FI
see Details.
partyID_UL
see Details.
partyID_AN
see Details.
partyID_UDC
see Details.
partyID_RC
see Details.
sex
gender variable 1
= female
age
see Details.
education
see Details.
gov_perf
see Details.
In this survey respondents were asked to indicate which party they voted for in the 2006 Election. The data concerns 5 parties: UL (Ulivo), RC (Communist Refoundation party), FI (Forza Italia), AN (National Alliance) and UDC (Union of Christian Democrats).
prox_*
linear ideological distance between the respondent and a party *
placement
partyID_*
binary variable equals to 1
if the respondent declares to feel herself close to party *
age
: 1 = "18-24 years", 2 = "25-34", 3 = "35-44", 4 = "45-54", 5 = "55-64", 6 = "65 +"
education
: 0 = "up to primary school", 1 = "incomplete secondary", 2 = "secondary completed", 3 = "post-secondary trade", 4 = "university undergraduate degree inc", 5 = "university undergraduate degree comp"
gov_perf
: 1 = "very good job", 2 = "good job", 3 = "bad job", 4 = "very bad job"
CSES - Comparative Study of Electoral Systems: https://cses.org/).
data(italy2006.lin) head(italy2006.lin) ## maybe str(italy2006.lin) ; plot(italy2006.lin) ...
data(italy2006.lin) head(italy2006.lin) ## maybe str(italy2006.lin) ; plot(italy2006.lin) ...
2006 Italian General Election survey - wide format
data(italy2006.wide)
data(italy2006.wide)
A data frame with 524 observations on the following 15 variables.
country
country name
id
id of respondent
vote
a factor with levels FI
UL
AN
UDC
RC
for each party voted
self
self-placement of respondent on a 0 to 10 left-right scale
FI
see Details.
DS
see Details.
AN
see Details.
DL
see Details.
UDC
see Details.
RC
see Details.
pID
see Details.
sex
gender variable 1
= female
age
see Details.
education
see Details.
gov_perf
see Details.
In this survey respondents were asked to indicate which party they voted for in the 2006 Election. The data concerns 5 parties: UL (Ulivo), RC (Communist Refoundation party), FI (Forza Italia), AN (National Alliance) and UDC (Union of Christian Democrats). The dataset is in wide format.
variable from FI
to RC
identify the placement of those parties, on a 0 to 10 left-right scale, as perceived by the respondent.
pID
is a variable that identifies the partisanship of the respondent (where 0=stands for no partyID, 1 = FI partyID, 23 = UL partyID, 3 = AN partyID, 4 = UDC partyID, 6 = RC partyID)
age
: 1 = "18-24 years", 2 = "25-34", 3 = "35-44", 4 = "45-54", 5 = "55-64", 6 = "65 +"
education
: 0 = "up to primary school", 1 = "incomplete secondary", 2 = "secondary completed", 3 = "post-secondary trade", 4 = "university undergraduate degree inc", 5 = "university undergraduate degree comp"
gov_perf
: 1 = "very good job", 2 = "good job", 3 = "bad job", 4 = "very bad job"
CSES - Comparative Study of Electoral Systems: https://cses.org/).
data(italy2006.wide) head(italy2006.wide) ## maybe str(italy2006.wide) ; plot(italy2006.wide) ...
data(italy2006.wide) head(italy2006.wide) ## maybe str(italy2006.wide) ; plot(italy2006.wide) ...
Show the NEWS file of the nopp package.
noppNews()
noppNews()
None.
Plot function for Nash equilibrium object
## S3 method for class 'nash.eq' plot(x,...)
## S3 method for class 'nash.eq' plot(x,...)
x |
a |
... |
additional arguments passed to the inner plot function |
See vignette.
Luigi Curini, Stefano M. Iacus
Curini, L., and Iacus, S.M. (2017) Nash Optimal Party Positions: The nopp R Package, Journal of Statistical Software, 81(11), 1–25
See Also as equilibrium
## Not run: data(italy2006) election <- set.data(italy2006 , shape="wide", choice="vote", varying=c(5:14), sep="_") m <- mlogit(vote~prox+partyID | gov_perf+sex+age+education, election, reflevel = "UL") true.pos <- list(FI=7.59, UL=3.50, RC=1.95, AN=8.08, UDC=5.66) true.votes <- list(FI=.24, UL=.40, RC=.10, AN=.18, UDC=.08) # comparison against true votes and party positions nash.eq <- equilibrium(model=m, data=election, pos=true.pos, votes=true.votes) nash.eq par(mfrow=c(3,1)) plot(nash.eq) # bootstrap confidence intervals nash.eq <- equilibrium(model=m, data=election, boot=10) nash.eq plot(nash.eq) par(mfrow=c(1,1)) ## End(Not run)
## Not run: data(italy2006) election <- set.data(italy2006 , shape="wide", choice="vote", varying=c(5:14), sep="_") m <- mlogit(vote~prox+partyID | gov_perf+sex+age+education, election, reflevel = "UL") true.pos <- list(FI=7.59, UL=3.50, RC=1.95, AN=8.08, UDC=5.66) true.votes <- list(FI=.24, UL=.40, RC=.10, AN=.18, UDC=.08) # comparison against true votes and party positions nash.eq <- equilibrium(model=m, data=election, pos=true.pos, votes=true.votes) nash.eq par(mfrow=c(3,1)) plot(nash.eq) # bootstrap confidence intervals nash.eq <- equilibrium(model=m, data=election, boot=10) nash.eq plot(nash.eq) par(mfrow=c(1,1)) ## End(Not run)
Prepares data for Nash equilibrium
set.data(data, shape="wide", choice, varying, sep="_")
set.data(data, shape="wide", choice, varying, sep="_")
data |
the data set |
shape |
either |
choice |
the variable indicating the choice made: it can be either a logical vector, a numerical vector with 0 where the alternative is not chosen, a factor with level 'yes' when the alternative is chosen. |
varying |
the indexes of the variables that are alternative specific. See Details. |
sep |
the seperator of the variable name and the alternative name (only relevant for a wide data.frame). See Details. |
For general examples see the vignette. The arguments shape
, choice
, varying
and sep
as as in the mlogit.data
function.
A mlogit.data
object, which is a data.frame
in long format, i.e. one line for each alternative. It has a index attribute, which is a data.frame that contains the index of the choice made ('chid'), the index of the alternative ('alt') and, if any, the index of the individual ('id'). The choice variable is a boolean which indicates the choice made. This function use reshape if the data.frame is in wide format. It also has the attribute call
for further data manipulation in the bootstrap task of equilibrium
.
See the vignette for detailed explanations and other working examples.
Luigi Curini, Stefano M. Iacus
Curini, L., and Iacus, S.M. (2017) Nash Optimal Party Positions: The nopp R Package, Journal of Statistical Software, 81(11), 1–25
## Not run: data(italy2006) str(italy2006) italy2006[1:2,1:14] election <- set.data(italy2006 , shape="wide", choice="vote", varying=c(5:14), sep="_") str(election) m <- mlogit(vote~prox+partyID | gov_perf+sex+age+education, election, reflevel = "UL") summary(m) true.pos <- list(FI=7.59, UL=3.50, RC=1.95, AN=8.08, UDC=5.66) true.votes <- list(FI=.24, UL=.40, RC=.10, AN=.18, UDC=.08) # model: comparison against true votes and party positions nash.eq <- equilibrium(model=m, data=election, pos=true.pos, votes=true.votes) nash.eq ## End(Not run)
## Not run: data(italy2006) str(italy2006) italy2006[1:2,1:14] election <- set.data(italy2006 , shape="wide", choice="vote", varying=c(5:14), sep="_") str(election) m <- mlogit(vote~prox+partyID | gov_perf+sex+age+education, election, reflevel = "UL") summary(m) true.pos <- list(FI=7.59, UL=3.50, RC=1.95, AN=8.08, UDC=5.66) true.votes <- list(FI=.24, UL=.40, RC=.10, AN=.18, UDC=.08) # model: comparison against true votes and party positions nash.eq <- equilibrium(model=m, data=election, pos=true.pos, votes=true.votes) nash.eq ## End(Not run)