| Type: | Package |
| Title: | Statistical Methods for Composite Material Data |
| Version: | 0.10.0 |
| Date: | 2024-11-18 |
| Depends: | R (≥ 3.3) |
| Description: | An implementation of the statistical methods commonly used for advanced composite materials in aerospace applications. This package focuses on calculating basis values (lower tolerance bounds) for material strength properties, as well as performing the associated diagnostic tests. This package provides functions for calculating basis values assuming several different distributions, as well as providing functions for non-parametric methods of computing basis values. Functions are also provided for testing the hypothesis that there is no difference between strength and modulus data from an alternate sample and that from a "qualification" or "baseline" sample. For a discussion of these statistical methods and their use, see the Composite Materials Handbook, Volume 1 (2012, ISBN: 978-0-7680-7811-4). Additional details about this package are available in the paper by Kloppenborg (2020, <doi:10.21105/joss.02265>). |
| URL: | https://www.cmstatr.net/,https://github.com/cmstatr/cmstatr |
| BugReports: | https://github.com/cmstatr/cmstatr/issues |
| License: | AGPL-3 |
| Encoding: | UTF-8 |
| LazyData: | true |
| Imports: | dplyr, generics, ggplot2, kSamples, MASS, purrr, rlang, stats,tibble, tidyr |
| Suggests: | knitr, lintr, rmarkdown, spelling, testthat, vdiffr |
| RoxygenNote: | 7.3.2 |
| VignetteBuilder: | knitr |
| Language: | en-US |
| Config/testthat/parallel: | true |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2024-11-19 04:04:50 UTC; stefan |
| Author: | Stefan Kloppenborg |
| Maintainer: | Stefan Kloppenborg <stefan@kloppenborg.ca> |
| Repository: | CRAN |
| Date/Publication: | 2024-11-19 07:50:08 UTC |
cmstatr: Statistical Methods for Composite Material Data
Description
To learn more aboutcmstatr, start with the vignettes:browseVignettes(package = "cmstatr")
Author(s)
Maintainer: Stefan Kloppenborgstefan@kloppenborg.ca (ORCID)
Other contributors:
Billy Chengbcheng@comtekadvanced.com [contributor]
Ally Fraserally.fraser25@gmail.com [contributor]
Jeffrey Borlik [contributor]
Brice Langstontblangst@gmail.com [contributor]
Comtek Advanced Structures, Ltd. [funder]
See Also
Useful links:
Report bugs athttps://github.com/cmstatr/cmstatr/issues
Anderson–Darling K-Sample Test
Description
This function performs an Anderson–Darling k-sample test. This is used todetermine if several samples (groups) share a common (unspecified)distribution.
Usage
ad_ksample(data = NULL, x, groups, alpha = 0.025)Arguments
data | a data.frame |
x | the variable in the data.frame on which to perform theAnderson–Darling k-Sample test (usually strength) |
groups | a variable in the data.frame that defines the groups |
alpha | the significance level (default 0.025) |
Details
This function is a wrapper for thead.test function fromthe packagekSamples. The method "exact" is specified in the call toad.test. Refer to that package's documentation for details.
There is a minor difference in the formulation of the Anderson–Darlingk-Sample test in CMH-17-1G, compared with that in the Scholz andStephens (1987). This difference affects the test statistic and thecritical value in the same proportion, and therefore the conclusion ofthe test is unaffected. Whencomparing the test statistic generated by this function to that generatedby software that uses the CMH-17-1G formulation (such as ASAP, CMH17-STATS,etc.), the test statistic reported by this function will be greater bya factor of(k - 1), with a corresponding change in the criticalvalue.
For more information about the difference between this function andthe formulation in CMH-17-1G, see the vignette on the subject, whichcan be accessed by runningvignette("adktest")
Value
Returns an object of classadk. This object has the following fields:
callthe expression used to call this functiondatathe original data used to compute the ADKgroupsa vector of the groups used in the computationalphathe value of alpha specifiednthe total number of observationskthe number of groupssigmathe computed standard deviation of the test statisticadthe value of the Anderson–Darling k-Sample test statisticpthe computed p-valuereject_same_dista boolean value indicating whether the nullhypothesis that all samples come from the same distribution is rejectedrawthe original results returned fromad.test
References
F. W. Scholz and M. Stephens, “K-Sample Anderson–Darling Tests,” Journalof the American Statistical Association, vol. 82, no. 399. pp. 918–924,Sep-1987.
“Composite Materials Handbook, Volume 1. Polymer Matrix CompositesGuideline for Characterization of Structural Materials,” SAE International,CMH-17-1G, Mar. 2012.
Examples
library(dplyr)carbon.fabric %>% filter(test == "WT") %>% filter(condition == "RTD") %>% ad_ksample(strength, batch)#### Call:## ad_ksample(data = ., x = strength, groups = batch)#### N = 18 k = 3## ADK = 0.912 p-value = 0.95989## Conclusion: Samples come from the same distribution ( alpha = 0.025 )Anderson–Darling test for goodness of fit
Description
Calculates the Anderson–Darling test statistic for a sample givena particular distribution, and determines whether to reject thehypothesis that a sample is drawn from that distribution.
Usage
anderson_darling_normal(data = NULL, x, alpha = 0.05)anderson_darling_lognormal(data = NULL, x, alpha = 0.05)anderson_darling_weibull(data = NULL, x, alpha = 0.05)Arguments
data | a data.frame-like object (optional) |
x | a numeric vector or a variable in the data.frame |
alpha | the required significance level of the test.Defaults to 0.05. |
Details
The Anderson–Darling test statistic is calculated for the distributiongiven by the user.
The observed significance level (OSL), or p-value, is calculated assumingthat the parametersof the distribution are unknown; these parameters are estimate from thedata.
The functionanderson_darling_normal computes the Anderson–Darlingtest statistic given a normal distribution with mean and standard deviationequal to the sample mean and standard deviation.
The functionanderson_darling_lognormal is the same asanderson_darling_normal except that the data is log transformedfirst.
The functionanderson_darling_weibull computes the Anderson–Darlingtest statistic given a Weibull distribution with shape and scale parametersestimated from the data using a maximum likelihood estimate.
The test statistic,A, is modified to account forthe fact that the parameters of the population are not known,but are instead estimated from the sample. This modification isa function of the sample size only, and is different for eachdistribution (normal/lognormal or Weibull). Several such modificationshave been proposed. This function uses the modification published inStephens (1974), Lawless (1982) and CMH-17-1G. Some other implementationsof the Anderson-Darling test, such as the implementation in thenortest package, use other modifications, such as the onepublished in D'Agostino and Stephens (1986). As such, the p-valuereported by this function may differ from the p-value reportedby implementations of the Anderson–Darling test that usedifferent modifiers. Only the unmodifiedtest statistic is reported in the result of this function, butthe modified test statistic is used to compute the OSL (p-value).
This function uses the formulae for observed significancelevel (OSL) published in CMH-17-1G. These formulae depend on the particulardistribution used.
The results of this function have been validated againstpublished values in Lawless (1982).
Value
an object of classanderson_darling. This object has the followingfields.
callthe expression used to call this functiondistthe distribution useddataa copy of the data analyzednthe number of observations in the sampleAthe Anderson–Darling test statisticoslthe observed significance level (p-value),assuming theparameters of the distribution are estimated from the dataalphathe required significance level for the test.This value is given by the user.reject_distributiona logical value indicating whetherthe hypothesis that the data is drawn from the specified distributionshould be rejected
References
J. F. Lawless,Statistical models and methods for lifetime data.New York: Wiley, 1982.
"Composite Materials Handbook, Volume 1. Polymer MatrixComposites Guideline for Characterization of StructuralMaterials," SAE International, CMH-17-1G, Mar. 2012.
M. A. Stephens, “EDF Statistics for Goodness of Fit and SomeComparisons,”Journal of the American Statistical Association, vol. 69, no. 347.pp. 730–737, 1974.
R. D’Agostino and M. Stephens, Goodness-of-Fit Techniques.New York: Marcel Dekker, 1986.
Examples
library(dplyr)carbon.fabric %>% filter(test == "FC") %>% filter(condition == "RTD") %>% anderson_darling_normal(strength)## Call:## anderson_darling_normal(data = ., x = strength)#### Distribution: Normal ( n = 18 )## Test statistic: A = 0.9224776## OSL (p-value): 0.01212193 (assuming unknown parameters)## Conclusion: Sample is not drawn from a Normal distribution (alpha = 0.05)Augment data with information from anmnr object
Description
Augment accepts anmnr object (returned from the functionmaximum_normed_residual()) and a dataset and adds the column.outlier to the dataset. The column.outlier is a logicalvector indicating whether each observation is an outlier.
When passing data intoaugment using thedata argument,the data must be exactly the data that was passed tomaximum_normed_residual.
Usage
## S3 method for class 'mnr'augment(x, data = x$data, ...)Arguments
x | an |
data | a |
... | Additional arguments. Not used. Included only to match genericsignature. |
Value
Whendata is supplied,augment returnsdata, but withone column appended. Whendata is not supplied,augmentreturns a newtibble::tibble() with the columnvalues containing the original values used bymaximum_normed_residaul plus one additional column. The additionalcolumn is:
.outlera logical value indicating whether the observationis an outlier
See Also
Examples
data <- data.frame(strength = c(80, 98, 96, 97, 98, 120))m <- maximum_normed_residual(data, strength)# augment can be called with the original dataaugment(m, data)## strength .outlier## 1 80 FALSE## 2 98 FALSE## 3 96 FALSE## 4 97 FALSE## 5 98 FALSE## 6 120 FALSE# or augment can be called without the orignal data and it will be# reconstructedaugment(m)## # A tibble: 6 x 2## values .outlier## <dbl> <lgl>## 1 80 FALSE## 2 98 FALSE## 3 96 FALSE## 4 97 FALSE## 5 98 FALSE## 6 120 FALSECalculate basis values
Description
Calculate the basis value for a given data set. There are various functionsto calculate the basis values for different distributions.The basis value is the lower one-sided tolerance bound of a certainproportion of the population. For more information on tolerance bounds,see Meeker, et. al. (2017).For B-Basis, set the content of tolerance bound top=0.90 andthe confidence level toconf=0.95; for A-Basis, setp=0.99 andconf=0.95. While other tolerance boundcontents and confidence levels may be computed, they are infrequentlyneeded in practice.
These functions also perform some automated diagnostictests of the data prior to calculating the basis values. These diagnostictests can be overridden if needed.
Usage
basis_normal( data = NULL, x, batch = NULL, p = 0.9, conf = 0.95, override = c())basis_lognormal( data = NULL, x, batch = NULL, p = 0.9, conf = 0.95, override = c())basis_weibull( data = NULL, x, batch = NULL, p = 0.9, conf = 0.95, override = c())basis_pooled_cv( data = NULL, x, groups, batch = NULL, p = 0.9, conf = 0.95, modcv = FALSE, override = c())basis_pooled_sd( data = NULL, x, groups, batch = NULL, p = 0.9, conf = 0.95, modcv = FALSE, override = c())basis_hk_ext( data = NULL, x, batch = NULL, p = 0.9, conf = 0.95, method = c("optimum-order", "woodward-frawley"), override = c())basis_nonpara_large_sample( data = NULL, x, batch = NULL, p = 0.9, conf = 0.95, override = c())basis_anova(data = NULL, x, groups, p = 0.9, conf = 0.95, override = c())Arguments
data | a data.frame |
x | the variable in the data.frame for which to find the basis value |
batch | the variable in the data.frame that contains the batches. |
p | the content of the tolerance bound. Should be 0.90 for B-Basisand 0.99 for A-Basis |
conf | confidence level Should be 0.95 for both A- and B-Basis |
override | a list of names of diagnostic tests to override,if desired. Specifying "all" will override all diagnostictests applicable to the current method. |
groups | the variable in the data.frame representing the groups |
modcv | a logical value indicating whether the modified CV approachshould be used. Only applicable to pooling methods. |
method | the method for Hanson–Koopmans nonparametric basis values.should be "optimum-order" for B-Basis and "woodward-frawley"for A-Basis. |
Details
data is an optional argument. Ifdata is given, it shouldbe adata.frame (or similar object). Whendata is specified, thevalue ofx is expected to be a variable withindata. Ifdata is not specified,x must be a vector.
Whenmodcv=TRUE is set, which is only applicable to thepooling methods,the data is first modified according to the modified coefficientof variation (CV)rules. This modified data is then used when both calculating thebasis values andalso when performing the diagnostic tests. The modified CV approachis a way ofadding extra variance to datasets with unexpectedly low variance.
basis_normal calculate the basis value by subtractingk timesthe standard deviation from the mean.k is given bythe functionk_factor_normal(). The equations inKrishnamoorthy and Mathew (2008) are used.basis_normal alsoperforms a diagnostic test for outliers (usingmaximum_normed_residual())and a diagnostic test for normality (usinganderson_darling_normal()).If the argumentbatch is given, this function also performsa diagnostic test for outliers withineach batch (usingmaximum_normed_residual())and a diagnostic test for between batch variability (usingad_ksample()). The argumentbatch is only usedfor these diagnostic tests.
basis_lognormal calculates the basis value in the same waythatbasis_normal does, except that the natural logarithm of thedata is taken.
basis_lognormal function also performsa diagnostic test for outliers (usingmaximum_normed_residual())and a diagnostic test for normality (usinganderson_darling_lognormal()).If the argumentbatch is given, this function also performsa diagnostic test for outliers withineach batch (usingmaximum_normed_residual())and a diagnostic test for between batch variability (usingad_ksample()). The argumentbatch is only usedfor these diagnostic tests.
basis_weibull calculates the basis value for data distributedaccording to a Weibull distribution. The confidence level for thecontent requested is calculated using the conditional method, asdescribed in Lawless (1982) Section 4.1.2b. This has good agreementwith tables published in CMH-17-1G. Results differ between this functionand STAT17 by approximately 0.5\
basis_weibull function also performsa diagnostic test for outliers (usingmaximum_normed_residual())and a diagnostic test for normality (usinganderson_darling_weibull()).If the argumentbatch is given, this function also performsa diagnostic test for outliers withineach batch (usingmaximum_normed_residual())and a diagnostic test for between batch variability (usingad_ksample()). The argumentbatch is only usedfor these diagnostic tests.
basis_hk_ext calculates the basis value using the ExtendedHanson–Koopmans method, as described in CMH-17-1G and Vangel (1994).For nonparametric distributions, this function should be used for samplesup to n=28 for B-Basis and up ton=299 for A-Basis.This method uses a pair of order statistics to determine the basis value.CMH-17-1G suggests that for A-Basis, the first and last order statisticis used: this is called the "woodward-frawley" method in this package,after the paper in which this approach is described (as referencedby Vangel (1994)). For B-Basis, another approach is used whereby thefirst andj-th order statistic are used to calculate the basis value.In this approach, thej-th order statistic is selected to minimizethe difference between the tolerance limit (assuming that the orderstatistics are equal to the expected values from a standard normaldistribution) and the population quantile for a standard normaldistribution. This approach is described in Vangel (1994). This secondmethod (for use when calculating B-Basis values) is called"optimum-order" in this package.The results ofbasis_hk_ext have beenverified against example results from the program STAT-17. Agreement istypically well within 0.2%.
Note that the implementation ofhk_ext_z_j_opt changed aftercmstatrversion 0.8.0. This function is used internally bybasis_hk_extwhenmethod = "optimum-order". This implementation change may meanthat basis values computed using this method may change slightlyafter version 0.8.0. However, both implementations seem to be equallyvalid. See the included vignettefor a discussion of the differences between the implementation beforeand after version 0.8.0, as well as the factors given in CMH-17-1G.To access this vignette, run:vignette("hk_ext", package = "cmstatr")
basis_hk_ext also performsa diagnostic test for outliers (usingmaximum_normed_residual())and performs a pair of tests that the sample size and method selectedfollow the guidance described above.If the argumentbatch is given, this function also performsa diagnostic test for outliers withineach batch (usingmaximum_normed_residual())and a diagnostic test for between batch variability (usingad_ksample()). The argumentbatch is only usedfor these diagnostic tests.
basis_nonpara_large_sample calculates the basis valueusing the large sample method described in CMH-17-1G. This method usesa sum of binomials to determine the rank of the ordered statisticcorresponding with the desired tolerance limit (basis value). Resultsof this function have been verified against results of the STAT-17program.
basis_nonpara_large_sample also performsa diagnostic test for outliers (usingmaximum_normed_residual())and performs a test that the sample size is sufficiently large.If the argumentbatch is given, this function also performsa diagnostic test for outliers withineach batch (usingmaximum_normed_residual())and a diagnostic test for between batch variability (usingad_ksample()). The argumentbatch is only usedfor these diagnostic tests.
basis_anova calculates basis values using the ANOVA method.x specifies the data (normally strength) andgroupsindicates the group corresponding to each observation. This method isdescribed in CMH-17-1G, but when the ratio of between-batch meansquare to the within-batch mean square is less than or equalto one, the tolerance factor is calculated based on pooling the datafrom all groups. This approach is recommended by Vangel (1992)and by Krishnamoorthy and Mathew (2008), and is also implementedby the software CMH17-STATS and STAT-17.This function automatically performs a diagnostictest for outliers within each group(usingmaximum_normed_residual()) and a test for betweengroup variability (usingad_ksample()) as well as checkingthat the data contains at least 5 groups.This function has been verified against the results of the STAT-17 program.
basis_pooled_sd calculates basis values by pooling the data fromseveral groups together.x specifies the data (normally strength)andgroup indicates the group corresponding to each observation.This method is described in CMH-17-1G and matches the pooling methodimplemented in ASAP 2008.
basis_pooled_cv calculates basis values by pooling the data fromseveral groups together.x specifies the data (normally strength)andgroup indicates the group corresponding to each observation.This method is described in CMH-17-1G.
basis_pooled_sd andbasis_pooled_cv both automaticallyperform a number of diagnostic tests. Usingmaximum_normed_residual(), they check that there are nooutliers within each group and batch (provided thatbatch isspecified). They check the between batch variability usingad_ksample(). They check that there are no outliers withineach group (pooling all batches) usingmaximum_normed_residual(). They check for the normalityof the pooled data usinganderson_darling_normal().basis_pooled_sd checks for equality of variance of alldata usinglevene_test() andbasis_pooled_cvchecks for equality of variances of all data after transforming itusingnormalize_group_mean()usinglevene_test().
The object returned by these functions includes the named vectordiagnostic_results. This contains all of the diagnostic testsperformed. The name of each element of the vector corresponds with thename of the diagnostic test. The contents of each element will be"P" if the diagnostic test passed, "F" if the diagnostic test failed,"O" if the diagnostic test was overridden andNA if thediagnostic test was skipped (typically because an optionalargument was not supplied).
The objects produced by the diagnostic tests are included in the namedlistdiagnostic_obj. The name of each element in the list corresponds withthe name of the test. This can be useful when evaluating diagnostic testfailures.
The following list summarizes the diagnostic tests automaticallyperformed by each function.
basis_normaloutliers_within_batchbetween_batch_variabilityoutliersanderson_darling_normal
basis_lognormaloutliers_within_batchbetween_batch_variabilityoutliersanderson_darling_lognormal
basis_weibulloutliers_within_batchbetween_batch_variabilityoutliersanderson_darling_weibull
basis_pooled_cvoutliers_within_batchbetween_group_variabilityoutliers_within_grouppooled_data_normalnormalized_variance_equal
basis_pooled_sdoutliers_within_batchbetween_group_variabilityoutliers_within_grouppooled_data_normalpooled_variance_equal
basis_hk_extoutliers_within_batchbetween_batch_variabilityoutlierssample_size
basis_nonpara_large_sampleoutliers_within_batchbetween_batch_variabilityoutlierssample_size
basis_anovaoutliers_within_groupequality_of_variancenumber_of_groups
Value
an object of classbasisThis object has the following fields:
callthe expression used to call this functiondistributionthe distribution used (normal, etc.)pthe value ofpsuppliedconfthe value ofconfsuppliedmodcva logical value indicating whether the modifiedCV approach was used. Only applicable to pooling methods.dataa copy of the data used in the calculationgroupsa copy of the groups variable.Only used for pooling and ANOVA methods.batcha copy of the batch data used for diagnostic testsmodcv_transformed_datathe data after the modified CV transformationoverridea vector of the names of diagnostic tests thatwere overridden.NULLif none were overriddendiagnostic_resultsa named character vector containing theresults of all the diagnostic tests. See the Details section foradditional informationdiagnostic_obja named list containing the objects produced by thediagnostic tests.diagnostic_failuresa vector containing any diagnostic teststhat produced failuresnthe number of observationsrthe number of groups, if a pooling method was used.Otherwise it is NULL.basisthe basis value computed. This is a numberexcept when pooling methods are used, in which case it is a data.frame.
References
J. F. Lawless, Statistical Models and Methods for Lifetime Data.New York: John Wiley & Sons, 1982.
“Composite Materials Handbook, Volume 1. Polymer Matrix CompositesGuideline for Characterization of Structural Materials,” SAE International,CMH-17-1G, Mar. 2012.
M. Vangel, “One-Sided Nonparametric Tolerance Limits,”Communications in Statistics - Simulation and Computation,vol. 23, no. 4. pp. 1137–1154, 1994.
K. Krishnamoorthy and T. Mathew, Statistical Tolerance Regions: Theory,Applications, and Computation. Hoboken: John Wiley & Sons, 2008.
W. Meeker, G. Hahn, and L. Escobar, Statistical Intervals: A Guidefor Practitioners and Researchers, Second Edition.Hoboken: John Wiley & Sons, 2017.
M. Vangel, “New Methods for One-Sided Tolerance Limits for a One-WayBalanced Random-Effects ANOVA Model,” Technometrics, vol. 34, no. 2.Taylor & Francis, pp. 176–185, 1992.
See Also
Examples
library(dplyr)# A single-point basis value can be calculated as follows# in this example, three failed diagnostic tests are# overridden.res <- carbon.fabric %>% filter(test == "FC") %>% filter(condition == "RTD") %>% basis_normal(strength, batch, override = c("outliers", "outliers_within_batch", "anderson_darling_normal"))print(res)## Call:## basis_normal(data = ., x = strength, batch = batch,## override = c("outliers", "outliers_within_batch",## "anderson_darling_normal"))#### Distribution: Normal ( n = 18 )## The following diagnostic tests were overridden:## `outliers`,## `outliers_within_batch`,## `anderson_darling_normal`## B-Basis: ( p = 0.9 , conf = 0.95 )## 76.94656print(res$diagnostic_obj$between_batch_variability)## Call:## ad_ksample(x = x, groups = batch, alpha = 0.025)#### N = 18 k = 3## ADK = 1.73 p-value = 0.52151## Conclusion: Samples come from the same distribution ( alpha = 0.025 )# A set of pooled basis values can also be calculated# using the pooled standard deviation method, as follows.# In this example, one failed diagnostic test is overridden.carbon.fabric %>% filter(test == "WT") %>% basis_pooled_sd(strength, condition, batch, override = c("outliers_within_batch"))## Call:## basis_pooled_sd(data = ., x = strength, groups = condition,## batch = batch, override = c("outliers_within_batch"))#### Distribution: Normal - Pooled Standard Deviation ( n = 54, r = 3 )## The following diagnostic tests were overridden:## `outliers_within_batch`## B-Basis: ( p = 0.9 , conf = 0.95 )## CTD 127.6914## ETW 125.0698## RTD 132.1457Calculate the modified CV from the CV
Description
This function calculates the modified coefficient of variation (CV)based on a (unmodified) CV.The modified CV is calculated based on the rules in CMH-17-1G. Thoserules are:
For CV < 4\%, CV* = 6\%
For 4\% <= CV < 8\%, CV* = CV / 2 + 4\%
For CV > 8\%, CV* = CV
Usage
calc_cv_star(cv)Arguments
cv | The CV to modify |
Value
The value of the modified CV
References
"Composite Materials Handbook, Volume 1. Polymer Matrix CompositesGuideline for Characterization of Structural Materials,"SAE International, CMH-17-1G, Mar. 2012.
See Also
Examples
# The modified CV for values of CV smaller than 4% is 6%calc_cv_star(0.01)## [1] 0.06# The modified CV for values of CV larger than 8% is unchangedcalc_cv_star(0.09)## [1] 0.09Sample data for a generic carbon fabric
Description
Datasets containing sample data that is typical of a generic carbonfabric prepreg. This data is used in several examples within thecmstatr package. This data is fictional and shouldonly be used for learning how to use this package.
Usage
carbon.fabriccarbon.fabric.2Format
An object of classdata.frame with 216 rows and 5 columns.
An object of classdata.frame with 177 rows and 9 columns.
Produce basis summary statistics for each (environmental) condition
Description
Produces adata.frame containing the sample size and mean for eachcondition. If a reference condition (e.g. "RTD") is specified, the ratioof each condition mean value to the mean value for the reference conditionis also calculated. If abasis object returned by one of thebasis_pooled functions is given as an argument, this table also containsthe basis value for each condition.
Usage
condition_summary(data, ...)## S3 method for class 'data.frame'condition_summary(data, x, condition, ref_condition = NULL, ...)## S3 method for class 'basis'condition_summary(data, ref_condition = NULL, ...)Arguments
data | a |
... | not used |
x | the column name of the variable of interest (usually strength) |
condition | the column name for the condition |
ref_condition | a |
Value
adata.frame
Examples
library(dplyr)carbon.fabric.2 %>% filter(test == "WT") %>% condition_summary(strength, condition, "RTD")## condition n mean mean_fraction## 1 CTD 19 135.4719 0.9702503## 2 RTD 28 139.6257 1.0000000## 3 ETW 18 134.1009 0.9604312## 4 ETW2 21 130.1545 0.9321673carbon.fabric %>% filter(test == "FT") %>% basis_pooled_sd(strength, condition, batch) %>% condition_summary("RTD")## condition n mean mean_fraction basis basis_fraction## 1 RTD 18 127.6211 1.0000000 116.8894 1.0000000## 2 ETW 18 117.8080 0.9231072 107.0762 0.9160476## 3 CTD 18 125.9629 0.9870063 115.2311 0.9858133Calculate the coefficient of variation
Description
The coefficient of variation (CV) is the ratio of the standarddeviation to the mean of a sample. This function takes a vectorof data and calculates the CV.
Usage
cv(x, na.rm = FALSE)Arguments
x | a vector |
na.rm | logical. Should missing values be removed? |
Value
The calculated CV
Examples
set.seed(15) # make this example reproduciblex <- rnorm(100, mean = 100, sd = 5)cv(x)## [1] 0.04944505# the cv function can also be used within a call to dplyr::summariselibrary(dplyr)carbon.fabric %>%filter(test == "WT") %>% group_by(condition) %>% summarise(mean = mean(strength), cv = cv(strength))## # A tibble: 3 x 3## condition mean cv## <chr> <dbl> <dbl>## 1 CTD 137. 0.0417## 2 ETW 135. 0.0310## 3 RTD 142. 0.0451Equivalency based on change in mean value
Description
Checks for change in the mean value between a qualification data set anda sample. This is normally used to check for properties such as modulus.This function is a wrapper for a two-sample t–test.
Usage
equiv_change_mean( df_qual = NULL, data_qual = NULL, n_qual = NULL, mean_qual = NULL, sd_qual = NULL, data_sample = NULL, n_sample = NULL, mean_sample = NULL, sd_sample = NULL, alpha, modcv = FALSE)Arguments
df_qual | (optional) a data.frame containing the qualification data.Defaults to NULL. |
data_qual | (optional) a vector of observations from the"qualification" data to which equivalency is being tested. Or the column of |
n_qual | the number of observations in the qualification data to whichthe sample is being compared for equivalency |
mean_qual | the mean from the qualification data to which the sampleis being compared for equivalency |
sd_qual | the standard deviation from the qualification data to whichthe sample is being compared for equivalency |
data_sample | a vector of observations from the sample being comparedfor equivalency |
n_sample | the number of observations in the sample being compared forequivalency |
mean_sample | the mean of the sample being compared for equivalency |
sd_sample | the standard deviation of the sample being compared forequivalency |
alpha | the acceptable probability of a Type I error |
modcv | a logical value indicating whether the modified CV approachshould be used. Defaults to |
Details
There are several optional arguments to this function. Either (but not both)data_sample or all ofn_sample,mean_sample andsd_sample must be supplied. And, either (but not both)data_qual(and alsodf_qual ifdata_qual is a column name and not avector) or all ofn_qual,mean_qual andsd_qual mustbe supplied. If these requirements are violated, warning(s) or error(s) willbe issued.
This function uses a two-sample t-test to determine if there is a differencein the mean value of the qualification data and the sample. A pooledstandard deviation is used in the t-test. The procedure is per CMH-17-1G.
Ifmodcv is TRUE, the standard deviation used to calculate thethresholds will be replaced with a standard deviation calculatedusing the Modified Coefficient of Variation (CV) approach.The Modified CV approach is a way of adding extra variance to thequalification data in the case that the qualification data has lessvariance than expected, which sometimes occurs when qualification testingis performed in a short period of time.Using the Modified CV approach, the standard deviation is calculated bymultiplyingCV_star * mean_qual wheremean_qual is either thevalue supplied or the value calculated bymean(data_qual) andCV* is determined usingcalc_cv_star().
Note that the modified CV option should only be used if that data passes theAnderson–Darling test.
Value
callthe expression used to call this functionalphathe value of alpha passed to this functionn_samplethe number of observations in the sample for whichequivalency is being checked. This is either the valuen_samplepassed to this function or the length of the vectordata_sample.mean_samplethe mean of the observations in the sample forwhich equivalency is being checked. This is either the valuemean_samplepassed to this function or the mean of the vectordata-sample.sd_samplethe standard deviation of the observations in thesample for which equivalency is being checked. This is either the valuemean_samplepassed to this function or the standard deviation ofthe vectordata-sample.n_qualthe number of observations in the qualification datato which the sample is being compared for equivalency. This is eitherthe valuen_qualpassed to this function or the length of thevectordata_qual.mean_qualthe mean of the qualification data to which thesample is being compared for equivalency. This is either the valuemean_qualpassed to this function or the mean of the vectordata_qual.sd_qualthe standard deviation of the qualification data towhich the sample is being compared for equivalency. This is either thevaluemean_qualpassed to this function or the standard deviationof the vectordata_qual.modcvlogical value indicating whether the equivalencycalculations were performed using the modified CV approachspthe value of the pooled standard deviation. Ifmodecv = TRUE, this pooled standard deviation includes themodification to the qualification CV.t0the test statistict_reqthe t-value for\alpha / 2anddf = n1 + n2 -2thresholda vector with two elements corresponding to theminimum and maximum values of the sample mean that would result in apassresulta character vector of either "PASS" or "FAIL"indicating the result of the test for change in mean
References
“Composite Materials Handbook, Volume 1. Polymer Matrix CompositesGuideline for Characterization of Structural Materials,” SAE International,CMH-17-1G, Mar. 2012.
See Also
Examples
equiv_change_mean(alpha = 0.05, n_sample = 9, mean_sample = 9.02, sd_sample = 0.15785, n_qual = 28, mean_qual = 9.24, sd_qual = 0.162, modcv = TRUE)## Call:## equiv_change_mean(n_qual = 28, mean_qual = 9.24, sd_qual = 0.162,## n_sample = 9, mean_sample = 9.02, sd_sample = 0.15785,## alpha = 0.05,modcv = TRUE)#### For alpha = 0.05## Modified CV used## Qualification Sample## Number 28 9## Mean 9.24 9.02## SD 0.162 0.15785## Result PASS## Passing Range 8.856695 to 9.623305Test for decrease in mean or minimum individual
Description
This test is used when determining if a new process ormanufacturing location produces material properties that are"equivalent" to an existing dataset, and hence the existingbasis values are applicable to the new dataset. This test is alsosometimes used for determining if a new batch of material is acceptable.This function determines thresholds based on both minimumindividual and mean, and optionally evaluates a sample against thosethresholds. The joint distribution between the sample meanand sample minimum is used to generate these thresholds.When there is no true difference between the existing ("qualification")and the new population from which the sample is obtained, there is aprobability of\alpha of falsely concluding that there is adifference in mean or variance. It is assumed that both the originaland new populations are normally distributed.According to Vangel (2002), this test provides improved power comparedwith a test of mean and standard deviation.
Usage
equiv_mean_extremum( df_qual = NULL, data_qual = NULL, mean_qual = NULL, sd_qual = NULL, data_sample = NULL, n_sample = NULL, alpha, modcv = FALSE)Arguments
df_qual | (optional) a data.frame containing the qualification data.Defaults to NULL. |
data_qual | (optional) a vector of observations from the"qualification" data to which equivalency is being tested. Or the column of |
mean_qual | (optional) the mean from the "qualification" data to whichequivalency is being tested. Defaults to NULL |
sd_qual | (optional) the standard deviation from the "qualification"data to which equivalency is being tested. Defaults to NULL |
data_sample | (optional) a vector of observations from the sample forwhich equivalency is being tested. Defaults to NULL |
n_sample | (optional) the number of observations in the sample forwhich equivalency will be tested. Defaults to NULL |
alpha | the acceptable probability of a type I error |
modcv | (optional) a boolean value indicating whether a modified CVshould be used. Defaults to FALSE, in which case the standard deviationsupplied (or calculated from |
Details
This function is used todetermine acceptance limits for a sample mean and sample minimum.These acceptance limits are often used to set acceptance limits formaterial strength for each lot of material, or each new manufacturingsite. When a sample meets the criteria that its mean and its minimum areboth greater than these limits, then one may accept the lot of materialor the new manufacturing site.
This procedure is used to ensure that the strength of material processedat a second site, or made with a new batch of material are not degradedrelative to the data originally used to determine basis values for thematerial. For more information about the use of this procedure, seeCMH-17-1G or PS-ACE 100-2002-006.
There are several optional arguments to this function. However, you can'tomit all of the optional arguments. You must supply eitherdata_sample orn_sample, but not both. You must also supplyeitherdata_qual (anddf_qual ifdata_qual is avariable name and not a vector) or bothmean_qual andsd_qual,but if you supplydata_qual (and possiblydf_qual) you shouldnot supply eithermean_qual orsd_qual (and visa-versa). Thisfunction will issue a warning or error if you violate any of these rules.
Ifmodcv is TRUE, the standard deviation used to calculate thethresholds will be replaced with a standard deviation calculatedusing the Modified Coefficient of Variation (CV) approach.The Modified CV approach is a way of adding extra variance to thequalification data in the case that the qualification data has lessvariance than expected, which sometimes occurs when qualification testingis performed in a short period of time.Using the Modified CV approach, the standard deviation is calculated bymultiplyingCV_star * mean_qual wheremean_qual is either thevalue supplied or the value calculated bymean(data_qual) andCV* is the value computed bycalc_cv_star().
Value
Returns an object of classequiv_mean_extremum. This object is a listwith the following named elements:
callthe expression used to call this functionalphathe value of alpha passed to this functionn_samplethe number of observations in the sample for whichequivalency is being checked. This is either the valuen_samplepassed to this function or the length of the vectordata_sample.k1the factor used to calculate the minimum individualthreshold. The minimum individual threshold is calculated asW_{min} = qual\,mean - k_1 \cdot qual\,sdk2the factor used to calculate the threshold for mean. Thethreshold for mean is calculated asW_{mean} = qual\,mean - k_2 \cdot qual\,sdmodcvlogical value indicating whether the acceptancethresholds are calculated using the modified CV approachcvthe coefficient of variation of the qualification data.This value is not modified, even ifmodcv=TRUEcv_starThe modified coefficient of variation. Ifmodcv=FALSE, this will beNULLthreshold_min_indivThe calculated threshold value forminimum individualthreshold_meanThe calculated threshold value for meanresult_min_indiva character vector of either "PASS" or"FAIL" indicating whether the data fromdata_samplepasses thetest for minimum individual. Ifdata_samplewas not supplied,this value will beNULLresult_meana character vector of either "PASS" or"FAIL" indicating whether the data fromdata_samplepasses thetest for mean. Ifdata_samplewas not supplied, this value willbeNULLmin_sampleThe minimum value from the vectordata_sample. ifdata_samplewas not supplied, this willhave a value ofNULLmean_sampleThe mean value from the vectordata_sample. Ifdata_samplewas not supplied, this willhave a value ofNULL
References
M. G. Vangel. Lot Acceptance and Compliance Testing Using the Sample Meanand an Extremum, Technometrics, vol. 44, no. 3. pp. 242–249. 2002.
“Composite Materials Handbook, Volume 1. Polymer Matrix CompositesGuideline for Characterization of Structural Materials,” SAE International,CMH-17-1G, Mar. 2012.
Federal Aviation Administration, “Material Qualification and Equivalencyfor Polymer Matrix Composite Material Systems,” PS-ACE 100-2002-006,Sep. 2003.
See Also
Examples
equiv_mean_extremum(alpha = 0.01, n_sample = 6, mean_qual = 100, sd_qual = 5.5, modcv = TRUE)#### Call:## equiv_mean_extremum(mean_qual = 100, sd_qual = 5.5, n_sample = 6,## alpha = 0.01, modcv = TRUE)#### Modified CV used: CV* = 0.0675 ( CV = 0.055 )#### For alpha = 0.01 and n = 6## ( k1 = 3.128346 and k2 = 1.044342 )## Min Individual Sample Mean## Thresholds: 78.88367 92.95069Jittered points showing (possibly multiple) failure modes
Description
Thegeom_jitter_failure_mode is very similar toggplot2::geom_jitter() except that a failure mode variable specifiedas the color and/or shape aesthetic is parsed to separate multiplefailure modes and plot them separately. For example, if an observationhas the failure mode "LAT/LAB", two points will be plotted, one with thefailure mode "LAT" and the second with the failure mode "LAB".
Usage
geom_jitter_failure_mode( mapping = NULL, data = NULL, stat = "identity", position = "jitter", ..., width = NULL, height = NULL, na.rm = FALSE, show.legend = NA, inherit.aes = TRUE, sep = "[/, ]+")Arguments
mapping | Set of aesthetic mapping created by |
data | The data to be displayed by this layer.See |
stat | The statistical transformation to use on the data for this layer.See |
position | A position adjustment to use on the data for this layer.See |
... | Other arguments passed on to |
width | The amount of horizontal jitter.See |
height | The amount of vertical jitter.See |
na.rm | If FALSE, the default, missing values are removed with warning.See |
show.legend |
|
inherit.aes | if FALSE, overrides the default aesthetics.See |
sep | A regular expression indicating the character(s) separatingmultiple failure modes. By default |
Details
The variable specified for the aestheticsshape andcolor are passedto the functionseparate_failure_modes() to parse the failure modes andseparate multiple failure modes separated by character(s) specified inthe regular expression given in the parametersep. By default, multiplefailure modes are expected to be separated by spaces, commas or forwardslashes, but this can be overridden.
If bothshape andcolor aesthetics are specified, both must be identical.
See Also
Examples
library(dplyr)library(ggplot2)carbon.fabric.2 %>% filter(test == "WT") %>% ggplot(aes(x = condition, y = strength)) + geom_boxplot() + geom_jitter_failure_mode(aes(color = failure_mode, shape = failure_mode))Glance at aadk (Anderson–Darling k-Sample) object
Description
Glance accepts an object of typeadk and returns atibble::tibble() withone row of summaries.
Glance does not do any calculations: it just gathers the results in atibble.
Usage
## S3 method for class 'adk'glance(x, ...)Arguments
x | an |
... | Additional arguments. Not used. Included only to match genericsignature. |
Value
A one-rowtibble::tibble() with the followingcolumns:
alphathe significance level for the testnthe sample size for the testkthe number of samplessigmathe computed standard deviation of the test statisticadthe test statisticpthe p-value of the testreject_same_distwhether the test concludes that the samplesare drawn from different populations
See Also
Examples
x <- c(rnorm(20, 100, 5), rnorm(20, 105, 6))k <- c(rep(1, 20), rep(2, 20))a <- ad_ksample(x = x, groups = k)glance(a)## A tibble: 1 x 7## alpha n k sigma ad p reject_same_dist## <dbl> <int> <int> <dbl> <dbl> <dbl> <lgl>## 1 0.025 40 2 0.727 4.37 0.00487 TRUEGlance at ananderson_darling object
Description
Glance accepts an object of typeanderson_darling andreturns atibble::tibble() withone row of summaries.
Glance does not do any calculations: it just gathers the results in atibble.
Usage
## S3 method for class 'anderson_darling'glance(x, ...)Arguments
x | an |
... | Additional arguments. Not used. Included only to match genericsignature. |
Value
A one-rowtibble::tibble() with the followingcolumns:
distthe distribution usednthe number of observations in the sampleAthe Anderson–Darling test statisticoslthe observed significance level (p-value),assuming theparameters of the distribution are estimated from the dataalphathe required significance level for the test.This value is given by the user.reject_distributiona logical value indicating whetherthe hypothesis that the data is drawn from the specified distributionshould be rejected
See Also
Examples
x <- rnorm(100, 100, 4)ad <- anderson_darling_weibull(x = x)glance(ad)## # A tibble: 1 x 6## dist n A osl alpha reject_distribution## <chr> <int> <dbl> <dbl> <dbl> <lgl>## 1 Weibull 100 2.62 0.00000207 0.05 TRUEGlance at a basis object
Description
Glance accepts an object of type basis and returns atibble::tibble() withone row of summaries for each basis value.
Glance does not do any calculations: it just gathers the results in atibble.
Usage
## S3 method for class 'basis'glance(x, include_diagnostics = FALSE, ...)Arguments
x | a basis object |
include_diagnostics | a logical value indicating whether to includecolumns for diagnostic tests. Default FALSE. |
... | Additional arguments. Not used. Included only to match genericsignature. |
Details
For the pooled basis methods (basis_pooled_cv andbasis_pooled_sd), thetibble::tibble()returned byglance will have one row for each group included inthe pooling. For all other basis methods, the resultingtibblewill have a single row.
Ifinclude_diagnostics=TRUE, there will be additional columnscorresponding with the diagnostic tests performed. These column(s) willbe of type character and will contain a "P" if the diagnostic testpassed, a "F" if the diagnostic test failed, an "O" if the diagnostictest was overridden orNA if the test was not run (typicallybecause an optional argument was not passed to the function thatcomputed the basis value).
Value
Atibble::tibble() with the followingcolumns:
pthe the content of the tolerance bound. Normally 0.90 or 0.99confthe confidence level. Normally 0.95distributiona string representing the distribution assumedwhen calculating the basis valuemodcva logical value indicating whether the modifiedCV approach was used. Only applicable to pooling methods.nthe sample sizerthe number of groups used in the calculation. This willbeNAfor single-point basis valuesbasisthe basis value
See Also
Examples
set.seed(10)x <- rnorm(20, 100, 5)b <- basis_normal(x = x)glance(b)## # A tibble: 1 x 7## p conf distribution modcv n r basis## <dbl> <dbl> <chr> <lgl> <int> <lgl> <dbl>## 1 0.9 0.95 Normal FALSE 20 NA 92.0glance(b, include_diagnostics = TRUE)## # A tibble: 1 x 11## p conf distribution modcv n r basis outliers_within…## <dbl> <dbl> <chr> <lgl> <int> <lgl> <dbl> <chr>## 1 0.9 0.95 Normal FALSE 20 NA 92.0 NA## # … with 3 more variables: between_batch_variability <chr>,## # outliers <chr>, anderson_darling_normal <chr>Glance at aequiv_change_mean object
Description
Glance accepts an object of typeequiv_change_meanand returns atibble::tibble() withone row of summaries.
Glance does not do any calculations: it just gathers the results in atibble.
Usage
## S3 method for class 'equiv_change_mean'glance(x, ...)Arguments
x | a |
... | Additional arguments. Not used. Included only to match genericsignature. |
Value
A one-rowtibble::tibble() with the followingcolumns:
alphathe value of alpha passed to this functionn_samplethe number of observations in the sample for whichequivalency is being checked. This is either the valuen_samplepassed to this function or the length of the vectordata_sample.mean_samplethe mean of the observations in the sample forwhich equivalency is being checked. This is either the valuemean_samplepassed to this function or the mean of the vectordata-sample.sd_samplethe standard deviation of the observations in thesample for which equivalency is being checked. This is either the valuemean_samplepassed to this function or the standard deviation ofthe vectordata-sample.n_qualthe number of observations in the qualification datato which the sample is being compared for equivalency. This is eitherthe valuen_qualpassed to this function or the length of thevectordata_qual.mean_qualthe mean of the qualification data to which thesample is being compared for equivalency. This is either the valuemean_qualpassed to this function or the mean of the vectordata_qual.sd_qualthe standard deviation of the qualification data towhich the sample is being compared for equivalency. This is either thevaluemean_qualpassed to this function or the standard deviationof the vectordata_qual.modcvlogical value indicating whether the equivalencycalculations were performed using the modified CV approachspthe value of the pooled standard deviation. Ifmodecv = TRUE, this pooled standard deviation includes themodification to the qualification CV.t0the test statistict_reqthe t-value for\alpha / 2anddf = n1 + n2 -2threshold_minthe minimum value of the sample mean that wouldresult in a passthreshold_maxthe maximum value of the sample mean that wouldresult in a passresulta character vector of either "PASS" or "FAIL"indicating the result of the test for change in mean
See Also
Examples
x0 <- rnorm(30, 100, 4)x1 <- rnorm(5, 91, 7)eq <- equiv_change_mean(data_qual = x0, data_sample = x1, alpha = 0.01)glance(eq)## # A tibble: 1 x 14## alpha n_sample mean_sample sd_sample n_qual mean_qual sd_qual modcv## <dbl> <int> <dbl> <dbl> <int> <dbl> <dbl> <lgl>## 1 0.01 5 85.8 9.93 30 100. 3.90 FALSE## # ... with 6 more variables: sp <dbl>, t0 <dbl>, t_req <dbl>,## # threshold_min <dbl>, threshold_max <dbl>, result <chr>Glance at anequiv_mean_extremum object
Description
Glance accepts an object of typeequiv_mean_extremum and returns atibble::tibble() withone row of summaries.
Glance does not do any calculations: it just gathers the results in atibble.
Usage
## S3 method for class 'equiv_mean_extremum'glance(x, ...)Arguments
x | an equiv_mean_extremum object returned from |
... | Additional arguments. Not used. Included only to match genericsignature. |
Value
A one-rowtibble::tibble() with the followingcolumns:
alphathe value of alpha passed to this functionn_samplethe number of observations in the sample for whichequivalency is being checked. This is either the valuen_samplepassed to this function or the length of the vectordata_sample.modcvlogical value indicating whether the acceptancethresholds are calculated using the modified CV approachthreshold_min_indivThe calculated threshold value forminimum individualthreshold_meanThe calculated threshold value for meanresult_min_indiva character vector of either "PASS" or"FAIL" indicating whether the data fromdata_samplepasses thetest for minimum individual. Ifdata_samplewas not supplied,this value will beNULLresult_meana character vector of either "PASS" or"FAIL" indicating whether the data fromdata_samplepasses thetest for mean. Ifdata_samplewas not supplied, this value willbeNULLmin_sampleThe minimum value from the vectordata_sample. ifdata_samplewas not supplied, this willhave a value ofNULLmean_sampleThe mean value from the vectordata_sample. Ifdata_samplewas not supplied, this willhave a value ofNULL
See Also
Examples
x0 <- rnorm(30, 100, 4)x1 <- rnorm(5, 91, 7)eq <- equiv_mean_extremum(data_qual = x0, data_sample = x1, alpha = 0.01)glance(eq)## # A tibble: 1 x 9## alpha n_sample modcv threshold_min_indiv threshold_mean## <dbl> <int> <lgl> <dbl> <dbl>## 1 0.01 5 FALSE 86.2 94.9## # ... with 4 more variables: result_min_indiv <chr>, result_mean <chr>,## # min_sample <dbl>, mean_sample <dbl>Glance at alevene object
Description
Glance accepts an object of typelevene and returns atibble::tibble() withone row of summaries.
Glance does not do any calculations: it just gathers the results in atibble.
Usage
## S3 method for class 'levene'glance(x, ...)Arguments
x | a |
... | Additional arguments. Not used. Included only to match genericsignature. |
Value
A one-rowtibble::tibble() with the followingcolumns:
alphathe value of alpha specifiedmodcva logical value indicating whether the modifiedCV approach was used.nthe total number of observationskthe number of groupsfthe value of the F test statisticpthe computed p-valuereject_equal_variancea boolean value indicating whether thenull hypothesis that all samples have the same variance is rejected
See Also
Examples
df <- data.frame( groups = c(rep("A", 5), rep("B", 6)), strength = c(rnorm(5, 100, 6), rnorm(6, 105, 7)))levene_result <- levene_test(df, strength, groups)glance(levene_result)## # A tibble: 1 x 7## alpha modcv n k f p reject_equal_variance## <dbl> <lgl> <int> <int> <dbl> <dbl> <lgl>## 1 0.05 FALSE 11 2 0.0191 0.893 FALSEGlance at amnr (maximum normed residual) object
Description
Glance accepts an object of typemnr and returns atibble::tibble() withone row of summaries.
Glance does not do any calculations: it just gathers the results in atibble.
Usage
## S3 method for class 'mnr'glance(x, ...)Arguments
x | An |
... | Additional arguments. Not used. Included only to match genericsignature. |
Value
A one-rowtibble::tibble() with the followingcolumns:
mnrthe computed MNR test statisticalphathe value of alpha used for the testcritthe critical value given the sample size and thesignificance leveln_outliersthe number of outliers found
See Also
Examples
x <- c(rnorm(20, 100, 5), 10)m <- maximum_normed_residual(x = x)glance(m)## # A tibble: 1 x 4## mnr alpha crit n_outliers## <dbl> <dbl> <dbl> <dbl>## 1 4.23 0.05 2.73 1Calculate values related to Extended Hanson–Koopmans tolerance bounds
Description
Calculates values related to Extended Hanson–Koopmans tolerance boundsas described by Vangel (1994).
Usage
hk_ext_z(n, i, j, p, conf)hk_ext_z_j_opt(n, p, conf)Arguments
n | the sample size |
i | the first order statistic (1 <= i < j) |
j | the second order statistic (i < j <= n) |
p | the content of the tolerance bound (normally 0.90 or 0.99) |
conf | the confidence level (normally 0.95) |
Details
Hanson (1964) presents a nonparametric method for determiningtolerance bounds based on consecutive order statistics.Vangel (1994) extends this method using non-consecutive order statistics.
The extended Hanson–Koopmans method calculates a tolerance bound(basis value) based on two order statistics and a weighting valuez. The value ofz is based on the sample size, whichorder statistics are selected, the desired content of the tolerancebond and the desired confidence level.
The functionhk_ext_z calculates the weighting variablezbased on selected order statisticsi andj. Based on thisvaluez, the tolerance bound can be calculated as:
S = z X_{(i)} + (1 - z) X_{(j)}
WhereX_{(i)} andX_{(j)} are thei-thandj-th ordered observation.
The functionhk_ext_z_j_opt determines the value ofj andthe corresponding value ofz, assumingi=1. The valueofj is selected such that the computed tolerance limit isnearest to the desired population quantile for a standard normaldistribution when the order statistics are equal to the expectedvalue of the order statistics for the standard normal distribution.
Value
Forhk_ext_z, the return value is a numeric value representingthe parameter z (denoted as k in CMH-17-1G).
Forhk_ext_z_j_opt, the return value is named list containingz andk. The former is the value of z, as defined byVangel (1994), and the latter is the corresponding order statistic.
References
M. Vangel, “One-Sided Nonparametric Tolerance Limits,”Communications in Statistics - Simulation and Computation,vol. 23, no. 4. pp. 1137–1154, 1994.
D. L. Hanson and L. H. Koopmans,“Tolerance Limits for the Class of Distributions with IncreasingHazard Rates,” The Annals of Mathematical Statistics,vol. 35, no. 4. pp. 1561–1570, 1964.
See Also
Examples
# The factors from Table 1 of Vangel (1994) can be recreated# using the hk_ext_z function. For the sample size n=21,# the median is the 11th ordered observation. The factor# required for calculating the tolerance bound with a content# of 0.9 and a confidence level of 0.95 based on the median# and first ordered observation can be calculated as follows.hk_ext_z(n = 21, i = 1, j = 11, p = 0.9, conf = 0.95)## [1] 1.204806# The hk_ext_z_j_opt function can be used to refine this value# of z by finding an optimum value of j, rather than simply# using the median. Here, we find that the optimal observation# to use is the 10th, not the 11th (which is the median).hk_ext_z_j_opt(n = 21, p = 0.9, conf = 0.95)## $z## [1] 1.217717#### $j## [1] 10k-factors for determining acceptance based on sample mean and an extremum
Description
k-factors for determining acceptance based on sample mean and an extremum
Usage
k_equiv(alpha, n)Arguments
alpha | the acceptable probability of a type I error |
n | the number of observations in the sample to test |
Details
The k-factors returned by this function are used for determiningwhether to accept a new dataset.
This function is used as part of the procedure fordetermining acceptance limits for a sample mean and sample minimum.These acceptance limits are often used to set acceptance limits formaterial strength for each lot of material, or each new manufacturingsite. When a sample meets the criteria that its mean and its minimum areboth greater than these limits, then one may accept the lot of materialor the new manufacturing site.
This procedure is used to ensure that the strength of material processedat a second site, or made with a new batch of material are not degradedrelative to the data originally used to determine basis values for thematerial. For more information about the use of this procedure, seeCMH-17-1G or PS-ACE 100-2002-006.
According to Vangel (2002), the use of mean and extremum for this purposeis more powerful than the use of mean and standard deviation.
The results of this function match those published by Vangel within0.05\by Vangel are identical to those published in CMH-17-1G.
This function uses numerical integration and numerical optimization tofind values of the factorsk_1 andk_2 based on Vangel'ssaddle point approximation.
The valuen refers to the number of observations in the samplebeing compared with the original population (the qualification sample isusually assumed to be equal to the population statistics).
The value ofalpha is the acceptable probability of a type I error.Normally, this is set to 0.05 for material or process equivalency and 0.01when setting lot acceptance limits. Though, in principle, this parametercan be set to any number between 0 and 1. This function, however, has onlybeen validated in the range of1e-5 \le alpha \le 0.5.
Value
a vector with elements c(k1, k2). k1 is for testing the sampleextremum. k2 is for testing the sample mean
References
M. G. Vangel. Lot Acceptance and Compliance Testing Using the Sample Meanand an Extremum, Technometrics, vol. 44, no. 3. pp. 242–249. 2002.
“Composite Materials Handbook, Volume 1. Polymer Matrix CompositesGuideline for Characterization of Structural Materials,” SAE International,CMH-17-1G, Mar. 2012.
Federal Aviation Administration, “Material Qualification and Equivalencyfor Polymer Matrix Composite Material Systems,” PS-ACE 100-2002-006,Sep. 2003.
See Also
Examples
qual_mean <- 100qual_sd <- 3.5k <- k_equiv(0.01, 5)print("Minimum Individual Acceptance Limit:")print(qual_mean - qual_sd * k[1])print("Minimum Average Acceptance Limit:")print(qual_mean - qual_sd * k[2])## [1] "Minimum Individual Acceptance Limit:"## [1] 89.24981## [1] "Minimum Average Acceptance Limit:"## [1] 96.00123Calculate k factor for basis values (kB,kA) with normaldistribution
Description
The factors returned by this function are used when calculating basisvalues (one-sided confidence bounds) when the data are normallydistributed. The basis value willbe equal to\bar{x} - k s,where\bar{x} is the sample mean,s is the sample standard deviation andk is the resultof this function.This function is internally used bybasis_normal() whencomputing basis values.
Usage
k_factor_normal(n, p = 0.9, conf = 0.95)Arguments
n | the number of observations (i.e. coupons) |
p | the desired content of the tolerance bound.Should be 0.90 for B-Basis and 0.99 for A-Basis |
conf | confidence level. Should be 0.95 for both A- and B-Basis |
Details
This function calculates the k factors used when determining A- andB-Basis values for normally distributed data. To getkB, setthe content of the tolerance bound top = 0.90 andthe confidence level toconf = 0.95. To getkA, setp = 0.99 andconf = 0.95. While other tolerance boundcontents and confidence levels may be computed, they are infrequentlyneeded in practice.
The k-factor is calculated using equation 2.2.3 ofKrishnamoorthy and Mathew (2008).
This function has been validated against thekB tables inCMH-17-1G for each value ofn fromn = 2 ton = 95.It has been validated against thekA tables in CMH-17-1G for eachvalue ofn fromn = 2 ton = 75. Larger values ofnalso match the tables in CMH-17-1G, but Remits warnings that "full precision may not have been achieved." Whenvalidating the results of this function against the tables in CMH-17-1G,the maximum allowable difference between the two is 0.002. The tables inCMH-17-1G give values to three decimal places.
For more information about tolerance bounds in general, seeMeeker, et. al. (2017).
Value
the calculated factor
References
K. Krishnamoorthy and T. Mathew, Statistical Tolerance Regions: Theory,Applications, and Computation. Hoboken: John Wiley & Sons, 2008.
W. Meeker, G. Hahn, and L. Escobar, Statistical Intervals: A Guidefor Practitioners and Researchers, Second Edition.Hoboken: John Wiley & Sons, 2017.
“Composite Materials Handbook, Volume 1. Polymer Matrix CompositesGuideline for Characterization of Structural Materials,” SAE International,CMH-17-1G, Mar. 2012.
See Also
Examples
kb <- k_factor_normal(n = 10, p = 0.9, conf = 0.95)print(kb)## [1] 2.35464# This can be used to caclulate the B-Basis if# the sample mean and sample standard deviation# is known, and data is assumed to be normally# distributedsample_mean <- 90sample_sd <- 5.2print("B-Basis:")print(sample_mean - sample_sd * kb)## [1] B-Basis:## [1] 77.75587Levene's Test (Median) for Equality of Variance
Description
This function performs the Levene's test for equality of variance usingthe median. This is also known as the Brown-Forsythe test.
Usage
levene_test(data = NULL, x, groups, alpha = 0.05, modcv = FALSE)Arguments
data | a data.frame |
x | the variable in the data.frame or a vector on which to perform theLevene's test (usually strength) |
groups | a variable in the data.frame that defines the groups |
alpha | the significance level (default 0.05) |
modcv | a logical value indicating whether the modified CV approachshould be used. |
Details
This function performs the Levene's test for equality of variance usingmedian (also known as the Brown-Forsythe test). Thedata is transformed as follows:
w_{ij} = \left| x_{ij} - m_i \right|
Wherem_i is median of theith group. An F-Test is thenperformed on the transformed data.
Whenmodcv=TRUE, the data from each group is first transformedaccording to the modified coefficient of variation (CV) rules beforeperforming Levene's test.
Value
Returns an object of classlevene. This object has the following fields:
callthe expression used to call this functiondatathe original data supplied by the usergroupsa vector of the groups used in the computationalphathe value of alpha specifiedmodcva logical value indicating whether the modifiedCV approach was used.nthe total number of observationskthe number of groupsfthe value of the F test statisticpthe computed p-valuereject_equal_variancea boolean value indicating whether thenull hypothesis that all samples have the same variance is rejectedmodcv_transformed_datathe data after the modified CV transformation
References
“Composite Materials Handbook, Volume 1. Polymer Matrix CompositesGuideline for Characterization of Structural Materials,” SAE International,CMH-17-1G, Mar. 2012.
NIST/SEMATECH e-Handbook of Statistical Methods,https://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm, 2024.
Brown, M. B. and Forsythe, A. B. (1974), Journal of the AmericanStatistical Association, 69, pp. 364-367.
See Also
Examples
library(dplyr)carbon.fabric.2 %>% filter(test == "FC") %>% levene_test(strength, condition)#### Call:## levene_test(data = ., x = strength, groups = condition)#### n = 91 k = 5## F = 3.883818 p-value = 0.00600518## Conclusion: Samples have unequal variance ( alpha = 0.05 )Detect outliers using the maximum normed residual method
Description
This function detects outliers using the maximum normed residualmethod described in CMH-17-1G. This method identifies a valueas an outlier if the absolute difference between the value andthe sample mean divided by the sample standard deviationexceeds a critical value.
Usage
maximum_normed_residual(data = NULL, x, alpha = 0.05)Arguments
data | a data.frame |
x | the variable in the data.frame for which to find the MNRor a vector if |
alpha | the significance level for the test. Defaults to 0.05 |
Details
data is an optional argument. Ifdata is given, itshould be adata.frame (or similar object). Whendata is specified, thevalue ofx is expected to be a variable withindata. Ifdata is not specified,x must be a vector.
The maximum normed residual test is a test for outliers. The test statisticis given in CMH-17-1G. Outliers are identified in the returned object.
The maximum normed residual test statistic is defined as:
MNR = max \frac{\left| x_i - \bar{x} \right|}{s}
When the value of the MNR test statistic exceeds the critical valuedefined in Section 8.3.3.1 of CMH-17-1G, the corresponding valueis identified as an outlier. It is then removed from the sample, andthe test statistic is computed again and compared with the criticalvalue corresponding with the new sample. This process is repeated untilno values are identified as outliers.
Value
an object of classmnrThis object has the following fields:
callthe expression used to call this functiondatathe original data used to compute the MNRalphathe value of alpha given by the usermnrthe computed MNR test statisticcritthe critical value given the sample size and thesignificance leveloutliersa data.frame containing theindexandvalueof each of the identified outliersn_outliersthe number of outliers found
References
“Composite Materials Handbook, Volume 1. Polymer Matrix CompositesGuideline for Characterization of Structural Materials,” SAE International,CMH-17-1G, Mar. 2012.
Examples
library(dplyr)carbon.fabric.2 %>% filter(test=="FC" & condition=="ETW2" & batch=="A") %>% maximum_normed_residual(strength)## Call:## maximum_normed_residual(data = ., x = strength)#### MNR = 1.958797 ( critical value = 1.887145 )#### Outliers ( alpha = 0.05 ):## Index Value## 6 44.26carbon.fabric.2 %>% filter(test=="FC" & condition=="ETW2" & batch=="B") %>% maximum_normed_residual(strength)## Call:## maximum_normed_residual(data = ., x = strength)#### MNR = 1.469517 ( critical value = 1.887145 )#### No outliers detected ( alpha = 0.05 )Create a plot of nested sources of variation
Description
Creates a plot showing the breakdown of variation within a sample. Thisfunction usesggplot2 internally.
Usage
nested_data_plot( dat, x, groups = c(), stat = "mean", ..., y_gap = 1, divider_color = "grey50", point_args = list(), dline_args = list(), vline_args = list(), hline_args = list(), label_args = list(), connector_args = list())Arguments
dat | a |
x | the variable within |
groups | a vector of variables to group the data by |
stat | a function for computing the central location for each group.This is normally "mean" but could be "median" or anotherfunction. |
... | extra options. See Details. |
y_gap | the vertical gap between grouping variables |
divider_color | the color of the lines between grouping variables.Or |
point_args | arguments to pass toggplot2::geom_point when plottingindividual data points. |
dline_args | arguments to pass toggplot2::geom_segment when plottingthe horizontal lines between data points. |
vline_args | arguments to pass toggplot2::geom_segment when plottingvertical lines |
hline_args | arguments to pass toggplot2::geom_segment when plottinghorizontal lines connecting levels in groups |
label_args | arguments to pass toggplot2::geom_label when plottinglabels |
connector_args | arguments to pass toggplot2::geom_point whenplotting the connection between the vertical linesand the horizontal lines connecting levels in groups |
Details
Extra options can be included to control aesthetic options. The followingoptions are supported. Any (or all) can be set to a single variablein the data set.
color: Controls the color of the data points.fill: Controls the fill color of the labels. When a particular labelis associated with data points with more than one level of the suppliedvariable, the fill is omitted.
Examples
library(dplyr)carbon.fabric.2 %>% filter(test == "WT" & condition == "RTD") %>% nested_data_plot(strength, groups = c(batch, panel))# Labels can be filled toocarbon.fabric.2 %>% filter(test == "WT" & condition == "RTD") %>% nested_data_plot(strength, groups = c(batch, panel), fill = batch)Rank for distribution-free tolerance bound
Description
Calculates the rank order for finding distribution-free tolerancebounds for large samples. This function should only be used forcomputing B-Basis for samples larger than 28 or A-Basis for sampleslarger than 298. This function is used bybasis_nonpara_large_sample().
Usage
nonpara_binomial_rank(n, p, conf)Arguments
n | the sample size |
p | the desired content for the tolerance bound |
conf | the confidence level for the desired tolerance bound |
Details
This function uses the sum of binomial terms to determine the rankof the ordered statistic that corresponds with the desired tolerancelimit. This approach does not assume any particular distribution. Thisapproach is described by Guenther (1969) and by CMH-17-1G.
The results of this function have been verified against the tables inCMH-17-1G and agreement was found for all sample sizes published inCMH-17-1G for both A- and B-Basis, as well as the sample sizesn+1 andn-1, wheren is the sample size published in CMH-17-1G.
The tables in CMH-17-1G purportedly list the smallest sample sizesfor which a particular rank can be used. That is, for a sample sizeone less than then published in the table, the next lowest rankwould be used. In some cases, the results of this function disagree by arank of one for sample sizes one less than then published in thetable. This indicates a disagreement in that sample size at whichthe rank should change. This is likely due to numericaldifferences in this function and the procedure used to generate the tables.However, the disagreement is limited to sample 6500 for A-Basis; nodiscrepancies have been identified for B-Basis. Since these sample sizes areuncommon for composite materialstesting, and the difference between subsequent order statistics will bevery small for samples this large, this difference will have no practicaleffect on computed tolerance bounds.
Value
The rank corresponding with the desired tolerance bound
References
W. Guenther, “Determination of Sample Size for Distribution-FreeTolerance Limits,” Jan. 1969.Available online:https://www.duo.uio.no/handle/10852/48686
“Composite Materials Handbook, Volume 1. Polymer Matrix CompositesGuideline for Characterization of Structural Materials,” SAE International,CMH-17-1G, Mar. 2012.
See Also
Examples
nonpara_binomial_rank(n = 1693, p = 0.99, conf = 0.95)## [1] 11# The above example indicates that for a sample of 1693 observations,# the A-Basis is best approximated as the 11th ordered observation.# In the example below, the same ordered observation would also be used# for a sample of size 1702.nonpara_binomial_rank(n = 1702, p = 0.99, conf = 0.95)## [1] 11Normalize values to group means
Description
This function computes the mean of each group, then divides eachobservation by its corresponding group mean. This is commonly donewhen pooling data across environments.
Usage
normalize_group_mean(x, group)Arguments
x | the variable containing the data to normalized |
group | the variable containing the groups |
Details
Computes the mean for each group, then divides each value by the mean forthe corresponding group.
Value
Returns a vector of normalized values
References
“Composite Materials Handbook, Volume 1. Polymer Matrix CompositesGuideline for Characterization of Structural Materials,” SAE International,CMH-17-1G, Mar. 2012.
Examples
library(dplyr)carbon.fabric.2 %>%filter(test == "WT") %>% select(condition, strength) %>% mutate(condition_norm = normalize_group_mean(strength, condition)) %>% head(10)## condition strength condition_norm## 1 CTD 142.817 1.0542187## 2 CTD 135.901 1.0031675## 3 CTD 132.511 0.9781438## 4 CTD 135.586 1.0008423## 5 CTD 125.145 0.9237709## 6 CTD 135.203 0.9980151## 7 CTD 128.547 0.9488832## 8 CTD 127.709 0.9426974## 9 CTD 127.074 0.9380101## 10 CTD 126.879 0.9365706Normalizes strength values to ply thickness
Description
This function takes a vector of strength values and avector of measured thicknesses, and a nominal thicknessand returns the normalized strength.
Usage
normalize_ply_thickness(strength, measured_thk, nom_thk)Arguments
strength | the strength to be normalized. Either a vector or a numeric |
measured_thk | the measured thickness of the samples. Must be the samelength as strength |
nom_thk | the nominal thickness. Must be a single numeric value. |
Details
It is often necessary to normalize strength values so that variation inspecimen thickness does not unnecessarily increase variation in strength.See CMH-17-1G, or other references, for information about the cases wherenormalization is appropriate.
Either cured ply thickness or laminate thickness may be used formeasured_thk andnom_thk, as long as the same decisionmade for both values.
The formula applied is:
normalized\,value = test\,value \frac{t_{measured}}{t_{nominal}}
If you need to normalize based on fiber volume fraction (or another method),you will first need to calculate the nominal cured ply thickness (or laminatethickness). Those calculations are outside the scope of this documentation.
Value
The normalized strength values
References
“Composite Materials Handbook, Volume 1. Polymer Matrix CompositesGuideline for Characterization of Structural Materials,” SAE International,CMH-17-1G, Mar. 2012.
Examples
library(dplyr)carbon.fabric.2 %>%select(thickness, strength) %>% mutate(normalized_strength = normalize_ply_thickness(strength, thickness, 0.105)) %>% head(10)## thickness strength normalized_strength## 1 0.112 142.817 152.3381## 2 0.113 135.901 146.2554## 3 0.113 132.511 142.6071## 4 0.112 135.586 144.6251## 5 0.113 125.145 134.6799## 6 0.113 135.203 145.5042## 7 0.113 128.547 138.3411## 8 0.113 127.709 137.4392## 9 0.113 127.074 136.7558## 10 0.114 126.879 137.7543Objects exported from other packages
Description
These objects are imported from other packages. Follow the linksbelow to see their documentation.
See Also
Separate multiple failure modes into multiple rows
Description
For adata.frame containing a column with (some) multiple failure modes,this function expands thedata.frame by repeating each row with multiplefailure modes so that each row contains only a single failure mode.
Usage
separate_failure_modes(data, failure_mode, sep = "[/, ]+")Arguments
data | a |
failure_mode | the column in |
sep | a regular expression with the character(s) separating individualfailure modes. Default |
Details
When multiple failure modes are reported, they are commonly reported inthe format "LGM/GIT" or "LGM,GIT". This function will separate these multiplefailure modes into multiple rows.
This can be useful when counting the number of coupons exhibited eachfailure mode.
Examples
library(dplyr)data.frame(strength = c(101, 102), fm = c("LGM/GIT", "LGM")) %>% separate_failure_modes(fm)#### # A tibble: 3 × 2## strength fm## <dbl> <chr>## 1 101 LGM## 2 101 GIT## 3 102 LGMEmpirical Survival Function
Description
The empirical survival function (ESF) provides a visualization of adistribution. This is closely related to the empirical cumulativedistribution function (ECDF). The empirical survival function issimply ESF = 1 - ECDF.
Usage
stat_esf( mapping = NULL, data = NULL, geom = "point", position = "identity", show.legend = NA, inherit.aes = TRUE, n = NULL, pad = FALSE, ...)Arguments
mapping | Set of aesthetic mappings created by |
data | The data to be displayed in this layer. This has thesame usage as a |
geom | The geometric object to use to display the data. |
position | Position argument |
show.legend | Should this layer be included in the legends? |
inherit.aes | If |
n | If |
pad | If |
... | Other arguments to pass on to |
Normal Survival Function
Description
The Normal survival function provides a visualization of adistribution. A normal curve is fit based on the mean and standarddeviation of the data, and the survival function of this normalcurve is plotted. The survival function is simply one minus theCDF.
Usage
stat_normal_surv_func( mapping = NULL, data = NULL, geom = "smooth", position = "identity", show.legend = NA, inherit.aes = TRUE, n = 100, pad = FALSE, ...)Arguments
mapping | Set of aesthetic mappings created by |
data | The data to be displayed in this layer. This has thesame usage as a |
geom | The geometric object to use to display the data. |
position | Position argument |
show.legend | Should this layer be included in the legends? |
inherit.aes | If |
n | If |
pad | If |
... | Other arguments to pass on to |
Transforms data according to the modified CV rule
Description
Transforms data according to the modified coefficient of variation (CV)rule. This is used to add additional variance to datasets withunexpectedly low variance, which is sometimes encountered duringtesting of new materials over short periods of time.
Two versions of this transformation are implemented. The first version,transform_mod_cv(), transforms the data in a single group (withno other structure) according to the modified CV rules.
The secondversion,transform_mod_cv_ad(), transforms data that is structuredaccording to both condition and batch, as is commonly done forthe Anderson–Darling k-Sample and Anderson-Darling tests when poolingacross environments.
Usage
transform_mod_cv_ad(x, condition, batch)transform_mod_cv(x)Arguments
x | a vector of data to transform |
condition | a vector indicating the condition to which eachobservation belongs |
batch | a vector indicating the batch to which each observationbelongs |
Details
The modified CV transformation takes the general form:
\frac{S_i^*}{S_i} (x_{ij} - \bar{x_i}) + \bar{x_i}
WhereS_i^* is the modified standard deviation(mod CV times mean) fortheith group;S_i is the standard deviationfor theith group,\bar{x_i} isthe group mean andx_{ij} is the observation.
transform_mod_cv() takes a vectorcontaining the observations and transforms the data.The equation above is used, and all observationsare considered to be from the same group.
transform_mod_cv_ad() takes a vector containing the observationsplus a vector containing the corresponding conditions and a vectorcontaining the batches. This function first calculates the modifiedCV value from the data from each condition (independently). Then,within each condition, the transformationabove is applied to produce the transformed datax'.This transformed data is further transformed using the followingequation.
x_{ij}'' = C (x'_{ij} - \bar{x_i}) + \bar{x_i}
Where:
C = \sqrt{\frac{SSE^*}{SSE'}}
SSE^* = (n-1) (CV^* \bar{x})^2 - \sum(n_i(\bar{x_i}-\bar{x})^2)
SSE' = \sum(x'_{ij} - \bar{x_i})^2
Value
A vector of transformed data
See Also
Examples
# Transform data according to the modified CV transformation# and report the original and modified CV for each conditionlibrary(dplyr)carbon.fabric %>%filter(test == "FT") %>% group_by(condition) %>% mutate(trans_strength = transform_mod_cv(strength)) %>% head(10)## # A tibble: 10 x 6## # Groups: condition [1]## id test condition batch strength trans_strength## <chr> <chr> <chr> <int> <dbl> <dbl>## 1 FT-RTD-1-1 FT RTD 1 126. 126.## 2 FT-RTD-1-2 FT RTD 1 139. 141.## 3 FT-RTD-1-3 FT RTD 1 116. 115.## 4 FT-RTD-1-4 FT RTD 1 132. 133.## 5 FT-RTD-1-5 FT RTD 1 129. 129.## 6 FT-RTD-1-6 FT RTD 1 130. 130.## 7 FT-RTD-2-1 FT RTD 2 131. 131.## 8 FT-RTD-2-2 FT RTD 2 124. 124.## 9 FT-RTD-2-3 FT RTD 2 125. 125.## 10 FT-RTD-2-4 FT RTD 2 120. 119.# The CV of this transformed data can be computed to verify# that the resulting CV follows the rules for modified CVcarbon.fabric %>% filter(test == "FT") %>% group_by(condition) %>% mutate(trans_strength = transform_mod_cv(strength)) %>% summarize(cv = sd(strength) / mean(strength), mod_cv = sd(trans_strength) / mean(trans_strength))## # A tibble: 3 x 3## condition cv mod_cv## <chr> <dbl> <dbl>## 1 CTD 0.0423 0.0612## 2 ETW 0.0369 0.0600## 3 RTD 0.0621 0.0711