Description Usage Arguments Value Author(s) Examples
View source: R/estimate-ideology.R
estimateIdeology
estimates ideology for a given user using the
Metropolis algorithm developed in Barbera (2015). It takes as argument
of the function a list of user IDs indicating who a given user follows.
1 2 | estimateIdeology(user, friends, verbose = TRUE, method = "MCMC",
iters = 5000, n.warmup = 1000, thin = 20, ...)
|
user |
screen name of user for which ideology is to be estimated. |
friends |
vector of user IDs that the user for which ideology wants
to be estimated follows. If missing, |
verbose |
logical, default is |
method |
"MCMC" (default) for the Metropolis algorithm described in the paper. "MLE" will use simple maximum likelihood estimation to compute the point estimate. Note that the standard error for the ML method is likely to be wrong. |
iters |
number of iterations of the metropolis algorithm. Default is 5000 |
n.warmup |
warmup period for the sampler. Default is 1000 iterations. |
thin |
thinning of the sampler. Default is 20. |
... |
other options to be passed to the estimation functions |
The function returns a matrix with summary statistics of the posterior distribution of the two estimated parameters, beta (political interest) and theta (ideology).
Pablo Barbera P.Barbera@lse.ac.uk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
## Creating OAuth token
my_oauth <- list(consumer_key = "CONSUMER_KEY",
consumer_secret = "CONSUMER_SECRET",
access_token="ACCESS_TOKEN",
access_token_secret = "ACCESS_TOKEN_SECRET")
## download list of friends for a given user
friends <- getFriends(screen_name = "p_barbera", oauth=my_oauth)
## estimating ideology
results <- estimateIdeology(friends)
results['theta', 'mean']
## estimating ideology using ML (fast) method
results <- estimateIdeology(friends, method="ML")
results['theta', 'mean']
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.