Estimates the Dyad Ratios Algorithm for constructing latent time series from survey-research marginals.
A list with components:
call: The initial call to `extract()`.
T: Number of aggregation periods.
nvar: Number of series used in the analysis.
unit: The aggregation period.
dimensions: Number of dimensions estimated (1 or 2).
period: List of aggregation periods.
varname: List in order of the variables used in the analysis.
N: Number of non-missing observations for each series.
wtdmean: The weighted mean of the input variables.
wtstd: The weighted standard deviation of the input series.
means: Item descriptive information.
std.deviations: Item descriptive information.
setup1: Basic information about the options and iterative solution for the first dimension.
setup2: Basic information about the options and iterative solution for the second dimension, if applicable.
loadings1: Item–scale correlations from the first dimension of the final solution.
Their square is the validity estimate used in weighting.
loadings2: Item–scale correlations from the second dimension of the final solution, if applicable.
latent1: Estimated time series for first dimension.
latent2: Estimated time series for second dimension, if applicable.
hist: Data frame with iteration history, including convergence statistics.
totalvar: Total variance in the data that could be explained by the estimated dimensions.
var_exp: Data frame with variance explained and proportion of variance explained for each dimension.
dropped: Data frame listing any series that were dropped from the analysis due to insufficient data.
smoothing: Logical indicating whether smoothing was applied during the iterative solution process.
ms_list: List of means and variances for standardizing the input series for the bootstrap.
String giving the name of the input series to be smoothed.
This should identify similar or comparable values in the series. Values in
the series that have the same varname will be assumed to come from
the same source.
ISO numeric representation of the date the survey was in the field (usually the start, end, or median date).
Numeric value of the series. It might be a percent or proportion responding in a single category (e.g., the approve response in presidential approval) or some multi-response summary. For ease of interpretation, polarity should be the same for all items.
Number of cases (e.g., sample size) of the survey. This provides
differential weighting for the values. Setting this to NULL or
leaving it blank will weight each value equally.
Aggregation period—one of ‘D’ (daily), ‘M’ (monthly), ‘Q’ (quarterly), ‘A’ (annual), or ‘O’ (multi-year aggregation).
Number of years, only used if unit is ‘O’.
Beginning date of the analysis. Defaults to earliest date in
the dataset. Should be specified with lubridate::ymd().
Ending date for the analysis. Defaults to the latest date in the data.
Not yet implemented.
Logical. Specifies whether exponential smoothing is applied
to the intermediate estimates during the iterative solution process.
Defaults to TRUE.
Ending month of the analysis.
In previous versions of the algorithm, especially in its original incarnation as `Wcalc.exe`, getting the dates right was really important. They needed to be in precisely the right format and the data needed to be ordered by date. In this version of the `extract()` function, any R date class is fine whether it is a `Date` class or `POSIX*` class. The function uses `is.Date` from the `lubridate` package to check if it is a `Date` class and `as.Date()` from R's `base` package to coerce it to a `Date` class if it is not. Further, the series are ordered by date in the function as a matter of course, so it is not necessary that they be in ascending ordered of date in the input data.
Stimson, J. A. (2018). ‘The Dyad Ratios Algorithm for Estimating Latent Public Opinion: Estimation, Testing, and Comparison to Other Approaches’, Bulletin of Sociological Methodology/Bulletin de Méthodologie Sociologique, 137–138(1), 201–218. tools:::Rd_expr_doi("10.1177/0759106318761614")
data(jennings)
dr_out <- extract(varname = jennings$variable,
date = jennings$date,
index = jennings$value,
ncases = jennings$n,
begindt = min(jennings$date),
enddt = max(jennings$date),
npass=1)
summary(dr_out)
Run the code above in your browser using DataLab