
Last chance! 50% off unlimited learning
Sale ends in
Visualize the imputed values in a time series.
plotNA.imputations(x.withNA, x.withImputations, x.withTruth = NULL,
legend = TRUE, main = "Visualization Imputed Values", xlab = "Time",
ylab = "Value", colWithTruth = "green3", colLines = "black",
colWithImputations = "indianred2", colWithNA = "steelblue2",
ylim = c(min(c(x.withImputations, x.withTruth), na.rm = TRUE),
max(c(x.withImputations, x.withTruth), na.rm = TRUE)), pch = 20,
cex = 0.8, ...)
Numeric Vector or Time Series (ts
) object with NAs before imputation
Numeric Vector or Time Series (ts
) object with NAs replaced by imputed values
Numeric Vector or Time Series (ts
) object with the real values. (can be set to NULL if not known)
If TRUE a legend is shown at the bottom of the plot. A custom legend can be obtained by
setting this parameter to FALSE and using legend
function
Main title for the plot
Label for x axis of the plot
Label for y axis of plot
Defines the color of the real values (truth) for the NA values.
Defines the color of the lines connecting non-NA observations.
Defines the color for the imputed values.
Defines the color of the non-NA observations.
the y limits of the plot
Either an integer specifying a symbol or a single character to be used as the default in plotting points.
A numerical value giving the amount by which plotting text and symbols should be magnified relative to the default.
Additional graphical parameters that can be passed through to plot
This plot can be used, to visualize the imputed values for a time series. Therefore, the imputed values (filled NA gaps) are shown in a different color than the other values. If the real values (truth) behind the NA gaps are known these are also added in a different color.
#Example 1: Visualize the values that were imputed by na.mean in the time series
impMean.Airgap <- na.mean(tsAirgap)
plotNA.imputations(tsAirgap, impMean.Airgap)
#Example 2: Visualize the values that were imputed by na.locf and the true values in the time series
impLOCF.Airgap <- na.locf(tsAirgap)
plotNA.imputations(tsAirgap, impLOCF.Airgap, tsAirgapComplete)
Run the code above in your browser using DataLab