Hi, I’ve created a simple fixed effects version of Li and Racine’s Kernel Regression with Mixed Data Types (npreg function from np package) by including an unordered firm id variable and ordered year variable as extra covariates. See below for the setup:
****** bandwidth <- npregbw(formula = log.PPE ~ factor(tax.policy) + tax.rate + GDP.growth + log.firm.turnover + MNE.country.count, factor(subsidiary_id), ordered(year) data = Norway, regtype = "ll", bwmethod = "cv.aic", ckertype = "gaussian", ckerorder = 2, ukertype = "aitchisonaitken", okertype = "wangvanryzin" ) model.np <- npreg(bws = bandwidth, gradients = TRUE, residuals = TRUE) plot(model.np, plot.errors.method = "bootstrap", plot.errors.boot.num = 25, plot.errors.boot.method = "inid") ****** I understand that nonparametric regressions allow for nonlinear relationships for all covariates and interactions between all covariates. I have calculated the gradients in the npreg function but would like advice about how to use them. I have several related questions: 1. How do I calculate the average partial effect of the binary tax policy variable over all subsidiaries in the sample? That is, I would like to calculate the: a. average investment level of each subsidiary when the policy variable = 0 (holding other covariates at their median for that subsidiary) and b. average investment level of each subsidiary when the policy variable = 1 (holding other covariates at their median for that subsidiary) and then c. take the difference. d. And then I would like to calculate the average of this difference over all subsidiaries. 2. Similarly, I am interested in the interactions between the policy variable and other covariates. For example, was the policy effect bigger for larger subsidiaries or for multinationals with a presence in many other countries? Basically, I would like to know how to produce the type of output that one can get from the 'margins' command in STATA. 3. Finally, is there a way to customise the partial regression plots that result from the plot command after using npreg? Eg. How do I choose to hold the policy variable at 0 and at 1 so that I can compare two versions of the plots? Many thanks, Lisa Masters Student, University of Tübingen. -- View this message in context: http://r.789695.n4.nabble.com/npreg-average-partial-effects-and-customised-partial-regression-plots-tp4710500.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.