| Type: | Package |
| Title: | Compare Models with Cross-Validated Log-Likelihood |
| Version: | 1.0.5 |
| Date: | 2025-10-11 |
| 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. |
| URL: | https://github.com/ShanaScogin/modeLLtest |
| License: | GPL-3 |
| NeedsCompilation: | yes |
| BugReports: | https://github.com/ShanaScogin/modeLLtest/issues |
| Imports: | stats, quantreg, survival, coxrobust, MASS, Rcpp |
| Depends: | R (≥ 3.2.3) |
| Encoding: | UTF-8 |
| LazyData: | TRUE |
| LazyLoad: | TRUE |
| Suggests: | knitr, rmarkdown, testthat |
| VignetteBuilder: | knitr |
| SystemRequirements: | GNU make |
| RoxygenNote: | 7.1.2 |
| LinkingTo: | Rcpp, RcppArmadillo |
| Packaged: | 2025-10-12 02:25:51 UTC; shanascogin |
| Author: | Shana Scogin |
| Maintainer: | Shana Scogin <shanarscogin@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2025-10-12 02:40:02 UTC |
Cross-Validated Difference in Means (CVDM) Test
Description
Applies cross-validated log-likelihood difference in means test tocompare two methods of estimating a formula. The output identifies the moreappropriate 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 UsingCross-Validation. Quality & Quantity, 48(4), 2155-2173.doi:10.1007/s11135-013-9884-7
Note that Eqn. 6 of Desmarais & Harden, 2014 has a typo in thedenominator. The code here correctly implements Johnson (1978)(doi:10.1080/01621459.1978.10480051), Eqn. 2.5; however, the fraction isflipped in the paper's equation.
Usage
cvdm( formula, data, method1 = c("OLS", "MR", "RLM", "RLM-MM"), method2 = c("OLS", "MR", "RLM", "RLM-MM"), subset, na.action, ...)Arguments
formula | A formula object, with the dependent variable on theleft of a ~ operator, and the independent variables on the right. |
data | A data frame, list or environment (or object coercible byas.data.frame to a data frame) containing the variables in the model. |
method1 | A method to estimate the model. Currently takesOrdinary Least Squares ("OLS"), Median Regression ("MR"), Robust LinearRegression ("RLM") using M-estimation, and Robust Linear Regression usingMM-estimation ("RLM-MM"). The algorithm method used to compute the fit for themedian regression is the modified version of the Barrodale and Roberts algorithmfor l1-regression, which is the |
method2 | A method to estimate the model. Optionsare same as for method1. |
subset | Expression indicating which subset of the rows of data should beused 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. |
Details
This function implements the cross-validated difference in means (CVDM)test between two methods of estimating a formula. The function takesa formula and two methods and computes a vector of cross-validated log-likelihoods (CVLLs) for each method using the leave-one-out method. Theseoutput test score is the cross-validated Johnson's t-test. A positive teststatistic supports the first method and a negative test statistic supportsthe second. Singular matrices during the leave-one-out cross-validation processare skipped.
Value
An object of classcvdm computed by the cross-validated log likelihooddifference 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 supportsthe second. Seecvdm_object for more details.
References
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 UsingCross-Validation. Quality & Quantity, 48(4), 2155-2173.doi:10.1007/s11135-013-9884-7
Examples
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")Cross-Validated Difference in Means (CVDM) Object
Description
This class of objects is returned by thecvdm function to compare two methods of estimating a formula.
Value
The following components must be included in a legitimatecvdm 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, andy. Seelm documentation for more.
See Also
Cross-Validated Log Likelihood (CVLL)
Description
Extracts the leave-one-out cross-validated log-likelihoodsfrom a method of estimating a formula.
Usage
cvll( formula, data, method = c("OLS", "MR", "RLM", "RLM-MM"), subset, na.action, ...)Arguments
formula | A formula object, with the dependent variable on theleft of a ~ operator, and the independent variables on the right. |
data | A data frame, list or environment (or object coercible byas.data.frame to a data frame) containing the variables in the model. |
method | A method to estimate the model. Currently takesOrdinary Least Squares ("OLS"), Median Regression ("MR"), Robust LinearRegression ("RLM") using M-estimation, and Robust Linear Regression usingMM-estimation ("RLM-MM"). The algorithm method used to compute the fit for themedian regression is the modified version of the Barrodale and Roberts algorithmfor l1-regression, which is the |
subset | Expression indicating which subset of the rows of data should beused 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. |
Details
This function extracts a vector of leave-one-out cross-validatedlog likelihoods (CVLLs) from a method of estimating a formula.Singular matrices during the leave-one-out cross-validation processare skipped.
Value
An object of classcvll computed by the cross-validated log likelihood(CVLL). Seecvdm_object for more details.
References
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 UsingCross-Validation. Quality & Quantity, 48(4), 2155-2173.doi:10.1007/s11135-013-9884-7
Note that Eqn. 6 of Desmarais & Harden, 2014 has a typo in thedenominator. The code here correctly implements Johnson (1978)(doi:10.1080/01621459.1978.10480051), Eqn. 2.5; however, the fraction isflipped in the paper's equation.
Examples
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")Cross-Validated Log-Likelihood (CVLL) Object
Description
This class of objects is returned by thecvll function.
Value
The following components must be included in a legitimatecvll 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, andy. Seelm documentation for more.
See Also
Cross-Validated Difference in Means (CVDM) Test with Vector Imputs
Description
Applies cross-validated log-likelihood to test betweentwo methods of estimating a formula. The output identifies the vectorfrom the more appropriate model.
Please cite:
Desmarais, B. A., & Harden, J. J. (2014). An Unbiased Model Comparison Test UsingCross-Validation. Quality & Quantity, 48(4), 2155-2173.doi:10.1007/s11135-013-9884-7
Usage
cvlldiff(vector1, vector2, df)Arguments
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. |
Details
This function implements the cross-validated difference in means (CVDM)test between two vectors of cross-validated log-likelihoods. A positive teststatistic supports the method that produced the first vector and a negativetest statistic supports the second.
Value
An object of classcvlldiff computed by the cross-validated log likelihooddifference in means test (CVDM). The test statistic object is the Cross-ValidatedJohnson's t-test. A positive test statistic supports the first method and a negative teststatistic supports the second.Seecvdm_object for more details.
References
Desmarais, B. A., & Harden, J. J. (2014). An Unbiased Model Comparison Test UsingCross-Validation. Quality & Quantity, 48(4), 2155-2173.doi:10.1007/s11135-013-9884-7Note that Eqn. 6 of Desmarais & Harden, 2014 has a typo in thedenominator. The code here correctly implements Johnson (1978)(doi:10.1080/01621459.1978.10480051), Eqn. 2.5; however, the fraction isflipped in the paper's equation.
Examples
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)Cross-Validated Difference in Means (CVDM) Object from Generalcvlldiff Function
Description
This class of objects is returned by thecvlldiff function to compare vectors of cross-validated log-likelihood values.
Value
The following components must be included in a legitimatecvlldiff 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. |
See Also
Cross-Validated Median Fit (CVMF) Test
Description
Applies cross-validated log-likelihood to test betweenpartial likelihood maximization (PLM) and the iteratively reweightedrobust (IRR) method of estimation for a given application of the Cox model.For more, see: Desmarais, B. A., & Harden, J. J. (2012). Comparing partiallikelihood and robust estimation methods for the Cox regression model.Political Analysis, 20(1), 113-135.doi:10.1093/pan/mpr042
Usage
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)Arguments
formula | A formula object, with the response on the left of a ~operator, and the terms on the right. The response must be a survivalobject as returned by the |
data | A data frame, list or environment (or object coercible byas.data.frame to a data frame) containing the variables in the modelor 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 robustestimator. The default is 0.95. Roughly, quantile of the sample |
subset | Expression indicating which subset of the rows of data should beused 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 themodel matrix. If |
Details
This function implements the cross-validated median fit (CVMF) test.The function cvmf() tests between the partiallikelihood 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 assumptionsabout the baseline hazard. It can be estimated via PLM, the standardestimator, or IRR, a robust estimator that identifies and downweightsoutliers. The choice between the two methods involves a trade-offbetween bias and efficiency. PLM is more efficient, but biased underspecification problems. IRR reduces bias, but results in highvariance due to the loss of efficiency. The cvmf() function returns anobject to identify the prefered estimation method.
Value
An object of classcvmf computed by the cross-validated median fit test(CVMF) to test between the PLM and IRR methods of estimating the Cox model.Seecvmf_object for more details.
References
Desmarais, B. A., & Harden, J. J. (2012). Comparing partiallikelihood and robust estimation methods for the Cox regression model.Political Analysis, 20(1), 113-135.doi:10.1093/pan/mpr042
Examples
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)Cross-Validated Median Fit (CVMF) Object
Description
This class of objects is returned by thecvmf 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.
Value
The following components must be included in a legitimatecvmf 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, andy.
See Also
Data from Golder (2010) on government formation in Western Europe
Description
Data from a study on Western European government formationduration. Data is at the country-level (N = 409). Variable names aretaken directly from original dataset. The data is publicly availableand has been included here with the endorsement of the author. Pleasesee the original codebook for a more detailed description of thevariables.
Usage
data(govtform)Format
A data frame with 410 rows and 18 variables. The following are takenfrom the codebook atdoi:10.7910/DVN/BUWZBA.
- countryname
names of countries used in analysis
- country
unique number identifying each country
- cabinet
unique number identifying each country.Begins with country code, followed by cabinets 1 - n
- bargainingdays
the number of days between either an electionor the resignation of the previous government and the day onwhich the new government is officially inaugurated
- datein
date on which a government took office. Format is YYMMDD
- dateout
date on which a government left office. Format is YYMMDD
- postelection
dichotomous variable that equals 1 if a governmentis the first to form after an election (more uncertainty) and 0 if itforms in an interelection period (less uncertainty)
- nonpartisan
dichotomous variable that equals 1 if the governmentis nonpartisan and 0 otherwise
- legislative_parties
a fraction representing the number of parties thathave won legislative seats. See codebook for more detail
- inconclusive
the number of inconclusive bargaining rounds prior toa new government successfully forming
- cabinetname
cabinet name identified by surnameof prime minister (followed by a number if the PM presidedover more than one cabinet)
- singleparty_majority
dichotomous variable that equals 1 if a singleparty controls a majority of the legislative seats, 0 otherwise
- polarization
measures the level of ideological polarization in the partysystem. See codebook for more detail
- continuation
dichotomous variable that equals 1 if the outgoinggovernment or formateur gets the first opportunity to form a newgovernment, 0 otherwise. See codebook for more detail
- positive_parl
dichotomous variable that equals 1 if a new governmentrequires the explicit support of a legislative majority in order to takeoffice, 0 otherwise. See codebook for more detail
- post_legislative_parties
interaction term made by multiplying the postelectionvariable with the legislative_parties variable
- post_polariz
interaction term made by multiplying the postelectionvariable with the polarization variable
- post_positive
interaction term made by multiplying the postelectionvariable with the positive_parl variable
Source
References
Golder, S. N. (2010). Bargaining delays in the governmentformation process. Comparative Political Studies, 43(1), 3-32.doi:10.1177/0010414009341714
Examples
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 modelobj_cvmf_golder <- cvmf(golder_surv ~ golder_x, method = "efron", data = govtform)obj_cvmf_goldermodeLLtest Overview
Description
modeLLtest has three main functions to implement cross validated log likelihoodtests. To use this package, decide which specification(s) of a modeland distributions you wish compare. The function cvdm()compares the fits of one model specification between a medianregression and ordinary least squares. The function cvmf() compares betweenthe fits of one model specification between two estimations of a Cox model.The function cvll() extracts the leave-one-out cross-validated log-likelihoodsfrom a method of estimating a formula.
Data from Joshi and Mason (2008) on voter turnout in Nepal
Description
Data from a study on the relationship between land tenure andvoter turnout in the three rounds of parliamentary electionsin Nepal from the restoration of democracy in 1990 to 1999.Data is at the district-level (N = 75). Variable names aretaken directly from original dataset. The data is publicly availableand has been included here with the endorsement of the authors.
Usage
data(nepaldem)Format
A data frame with 76 rows and 73 variables:
- sn
a column of identifiers. This column is not a variable
- district
names of the district in Nepal used in analysis
- householdsize
average size of household in district
- total_holding
total land holding
- noown_single_tenure
number of households that own and cultivateland under single tenure
- norent_single_ten
number of households that rent for serviceand cultivate land under single tenure
- noother_single_ten
number of households that cultivateunder single tenure and have another set up other than those above
- nomore1_ten_hold
number of households with more than one tenure
- noholding_below1_pa
number of households that hold less than1.0 hectares of land
- noholding_2to3_pa
number of households that hold 2 to 3hectares of land
- noholding_4to5_pa
number of households that hold 4 to 5hectares of land
- noholding_6to9_pa
number of households that hold 6 to 9hectares of land
- noholding_10_pa
number of households with more than 10parcels of land
- total_ha
total hectares of land
- total_parcel
total parcels of land
- no_hold_fixmoney2
subsection of number of households with fixedcash rent
- no_hold_fixproduct2
subsection of households with fixedproduct rent
- no_hold_share2
subsection of households participatingin sharecropping
- no_hold_services2
subsection of households participatingin sharecropping
- no_hold_mortgage2
subsection of households with a mortgage
- no_hold_fixmoney1
subsection of households with fixedcash rent
- no_hold_fixproduct1
subsection of households with fixedproduct rent
- no_hold_share1
subsection of households participatingin sharecropping
- no_hold_services1
subsection of households with rent forservice
- no_hold_mortgage1
subsection of households with a mortgage
- totalhouseholds
total number of households
- landless
number of landless households
- totalvoters1991
total number of voters in 1991
- totalcastedvote1991
total number of votes cast in 1991
- totalvalidvote1991
total number of valid votes in 1991
- constituency1991
constituency in 1991
- totalcontestants1991
total number of candidates contestingelections in 1991
- totalvoters1994
total number of voters in 1994
- totalcastedvote1994
total number of votes cast in 1994
- totalvalidvote1994
total number of valid votes in 1994
- constituency1994
constituency in 1994
- totalcontestants1994
total number of candidates contestingelections in 1994
- togalvoters1999
total number of voters in 1999
- totalcastedvote1999
total number of votes cast in 1999
- totalvalidvote1999
total number of valid votes in 1999
- constituency1999
constituency in 1999
- totalcontestants1999
total number of candidates contestingelections in 1999
- pop_2001
population in 2001
- hdi_1996
HDI 1996 (index 0 to 1)
- per_without_instcredit
percent without access to institutionalcredit
- access_instutional_credit
access to institutional credit
- total_hh_sharecrop
total number of households participatingin sharecropping
- total_hh_fixmoney
total number of households with fixedcash rent
- total_hh_fixproduct
total number of households with fixedproduct rent
- total_hh_service
total number of households with rent forservice
- total_hh_mortgage
total number of households with a mortgage
- total_killed
total number of people killed. This serves asa measure of political violence during the insurgency
- percent_regvote1991
election turnout for 1991 as measuredby the percentage of registered voters who voted in the nationalparliamentary election
- percent_regvote1994
election turnout for 1994 as measuredby the percentage of registered voters who voted in the nationalparliamentary election
- percent_regvote1999
election turnout for 1999 as measuredby the percentage of registered voters who voted in the nationalparlimentary election
- per_total_hold_sharecrop
percent of sharecropping households
- per_total_hold_fixmoney
percent of households that have afixed cash rent
- per_total_hold_fixproduct
percent of households that have afixed product rent
- per_total_hold_service
percent of households that have rentfor service
- per_total_hold_mortgage
percent of households with a mortgage
- per_noholding_below1_pa
- landless_1000
landless households (in 1,000s)
- totoalkilled_1000
total number of people killed (in 1,000s). Thisserves as a measure of political violence during the insurgency
- cast_eth_fract
caste and ethnic fractionalization
- languistic_fract
linguistic fractionalization
- landless_gap
landless households (in 1,000s) gap
- below1pa_gap
percent smallholder households gap
- sharecrop_gap
percent sharecropping households gap
- service_gap
percent rent for service households gap
- fixmoney_gap
percent fixed cash rent households gap
- fixprod_gap
percent fixed product rent households gap
- hdi_gap
HDI 1996 (index 0 to 1) gap
- ln_pop2001
population in 2001 (logged)
- hdi_gap1
HDI 1996 (index 0 to 1) gap (positive values)
Source
Journal of Peace Research Replication Datasets
References
Joshi, M., & Mason, T. D. (2008). Between democracy andrevolution: peasant support for insurgency versus democracy in Nepal.Journal of Peace Research, 45(6), 765-782.doi:10.1177/0022343308096155
Examples
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_1999bobj_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