gpapadog / dapsm Goto Github PK
View Code? Open in Web Editor NEWDistance Adjusted Propensity Score Matching R Package
Distance Adjusted Propensity Score Matching R Package
An in-development package has a fourth component: the development version. This should start at 9000. For example, the first version of the package should be 0.0.0.9000. There are two reasons for this recommendation: first, it makes it easy to see if a package is released or in-development, and the use of the fourth place means that you’re not limited to what the next version will be. 0.0.1, 0.1.0 and 1.0.0 are all greater than 0.0.0.9000.
To have a non-simulated self-contained example: http://r-pkgs.had.co.nz/data.html.
Hello,
I'm trying to use the DAPSm package to look at the difference in above ground biomass between two forest treatment types that are spread across a large region. Because I have a lot of data points, I've been trying to use the "fast search of the optimal weight," but I keep getting this error:
Error in if (!any(abs(stand_diff) > cutoff)) { : missing value where TRUE/FALSE needed
My data frame has all of the variables you detail in your DAPSm vignette, so I'm not sure what I'm doing wrong. If you have any ideas, or you have dealt with getting past this error, I would much appreciate some help, as I am pretty new to coding. Here's my dapsm code for reference.
daps <- DAPSest(edges_100, out.col = 9, trt.col = 24, caliper = 0.3, weight = 'optimal', coords.columns = c(2, 1), pairsRet = TRUE, cov.cols = 20, cutoff = 0.15, w_tol = 0.001, coord_dist = TRUE, caliper_type = 'DAPS', matching_algorithm = 'greedy')
Cheers!
In a clean session:
> data('toyData')
> toyData$prop.scores <- glm(Z ~ X1 + X2 + X3 + X4, family = binomial,
+ data = toyData)$fitted.values
> daps1 <- DAPSest(toyData, out.col = 2, trt.col = 1, caliper = 0.5,
+ weight = 'optimal', coords.columns = c(4, 5),
+ pairsRet = TRUE, cov.cols = 6:9, cutoff = 0.1,
+ w_tol = 0.001, coord_dist = TRUE, caliper_type = 'DAPS')
[1] 0 1
Error in pairmatch(M, data = data.frame(treatment_indicator), remove.unmatchables = remove.unmatchables) :
could not find function "pairmatch"
From http://r-pkgs.had.co.nz/description.html:
Adding a package dependency here ensures that it’ll be installed. However, it does not mean that it will be attached along with your package (i.e., library(x)). The best practice is to explicitly refer to external functions using the syntax package::function(). This makes it very easy to identify which functions live outside of your package. This is especially useful when you read your code in the future.
> data('toyData')
> toyData$prop.scores <- glm(Z ~ X1 + X2 + X3 + X4, family = binomial,
+ data = toyData)$fitted.values
> daps1 <- DAPSest(toyData, out.col = 2, trt.col = 1, caliper = 0.5,
+ weight = 'optimal', coords.columns = c(4, 5),
+ pairsRet = TRUE, cov.cols = 6:9, cutoff = 0.1,
+ w_tol = 0.001, coord_dist = TRUE, caliper_type = 'DAPS')
[1] 0 1
Error in daps.out$match : $ operator is invalid for atomic vectors
> names(daps1)
Error: object 'daps1' not found
> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X El Capitan 10.11.4
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] DAPSm_0.0.0.9000 optmatch_0.9-7 survival_2.41-3 data.table_1.10.4
loaded via a namespace (and not attached):
[1] Rcpp_0.12.10 lattice_0.20-35 digest_0.6.12 grid_3.3.3 xtable_1.8-2 spam_1.4-0 svd_0.4
[8] SparseM_1.77 RItools_0.1-15 Matrix_1.2-10 splines_3.3.3 tools_3.3.3 maps_3.1.1 fields_8.10
[15] abind_1.4-5
Did you upload it on purpose (e.g., to get a specific display in Finder)?
https://help.github.com/articles/creating-releases/
For example, 0.1 for the draft, 0.2 for the revised version, 1.0 when on CRAN, etc.
f <- function(caliper_type = c("DAPS", "PS")) {
caliper_type <- match.arg(caliper_type)
if (caliper_type == "DAPS")
print("DAPS")
else if (caliper_type == "PS")
print("PS")
}
f() # ok "DAPS"
f("DAPS") # ok "DAPS"
f("PS") # ok "PS"
f("other") # Error in match.arg(caliper_type) : 'arg' should be one of "DAPS", "PS"
Once the repo goes public.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.