FIT {mimR} | R Documentation |
Fits model in MIM either directly or using an EMalgorithm in the case of incomplete data
fit(mim, submitData=TRUE) emfit(mim, arg = "R", submitData=TRUE, emconv=0.0001, emmax=1000, plot = FALSE)
mim |
A mim model object |
submitData |
If TRUE data are submitted to MIM, otherwise not. If data is already loaded in MIM, setting submitData=FALSE saves some time |
arg |
can be one of the letters "R", "S" or "F" |
emconv |
Convergence criterion for EM algorithm |
emmax |
|
plot |
If TRUE, the convergence history of the EM algorithm is plotted |
The S option enables the user to supply start values for the missing data: as with the R option these are used to calculate the sufficient statistics, and thence the initial parameter estimates. First start values are entered, and then these are overwritten with an asterix (missing value). For an example of how to do this, see the examples below.
The start values can be entered using EditData in MIM: first enter the desired value, and then overwrite this with an asterix (missing value). Check using Print E in MIM that the values have been correctly entered.
Returns a fitted mim object
Before using mimR, make sure that the MIM program is runnning.
Søren Højsgaard, sorenh@agrsci.dk
David Edwards, An Introduction to Graphical Modelling, Springer Verlag, 2002
data(mathmark) math <- mathmark math$L <- factor(NA, levels=1:2) gmd.math <- as.gmData(math) latent(gmd.math) <- "L" m1 <- mim("*", data=gmd.math) m2 <- editmim(m1, del=paste(names(math)[1:5],":",collapse='')) m2f <- emfit(m2) d.imp <- retrieveData(gmd.math,impute=TRUE)