Description Usage Arguments Details Value Examples
Function to Use SVD to Interpolate the Missing Values in the Time Series Data
1 | fillNASVDSer(dset, idF, dateF, valF, k)
|
dset |
The data frame for time series. Data format: siteid, date, obs |
idF |
The unique location id like siteid. |
dateF |
The time column name. |
valF |
The target variable column name. |
k |
the priciple component, default 1 |
This function can be used to fill the missing values in time series for many locations.
The data frame similar to the input dset's structure but with filled values.
1 2 3 4 5 6 7 8 9 10 11 12 13 | #Using the 2014 PM2.5 time series as an example
data("shdSeries2014")
n=nrow(shdSeries2014)
p=0.1 # Set the proportion of missing values
np=as.integer(n*p)
index=sample(n,np)
shdSeries2014missed=shdSeries2014
shdSeries2014missed[index,"obs"]=NA
shdSeries2014filled=fillNASVDSer(shdSeries2014missed,"siteid","date","obs",k=1)
#Exmine the accuracy:
cor(shdSeries2014filled[index,"obs"],shdSeries2014[index,"obs"])
rmse(shdSeries2014filled[index,"obs"],shdSeries2014[index,"obs"])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.