Package {FuzzyLogit}


Type: Package
Title: Fuzzy Logistic Regression
Version: 0.1.1
Description: Fits logistic regression models in which the binary response is represented by a triangular fuzzy number rather than an exact crisp label, allowing uncertainty in class membership to be encoded directly in the outcome. Model parameters are estimated using the Fuzzy Least Squares approach of Diamond (1988) <doi:10.1016/0020-0255(88)90047-3>, following the integrated fuzzy logistic regression method of Yapici Pehlivan and Sahin (2018) https://dergipark.org.tr/en/pub/jssa/issue/37877/437725. Provides fitting, prediction, classification, cross-validation, and diagnostic plotting methods, along with tools for comparing model behaviour across different assumed levels of label uncertainty.
License: GPL-3
Encoding: UTF-8
Depends: R (≥ 3.5.0)
Imports: stats, dplyr, tidyr, ggplot2, MASS
Suggests: testthat (≥ 3.0.0)
RoxygenNote: 7.2.3
NeedsCompilation: no
Packaged: 2026-08-26 21:38:22 UTC; LENOVO
Author: Md Faruk Hasan [aut, cre], Azizur Rahman [aut]
Maintainer: Md Faruk Hasan <md_faruk_hasan@sfu.ca>
Repository: CRAN
Date/Publication: 2026-09-09 09:40:14 UTC

FuzzyLogit: Fuzzy Logistic Regression Tools

Description

Provides utilities for fitting fuzzy logistic regression models with customizable membership functions, along with helper methods for prediction, classification, cross-validation, and visualization.

Getting Started

library(FuzzyLogit)
data <- read.csv("path/to/data.csv")
model <- fuzzy_logit(outcome ~ x1 + x2,
                     data = data)
summary(model)

Key Functions

Author(s)

Maintainer: Md Faruk Hasan md_faruk_hasan@sfu.ca

Authors:


Helper function to extract factor levels from model frame

Description

Helper function to extract factor levels from model frame

Usage

.get_xlevels(terms, model)

UCI Breast Cancer Wisconsin Dataset

Description

A dataset containing measurements from fine needle aspirates (FNA) of breast masses, used to classify tumours as benign or malignant. This is a cleaned version of the UCI Breast Cancer Wisconsin dataset with 16 rows containing missing values (in the BareNuclei column) removed.

Usage

data(breast_cancer)

Format

A data frame with 683 rows and 10 columns:

ClumpThickness

Clump thickness, integer 1-10.

UniformCellSize

Uniformity of cell size, integer 1-10.

UniformCellShape

Uniformity of cell shape, integer 1-10.

MarginalAdhesion

Marginal adhesion, integer 1-10.

SingleEpithelialCellSize

Single epithelial cell size, integer 1-10.

BareNuclei

Bare nuclei, integer 1-10.

BlandChromatin

Bland chromatin, integer 1-10.

NormalNucleoli

Normal nucleoli, integer 1-10.

Mitoses

Mitoses, integer 1-10.

Outcome

Binary outcome: 0 = Benign (444 cases), 1 = Malignant (239 cases).

Details

The original dataset contains 699 observations and 11 columns (including a sample ID column). The ID column has been removed, 16 rows with missing values in BareNuclei have been dropped, and the class variable (originally coded 2 = benign, 4 = malignant) has been recoded to Outcome (0 = benign, 1 = malignant).

Source

UCI Machine Learning Repository. https://archive.ics.uci.edu/ml/datasets/Breast+Cancer+Wisconsin+(Original)

Wolberg, W. H. and Mangasarian, O. L. (1990). Multisurface method of pattern separation for medical diagnosis applied to breast cytology. Proceedings of the National Academy of Sciences, 87, 9193-9196.

Examples

data(breast_cancer)
head(breast_cancer)
table(breast_cancer$Outcome)

model <- fuzzy_logit(
  Outcome ~ ClumpThickness + UniformCellSize + BareNuclei,
  data    = breast_cancer,
  n_alpha = 100
)
summary(model)

Extract case names from fuzzy_logit model

Description

This function extracts the row names (case names) from the model frame.

Usage

case.names(object, ...)

Arguments

object

A fuzzy_logit object

...

Additional arguments

Value

Character vector of case names


Classify Observations Using a Fuzzy Logistic Regression Model

Description

Classifies observations as belonging to class 0 or class 1 using a fitted fuzzy_logit model, builds a confusion matrix against the observed outcomes, and computes a set of performance metrics. classify is a generic function; classify.fuzzy_logit is the method used for objects of class "fuzzy_logit".

Usage

classify(object, ...)

## S3 method for class 'fuzzy_logit'
classify(
  object,
  newdata = NULL,
  threshold = 0.5,
  type = c("crisp", "fuzzy"),
  metrics = c("accuracy", "sensitivity", "specificity", "precision", "recall", "f1",
    "auc", "kappa"),
  plot = FALSE,
  ...
)

## S3 method for class 'classify.fuzzy_logit'
print(x, digits = 4, ...)

## S3 method for class 'classify.fuzzy_logit'
summary(object, ...)

Arguments

object

An object of class "fuzzy_logit" (for classify), or an object of class "classify.fuzzy_logit" (for summary).

...

Further arguments passed to or from other methods.

newdata

An optional data frame of new observations to classify, which must also contain the true outcome column so a confusion matrix can be built. If NULL (the default), the training data used to fit object is classified.

threshold

Numeric value in (0, 1) used as the probability cutoff for assigning class 1. An observation is classified as 1 if its predicted probability is greater than or equal to threshold. Lowering the threshold increases sensitivity (more positives detected) at the cost of specificity. Default is 0.5.

type

Character string. "crisp" (the default) assigns each observation a hard label of 0 or 1. "fuzzy" returns the raw predicted probabilities without thresholding.

metrics

Character vector specifying which performance metrics to compute. Available options are "accuracy", "sensitivity" (true positive rate), "specificity" (true negative rate), "precision", "recall" (identical to sensitivity), "f1", "auc" (area under the ROC curve), and "kappa" (Cohen's kappa). By default all are computed.

plot

Logical. If TRUE, a plot of the classification results is displayed in addition to the numeric output. Default is FALSE.

x

An object of class "classify.fuzzy_logit", for the print method.

digits

Integer. Number of decimal places to display. Default is 4.

Value

An object of class "classify.fuzzy_logit", a list containing predictions (a data frame of predicted probabilities/classes and, if available, observed values), confusion_matrix, metrics (a named numeric vector of the requested performance metrics), threshold, type, and the fitted model.

No return value, called for its side effect of printing the classification results, confusion matrix, and performance metrics to the console. Invisibly returns x.

No return value, called for its side effect of printing detailed classification statistics (TP, TN, FP, FN counts) to the console. Invisibly returns object.

See Also

fuzzy_logit, predict.fuzzy_logit, cv.fuzzy_logit

Examples

data(breast_cancer)
model <- fuzzy_logit(Outcome ~ ClumpThickness + UniformCellSize + BareNuclei,
                     data = breast_cancer, n_alpha = 100)

## Classify at the default threshold
cls <- classify(model, threshold = 0.5, type = "crisp")
print(cls)
summary(cls)

## Lower the threshold to increase sensitivity
cls2 <- classify(model, threshold = 0.3)
cls2$metrics["sensitivity"]


Extract coefficients from fuzzy_logit model

Description

Extract coefficients from fuzzy_logit model

Usage

## S3 method for class 'fuzzy_logit'
coef(object, type = c("a", "s", "both"), ...)

Arguments

object

A fuzzy_logit object

type

Type of coefficient to extract

...

Additional arguments

Value

If type = "a" or type = "s", a named numeric vector of coefficients. If type = "both", a list with two named numeric vectors, a (centre coefficients) and s (spread parameters).


Extract coefficients from fuzzy_logit model (alias)

Description

This function extracts the central tendency coefficients from a fuzzy_logit model.

Usage

## S3 method for class 'fuzzy_logit'
coefficients(object, ...)

Arguments

object

A fuzzy_logit object

...

Additional arguments

Value

Named numeric vector of centre coefficients.


Compare Multiple Cross-Validation Results

Description

Takes a named list of cv.fuzzy_logit results and displays their performance metrics side by side in a single comparison table. Useful for comparing how different fuzzy membership settings, or different model specifications, affect generalisation performance.

Usage

compare_cv_results(cv_list)

Arguments

cv_list

A named list containing at least two objects of class "cv.fuzzy_logit", each produced by cv.fuzzy_logit. The names given to the list elements are used as row labels in the comparison table.

Value

A data frame of class comparing performance metrics across models, with one row per model/setting and one column per metric. Also printed to the console.

Examples

data(breast_cancer)

cv_low <- cv.fuzzy_logit(
  formula = Outcome ~ ClumpThickness + UniformCellSize + BareNuclei,
  data    = breast_cancer, K = 5,
  mu_0 = c(0.01, 0.03, 0.05), mu_1 = c(0.95, 0.97, 0.99),
  n_alpha = 100, seed = 42, verbose = FALSE
)

cv_high <- cv.fuzzy_logit(
  formula = Outcome ~ ClumpThickness + UniformCellSize + BareNuclei,
  data    = breast_cancer, K = 5,
  mu_0 = c(0.10, 0.20, 0.30), mu_1 = c(0.70, 0.80, 0.90),
  n_alpha = 100, seed = 42, verbose = FALSE
)

compare_cv_results(list("Low fuzziness" = cv_low, "High fuzziness" = cv_high))


Compare Multiple Fuzzy Logit Models with Different Mu Values

Description

Fits multiple fuzzy logistic regression models with different membership function specifications and compares their results.

Usage

compare_fuzzy_models(formula, data, mu_list = NULL, verbose = TRUE, ...)

Arguments

formula

A formula object specifying the model

data

A data frame containing the variables

mu_list

A named list of mu specifications, where each element is a list containing mu_0 and mu_1. If NULL, uses default comparisons.

verbose

Logical. If TRUE (the default), a message is printed for each model as it is fitted.

...

Additional arguments passed to fuzzy_logit

Value

A list of class "fuzzy_logit_comparison" containing:

models

List of fitted fuzzy_logit models

comparison_table

Data frame comparing coefficients across models

spread_table

Data frame comparing spread parameters across models

fit_statistics

Data frame with AIC, BIC, and other fit statistics

Examples


data(breast_cancer)

# Compare three levels of uncertainty
comparison <- compare_fuzzy_models(
  Outcome ~ ClumpThickness + UniformCellSize + BareNuclei,
  data = breast_cancer,
  mu_list = list(
    low = list(mu_0 = c(0.01, 0.03, 0.05), mu_1 = c(0.95, 0.97, 0.99)),
    medium = list(mu_0 = c(0.05, 0.10, 0.15), mu_1 = c(0.85, 0.90, 0.95)),
    high = list(mu_0 = c(0.10, 0.20, 0.30), mu_1 = c(0.70, 0.80, 0.90))
  ),
  n_alpha = 100
)

print(comparison)



Confidence intervals for fuzzy_logit model parameters

Description

Confidence intervals for fuzzy_logit model parameters

Usage

## S3 method for class 'fuzzy_logit'
confint(object, parm = NULL, level = 0.95, ...)

Arguments

object

A fuzzy_logit object

parm

Parameters to include (default: all)

level

Confidence level (default: 0.95)

...

Additional arguments

Value

A matrix with columns giving the lower and upper confidence limits for each requested parameter, computed as the centre coefficient plus/minus a t-based margin using the spread parameter as an approximate standard error.


Cross-Validation for Fuzzy Logistic Regression

Description

Cross-Validation for Fuzzy Logistic Regression

Usage

cv.fuzzy_logit(
  formula,
  data,
  K = 10,
  mu_0 = c(0.01, 0.03, 0.05),
  mu_1 = c(0.95, 0.97, 0.99),
  n_alpha = NULL,
  stratified = TRUE,
  seed = NULL,
  metrics = c("accuracy", "sensitivity", "specificity", "precision", "f1", "auc"),
  threshold = 0.5,
  verbose = TRUE,
  ...
)

Arguments

formula

A formula object

data

A data frame

K

Number of folds

mu_0

Fuzzy membership for class 0

mu_1

Fuzzy membership for class 1

n_alpha

Number of alpha-cuts

stratified

Whether to use stratified sampling

seed

Random seed

metrics

Metrics to compute

threshold

Classification threshold

verbose

Whether to print progress

...

Additional arguments

Value

An object of class "cv.fuzzy_logit", a list containing: metrics (a data frame of performance metrics per fold), mean_metrics and sd_metrics (named numeric vectors of metrics averaged and their standard deviation across folds), predictions (a data frame of out-of-fold predictions), confusion_matrix (the overall confusion matrix pooled across folds), and the fold assignments, formula, and settings used.


Deviance for fuzzy_logit model

Description

Deviance for fuzzy_logit model

Usage

## S3 method for class 'fuzzy_logit'
deviance(object, ...)

Arguments

object

A fuzzy_logit object

...

Additional arguments

Value

A single numeric value: the sum of squared deviance residuals.


Extract residual degrees of freedom

Description

Extract residual degrees of freedom

Usage

## S3 method for class 'fuzzy_logit'
df.residual(object, ...)

Arguments

object

A fuzzy_logit object

...

Additional arguments

Value

A single integer: the number of observations minus the number of estimated coefficients (including the intercept).


Extract fitted values from fuzzy_logit model

Description

Extract fitted values from fuzzy_logit model

Usage

## S3 method for class 'fuzzy_logit'
fitted(object, type = c("link", "response"), ...)

Arguments

object

A fuzzy_logit object

type

Type of fitted values

...

Additional arguments

Value

A numeric vector of fitted values, one per observation used in fitting the model. On the "link" scale these are log-odds; on the "response" scale these are probabilities in [0, 1].


Extract formula from fuzzy_logit model

Description

Extract formula from fuzzy_logit model

Usage

## S3 method for class 'fuzzy_logit'
formula(x, ...)

Arguments

x

A fuzzy_logit object

...

Additional arguments

Value

An object of class "formula": the model formula used to fit the object.


Fuzzy Logistic Regression with Customizable Membership Functions

Description

Fits a fuzzy logistic regression model using triangular fuzzy numbers for the response variable. Users can customize the fuzzy membership values to control the degree of fuzziness in the model.

Usage

fuzzy_logit(
  formula,
  data,
  mu_0 = c(0.01, 0.03, 0.05),
  mu_1 = c(0.95, 0.97, 0.99),
  n_alpha = NULL,
  na.action = na.omit,
  subset = NULL,
  contrasts = NULL,
  ...
)

Arguments

formula

A formula object specifying the model, e.g., y ~ x1 + x2 + ... Can include transformations, interactions, and factor variables.

data

A data frame containing the variables in the model

mu_0

A numeric vector of length 3 specifying the triangular fuzzy number for the negative class (y = 0) as c(left, mode, right). Default is c(0.01, 0.03, 0.05) representing low uncertainty. **Users can modify these values to change the fuzziness level.**

mu_1

A numeric vector of length 3 specifying the triangular fuzzy number for the positive class (y = 1) as c(left, mode, right). Default is c(0.95, 0.97, 0.99) representing low uncertainty. **Users can modify these values to change the fuzziness level.**

n_alpha

Integer specifying the number of alpha-cut levels for numerical integration. Higher values give more accurate integration but slower computation. Default is the number of rows in the data (can be computationally expensive for large datasets).

na.action

A function which indicates what should happen when the data contain NAs. Default is na.omit.

subset

An optional vector specifying a subset of observations to be used

contrasts

An optional list for factor contrasts

...

Additional arguments (currently unused)

Details

The fuzzy membership values control the degree of uncertainty in class assignment. Narrower triangles (e.g., mu_0 = c(0.01, 0.03, 0.05)) represent low fuzziness, closer to crisp logistic regression. Wider triangles (e.g., mu_0 = c(0.10, 0.25, 0.40)) represent high fuzziness and more uncertainty in classification.

Value

An object of class "fuzzy_logit" containing model results

Examples

data(breast_cancer)

# Basic usage with default fuzzy membership
model1 <- fuzzy_logit(Outcome ~ ClumpThickness + UniformCellSize + BareNuclei,
                      data = breast_cancer, n_alpha = 100)
summary(model1)

# Custom fuzzy membership (moderate uncertainty)
model2 <- fuzzy_logit(
  Outcome ~ ClumpThickness + UniformCellSize + BareNuclei,
  data = breast_cancer,
  mu_0 = c(0.05, 0.10, 0.15),
  mu_1 = c(0.85, 0.90, 0.95),
  n_alpha = 100
)


Check if object is a fuzzy_logit model

Description

Check if object is a fuzzy_logit model

Usage

is.fuzzy_logit(x)

Arguments

x

An object to check

Value

Logical value indicating if object is of class fuzzy_logit


Log-likelihood for fuzzy_logit model

Description

Computes an approximate log-likelihood assuming normal errors. Note: This is an approximation as fuzzy regression does not have a standard likelihood function.

Usage

## S3 method for class 'fuzzy_logit'
logLik(object, ...)

Arguments

object

A fuzzy_logit object

...

Additional arguments

Value

An object of class "logLik" with the approximate log-likelihood value and attributes "df" (number of estimated parameters) and "nobs" (number of observations).


Extract model frame from fuzzy_logit model

Description

Extract model frame from fuzzy_logit model

Usage

## S3 method for class 'fuzzy_logit'
model.frame(formula, ...)

Arguments

formula

A fuzzy_logit object

...

Additional arguments

Value

A data frame containing the response and predictor variables used in fitting the model (i.e. the original data after applying na.action and any subset).


Extract model matrix from fuzzy_logit model

Description

Extract model matrix from fuzzy_logit model

Usage

## S3 method for class 'fuzzy_logit'
model.matrix(object, ...)

Arguments

object

A fuzzy_logit object

...

Additional arguments

Value

A numeric matrix: the design matrix used in estimation, with one row per observation and one column per model parameter (including the intercept).


Extract number of observations from fuzzy_logit model

Description

Extract number of observations from fuzzy_logit model

Usage

## S3 method for class 'fuzzy_logit'
nobs(object, ...)

Arguments

object

A fuzzy_logit object

...

Additional arguments

Value

A single integer: the number of observations used in fitting the model (after any rows with missing values have been removed).


Plot diagnostic plots for fuzzy_logit model

Description

Produces up to four diagnostic plots for a fitted fuzzy_logit model. Plots can be shown all at once or individually using the which argument or the dedicated single-plot functions.

Usage

## S3 method for class 'fuzzy_logit'
plot(x, which = 1:4, ...)

Arguments

x

A fuzzy_logit object

which

Integer vector specifying which plots to produce. 1 = Pearson Residuals vs Fitted, 2 = Binned Residual Plot, 3 = Scale-Location, 4 = Residuals vs Leverage. Default is 1:4 (all plots).

...

Additional arguments (currently unused)

Details

Diagnostic plots are adapted from classical logistic regression for convenience. They are approximate tools for model checking and are not theoretically derived from the fuzzy least squares estimation framework.

Value

Invisibly returns a named list of ggplot objects: pearson, binned, scale_location, leverage. Use p <- plot(model) then p$pearson to access individually.

Examples


  data(breast_cancer)
  model <- fuzzy_logit(Outcome ~ ClumpThickness + BareNuclei,
                       data = breast_cancer, n_alpha = 100)

  # All four plots
  plot(model)

  # Individual plots using which
  plot(model, which = 1)
  plot(model, which = 2)
  plot(model, which = 3)
  plot(model, which = 4)

  # Individual plots using named functions
  plot_pearson_residuals(model)
  plot_binned_residuals(model)
  plot_scale_location(model)
  plot_leverage(model)

  # Save a single plot to a temporary file
  p <- plot(model)
  ggplot2::ggsave(file.path(tempdir(), "pearson.png"), p$pearson,
                   width = 7, height = 5)



Plot Binned Residuals for a Fuzzy Logistic Regression Model

Description

Groups observations into bins by fitted probability and plots the average residual within each bin, together with an approximate 95% confidence band. Equivalent to plot(model, which = 2), provided as a standalone named function for convenience.

Usage

plot_binned_residuals(model)

Arguments

model

A fuzzy_logit object

Details

This plot is often the most informative of the four diagnostic plots. Bin averages that stay within the grey confidence band indicate the model is reasonably well calibrated. Bins outside the band point to specific probability ranges where the model is systematically over- or under-predicting.

Value

A ggplot object, printed as a side effect and returned invisibly.

See Also

plot.fuzzy_logit, plot_pearson_residuals, plot_scale_location, plot_leverage

Examples

data(breast_cancer)
model <- fuzzy_logit(Outcome ~ ClumpThickness + UniformCellSize + BareNuclei,
                     data = breast_cancer, n_alpha = 100)
plot_binned_residuals(model)


Visualize Fuzzy Membership Functions

Description

Creates a visualization of the triangular fuzzy membership functions for both classes to help users understand the effect of mu parameters.

Usage

plot_fuzzy_membership(
  mu_0 = c(0.01, 0.03, 0.05),
  mu_1 = c(0.95, 0.97, 0.99),
  main = "Fuzzy Membership Functions"
)

Arguments

mu_0

Triangular fuzzy number for class 0: c(left, mode, right)

mu_1

Triangular fuzzy number for class 1: c(left, mode, right)

main

Title for the plot

Value

A ggplot object showing the fuzzy membership functions

Examples

# Default membership functions
plot_fuzzy_membership()

# Custom membership functions with more uncertainty
plot_fuzzy_membership(
  mu_0 = c(0.05, 0.15, 0.25),
  mu_1 = c(0.75, 0.85, 0.95)
)


Residuals vs. Leverage Plot for a Fuzzy Logistic Regression Model

Description

Plots deviance residuals against leverage (the diagonal of the hat matrix), highlighting influential observations whose Cook's distance exceeds 4/n. Equivalent to plot(model, which = 4), provided as a standalone named function for convenience.

Usage

plot_leverage(model)

Arguments

model

A fuzzy_logit object

Details

Observations highlighted in red have a Cook's distance greater than 4/n, a common rule-of-thumb threshold for flagging influential points. High leverage combined with a large residual indicates an observation that may be disproportionately affecting the fitted coefficients and is worth inspecting individually.

Value

A ggplot object, printed as a side effect and returned invisibly.

See Also

plot.fuzzy_logit, plot_pearson_residuals, plot_binned_residuals, plot_scale_location

Examples

data(breast_cancer)
model <- fuzzy_logit(Outcome ~ ClumpThickness + UniformCellSize + BareNuclei,
                     data = breast_cancer, n_alpha = 100)
plot_leverage(model)


Plot Pearson Residuals vs. Fitted Probabilities

Description

Produces a single diagnostic plot of Pearson residuals against fitted probabilities for a fitted fuzzy_logit object. Equivalent to plot(model, which = 1), provided as a standalone named function for convenience.

Usage

plot_pearson_residuals(model)

Arguments

model

A fuzzy_logit object

Details

Points should scatter without any strong systematic curve. The gentle arch shape typically seen in this plot is a normal artefact of binary outcomes and is not on its own evidence of poor fit. Look instead for isolated extreme outliers (beyond roughly +/- 4).

Value

A ggplot object, printed as a side effect and returned invisibly.

See Also

plot.fuzzy_logit, plot_binned_residuals, plot_scale_location, plot_leverage

Examples

data(breast_cancer)
model <- fuzzy_logit(Outcome ~ ClumpThickness + UniformCellSize + BareNuclei,
                     data = breast_cancer, n_alpha = 100)
plot_pearson_residuals(model)


Scale-Location Plot for a Fuzzy Logistic Regression Model

Description

Plots the absolute value of the Pearson residuals against fitted probabilities, used to check for non-constant residual variance (heteroscedasticity). Equivalent to plot(model, which = 3), provided as a standalone named function for convenience.

Usage

plot_scale_location(model)

Arguments

model

A fuzzy_logit object

Details

For binary outcomes, the variance of the Pearson residual is approximately p(1-p), which is maximised at p = 0.5. This produces an inverted-U shape in the smooth trend line, which is expected and not a sign of model misspecification.

Value

A ggplot object, printed as a side effect and returned invisibly.

See Also

plot.fuzzy_logit, plot_pearson_residuals, plot_binned_residuals, plot_leverage

Examples

data(breast_cancer)
model <- fuzzy_logit(Outcome ~ ClumpThickness + UniformCellSize + BareNuclei,
                     data = breast_cancer, n_alpha = 100)
plot_scale_location(model)


Predict method for fuzzy_logit models

Description

Predict method for fuzzy_logit models

Usage

## S3 method for class 'fuzzy_logit'
predict(
  object,
  newdata = NULL,
  type = c("link", "response"),
  se.fit = FALSE,
  ...
)

Arguments

object

A fitted fuzzy_logit object

newdata

Optional data frame for predictions

type

Type of prediction

se.fit

Whether to return standard errors

...

Additional arguments

Value

If se.fit = FALSE, a numeric vector of predictions. If se.fit = TRUE, a list with components fit (numeric vector of predicted values) and se.fit (numeric vector of corresponding approximate standard errors).


Print Cross-Validation Results

Description

Print Cross-Validation Results

Usage

## S3 method for class 'cv.fuzzy_logit'
print(x, digits = 4, ...)

Arguments

x

An object of class "cv.fuzzy_logit".

digits

Integer. Number of decimal places to display. Default is 4.

...

Further arguments passed to or from other methods (currently unused).

Value

No return value, called for its side effect of printing the mean (+/- SD) performance metrics and pooled confusion matrix to the console. Invisibly returns x.


Print method for fuzzy_logit objects

Description

Print method for fuzzy_logit objects

Usage

## S3 method for class 'fuzzy_logit'
print(x, digits = 4, ...)

Arguments

x

A fuzzy_logit object

digits

Number of digits to display

...

Additional arguments

Value

No return value, called for its side effect of printing the model call, coefficients, and degrees of freedom to the console. Invisibly returns x.


Print method for fuzzy_logit_comparison

Description

Print method for fuzzy_logit_comparison

Usage

## S3 method for class 'fuzzy_logit_comparison'
print(x, digits = 4, ...)

Arguments

x

A fuzzy_logit_comparison object

digits

Number of digits to display

...

Additional arguments

Value

No return value, called for its side effect of printing the fit statistics and pivoted coefficient/spread comparison tables to the console. Invisibly returns x.


Print method for summary.fuzzy_logit objects

Description

Print method for summary.fuzzy_logit objects

Usage

## S3 method for class 'summary.fuzzy_logit'
print(x, digits = 4, signif.stars = TRUE, ...)

Arguments

x

A summary.fuzzy_logit object

digits

Number of digits to display

signif.stars

Logical, whether to show significance stars

...

Additional arguments

Value

No return value, called for its side effect of printing the formatted model summary to the console. Invisibly returns x.


Extract residuals from fuzzy_logit model

Description

Extract residuals from fuzzy_logit model

Usage

## S3 method for class 'fuzzy_logit'
residuals(object, type = c("response", "deviance", "pearson"), ...)

Arguments

object

A fuzzy_logit object

type

Type of residuals

...

Additional arguments

Value

A numeric vector of residuals, one per observation used in fitting the model. The scale depends on type: "response" residuals are on the log-odds scale, "pearson" residuals are standardised, and "deviance" residuals are signed square roots of each observation's deviance contribution.


Summarise Cross-Validation Results

Description

Summarise Cross-Validation Results

Usage

## S3 method for class 'cv.fuzzy_logit'
summary(object, ...)

Arguments

object

An object of class "cv.fuzzy_logit".

...

Further arguments passed to or from other methods (currently unused).

Value

No return value, called for its side effect of printing the overall results plus per-fold performance metrics to the console. Invisibly returns object.


Summary method for fuzzy_logit objects

Description

Summary method for fuzzy_logit objects

Usage

## S3 method for class 'fuzzy_logit'
summary(object, digits = 4, ...)

Arguments

object

A fuzzy_logit object

digits

Number of digits to display

...

Additional arguments

Value

An object of class "summary.fuzzy_logit", a list containing the model call, a coefficient table (coefficients) with centre estimate, spread, approximate SE, t-value, p-value, and significance code for each variable, the residual standard error, degrees of freedom, number of observations, and the fuzzy membership parameters used to fit the model.


Extract terms from fuzzy_logit model

Description

Extract terms from fuzzy_logit model

Usage

## S3 method for class 'fuzzy_logit'
terms(x, ...)

Arguments

x

A fuzzy_logit object

...

Additional arguments

Value

An object of class "terms" describing the structure of the fitted model.


Update fuzzy_logit model

Description

Update fuzzy_logit model

Usage

## S3 method for class 'fuzzy_logit'
update(object, formula., ..., evaluate = TRUE)

Arguments

object

A fuzzy_logit object

formula.

New formula (optional)

...

Additional arguments to pass to fuzzy_logit

evaluate

Logical, whether to evaluate the call

Value

If evaluate = TRUE, a new object of class "fuzzy_logit" fitted with the updated formula and/or arguments. If evaluate = FALSE, the unevaluated updated call.


Extract variable names from fuzzy_logit model

Description

Extract variable names from fuzzy_logit model

Usage

## S3 method for class 'fuzzy_logit'
variable.names(object, ...)

Arguments

object

A fuzzy_logit object

...

Additional arguments

Value

A character vector of variable names, including the intercept.


Variance-covariance matrix for fuzzy_logit model

Description

Computes an approximate variance-covariance matrix using the spread parameters. Note: This is an approximation for fuzzy regression models.

Usage

## S3 method for class 'fuzzy_logit'
vcov(object, ...)

Arguments

object

A fuzzy_logit object

...

Additional arguments

Value

A square numeric matrix with row and column names matching the model's variable names (including the intercept).