Learn R Programming

DLMRMV (version 1.0.0)

GMD: Generate Missing Data function

Description

This function generates missing data in a specified column of a data frame according to a given missing ratio.

Usage

GMD(data, ratio)

Value

data0

A modified version of `data` with missing values inserted.

Arguments

data

A data frame containing the linear regression model dataset

ratio

The missing ratio (e.g., 0.5 means 1/2 of data will be made missing)

Examples

Run this code
set.seed(123) # for reproducibility
data <- data.frame(x = 1:10, y = rnorm(10))
modified_data <- GMD(data, ratio = 0.5)
summary(modified_data)

Run the code above in your browser using DataLab