impute_cpop: Imputing gene expression values using CPOP model

View source: R/predict_cpop.R

impute_cpopR Documentation

Imputing gene expression values using CPOP model

Description

Imputing gene expression values using CPOP model

Usage

impute_cpop(cpop_result, x1, x2, newx)

Arguments

cpop_result

cpop_model result

x1

Original feature data matrix 1.

x2

Original feature data matrix 2.

newx

New original feature data matrix, with missing values.

Value

A vector

Examples

data(cpop_data_binary, package = 'CPOP')
## Loading simulated matrices and vectors
x1 = cpop_data_binary$x1
x2 = cpop_data_binary$x2
x3 = cpop_data_binary$x3
y1 = cpop_data_binary$y1
y2 = cpop_data_binary$y2
y3 = cpop_data_binary$y3
set.seed(1)
cpop_result = cpop_model(x1 = x1, x2 = x2, y1 = y1, y2 = y2, alpha = 0.1, n_features = 10)
cpop_result
x3_pred_result = predict_cpop(cpop_result, newx = x3)
head(x3_pred_result)
## Introduce a column of missing values in a new matrix, x4.
x4 = x3
x4[,2] = NA
## Without imputation, the prediction function would not work properly
## This prompts the user to use an imputation on their data.
## head(predict_cpop(cpop_result, newx = x4))
## CPOP can perform imputation on the x4 matrix, before this matrix is converted into z4.
x4_imp = impute_cpop(cpop_result, x1 = x1, x2 = x2, newx = x4)
x4_pred_result = predict_cpop(cpop_result, newx = x4_imp)
head(x4_pred_result)
plot(x3_pred_result$cpop_model_avg_prob, x3_pred_result$cpop_model_avg_prob)

kevinwang09/CPOP documentation built on April 23, 2022, 11:05 a.m.