# error_minimize: Minimize the Error for K-mer Frequency Fitting In findGSEP: Estimate Genome Size of Polyploid Species Using k-Mer Frequencies

 error_minimize R Documentation

## Minimize the Error for K-mer Frequency Fitting

### Description

This function minimizes the error for k-mer frequency fitting by adjusting the mean, standard deviation, and scaling factors.

### Usage

``````error_minimize(
tooptimize,
x,
end,
xfit,
xfit_left,
xfit_right,
d,
min_valid_pos,
itr
)
``````

### Arguments

 `tooptimize` A numeric vector containing the scale factors to optimize. `x` A numeric vector representing the histogram replicated from `d`. `end` An integer indicating the right-side position for fitting. `xfit` x-values to get the skew normal distribution `xfit_left` A numeric value for the left-side position to calculate initial mean and standard deviation. `xfit_right` A numeric value for the right-side position to calculate initial mean and standard deviation. `d` A data frame representing the observed k-mer frequencies that will be fitted. `min_valid_pos` An integer indicating the left-side position from which the observed k-mer frequencies will be fitted. `itr` An integer representing the iteration count.

### Value

A numeric value representing the minimized error.

### Examples

``````
tooptimize <- c(1, 1, 1, 1)
x <- rnorm(100)
end <- 100
xfit <- seq(min(x), max(x), length=end)
xfit_left <- min(x)
xfit_right <- max(x)
d <- data.frame(V1=1:100, V2=rnorm(100))
min_valid_pos <- 10
itr <- 100
error <- error_minimize(tooptimize, x, end, xfit, xfit_left, xfit_right, d, min_valid_pos, itr)
print(error)

``````

findGSEP documentation built on May 29, 2024, 3:35 a.m.