Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions R/commonQualityControl.R
Original file line number Diff line number Diff line change
Expand Up @@ -1375,8 +1375,8 @@ KnownControlStats.RS <- function(N, sigma = 3) {
fit_Lnorm <- try(EnvStats::elnorm(data))
if (jaspBase::isTryError(fit_Lnorm))
stop(gettext("Parameter estimation failed. Values might be too extreme. Try a different distribution."), call. = FALSE)
beta <- fit_Lnorm$parameters[1]
theta <- fit_Lnorm$parameters[2]
beta <- fit_Lnorm$parameters[1] # shape / logmean
theta <- fit_Lnorm$parameters[2] # scale / log std. dev.
} else if (distribution == "weibull") {
fit_Weibull <- try(fitdistrplus::fitdist(data, "weibull", method = "mle",
control = list(
Expand All @@ -1386,23 +1386,23 @@ KnownControlStats.RS <- function(N, sigma = 3) {
ndeps = rep(1e-8, 2))))
if (jaspBase::isTryError(fit_Weibull))
stop(gettext("Parameter estimation failed. Values might be too extreme. Try a different distribution."), call. = FALSE)
beta <- fit_Weibull$estimate[[1]]
theta <- fit_Weibull$estimate[[2]]
beta <- fit_Weibull$estimate[[1]] # shape
theta <- fit_Weibull$estimate[[2]] # scale
} else if(distribution == "3ParameterLognormal") {
temp <- try(EnvStats::elnorm3(data))
if (jaspBase::isTryError(temp))
stop(gettext("Parameter estimation failed. Values might be too extreme. Try a different distribution."), call. = FALSE)
beta <- temp$parameters[[1]]
theta <- temp$parameters[[2]]
threshold <- temp$parameters[[3]]
beta <- temp$parameters[[1]] # shape / logmean
theta <- temp$parameters[[2]] # scale / log std. dev.
threshold <- temp$parameters[[3]] # threshold
} else if(distribution == "3ParameterWeibull") {
temp <- try(MASS::fitdistr(data, function(x, shape, scale, thres)
dweibull(x-thres, shape, scale), list(shape = 0.1, scale = 1, thres = 0)))
if (jaspBase::isTryError(temp))
stop(gettext("Parameter estimation failed. Values might be too extreme. Try a different distribution."), call. = FALSE)
beta <- temp$estimate[1]
theta <- temp$estimate[2]
threshold <- temp$estimate[3]
beta <- temp$estimate[1] # shape
theta <- temp$estimate[2] # scale
threshold <- temp$estimate[3] # threshold
} else if (distribution == "exponential") {
fit_Weibull <- try(fitdistrplus::fitdist(data, "weibull", method = "mle", fix.arg = list("shape" = 1),
control = list(maxit = 500, abstol = .Machine$double.eps, reltol = .Machine$double.eps)))
Expand Down
304 changes: 237 additions & 67 deletions R/processCapabilityStudies.R

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions inst/help/processCapabilityStudies.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The size of the subgroups is relevant for the calculation of the process varianc
- Type of data distribution: indicate whether the data approximates a normal distribution or another distribution (the most commonly used distributions are: Weibull, Lognormal, 3-parameter Weibull, and 3-parameter lognorma)
- Specify a distribution: the non-normal distribution to be used.
- Non-normal capability statistics: the method used to calculate the capability statistics for non-normally distributed data.
- Historical parameters: Select which parameters should use fixed historical values instead of being estimated. Note that if only some parameters are set historically, JASP currently estimates all parameters first and then replaces the selected ones with their historical values; it does not keep them fixed during estimation.

#### Capability studies
- Specification limits:
Expand Down
125 changes: 125 additions & 0 deletions inst/qml/processCapabilityStudies.qml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,41 @@ Form
id : normalCapabilityAnalysis
label: qsTr("Normal distribution")
checked: true


CheckBox
{
name: "historicalMean"
label: qsTr("Historical mean")
id: historicalMean
childrenOnSameRow: true

DoubleField
{
name: "historicalMeanValue"
id: historicalMeanValue
negativeValues: true
defaultValue: 0
decimals: 9
}
}

CheckBox
{
name: "historicalStdDev"
label: qsTr("Historical std. dev.")
id: historicalStdDev
childrenOnSameRow: true

DoubleField
{
name: "historicalStdDevValue"
id: historicalStdDevValue
negativeValues: true
defaultValue: 1
decimals: 9
}
}
}

RadioButton
Expand All @@ -241,6 +276,96 @@ Form
indexDefaultValue: 0
}

CheckBox
{
name: "historicalShape"
label: qsTr("Historical shape")
id: historicalShape
childrenOnSameRow: true
visible: nonNormalDistribution.currentValue == "weibull" || nonNormalDistribution.currentValue == "3ParameterWeibull"

DoubleField
{
name: "historicalShapeValue"
id: historicalShapeValue
negativeValues: true
defaultValue: 1
decimals: 9
}
}

CheckBox
{
name: "historicalScale"
label: qsTr("Historical scale")
id: historicalScale
childrenOnSameRow: true
visible: nonNormalDistribution.currentValue == "weibull" || nonNormalDistribution.currentValue == "3ParameterWeibull"

DoubleField
{
name: "historicalScaleValue"
id: historicalScaleValue
negativeValues: true
defaultValue: 1
decimals: 9
}
}

CheckBox
{
name: "historicalLogMean"
label: qsTr("Historical log mean")
id: historicalLogMean
childrenOnSameRow: true
visible: nonNormalDistribution.currentValue == "lognormal" || nonNormalDistribution.currentValue == "3ParameterLognormal"

DoubleField
{
name: "historicalLogMeanValue"
id: historicalLogMeanValue
negativeValues: true
defaultValue: 1
decimals: 9
}
}

CheckBox
{
name: "historicalLogStdDev"
label: qsTr("Historical log std. dev.")
id: historicalLogStdDev
childrenOnSameRow: true
visible: nonNormalDistribution.currentValue == "lognormal" || nonNormalDistribution.currentValue == "3ParameterLognormal"

DoubleField
{
name: "historicalLogStdDevValue"
id: historicalLogStdDevValue
negativeValues: true
defaultValue: 1
decimals: 9
}
}

CheckBox
{
name: "historicalThreshold"
label: qsTr("Historical threshold")
id: historicalThreshold
childrenOnSameRow: true
visible: nonNormalDistribution.currentValue == "3ParameterLognormal" || nonNormalDistribution.currentValue == "3ParameterWeibull"

DoubleField
{
name: "historicalThresholdValue"
id: historicalThresholdValue
negativeValues: true
defaultValue: 1
decimals: 9
}
}

DropDown
{
name: "nonNormalMethod"
Expand Down
Loading
Loading