Description Usage Arguments Value Examples
This function performs imputation by predictive mean matching by executing the pmmDS function on the server-side.
1 2 |
y |
Vector to be imputed |
ry |
Logical vector of length |
x |
Numeric design matrix with |
wy |
Logical vector of length |
donors |
The size of the donor pool among which a draw is made.
The default is |
matchtype |
Type of matching distance. The default choice
( |
ridge |
The ridge penalty used in |
... |
Other named arguments. |
Vector with imputed data, same type as y
, and of length
sum(wy)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # In this example, we assume that the Opal server to which we are connecting,
# has a table that contains the 'boys' data from the original mice package.
# Load DataSHIELD libraries
library(dsBaseClient)
library(dsMiceClient)
# Build login information
server <- c("server_name")
url <- c("opal_url")
user <- "username"
password <- "password"
table <- c("project_name.table_name")
logindata <- data.frame(server,url,user,password,table)
# Login and assign the 'boys' dataset to varable 'D' on the server-side
opals <- datashield.login(logins=logindata, assign=TRUE)
datashield.assign(opals, symbol="xname", value=as.symbol("c('age', 'hgt', 'wgt')"))
datashield.assign(opals, symbol="r", value=as.symbol("complete.cases(D[, xname])"))
datashield.assign(opals, symbol="x", value=as.symbol("D[r, xname]"))
datashield.assign(opals, symbol="y", value=as.symbol("D[r, 'tv']"))
datashield.assign(opals, symbol="ry", value=as.symbol("notNaDS(y)"))
# Impute missing tv data
yimp <- ds.mice.pmm('y','ry','x')
length(yimp)
table(yimp)
hist(table(yimp), xlab = 'Imputed missing tv')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.