Question: use R as coding language Question 8 Imputation is the process of replacing missing values by estimated values. The simplest (far from preferred) method to

 use R as coding language Question 8 Imputation is the process

use R as coding language

of replacing missing values by estimated values. The simplest (far from preferred)

Question 8 Imputation is the process of replacing missing values by estimated values. The simplest (far from preferred) method to impute values is to replace missing values by the most typical (or "average") value. Write a function called impute () that will impute missing values from a specified column in a matrix or data frame. The impute ( ) function should have one required argument x that specifies the input matrix or data frame and three optional arguments: . The col argument specifies the column or columns in which to impute values. col is optional with no default. If col is not specified, the function should impute values for all numeric columns. . The center argument specifies what function to use for imputation. Your function should work for any function which returns a single summary statistic for a vector, such as mean, median, or max. This argument should be optional with a default of mean. . The margin argument specifies one of two ways to input values: - Impute the missing values using the center of the observed (non-missing) values in the column. - Impute the missing values using the center of the observed values in the row. - margin should be optional with a default of 2. Note: center should only be computed on the numeric values in the column or row

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!