# Using linear models with binary dependent variables, a simulation study

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

This blog post is an excerpt of my ebook Modern R with the tidyverse that you can read for free
here.
This is taken from Chapter 8, in which I discuss advanced functional programming methods for
modeling.

As written just above (note: as written above in the book), `map()` simply applies a function
to a list of inputs, and in the previous
section we mapped `ggplot()` to generate many plots at once. This approach can also be used to
map any modeling functions, for instance `lm()` to a list of datasets.

For instance, suppose that you wish to perform a Monte Carlo simulation. Suppose that you are
dealing with a binary choice problem; usually, you would use a logistic regression for this.

However, in certain disciplines, especially in the social sciences, the so-called Linear Probability
Model is often used as well. The LPM is a simple linear regression, but unlike the standard setting
of a linear regression, the dependent variable, or target, is a binary variable, and not a continuous
variable. Before you yell “Wait, that’s illegal”, you should know that in practice LPMs do a good
job of estimating marginal effects, which is what social scientists and econometricians are often
interested in. Marginal effects are another way of interpreting models, giving how the outcome
(or the target) changes given a change in a independent variable (or a feature). For instance,
a marginal effect of 0.10 for age would mean that probability of success would increase by 10% for

There has been a lot of discussion on logistic regression vs LPMs, and there are pros and cons
of using LPMs. Micro-econometricians are still fond of LPMs, even though the pros of LPMs are
not really convincing. However, quoting Angrist and Pischke:

“While a nonlinear model may fit the CEF (population conditional expectation function) for LDVs
(limited dependent variables) more closely than a linear model, when it comes to marginal effects,
this probably matters little” (source: Mostly Harmless Econometrics)

so LPMs are still used for estimating marginal effects.

Let us check this assessment with one example. First, we simulate some data, then
run a logistic regression and compute the marginal effects, and then compare with a LPM:

``````set.seed(1234)
x1 <- rnorm(100)
x2 <- rnorm(100)

z <- .5 + 2*x1 + 4*x2

p <- 1/(1 + exp(-z))

y <- rbinom(100, 1, p)

df <- tibble(y = y, x1 = x1, x2 = x2)``````

This data generating process generates data from a binary choice model. Fitting the model using a
logistic regression allows us to recover the structural parameters:

``logistic_regression <- glm(y ~ ., data = df, family = binomial(link = "logit"))``

Let’s see a summary of the model fit:

``summary(logistic_regression)``
``````##
## Call:
## glm(formula = y ~ ., family = binomial(link = "logit"), data = df)
##
## Deviance Residuals:
##      Min        1Q    Median        3Q       Max
## -2.91941  -0.44872   0.00038   0.42843   2.55426
##
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept)   0.0960     0.3293   0.292 0.770630
## x1            1.6625     0.4628   3.592 0.000328 ***
## x2            3.6582     0.8059   4.539 5.64e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
##     Null deviance: 138.629  on 99  degrees of freedom
## Residual deviance:  60.576  on 97  degrees of freedom
## AIC: 66.576
##
## Number of Fisher Scoring iterations: 7``````

We do recover the parameters that generated the data, but what about the marginal effects? We can
get the marginal effects easily using the `{margins}` package:

``````library(margins)

margins(logistic_regression)``````
``## Average marginal effects``
``## glm(formula = y ~ ., family = binomial(link = "logit"), data = df)``
``````##      x1     x2
##  0.1598 0.3516``````

Or, even better, we can compute the true marginal effects, since we know the data
generating process:

``````meffects <- function(dataset, coefs){
X <- dataset %>%
select(-y) %>%
as.matrix()

dydx_x1 <- mean(dlogis(X%*%c(coefs[2], coefs[3]))*coefs[2])
dydx_x2 <- mean(dlogis(X%*%c(coefs[2], coefs[3]))*coefs[3])

tribble(~term, ~true_effect,
"x1", dydx_x1,
"x2", dydx_x2)
}

(true_meffects <- meffects(df, c(0.5, 2, 4)))``````
``````## # A tibble: 2 x 2
##   term  true_effect
##
## 1 x1          0.175
## 2 x2          0.350``````

Ok, so now what about using this infamous Linear Probability Model to estimate the marginal effects?

``````lpm <- lm(y ~ ., data = df)

summary(lpm)``````
``````##
## Call:
## lm(formula = y ~ ., data = df)
##
## Residuals:
##      Min       1Q   Median       3Q      Max
## -0.83953 -0.31588 -0.02885  0.28774  0.77407
##
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)  0.51340    0.03587  14.314  < 2e-16 ***
## x1           0.16771    0.03545   4.732 7.58e-06 ***
## x2           0.31250    0.03449   9.060 1.43e-14 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3541 on 97 degrees of freedom
## Multiple R-squared:  0.5135, Adjusted R-squared:  0.5034
## F-statistic: 51.18 on 2 and 97 DF,  p-value: 6.693e-16``````

It’s not too bad, but maybe it could have been better in other circumstances. Perhaps if we had more
observations, or perhaps for a different set of structural parameters the results of the LPM
would have been closer. The LPM estimates the marginal effect of `x1` to be
0.1677134 vs 0.1597956
for the logistic regression and for `x2`, the LPM estimation is 0.3124966
vs 0.351607. The true marginal effects are
0.1750963 and 0.3501926 for `x1` and `x2` respectively.

Just as to assess the accuracy of a model data scientists perform cross-validation, a Monte Carlo
study can be performed to asses how close the estimation of the marginal effects using a LPM is
to the marginal effects derived from a logistic regression. It will allow us to test with datasets
of different sizes, and generated using different structural parameters.

First, let’s write a function that generates data. The function below generates 10 datasets of size
100 (the code is inspired by this StackExchange answer):

``````generate_datasets <- function(coefs = c(.5, 2, 4), sample_size = 100, repeats = 10){

generate_one_dataset <- function(coefs, sample_size){
x1 <- rnorm(sample_size)
x2 <- rnorm(sample_size)

z <- coefs[1] + coefs[2]*x1 + coefs[3]*x2

p <- 1/(1 + exp(-z))

y <- rbinom(sample_size, 1, p)

df <- tibble(y = y, x1 = x1, x2 = x2)
}

simulations <- rerun(.n = repeats, generate_one_dataset(coefs, sample_size))

tibble("coefs" = list(coefs), "sample_size" = sample_size, "repeats" = repeats, "simulations" = list(simulations))
}``````

Let’s first generate one dataset:

``one_dataset <- generate_datasets(repeats = 1)``

Let’s take a look at `one_dataset`:

``one_dataset``
``````## # A tibble: 1 x 4
##   coefs     sample_size repeats simulations
##
## 1          100       1 ``````

As you can see, the tibble with the simulated data is inside a list-column called `simulations`.
Let’s take a closer look:

``str(one_dataset\$simulations)``
``````## List of 1
##  \$ :List of 1
##   ..\$ :Classes 'tbl_df', 'tbl' and 'data.frame': 100 obs. of  3 variables:
##   .. ..\$ y : int [1:100] 0 1 1 1 0 1 1 0 0 1 ...
##   .. ..\$ x1: num [1:100] 0.437 1.06 0.452 0.663 -1.136 ...
##   .. ..\$ x2: num [1:100] -2.316 0.562 -0.784 -0.226 -1.587 ...``````

The structure is quite complex, and it’s important to understand this, because it will have an
impact on the next lines of code; it is a list, containing a list, containing a dataset! No worries
though, we can still map over the datasets directly, by using `modify_depth()` instead of `map()`.

Now, let’s fit a LPM and compare the estimation of the marginal effects with the true marginal
effects. In order to have some confidence in our results,
we will not simply run a linear regression on that single dataset, but will instead simulate hundreds,
then thousands and ten of thousands of data sets, get the marginal effects and compare
them to the true ones (but here I won’t simulate more than 500 datasets).

Let’s first generate 10 datasets:

``many_datasets <- generate_datasets()``

Now comes the tricky part. I have this object, `many_datasets` looking like this:

``many_datasets``
``````## # A tibble: 1 x 4
##   coefs     sample_size repeats simulations
##
## 1          100      10 ``````

I would like to fit LPMs to the 10 datasets. For this, I will need to use all the power of functional
programming and the `{tidyverse}`. I will be adding columns to this data frame using `mutate()`
and mapping over the `simulations` list-column using `modify_depth()`. The list of data frames is
at the second level (remember, it’s a list containing a list containing data frames).

I’ll start by fitting the LPMs, then using `broom::tidy()` I will get a nice data frame of the
estimated parameters. I will then only select what I need, and then bind the rows of all the
data frames. I will do the same for the true marginal effects.

I highly suggest that you run the following lines, one after another. It is complicated to understand
what’s going on if you are not used to such workflows. However, I hope to convince you that once
it will click, it’ll be much more intuitive than doing all this inside a loop. Here’s the code:

``````results <- many_datasets %>%
mutate(lpm = modify_depth(simulations, 2, ~lm(y ~ ., data = .x))) %>%
mutate(lpm = modify_depth(lpm, 2, broom::tidy)) %>%
mutate(lpm = modify_depth(lpm, 2, ~select(., term, estimate))) %>%
mutate(lpm = modify_depth(lpm, 2, ~filter(., term != "(Intercept)"))) %>%
mutate(lpm = map(lpm, bind_rows)) %>%
mutate(true_effect = modify_depth(simulations, 2, ~meffects(., coefs = coefs[[1]]))) %>%
mutate(true_effect = map(true_effect, bind_rows))``````

This is how results looks like:

``results``
``````## # A tibble: 1 x 6
##   coefs     sample_size repeats simulations lpm             true_effect
##
## 1          100      10  ``````
``` Let’s take a closer look to the lpm and true_effect columns: results\$lpm ## [[1]] ## # A tibble: 20 x 2 ## term estimate ## ## 1 x1 0.228 ## 2 x2 0.353 ## 3 x1 0.180 ## 4 x2 0.361 ## 5 x1 0.165 ## 6 x2 0.374 ## 7 x1 0.182 ## 8 x2 0.358 ## 9 x1 0.125 ## 10 x2 0.345 ## 11 x1 0.171 ## 12 x2 0.331 ## 13 x1 0.122 ## 14 x2 0.309 ## 15 x1 0.129 ## 16 x2 0.332 ## 17 x1 0.102 ## 18 x2 0.374 ## 19 x1 0.176 ## 20 x2 0.410 results\$true_effect ## [[1]] ## # A tibble: 20 x 2 ## term true_effect ## ## 1 x1 0.183 ## 2 x2 0.366 ## 3 x1 0.166 ## 4 x2 0.331 ## 5 x1 0.174 ## 6 x2 0.348 ## 7 x1 0.169 ## 8 x2 0.339 ## 9 x1 0.167 ## 10 x2 0.335 ## 11 x1 0.173 ## 12 x2 0.345 ## 13 x1 0.157 ## 14 x2 0.314 ## 15 x1 0.170 ## 16 x2 0.340 ## 17 x1 0.182 ## 18 x2 0.365 ## 19 x1 0.161 ## 20 x2 0.321 Let’s bind the columns, and compute the difference between the true and estimated marginal effects: simulation_results <- results %>% mutate(difference = map2(.x = lpm, .y = true_effect, bind_cols)) %>% mutate(difference = map(difference, ~mutate(., difference = true_effect - estimate))) %>% mutate(difference = map(difference, ~select(., term, difference))) %>% pull(difference) %>% .[[1]] Let’s take a look at the simulation results: simulation_results %>% group_by(term) %>% summarise(mean = mean(difference), sd = sd(difference)) ## # A tibble: 2 x 3 ## term mean sd ## ## 1 x1 0.0122 0.0370 ## 2 x2 -0.0141 0.0306 Already with only 10 simulated datasets, the difference in means is not significant. Let’s rerun the analysis, but for difference sizes. In order to make things easier, we can put all the code into a nifty function: monte_carlo <- function(coefs, sample_size, repeats){ many_datasets <- generate_datasets(coefs, sample_size, repeats) results <- many_datasets %>% mutate(lpm = modify_depth(simulations, 2, ~lm(y ~ ., data = .x))) %>% mutate(lpm = modify_depth(lpm, 2, broom::tidy)) %>% mutate(lpm = modify_depth(lpm, 2, ~select(., term, estimate))) %>% mutate(lpm = modify_depth(lpm, 2, ~filter(., term != "(Intercept)"))) %>% mutate(lpm = map(lpm, bind_rows)) %>% mutate(true_effect = modify_depth(simulations, 2, ~meffects(., coefs = coefs[[1]]))) %>% mutate(true_effect = map(true_effect, bind_rows)) simulation_results <- results %>% mutate(difference = map2(.x = lpm, .y = true_effect, bind_cols)) %>% mutate(difference = map(difference, ~mutate(., difference = true_effect - estimate))) %>% mutate(difference = map(difference, ~select(., term, difference))) %>% pull(difference) %>% .[[1]] simulation_results %>% group_by(term) %>% summarise(mean = mean(difference), sd = sd(difference)) } And now, let’s run the simulation for different parameters and sizes: monte_carlo(c(.5, 2, 4), 100, 10) ## # A tibble: 2 x 3 ## term mean sd ## ## 1 x1 -0.00826 0.0291 ## 2 x2 -0.00732 0.0412 monte_carlo(c(.5, 2, 4), 100, 100) ## # A tibble: 2 x 3 ## term mean sd ## ## 1 x1 0.00360 0.0392 ## 2 x2 0.00517 0.0446 monte_carlo(c(.5, 2, 4), 100, 500) ## # A tibble: 2 x 3 ## term mean sd ## ## 1 x1 -0.00152 0.0371 ## 2 x2 -0.000701 0.0423 monte_carlo(c(pi, 6, 9), 100, 10) ## # A tibble: 2 x 3 ## term mean sd ## ## 1 x1 -0.00829 0.0546 ## 2 x2 0.00178 0.0370 monte_carlo(c(pi, 6, 9), 100, 100) ## # A tibble: 2 x 3 ## term mean sd ## ## 1 x1 0.0107 0.0608 ## 2 x2 0.00831 0.0804 monte_carlo(c(pi, 6, 9), 100, 500) ## # A tibble: 2 x 3 ## term mean sd ## ## 1 x1 0.00879 0.0522 ## 2 x2 0.0113 0.0668 We see that, at least for this set of parameters, the LPM does a good job of estimating marginal effects. Now, this study might in itself not be very interesting to you, but I believe the general approach is quite useful and flexible enough to be adapted to all kinds of use-cases. Hope you enjoyed! If you found this blog post useful, you might want to follow me on twitter for blog post updates and buy me an espresso or paypal.me. .bmc-button img{width: 27px !important;margin-bottom: 1px !important;box-shadow: none !important;border: none !important;vertical-align: middle !important;}.bmc-button{line-height: 36px !important;height:37px !important;text-decoration: none !important;display:inline-flex !important;color:#ffffff !important;background-color:#272b30 !important;border-radius: 3px !important;border: 1px solid transparent !important;padding: 1px 9px !important;font-size: 22px !important;letter-spacing:0.6px !important;box-shadow: 0px 1px 2px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important;margin: 0 auto !important;font-family:'Cookie', cursive !important;-webkit-box-sizing: border-box !important;box-sizing: border-box !important;-o-transition: 0.3s all linear !important;-webkit-transition: 0.3s all linear !important;-moz-transition: 0.3s all linear !important;-ms-transition: 0.3s all linear !important;transition: 0.3s all linear !important;}.bmc-button:hover, .bmc-button:active, .bmc-button:focus {-webkit-box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important;text-decoration: none !important;box-shadow: 0px 1px 2px 2px rgba(190, 190, 190, 0.5) !important;opacity: 0.85 !important;color:#82518c !important;} Buy me an Espresso var vglnk = { key: '949efb41171ac6ec1bf7f206d57e90b8' }; (function(d, t) { var s = d.createElement(t); s.type = 'text/javascript'; s.async = true; s.src = '//cdn.viglink.com/api/vglnk.js'; var r = d.getElementsByTagName(t)[0]; r.parentNode.insertBefore(s, r); }(document, 'script')); Related ShareTweet To leave a comment for the author, please follow the link and comment on their blog: Econometrics and Free Software. R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job. Want to share your content on R-bloggers? click here if you have a blog, or here if you don't. If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook... ```
``` ```
``` Comments are closed. ```
``` Search R-bloggers Most visited articles of the week Free Springer Books during COVID19 5 Ways to Subset a Data Frame in R How to write the first for loop in R R – Sorting a data frame by the contents of a column Date Formats in R Installing R packages How to Set Up TensorFlow 2 in R in 5 Minutes (BONUS Image Recognition Tutorial) Intro to {polite} Web Scraping of Soccer Data with R! How to schedule R scripts Sponsors // https://support.cloudflare.com/hc/en-us/articles/200169436-How-can-I-have-Rocket-Loader-ignore-my-script-s-in-Automatic-Mode- // this must be placed higher. Otherwise it doesn't work. // data-cfasync="false" is for making sure cloudflares' rocketcache doesn't interfeare with this // in this case it only works because it was used at the original script in the text widget function createCookie(name,value,days) { var expires = ""; if (days) { var date = new Date(); date.setTime(date.getTime() + (days*24*60*60*1000)); expires = "; expires=" + date.toUTCString(); } document.cookie = name + "=" + value + expires + "; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); } async function readTextFile(file) { // Helps people browse between pages without the need to keep downloading the same // ads txt page everytime. This way, it allows them to use their browser's cache. var random_number = readCookie("ad_random_number_cookie"); if(random_number == null) { var random_number = Math.floor(Math.random()*100*(new Date().getTime()/10000000000)); createCookie("ad_random_number_cookie",random_number,1) } file += '?t='+random_number; var rawFile = new XMLHttpRequest(); rawFile.onreadystatechange = function () { if(rawFile.readyState === 4) { if(rawFile.status === 200 || rawFile.status == 0) { // var allText = rawFile.responseText; // document.write(allText); document.write(rawFile.responseText); } } } rawFile.open("GET", file, false); rawFile.send(null); } // readTextFile('https://raw.githubusercontent.com/Raynos/file-store/master/temp.txt'); readTextFile("https://www.r-bloggers.com/wp-content/uploads/text-widget_anti-cache.txt"); Jobs for R usersData Analytics Auditor, Future of Audit LeadData Analytics Auditor, Future of Audit Lead @ London or NewcastleSenior Scientist, Translational Informatics @ Vancouver, BC, CanadaSenior Principal Data Scientist @ Mountain View, California, United StatesTechnical Research Analyst – New York, U.S.Movement Building AnalystInnovation Fellow python-bloggers.com (python/data-science news)AdaOptAutomatically create perfect .gitignore file for your projectHow to Write a Git Commit Message, in 7 StepsPredictive Power Score: Finding predictive patterns in your datasetDocumentation+Pypi for the `teller`, a model-agnostic tool for Machine Learning explainabilityPyBoy: A Python GameBoy EmulatorFree Springer Books during COVID19 Full list of contributing R-bloggers ```
``` R-bloggers was founded by Tal Galili, with gratitude to the R community. Is powered by WordPress using a bavotasan.com design. Copyright © 2020 R-bloggers. All Rights Reserved. Terms and Conditions for this website var snp_f = []; var snp_hostname = new RegExp(location.host); var snp_http = new RegExp("^(http|https)://", "i"); var snp_cookie_prefix = ''; var snp_separate_cookies = false; var snp_ajax_url = 'https://www.r-bloggers.com/wp-admin/admin-ajax.php'; var snp_ajax_nonce = 'b78866f63c'; var snp_ignore_cookies = false; var snp_enable_analytics_events = false; var snp_enable_mobile = false; var snp_use_in_all = false; var snp_excluded_urls = []; snp_excluded_urls.push(''); Never miss an update! Subscribe to R-bloggers to receive e-mails with the latest R posts. (You will not see this message again.) Click here to close (This popup will not appear again) .snp-pop-109583 .snp-theme6 { max-width: 700px;} .snp-pop-109583 .snp-theme6 h1 {font-size: 17px;} .snp-pop-109583 .snp-theme6 { color: #a0a4a9;} .snp-pop-109583 .snp-theme6 .snp-field ::-webkit-input-placeholder { color: #a0a4a9;} .snp-pop-109583 .snp-theme6 .snp-field :-moz-placeholder { color: #a0a4a9;} .snp-pop-109583 .snp-theme6 .snp-field :-ms-input-placeholder { color: #a0a4a9;} .snp-pop-109583 .snp-theme6 .snp-field input { border: 1px solid #a0a4a9;} .snp-pop-109583 .snp-theme6 .snp-field { color: #000000;} .snp-pop-109583 .snp-theme6 { background: #f2f2f2;} jQuery(document).ready(function() { }); var CaptchaCallback = function() { jQuery('.g-recaptcha').each(function(index, el) { grecaptcha.render(el, { 'sitekey' : '' }); }); }; (function(){ var corecss = document.createElement('link'); var themecss = document.createElement('link'); var corecssurl = "https://www.r-bloggers.com/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/styles/shCore.css?ver=3.0.9b"; if ( corecss.setAttribute ) { corecss.setAttribute( "rel", "stylesheet" ); corecss.setAttribute( "type", "text/css" ); corecss.setAttribute( "href", corecssurl ); } else { corecss.rel = "stylesheet"; corecss.href = corecssurl; } document.head.appendChild( corecss ); var themecssurl = "https://www.r-bloggers.com/wp-content/plugins/syntaxhighlighter/syntaxhighlighter3/styles/shThemeDefault.css?ver=3.0.9b"; if ( themecss.setAttribute ) { themecss.setAttribute( "rel", "stylesheet" ); themecss.setAttribute( "type", "text/css" ); themecss.setAttribute( "href", themecssurl ); } else { themecss.rel = "stylesheet"; themecss.href = themecssurl; } document.head.appendChild( themecss ); })(); SyntaxHighlighter.config.strings.expandSource = '+ expand source'; SyntaxHighlighter.config.strings.help = '?'; SyntaxHighlighter.config.strings.alert = 'SyntaxHighlighter\n\n'; SyntaxHighlighter.config.strings.noBrush = 'Can\'t find brush for: '; SyntaxHighlighter.config.strings.brushNotHtmlScript = 'Brush wasn\'t configured for html-script option: '; SyntaxHighlighter.defaults['pad-line-numbers'] = false; SyntaxHighlighter.defaults['toolbar'] = false; SyntaxHighlighter.all(); // Infinite scroll support if ( typeof( jQuery ) !== 'undefined' ) { jQuery( function( \$ ) { \$( document.body ).on( 'post-load', function() { SyntaxHighlighter.highlight(); } ); } ); } _stq = window._stq || []; _stq.push([ 'view', {v:'ext',j:'1:7.3.2',blog:'11524731',post:'185646',tz:'-6',srv:'www.r-bloggers.com'} ]); _stq.push([ 'clickTrackerInit', '11524731', '185646' ]); jQuery(document).ready(function (\$) { //\$( document ).ajaxStart(function() { //}); for (var i = 0; i < document.forms.length; ++i) { var form = document.forms[i]; if (\$(form).attr("method") != "get") { \$(form).append('<input type="hidden" name="jIBkaqQVHTl" value="oCAPh9pY4Iy" />'); } if (\$(form).attr("method") != "get") { \$(form).append('<input type="hidden" name="cgSbLnGDmuop" value="0ymqxuI5tUKJ" />'); } if (\$(form).attr("method") != "get") { \$(form).append('<input type="hidden" name="lbnHGIegTFXc" value="hw1t.gx[]HkX" />'); } if (\$(form).attr("method") != "get") { \$(form).append('<input type="hidden" name="ZVuvrLMsGE_Xd" value="jA92xkTbXp]@l" />'); } } \$(document).on('submit', 'form', function () { if (\$(this).attr("method") != "get") { \$(this).append('<input type="hidden" name="jIBkaqQVHTl" value="oCAPh9pY4Iy" />'); } if (\$(this).attr("method") != "get") { \$(this).append('<input type="hidden" name="cgSbLnGDmuop" value="0ymqxuI5tUKJ" />'); } if (\$(this).attr("method") != "get") { \$(this).append('<input type="hidden" name="lbnHGIegTFXc" value="hw1t.gx[]HkX" />'); } if (\$(this).attr("method") != "get") { \$(this).append('<input type="hidden" name="ZVuvrLMsGE_Xd" value="jA92xkTbXp]@l" />'); } return true; }); jQuery.ajaxSetup({ beforeSend: function (e, data) { //console.log(Object.getOwnPropertyNames(data).sort()); //console.log(data.type); if (data.type !== 'POST') return; if (typeof data.data === 'object' && data.data !== null) { data.data.append("jIBkaqQVHTl", "oCAPh9pY4Iy"); data.data.append("cgSbLnGDmuop", "0ymqxuI5tUKJ"); data.data.append("lbnHGIegTFXc", "hw1t.gx[]HkX"); data.data.append("ZVuvrLMsGE_Xd", "jA92xkTbXp]@l"); } else { data.data = data.data + '&jIBkaqQVHTl=oCAPh9pY4Iy&cgSbLnGDmuop=0ymqxuI5tUKJ&lbnHGIegTFXc=hw1t.gx[]HkX&ZVuvrLMsGE_Xd=jA92xkTbXp]@l'; } } }); }); /* <![CDATA[ */ jQuery(function(){ jQuery("ul.sf-menu").supersubs({ minWidth: 12, maxWidth: 27, extraWidth: 1 }).superfish({ delay: 100, speed: 250 }); }); /* ]]> */ ```