I have two time series. One is an environmental variable (*n* = 108) organized by year and month. The other is a biological variable, also organized by year and month, but I have no data for some months (*n* = 97).

I did a cross-correlation in R between these 2 times series, and used the `na.exclude`

function for the biological variable to account for the missing values. I then fit a lagged regression, again accounting for the missing values.

However, I want to know:

Could I do a cross-correlation by deleting these missing values (no data months) for the biological variable, which will leave me with unequal lengths? R still does a cross-correlation, but I am unsure if the results are valid.

Could I delete the corresponding months in the env. variable to have equal length time series, or is accounting for missing values the correct approach?

Thanks.

**Contents**hide

#### Best Answer

First, if your software (R or any other) is computing a correlation, it is doing so without using any blank values.

As for the larger question: there is no single correct approach. Recognize that this is not a choice between reacting or not reacting to the missing data: to perform *complete-case analysis* in the presence of missing data (i.e., to ignore the fact that some values are missing) is itself a choice.

To impute values may be a defensible strategy. You will want to study the literature on different techniques for imputing, e.g., mean-value imputation, hot-deck imputation, multiple imputation, and multiple imputation with chained equations (these last would be applicable if you have more than just the two variables to work with).

Just as important, you will want to study the preconditions that are typically associated with the use of these techniques — *including complete case analysis*. These conditions involve determinations that the data are either missing at random (MAR), missing completely at random (MCAR), or missing not at random (MNAR or NMAR).

### Similar Posts:

- Solved – Handling large gaps of missing data in the dataset
- Solved – Validation set for hyperparameter tuning of ML time series model
- Solved – Pearson Correlations in time series between time and value
- Solved – Missing value treatment
- Solved – What happens if I add all the months as independent variable