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

 error_minimize3 R Documentation

## Minimize the Error for Remaining K-mer Frequency

### Description

This function minimizes the error for the remaining k-mer frequency by adjusting the scaling factor.

### Usage

``````error_minimize3(
tooptimize,
x,
end,
xfit_left,
xfit_right,
d,
min_valid_pos,
itr,
meanfit,
sdfit
)
``````

### Arguments

 `tooptimize` A numeric vector containing the scale factors to optimize. `x` A numeric vector representing the histogram. `end` An integer indicating the right-side position for fitting. `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. `meanfit` A numeric value representing the initial mean. `sdfit` A numeric value representing the initial standard deviation.

### 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 <- 20
xfit_right <- 80
d <- data.frame(V1=1:100, V2=rnorm(100))
min_valid_pos <- 10
itr <- 100
meanfit <- 18
sdfit <- 4.21
error <- error_minimize3(tooptimize, x, end, xfit_left, xfit_right, d,
min_valid_pos, itr, meanfit, sdfit)
print(error)

``````

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