-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed piecewise function, updated log transformation arguments
- Loading branch information
Showing
27 changed files
with
585 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export("%>%") | ||
export(broken_stick) | ||
export(broken_stick_stevens) | ||
export(cluster_mods) | ||
export(fake_crustaceans) | ||
export(infl_pt) | ||
export(piecewise_mods) | ||
export(regrans) | ||
export(somerton) | ||
export(two_line) | ||
export(two_line_logistic) | ||
import(ggplot2) | ||
import(rlang) | ||
importFrom(ggplot2,aes) | ||
importFrom(glue,glue) | ||
importFrom(lifecycle,deprecated) | ||
importFrom(magrittr,"%>%") | ||
importFrom(rlang,.data) | ||
importFrom(mclust,Mclust) | ||
importFrom(minpack.lm,nls.lm.control) | ||
importFrom(minpack.lm,nlsLM) | ||
importFrom(splus2R,peaks) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#' Classification approaches to estimating SM50 | ||
#' | ||
#' @param dat data frame or matrix containing the data | ||
#' @param xvar Name of column (integer or double) of measurements for the x-axis | ||
#' variable (e.g., carapace width). | ||
#' @param yvar Name of column (integer or double) of measurements for the y-axis | ||
#' variable (e.g., claw height). | ||
#' @param log Boolean; should both variables be log-transformed before performing the | ||
#' regression? Defaults to FALSE. | ||
#' @param method Classification method to use. A single string or vector | ||
#' containing one or more of c("mclust", "Somerton", "kmeans", "hclust", "infl_pt"), or "all" to return the results of all methods for comparison. | ||
#' @returns An estimate of SM50 from the specified method(s). | ||
#' @export | ||
#' | ||
#' @examples | ||
#' set.seed(12) | ||
#' fc <- fake_crustaceans(n = 100, L50 = 100, allo_params = c(1, 0.2, 1.1, 0.2)) | ||
#' cluster_mods(fc, xvar = "x", yvar = "y", method = c("kmeans")) | ||
cluster_mods <- function(dat, | ||
xvar, | ||
yvar, | ||
log = FALSE, | ||
method = c("mclust", "Somerton", "kmeans", "hclust", "infl_pt", "all")) { | ||
|
||
new_dat <- data.frame(xvar = dat[[xvar]], yvar = dat[[yvar]]) | ||
|
||
if (isTRUE(log)) { | ||
new_dat$xvar <- log(dat[[xvar]]) | ||
new_dat$yvar <- log(dat[[yvar]]) | ||
} | ||
|
||
if ("kmeans" %in% method | "all" %in% method) { | ||
|
||
out <- new_dat | ||
|
||
} | ||
|
||
return(out) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.