Title: | Compare Models with Cross-Validated Log-Likelihood |
---|---|
Description: | An implementation of the cross-validated difference in means (CVDM) test by Desmarais and Harden (2014) <doi:10.1007/s11135-013-9884-7> (see also Harden and Desmarais, 2011 <doi:10.1177/1532440011408929>) and the cross-validated median fit (CVMF) test by Desmarais and Harden (2012) <doi:10.1093/pan/mpr042>. These tests use leave-one-out cross-validated log-likelihoods to assist in selecting among model estimations. You can also utilize data from Golder (2010) <doi:10.1177/0010414009341714> and Joshi & Mason (2008) <doi:10.1177/0022343308096155> that are included to facilitate examples from real-world analysis. |
Authors: | Shana Scogin <[email protected]>, Sarah Petersen <[email protected]>, Jeff Harden <[email protected]>, Bruce A. Desmarais <[email protected]> |
Maintainer: | Shana Scogin <[email protected]> |
License: | GPL-3 |
Version: | 1.0.4 |
Built: | 2024-11-17 06:54:22 UTC |
Source: | CRAN |
Applies cross-validated log-likelihood difference in means test to compare two methods of estimating a formula. The output identifies the more appropriate model.
In choosing between OLS and MR, please cite:
Harden, J. J., & Desmarais, B. A. (2011). Linear Models with Outliers: Choosing between Conditional-Mean and Conditional-Median Methods. State Politics & Policy Quarterly, 11(4), 371-389. doi:10.1177/1532440011408929
For other applications of the CVDM test, please cite:
Desmarais, B. A., & Harden, J. J. (2014). An Unbiased Model Comparison Test Using Cross-Validation. Quality & Quantity, 48(4), 2155-2173. doi:10.1007/s11135-013-9884-7
cvdm( formula, data, method1 = c("OLS", "MR", "RLM", "RLM-MM"), method2 = c("OLS", "MR", "RLM", "RLM-MM"), subset, na.action, ... )
cvdm( formula, data, method1 = c("OLS", "MR", "RLM", "RLM-MM"), method2 = c("OLS", "MR", "RLM", "RLM-MM"), subset, na.action, ... )
formula |
A formula object, with the dependent variable on the left of a ~ operator, and the independent variables on the right. |
data |
A data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. |
method1 |
A method to estimate the model. Currently takes
Ordinary Least Squares ("OLS"), Median Regression ("MR"), Robust Linear
Regression ("RLM") using M-estimation, and Robust Linear Regression using
MM-estimation ("RLM-MM"). The algorithm method used to compute the fit for the
median regression is the modified version of the Barrodale and Roberts algorithm
for l1-regression, which is the |
method2 |
A method to estimate the model. Options are same as for method1. |
subset |
Expression indicating which subset of the rows of data should be used in the fit. All observations are included by default. |
na.action |
A missing-data filter function, applied to the model.frame, after any subset argument has been used. |
... |
Optional arguments, currently unsupported. |
This function implements the cross-validated difference in means (CVDM) test between two methods of estimating a formula. The function takes a formula and two methods and computes a vector of cross-validated log- likelihoods (CVLLs) for each method using the leave-one-out method. These output test score is the cross-validated Johnson's t-test. A positive test statistic supports the first method and a negative test statistic supports the second. Singular matrices during the leave-one-out cross-validation process are skipped.
An object of class cvdm
computed by the cross-validated log likelihood
difference in means test (CVDM). The object is the Cross-Validated Johnson's t-test.
A positive test statistic supports the first method and a negative test statistic supports
the second. See cvdm_object
for more details.
Harden, J. J., & Desmarais, B. A. (2011). Linear Models with Outliers: Choosing between Conditional-Mean and Conditional-Median Methods. State Politics & Policy Quarterly, 11(4), 371-389. doi:10.1177/1532440011408929
Desmarais, B. A., & Harden, J. J. (2014). An Unbiased Model Comparison Test Using Cross-Validation. Quality & Quantity, 48(4), 2155-2173. doi:10.1007/s11135-013-9884-7
set.seed(123456) b0 <- .2 # True value for the intercept b1 <- .5 # True value for the slope n <- 500 # Sample size X <- runif(n, -1, 1) Y <- b0 + b1 * X + rnorm(n, 0, 1) # N(0, 1 error) obj_cvdm <- cvdm(Y ~ X, data.frame(cbind(Y, X)), method1 = "OLS", method2 = "MR")
set.seed(123456) b0 <- .2 # True value for the intercept b1 <- .5 # True value for the slope n <- 500 # Sample size X <- runif(n, -1, 1) Y <- b0 + b1 * X + rnorm(n, 0, 1) # N(0, 1 error) obj_cvdm <- cvdm(Y ~ X, data.frame(cbind(Y, X)), method1 = "OLS", method2 = "MR")
This class of objects is returned by the cvdm
function to compare two methods of estimating a formula.
The following components must be included in a legitimate cvdm
object.
best |
name of the estimation method favored by the cvdm test. |
test_stat |
object returned by the bias-corrected Johnson's t-test. A positive test statistic supports method 1 and a negative test statistic supports method 2. |
p_value |
p-value for the test statistic. |
n |
number of observations. |
df |
degrees of freedom. |
The object also contain the following: call
, x
, and y
. See lm
documentation for more.
Extracts the leave-one-out cross-validated log-likelihoods from a method of estimating a formula.
cvll( formula, data, method = c("OLS", "MR", "RLM", "RLM-MM"), subset, na.action, ... )
cvll( formula, data, method = c("OLS", "MR", "RLM", "RLM-MM"), subset, na.action, ... )
formula |
A formula object, with the dependent variable on the left of a ~ operator, and the independent variables on the right. |
data |
A data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. |
method |
A method to estimate the model. Currently takes
Ordinary Least Squares ("OLS"), Median Regression ("MR"), Robust Linear
Regression ("RLM") using M-estimation, and Robust Linear Regression using
MM-estimation ("RLM-MM"). The algorithm method used to compute the fit for the
median regression is the modified version of the Barrodale and Roberts algorithm
for l1-regression, which is the |
subset |
Expression indicating which subset of the rows of data should be used in the fit. All observations are included by default. |
na.action |
A missing-data filter function, applied to the model.frame, after any subset argument has been used. |
... |
Optional arguments, currently unsupported. |
This function extracts a vector of leave-one-out cross-validated log likelihoods (CVLLs) from a method of estimating a formula. Singular matrices during the leave-one-out cross-validation process are skipped.
An object of class cvll
computed by the cross-validated log likelihood
(CVLL). See cvdm_object
for more details.
Harden, J. J., & Desmarais, B. A. (2011). Linear Models with Outliers: Choosing between Conditional-Mean and Conditional-Median Methods. State Politics & Policy Quarterly, 11(4), 371-389. doi:10.1177/1532440011408929
Desmarais, B. A., & Harden, J. J. (2014). An Unbiased Model Comparison Test Using Cross-Validation. Quality & Quantity, 48(4), 2155-2173. doi:10.1007/s11135-013-9884-7
set.seed(123456) b0 <- .2 # True value for the intercept b1 <- .5 # True value for the slope n <- 500 # Sample size X <- runif(n, -1, 1) Y <- b0 + b1 * X + rnorm(n, 0, 1) # N(0, 1 error) obj_cvll <- cvll(Y ~ X, data.frame(cbind(Y, X)), method = "OLS")
set.seed(123456) b0 <- .2 # True value for the intercept b1 <- .5 # True value for the slope n <- 500 # Sample size X <- runif(n, -1, 1) Y <- b0 + b1 * X + rnorm(n, 0, 1) # N(0, 1 error) obj_cvll <- cvll(Y ~ X, data.frame(cbind(Y, X)), method = "OLS")
This class of objects is returned by the cvll
function.
The following components must be included in a legitimate cvll
object.
cvll |
vector of cross-validated log-likelihood values using the leave-one-out method. |
n |
number of observations. |
df |
degrees of freedom. |
method |
method of estimation. |
The object also contain the following: call
, x
, and y
. See lm
documentation for more.
Applies cross-validated log-likelihood to test between two methods of estimating a formula. The output identifies the vector from the more appropriate model.
Please cite:
Desmarais, B. A., & Harden, J. J. (2014). An Unbiased Model Comparison Test Using Cross-Validation. Quality & Quantity, 48(4), 2155-2173. doi:10.1007/s11135-013-9884-7
cvlldiff(vector1, vector2, df)
cvlldiff(vector1, vector2, df)
vector1 |
A numeric vector of cross-validated log-likelihoods. |
vector2 |
A numeric vector of cross-validated log-likelihoods. |
df |
A value of the degrees of freedom in the models. |
This function implements the cross-validated difference in means (CVDM) test between two vectors of cross-validated log-likelihoods. A positive test statistic supports the method that produced the first vector and a negative test statistic supports the second.
An object of class cvlldiff
computed by the cross-validated log likelihood
difference in means test (CVDM). The test statistic object is the Cross-Validated
Johnson's t-test. A positive test statistic supports the first method and a negative test
statistic supports the second.See cvdm_object
for more details.
Desmarais, B. A., & Harden, J. J. (2014). An Unbiased Model Comparison Test Using Cross-Validation. Quality & Quantity, 48(4), 2155-2173. doi:10.1007/s11135-013-9884-7
set.seed(123456) b0 <- .2 # True value for the intercept b1 <- .5 # True value for the slope n <- 500 # Sample size X <- runif(n, -1, 1) Y <- b0 + b1 * X + rnorm(n, 0, 1) # N(0, 1 error) cvll_ols <- cvll(Y ~ X, data.frame(cbind(Y, X)), method = "OLS") cvll_mr <- cvll(Y ~ X, data.frame(cbind(Y, X)), method = "MR") obj_compare <- cvlldiff(cvll_ols$cvll, cvll_mr$cvll, cvll_ols$df)
set.seed(123456) b0 <- .2 # True value for the intercept b1 <- .5 # True value for the slope n <- 500 # Sample size X <- runif(n, -1, 1) Y <- b0 + b1 * X + rnorm(n, 0, 1) # N(0, 1 error) cvll_ols <- cvll(Y ~ X, data.frame(cbind(Y, X)), method = "OLS") cvll_mr <- cvll(Y ~ X, data.frame(cbind(Y, X)), method = "MR") obj_compare <- cvlldiff(cvll_ols$cvll, cvll_mr$cvll, cvll_ols$df)
cvlldiff
FunctionThis class of objects is returned by the cvlldiff
function to compare vectors of cross-validated log-likelihood values.
The following components must be included in a legitimate cvlldiff
object.
best |
name of the estimation method favored by the cvdm test. |
test_stat |
object returned by the bias-corrected Johnson's t-test. A positive test statistic supports the method that generated the first vector of cross-validated log-likelihood values and a negative test statistic supports the method that generated the second vector. |
p_value |
p-value for the test statistic. |
Applies cross-validated log-likelihood to test between partial likelihood maximization (PLM) and the iteratively reweighted robust (IRR) method of estimation for a given application of the Cox model. For more, see: Desmarais, B. A., & Harden, J. J. (2012). Comparing partial likelihood and robust estimation methods for the Cox regression model. Political Analysis, 20(1), 113-135. doi:10.1093/pan/mpr042
cvmf( formula, data, method = c("exact", "approximate", "efron", "breslow"), trunc = 0.95, subset, na.action, f.weight = c("linear", "quadratic", "exponential"), weights, singular.ok = TRUE )
cvmf( formula, data, method = c("exact", "approximate", "efron", "breslow"), trunc = 0.95, subset, na.action, f.weight = c("linear", "quadratic", "exponential"), weights, singular.ok = TRUE )
formula |
A formula object, with the response on the left of a ~
operator, and the terms on the right. The response must be a survival
object as returned by the |
data |
A data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model or in the subset and the weights argument. |
method |
A character string specifying the method for tie handling in coxph().
If there are no tied death times all the methods are equivalent.
Following the |
trunc |
A value that determines the trimming level for the robust
estimator. The default is 0.95. Roughly, quantile of the sample
|
subset |
Expression indicating which subset of the rows of data should be used in the fit. All observations are included by default. |
na.action |
A missing-data filter function, applied to the model.frame, after any subset argument has been used. |
f.weight |
A type of weighting function for |
weights |
A vector of case weights for |
singular.ok |
Logical value indicating how to handle collinearity in the
model matrix. If |
This function implements the cross-validated median fit (CVMF) test. The function cvmf() tests between the partial likelihood maximization (PLM) and the iteratively reweighted robust (IRR) method of estimation for a given application of the Cox model. The Cox model is a partial parametric model that does not make assumptions about the baseline hazard. It can be estimated via PLM, the standard estimator, or IRR, a robust estimator that identifies and downweights outliers. The choice between the two methods involves a trade-off between bias and efficiency. PLM is more efficient, but biased under specification problems. IRR reduces bias, but results in high variance due to the loss of efficiency. The cvmf() function returns an object to identify the prefered estimation method.
An object of class cvmf
computed by the cross-validated median fit test
(CVMF) to test between the PLM and IRR methods of estimating the Cox model.
See cvmf_object
for more details.
Desmarais, B. A., & Harden, J. J. (2012). Comparing partial likelihood and robust estimation methods for the Cox regression model. Political Analysis, 20(1), 113-135. doi:10.1093/pan/mpr042
set.seed(12345) x1 <- rnorm(100) x2 <- rnorm(100) x2e <- x2 + rnorm(100, 0, 0.5) y <- rexp(100, exp(x1 + x2)) y <- survival::Surv(y) dat <- data.frame(y, x1, x2e) form <- y ~ x1 + x2e results <- cvmf(formula = form, data = dat)
set.seed(12345) x1 <- rnorm(100) x2 <- rnorm(100) x2e <- x2 + rnorm(100, 0, 0.5) y <- rexp(100, exp(x1 + x2)) y <- survival::Surv(y) dat <- data.frame(y, x1, x2e) form <- y ~ x1 + x2e results <- cvmf(formula = form, data = dat)
This class of objects is returned by the cvmf
function to test between the partial likelihood maximization (PLM) and the iteratively reweighted robust (IRR) method of estimation for a given application of the Cox model.
The following components must be included in a legitimate cvmf
object.
best |
name of the model of estimation favored by the cvmf test. |
p |
p-value of the binomial test used to test between estimation models. |
cvmf |
full output of the binomial test used to test between estimation methods. See documentation for |
coef_names |
names of the coefficients. |
irr |
full output for the iteratively reweighted robust (IRR) method of estimating the Cox model. See documentation for |
plm |
full output for the partial likelihood maximization (PLM) method of estimating the Cox model. See documentation for |
irr_coefs |
estimates obtained from IRR method of estimating the Cox model. See documentation for |
plm_coefs |
estimates obtained from PLM method of estimating the Cox model. See documentation for |
cvpl_irr |
observation-wise contributions to the log-partial likelihood for IRR method of estimating the Cox model. See Desmarais and Hardin (Political Analysis 20:113-135, 2012) for more about the test and Verweij and Houwelingen (Statistics in Medicine 12(24): 2305–14, 1993) for more about the measure |
cvpl_plm |
observation-wise contributions to the log-partial likelihood for PLM method of estimating the Cox model. See Desmarais and Hardin (Political Analysis 20:113-135, 2012) for more about the test and Verweij and Houwelingen (Statistics in Medicine 12(24): 2305–14, 1993) for more about the measure |
The object also contain the following: call
, x
, and y
.
Data from a study on Western European government formation duration. Data is at the country-level (N = 409). Variable names are taken directly from original dataset. The data is publicly available and has been included here with the endorsement of the author. Please see the original codebook for a more detailed description of the variables.
data(govtform)
data(govtform)
A data frame with 410 rows and 18 variables. The following are taken from the codebook at doi:10.7910/DVN/BUWZBA.
names of countries used in analysis
unique number identifying each country
unique number identifying each country. Begins with country code, followed by cabinets 1 - n
the number of days between either an election or the resignation of the previous government and the day on which the new government is officially inaugurated
date on which a government took office. Format is YYMMDD
date on which a government left office. Format is YYMMDD
dichotomous variable that equals 1 if a government is the first to form after an election (more uncertainty) and 0 if it forms in an interelection period (less uncertainty)
dichotomous variable that equals 1 if the government is nonpartisan and 0 otherwise
a fraction representing the number of parties that have won legislative seats. See codebook for more detail
the number of inconclusive bargaining rounds prior to a new government successfully forming
cabinet name identified by surname of prime minister (followed by a number if the PM presided over more than one cabinet)
dichotomous variable that equals 1 if a single party controls a majority of the legislative seats, 0 otherwise
measures the level of ideological polarization in the party system. See codebook for more detail
dichotomous variable that equals 1 if the outgoing government or formateur gets the first opportunity to form a new government, 0 otherwise. See codebook for more detail
dichotomous variable that equals 1 if a new government requires the explicit support of a legislative majority in order to take office, 0 otherwise. See codebook for more detail
interaction term made by multiplying the postelection variable with the legislative_parties variable
interaction term made by multiplying the postelection variable with the polarization variable
interaction term made by multiplying the postelection variable with the positive_parl variable
Golder, S. N. (2010). Bargaining delays in the government formation process. Comparative Political Studies, 43(1), 3-32. doi:10.1177/0010414009341714
data(govtform) library(survival) library(coxrobust) library(modeLLtest) # Survival models with data from Golder (2010) golder_surv <- Surv(govtform$bargainingdays) golder_x <- cbind(govtform$postelection, govtform$legislative_parties, govtform$polarization, govtform$positive_parl, govtform$post_legislative_parties, govtform$post_polariz, govtform$post_positive, govtform$continuation, govtform$singleparty_majority) colnames(golder_x) <- c("govtform$postelection", "govtform$legislative_parties", "govtform$polarization", "govtform$positive_parl", "govtform$post_legislative_parties", "govtform$post_polariz", "govtform$post_positive", "govtform$continuation", "govtform$singleparty_majority") golder_cox <- coxph(golder_surv ~ golder_x, method = "efron", data = govtform) golder_robust <- coxr(golder_surv ~ golder_x, data = govtform) # Comparing PLM to IRR methods of estimating the survival model obj_cvmf_golder <- cvmf(golder_surv ~ golder_x, method = "efron", data = govtform) obj_cvmf_golder
data(govtform) library(survival) library(coxrobust) library(modeLLtest) # Survival models with data from Golder (2010) golder_surv <- Surv(govtform$bargainingdays) golder_x <- cbind(govtform$postelection, govtform$legislative_parties, govtform$polarization, govtform$positive_parl, govtform$post_legislative_parties, govtform$post_polariz, govtform$post_positive, govtform$continuation, govtform$singleparty_majority) colnames(golder_x) <- c("govtform$postelection", "govtform$legislative_parties", "govtform$polarization", "govtform$positive_parl", "govtform$post_legislative_parties", "govtform$post_polariz", "govtform$post_positive", "govtform$continuation", "govtform$singleparty_majority") golder_cox <- coxph(golder_surv ~ golder_x, method = "efron", data = govtform) golder_robust <- coxr(golder_surv ~ golder_x, data = govtform) # Comparing PLM to IRR methods of estimating the survival model obj_cvmf_golder <- cvmf(golder_surv ~ golder_x, method = "efron", data = govtform) obj_cvmf_golder
modeLLtest has three main functions to implement cross validated log likelihood tests. To use this package, decide which specification(s) of a model and distributions you wish compare. The function cvdm() compares the fits of one model specification between a median regression and ordinary least squares. The function cvmf() compares between the fits of one model specification between two estimations of a Cox model. The function cvll() extracts the leave-one-out cross-validated log-likelihoods from a method of estimating a formula.
Data from a study on the relationship between land tenure and voter turnout in the three rounds of parliamentary elections in Nepal from the restoration of democracy in 1990 to 1999. Data is at the district-level (N = 75). Variable names are taken directly from original dataset. The data is publicly available and has been included here with the endorsement of the authors.
data(nepaldem)
data(nepaldem)
A data frame with 76 rows and 73 variables:
a column of identifiers. This column is not a variable
names of the district in Nepal used in analysis
average size of household in district
total land holding
number of households that own and cultivate land under single tenure
number of households that rent for service and cultivate land under single tenure
number of households that cultivate under single tenure and have another set up other than those above
number of households with more than one tenure
number of households that hold less than 1.0 hectares of land
number of households that hold 2 to 3 hectares of land
number of households that hold 4 to 5 hectares of land
number of households that hold 6 to 9 hectares of land
number of households with more than 10 parcels of land
total hectares of land
total parcels of land
subsection of number of households with fixed cash rent
subsection of households with fixed product rent
subsection of households participating in sharecropping
subsection of households participating in sharecropping
subsection of households with a mortgage
subsection of households with fixed cash rent
subsection of households with fixed product rent
subsection of households participating in sharecropping
subsection of households with rent for service
subsection of households with a mortgage
total number of households
number of landless households
total number of voters in 1991
total number of votes cast in 1991
total number of valid votes in 1991
constituency in 1991
total number of candidates contesting elections in 1991
total number of voters in 1994
total number of votes cast in 1994
total number of valid votes in 1994
constituency in 1994
total number of candidates contesting elections in 1994
total number of voters in 1999
total number of votes cast in 1999
total number of valid votes in 1999
constituency in 1999
total number of candidates contesting elections in 1999
population in 2001
HDI 1996 (index 0 to 1)
percent without access to institutional credit
access to institutional credit
total number of households participating in sharecropping
total number of households with fixed cash rent
total number of households with fixed product rent
total number of households with rent for service
total number of households with a mortgage
total number of people killed. This serves as a measure of political violence during the insurgency
election turnout for 1991 as measured by the percentage of registered voters who voted in the national parliamentary election
election turnout for 1994 as measured by the percentage of registered voters who voted in the national parliamentary election
election turnout for 1999 as measured by the percentage of registered voters who voted in the national parlimentary election
percent of sharecropping households
percent of households that have a fixed cash rent
percent of households that have a fixed product rent
percent of households that have rent for service
percent of households with a mortgage
landless households (in 1,000s)
total number of people killed (in 1,000s). This serves as a measure of political violence during the insurgency
caste and ethnic fractionalization
linguistic fractionalization
landless households (in 1,000s) gap
percent smallholder households gap
percent sharecropping households gap
percent rent for service households gap
percent fixed cash rent households gap
percent fixed product rent households gap
HDI 1996 (index 0 to 1) gap
population in 2001 (logged)
HDI 1996 (index 0 to 1) gap (positive values)
Journal of Peace Research Replication Datasets
Joshi, M., & Mason, T. D. (2008). Between democracy and revolution: peasant support for insurgency versus democracy in Nepal. Journal of Peace Research, 45(6), 765-782. doi:10.1177/0022343308096155
data(nepaldem) library(MASS) library(modeLLtest) # Models from Joshi and Mason (2008) model_1991 <- rlm(percent_regvote1991 ~ landless_gap + below1pa_gap + sharecrop_gap + service_gap + fixmoney_gap + fixprod_gap + per_without_instcredit + hdi_gap1 + ln_pop2001 + totalcontestants1991 + cast_eth_fract, data = nepaldem) model_1994 <- rlm(percent_regvote1994 ~ landless_gap + below1pa_gap + sharecrop_gap + service_gap + fixmoney_gap + fixprod_gap + per_without_instcredit + hdi_gap1 + ln_pop2001 + totalcontestants1994 + cast_eth_fract, data = nepaldem) model_1999a <- rlm(percent_regvote1999 ~ landless_gap + below1pa_gap + sharecrop_gap + service_gap + fixmoney_gap + fixprod_gap + per_without_instcredit + hdi_gap1 + ln_pop2001 + totalcontestants1999 + cast_eth_fract, data = nepaldem) model_1999b <- rlm(percent_regvote1999 ~ landless_gap + below1pa_gap + sharecrop_gap + service_gap + fixmoney_gap + fixprod_gap + per_without_instcredit + totoalkilled_1000 + hdi_gap1 + ln_pop2001 + totalcontestants1999 + cast_eth_fract, data = nepaldem) # Comparing OLS to RR fit for model_1999b obj_cvdm_jm <- cvdm(percent_regvote1999 ~ landless_gap + below1pa_gap + sharecrop_gap + service_gap + fixmoney_gap + fixprod_gap + per_without_instcredit + totoalkilled_1000 + hdi_gap1 + ln_pop2001 + totalcontestants1999 + cast_eth_fract, data = nepaldem, method1 = "OLS", method2 = "RLM-MM") obj_cvdm_jm
data(nepaldem) library(MASS) library(modeLLtest) # Models from Joshi and Mason (2008) model_1991 <- rlm(percent_regvote1991 ~ landless_gap + below1pa_gap + sharecrop_gap + service_gap + fixmoney_gap + fixprod_gap + per_without_instcredit + hdi_gap1 + ln_pop2001 + totalcontestants1991 + cast_eth_fract, data = nepaldem) model_1994 <- rlm(percent_regvote1994 ~ landless_gap + below1pa_gap + sharecrop_gap + service_gap + fixmoney_gap + fixprod_gap + per_without_instcredit + hdi_gap1 + ln_pop2001 + totalcontestants1994 + cast_eth_fract, data = nepaldem) model_1999a <- rlm(percent_regvote1999 ~ landless_gap + below1pa_gap + sharecrop_gap + service_gap + fixmoney_gap + fixprod_gap + per_without_instcredit + hdi_gap1 + ln_pop2001 + totalcontestants1999 + cast_eth_fract, data = nepaldem) model_1999b <- rlm(percent_regvote1999 ~ landless_gap + below1pa_gap + sharecrop_gap + service_gap + fixmoney_gap + fixprod_gap + per_without_instcredit + totoalkilled_1000 + hdi_gap1 + ln_pop2001 + totalcontestants1999 + cast_eth_fract, data = nepaldem) # Comparing OLS to RR fit for model_1999b obj_cvdm_jm <- cvdm(percent_regvote1999 ~ landless_gap + below1pa_gap + sharecrop_gap + service_gap + fixmoney_gap + fixprod_gap + per_without_instcredit + totoalkilled_1000 + hdi_gap1 + ln_pop2001 + totalcontestants1999 + cast_eth_fract, data = nepaldem, method1 = "OLS", method2 = "RLM-MM") obj_cvdm_jm