FarhadPishgar / MatchThem

Matching and Weighting Multiply Imputed Datasets
14 stars 2 forks source link

Error in terms.default(object$model) : no terms component nor attribute #5

Closed akarito closed 4 years ago

akarito commented 4 years ago

When I import this package, this error occurred always. And I didn't no how to get my matched data from the models. "complete" only get the imputed data but not the dataset for PSM .

Error in terms.default(object$model) : no terms component nor attribute Error in substring(html, match + 6, match + attr(match, "match.length") - : '<93>6<39>. http://j.mp/2oOrtGs

See Also

mimids

with

pool

Examples

#Loading libraries
library(mice)
library(MatchThem)

#Loading the dataset
data(osteoarthritis)

#Multiply imputing the missing values
imputed.datasets <- mice(osteoarthritis, m = 5, maxit = 10,
                         method = c("", "", "mean", "polyreg",
                                    "logreg", "logreg", "logreg"))

#Matching the multiply imputed datasets
matched.datasets <- matchthem(OSP ~ AGE + SEX + BMI + RAC + SMK, imputed.datasets,
                              approach = 'within', method = 'nearest')


[Package MatchThem version 0.9.3 Index]
'多 Error in substring(html, match + 6, match + attr(match, "match.length") - : '<93>6<39>. http://j.mp/2oOrtGs

See Also

mimids

with

pool

Examples

#Loading libraries
library(mice)
library(MatchThem)

#Loading the dataset
data(osteoarthritis)

#Multiply imputing the missing values
imputed.datasets <- mice(osteoarthritis, m = 5, maxit = 10,
                         method = c("", "", "mean", "polyreg",
                                    "logreg", "logreg", "logreg"))

#Matching the multiply imputed datasets
matched.datasets <- matchthem(OSP ~ AGE + SEX + BMI + RAC + SMK, imputed.datasets,
                              approach = 'within', method = 'nearest')


[Package MatchThem version 0.9.3 Index]
'多 Error in substring(html, match + 6, match + attr(match, "match.length") - : '<93>6<39>. http://j.mp/2oOrtGs

See Also

mimids

with

pool

Examples

#Loading libraries
library(mice)
library(MatchThem)

#Loading the dataset
data(osteoarthritis)

#Multiply imputing the missing values
imputed.datasets <- mice(osteoarthritis, m = 5, maxit = 10,
                         method = c("", "", "mean", "polyreg",
                                    "logreg", "logreg", "logreg"))

#Matching the multiply imputed datasets
matched.datasets <- matchthem(OSP ~ AGE + SEX + BMI + RAC + SMK, imputed.datasets,
                              approach = 'within', method = 'nearest')


[Package MatchThem version 0.9.3 Index]
'多

FarhadPishgar commented 4 years ago

Thanks for reaching out. I am unable to reproduce this error. Could you please download the latest versions of the MatchThem and mice packages from the CRAN? Please let me know if the error still occurs.

Regarding your other question, please use: dta.1 <- complete(matched.datasets, n = 1, all = FALSE) The n specifies the matched data set you want to extract. You can also use n = "long" to extract all matched data set in a single data frame (they will be binded vertically): dta.long <- complete(matched.datasets, n = "long", all = FALSE) (all = TRUE/FALSE specifies including/excluding unmatched rows)

However, I highly suggest using with() and pool() for analysis of the matched data sets. Please see here for more details. Thanks,

akarito commented 4 years ago

Thanks for your advice.

The versions of the MatchThem and mice packages are already the latest, and I download it yesterday from CRAN.

I think maybe the R documentation of the "matchthem" function got something wrong because of encoding or something in my computer. I just enter the function name in my script, and I got this error in my Console. But when I reload the package it disappeared.

微信图片_20200723135038 微信图片_20200723135052