predict.GLoMo: Predict (sample) data from GLoMo model

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/GLoMo.r

Description

Sample data (filling out existing data or sampling a completely new dataset). If a dataset is provided, and it contains 'cells' that are not covered by the naive GLoMo, a warning is issued and marginal probabilities and means are used.

Usage

1
2
## S3 method for class 'GLoMo'
predict(object, nobs = 1, newdata = NULL, forrows = seq(nrow(newdata)), reusabledata = NULL, returnRepeats = FALSE, returnSelectedGlomoRows = FALSE, verbosity = 0,...)

Arguments

object

GLoMo object

nobs

number of observations to sample. Can be a single integer or a vector of the same length as forrows.

newdata

NULL (the default) if you want to sample a completely new dataset. Otherwise, a dataset of the correct column structure, holding NA values.

forrows

indices of the rows of newdata for which data will be sampled. Default is all of them.

reusabledata

See reusableDataForGLoMoSampling. Some of the calculations can be done for a row so that repeated sampling can go faster. If not provided, this is calculated. Optionally, pass a GuidData object or a list of uids for the rows here.

returnRepeats

if TRUE (not the default), an additional vector of the same length as forrows is returned, holding how many rows were sampled for each row.

returnSelectedGlomoRows

if TRUE (not the default), an additional vector of the same length as the number of rows sampled is returned, holding which row of the GLoMo object was used for which row.

verbosity

The higher this value, the more levels of progress and debug information is displayed (note: in R for Windows, turn off buffered output)

...

Ignored for now

Value

If both returnRepeats and returnSelectedGlomoRows are FALSE, a data.frame or numdfr (dependent on the dfr that was used in the original call to GLoMo that holds the sampled data.

Otherwise, a list with items:

predicted

The sampled dataset described above

glomorowsused

(only if returnSelectedGlomoRows was TRUE) vector of the same length as the number of rows sampled is returned, holding which row of the GLoMo object was used for which row

numRepPerRow

(only if returnRepeats was TRUE) vector of the same length as forrows is returned, holding how many rows were sampled for each row

Author(s)

Nick Sabbe (nick.sabbe@ugent.be)

References

"Statistical Analysis with Missing Values"

See Also

GLoMo-package, NumDfr, predict, GLoMo

Examples

1
2
3
4
5
6
7
iris.md<-randomNA(iris, 0.1)
iris.md.nd<-numdfr(iris.md)
iris.nd.rnd<-rCatsAndCntInDfr(iris.md.nd, orgriName=NULL, verbosity=1)
iris.weights<-iris.nd.rnd$weights
iris.nd.rnd<-iris.nd.rnd[,1:5]
iris.glomo<-GLoMo(iris.nd.rnd, weights=iris.weights, verbosity=1)
iris.pred.cond<-predict(iris.glomo, nobs=100, verbosity=1)

GLoMo documentation built on May 2, 2019, 5:26 p.m.