Description Usage Arguments Value Author(s) References Examples
Inserts the fitted probability of observing the chained data used in estimation for the model (fm). To be used when the outcome variable is used as a covariate at subsequent stages of an analysis. The fitted probability is conditional on the nearest observed value in the chain.
1 |
fm |
a fitted model for the outcome that is required to be filled. Must be the result of a call to |
states |
the outcome vector used to estimate the fitted model. Must be sequentially ordered within chains |
chain.id |
a vector indicating which states belong to which chains |
X |
the design matrix for the model used to create fm. Column ordering must match that provided to fm and row ordering must match that in states (and chain.id) |
a matrix with number of columns equal to the number of categories of the outcome variable. Each column contains the observed value of that variable (if available) or the predicted probability of that observed variable (if no observation). Note that missing values at the ends of the chains are not imputed and are removed prior to estimation from RMC.mod. |
Scott D. Foster
Foster, S.D., Bravington, M.V., Williams, A., Althaus, F, Laslett, G.M., and Kloser, R.J. (2008) Analysis and prediction of faunal distributions from video and multi-beam sonar data using Markov models. Environmetrics, 20: 541-560.
1 2 3 4 5 6 7 8 | #form data with NAs in the outcomes
dataEG2.NA <- dataEG2
dataEG2.NA[sample(1:nrow( dataEG2.NA), 1000),"state"] <- NA #specify lots of NAs
#fit a model using dataEG2.NA
fm.est2.NA <- RMC.mod( states=dataEG2.NA[,2], chain.id=dataEG2.NA[,1], X=dataEG2.NA[,-(1:2)])
#impute the missing values. The result will be a matrix
imputedData <- MVfill( fm.est2.NA, states=dataEG2.NA[,2], chain.id=dataEG2.NA[,1], X=dataEG2.NA[,3:4])
print( head( imputedData, 20))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.