mdImputeCondMean

Replace NaNs in Y by E[y_mis | y_obs, mu, Sigma] under MVN(mu,Sigma)

Syntax

  • Yimp=mdImputeCondMean(Y, mu, Sigma)example

Description

example

Yimp =mdImputeCondMean(Y, mu, Sigma) Example of imputation using conditional mean.

Examples

expand all

  • Example of imputation using conditional mean.
  • % Example of imputation using conditional mean.
    p=10; n=20;
    Yfull=randn(n,p);
    MU=median(Yfull); 
    Sigma=eye(p);
    Y=Yfull;
    Y(randsample(n*p,10,false))=NaN;
    Yinp=mdImputeCondMean(Y,MU,Sigma);

    Input Arguments

    expand all

    Y — Input data. Matrix.

    n x v data matrix; n observations and v variables. Rows of Y represent observations, and columns represent variables.

    Y contains a seres of missing values (NaN's)

    Data Types: single|double

    mu — Centroid. Vector.

    vector of length v, containing centroid to use

    Data Types: single| double

    Sigma — Covariance matrix. Matrix.

    v x v matrix containing covariance matrix which must be used

    Data Types: single| double

    Output Arguments

    expand all

    Yimp —matrix with imputed values. Matrix of size nxv

    Matrix Yinp does not contain missing values.

    References

    Little, R. J. A., & Rubin, D. B. (2019). Statistical Analysis with Missing Data (3rd ed.). Hoboken, NJ: John Wiley & Sons.

    Templ, M. (2023). Visualization and Imputation of Missing Values: With Applications in R. Cham, Switzerland: Springer Nature.

    This page has been automatically generated by our routine publishFS