bob123
bob123

Reputation: 163

R -- Method for Interpolation over 2d datset with missing values

I am currently using the 'Akima' interp routine in order to do 2d linear interpolation. I'm currently trying to do linear interpolations as best as I can by excluding the bad datpoints and interpolated values that depend upon them. I don't want to do any spline fitting just linear interpolation.

I can think of two ways to do this using the existing akima package;

  1. by partitioning the 2d datasets into valid subsets that do not have missing data points, and then interpolating on each, and then merging the results.
  2. or by setting the missing value to a nonsense value, (-1.0 in my case), and then marking the results where any interpolated value NA. Unfortunately, the indices of the interpolation nodes do not appear to be returned, so I'll have to find these nodes myself in which case I should just write my own routine.

Each is a a bit of a pain and I'm sure there must be a better way or there must be a package to do one of the above as this I'm sure is a common problems that many have had.

Any recommendations for an alternative interpolation routine or method to use akima interp is greatly appreciated. Bob

Upvotes: 2

Views: 950

Answers (1)

screechOwl
screechOwl

Reputation: 28189

Have you looked at the Amelia package?

Upvotes: 0

Related Questions