[r-cran-matchit] 17/45: Import Upstream version 2.2-11
Andreas Tille
tille at debian.org
Fri Oct 20 06:17:19 UTC 2017
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository r-cran-matchit.
commit f4aa1eb8fb0abc5ad965c745674dd27226a1eb5a
Author: Andreas Tille <tille at debian.org>
Date: Fri Oct 20 07:40:54 2017 +0200
Import Upstream version 2.2-11
---
DESCRIPTION | 6 +++---
R/matchit.R | 5 +++++
R/matchit.qqplot.R | 14 +++++++++++++-
R/matchit2nearest.R | 1 -
R/summary.matchit.R | 13 ++++++++++++-
R/summary.matchit.subclass.R | 13 ++++++++++++-
man/help.matchit.Rd | 2 +-
man/match.data.Rd | 2 +-
8 files changed, 47 insertions(+), 9 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index db65148..f610c96 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: MatchIt
-Version: 2.2-10
-Date: 2006-05-09
+Version: 2.2-11
+Date: 2006-06-12
Title: MatchIt: Nonparametric Preprocessing for Parametric Casual Inference
Author: Daniel Ho <daniel.e.ho at gmail.com>,
Kosuke Imai <kimai at Princeton.Edu>,
@@ -18,4 +18,4 @@ LazyLoad: yes
LazyData: yes
License: GPL version 2 or newer
URL: http://gking.harvard.edu/matchit
-Packaged: Wed May 10 09:33:05 2006; kimai
+Packaged: Thu Jul 13 16:25:02 2006; estuart
diff --git a/R/matchit.R b/R/matchit.R
index 5096285..254de57 100644
--- a/R/matchit.R
+++ b/R/matchit.R
@@ -9,6 +9,11 @@ matchit <- function(formula, data, method = "nearest", distance = "logit",
stop("Data must be a dataframe",call.=FALSE)}
if(sum(is.na(data))>0)
stop("Missing values exist in the data")
+
+ ## 7/13/06: Convert character variables to factors as necessary
+ ischar <- rep(0, dim(data)[2])
+ for (i in 1:dim(data)[2])
+ if(is.character(data[,i])) data[,i] <- as.factor(data[,i])
## check inputs
if (!is.numeric(distance)) {
diff --git a/R/matchit.qqplot.R b/R/matchit.qqplot.R
index 42a6357..1c7ab6d 100644
--- a/R/matchit.qqplot.R
+++ b/R/matchit.qqplot.R
@@ -1,7 +1,19 @@
matchit.qqplot <- function(x,discrete.cutoff,
which.subclass=NULL, numdraws=5000,
interactive = T, which.xs = NULL){
- covariates <- x$X
+ X <- x$X
+ ## Fix X matrix so that it doesn't have any factors
+ varnames <- colnames(X)
+ for(var in varnames) {
+ if(is.factor(X[,var])) {
+ tempX <- X[,!colnames(X)%in%c(var)]
+ form<-formula(substitute(~dummy-1,list(dummy=as.name(var))))
+ X <- cbind(tempX, model.matrix(form, X))
+ }
+ }
+
+ covariates <- X
+
if(!is.null(which.xs)){
if(sum(which.xs%in%dimnames(covariates)[[2]])!=length(which.xs)){
stop("which.xs is incorrectly specified")
diff --git a/R/matchit2nearest.R b/R/matchit2nearest.R
index cc4988b..9a3460f 100644
--- a/R/matchit2nearest.R
+++ b/R/matchit2nearest.R
@@ -224,7 +224,6 @@ matchit2nearest <- function(treat, X, data, distance, discarded,
x <- as.matrix(match.matrix)
x[x==-1] <- NA
-
## Calculate weights and return the results
res <- list(match.matrix = match.matrix, weights =
weights.matrix(match.matrix, treat, discarded), X=X)
diff --git a/R/summary.matchit.R b/R/summary.matchit.R
index 94f089c..7df6881 100644
--- a/R/summary.matchit.R
+++ b/R/summary.matchit.R
@@ -2,7 +2,18 @@ summary.matchit <- function(object, interactions = FALSE,
addlvariables = NULL, standardize = FALSE,
...) {
- XX <- cbind(distance=object$distance,object$X)
+ X <- object$X
+ ## Fix X matrix so that it doesn't have any factors
+ varnames <- colnames(X)
+ for(var in varnames) {
+ if(is.factor(X[,var])) {
+ tempX <- X[,!colnames(X)%in%c(var)]
+ form<-formula(substitute(~dummy-1,list(dummy=as.name(var))))
+ X <- cbind(tempX, model.matrix(form, X))
+ }
+ }
+
+ XX <- cbind(distance=object$distance,X)
if (!is.null(addlvariables)) XX <- cbind(XX, addlvariables)
treat <- object$treat
diff --git a/R/summary.matchit.subclass.R b/R/summary.matchit.subclass.R
index e42194f..96c59a6 100644
--- a/R/summary.matchit.subclass.R
+++ b/R/summary.matchit.subclass.R
@@ -2,7 +2,18 @@ summary.matchit.subclass <- function(object, interactions = FALSE,
addlvariables=NULL, standardize = FALSE,
...) {
- XX <- cbind(distance=object$distance,object$X)
+ X <- object$X
+ ## Fix X matrix so that it doesn't have any factors
+ varnames <- colnames(X)
+ for(var in varnames) {
+ if(is.factor(X[,var])) {
+ tempX <- X[,!colnames(X)%in%c(var)]
+ form<-formula(substitute(~dummy-1,list(dummy=as.name(var))))
+ X <- cbind(tempX, model.matrix(form, X))
+ }
+ }
+
+ XX <- cbind(distance=object$distance,X)
if (!is.null(addlvariables)) XX <- cbind(XX, addlvariables)
treat <- object$treat
diff --git a/man/help.matchit.Rd b/man/help.matchit.Rd
index c77c176..a2d1176 100644
--- a/man/help.matchit.Rd
+++ b/man/help.matchit.Rd
@@ -6,7 +6,7 @@
\description{
The \code{help.matchit} command launches html help for Matchit commands
- and supported models. The full manual is available online at
+ and supported methods. The full manual is available online at
\url{http://gking.harvard.edu/matchit}.
}
diff --git a/man/match.data.Rd b/man/match.data.Rd
index 31785b3..6f1b0dd 100644
--- a/man/match.data.Rd
+++ b/man/match.data.Rd
@@ -15,7 +15,7 @@ weights = "weights", subclass = "subclass")
\arguments{
\item{object}{The output object from {\tt matchit()}. This is
- an required input.
+ a required input.
}
\item{group}{This argument specifies for which matched group the user
wants to extract the data. Available options are \code{"all"} (all
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/r-cran-matchit.git
More information about the debian-science-commits
mailing list