Hi!
I am working with various petrophysical well log data from14 wells in my data set. The logging data have missing values that have been identified in different intervals and I would like to impute these values in various ways to see which techniques are best. I have been using the Explore Missing Values panel to implement the imputation from one variable where data are present to another variable where data are missing in the same well (e.g. Gamma Ray data are missing in the well at a 50 ft interval but density data are present). But what if I would like to use a logging variable in one well to impute missing values in the same logging variable but in another nearby well? For example, if I have Gamma Ray data in one well at depths 4000-6000 ft and another well nearby is missing Gamma Ray at depths 5000-5800 ft, how can I use the same variable (same column) to impute missing values in a well with different XY coordinates? Thanks!
Melanie
Below is an example of calculating a value for a well head by taking the well heads surounding the well head that has the missing value, and averaging their values, and setting the well head with the missing value to the averaged value.
Names Default To Here( 1 );
// Create a new table to use
dt = New Table( "Untitled 7",
Add Rows( 2500 ),
New Column( "x", Numeric, "Continuous", Format( "Best", 12 ), Set Display Width( 42 ) ),
New Column( "y", Numeric, "Continuous", Format( "Best", 12 ), Set Display Width( 83 ) ),
New Column( "data", Numeric, "Continuous", Format( "Best", 12 ), )
);
// Populate the data, leaving 2% missing data
theRow = 0;
For( i = 1, i <= 50, i++,
For( k = 1, k <= 50, k++,
theRow = theRow + 1;
:x[theRow] = i;
:y[theRow] = k;
If( Random Integer( 0, 100 ) <= 98,
:data[theRow] = Random Uniform( 800, 1000 ),
:data[theRow] = .;
write("\!nMissing value for row ", therow)
);
)
);
// Impute missing values by averaging the well heads around the missing value
For( theRow = 1, theRow <= N Rows( dt ), theRow++,
If( Is Missing( :data[theRow] ) == 1,
minX = :x[theRow] - 1;
If( minX < 1, minX = 1 );
maxX = :x[theRow] + 1;
If( maxX > 50, maxX = 50 );
minY = :y[theRow] - 1;
If( minY < 1, minY = 1 );
maxY = :y[theRow] + 1;
If( maxY > 50, maxY = 50 );
impute = 0;
count = 0;
For( i = minX, i <= maxX, i++,
For( k = minY, k <= maxY, k++,
theValue = dt:data[dt << get rows where( dt:x == i & dt:y == k )][1];
If( Is Missing( theValue ) == 0,
count
++);
impute = Sum( impute, theValue );
)
);
:Data[theRow] = impute / count;
)
);Thanks for the reply! I will try this.