% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/vis_numeric.R
\name{vis_numeric}
\alias{vis_numeric}
\title{Visualize Numeric Relationships: Regression or Correlation Analysis}
\usage{
vis_numeric(
  y,
  x,
  correlation = FALSE,
  conf.level = 0.95,
  name_of_factor = character(),
  name_of_sample = character()
)
}
\arguments{
\item{y}{Numeric vector. The response variable (dependent variable) for regression analysis, 
or the y-axis variable for correlation analysis.}

\item{x}{Numeric vector. The predictor variable (independent variable) for regression analysis,
or the x-axis variable for correlation analysis. Must have the same length as y.}

\item{correlation}{Logical. If FALSE (default), performs regression analysis with
confidence and prediction bands. If TRUE, performs Spearman rank correlation analysis.}

\item{conf.level}{Numeric. Confidence level for statistical tests and intervals. 
Must be between 0 and 1. Default is 0.95 (95 percent confidence level).}

\item{name_of_factor}{Character string. Label for the x-axis (independent variable). 
If empty, defaults to the variable name.}

\item{name_of_sample}{Character string. Label for the y-axis (dependent variable). 
If empty, defaults to the variable name.}
}
\value{
A list containing analysis results and assumption checks. Content depends on analysis type.
  For regression analysis: analysis_type, summary_regression, assumptions, warnings, r_squared, adj_r_squared.
  For correlation analysis: analysis_type, correlation_test, correlation_coefficient, assumptions,
  warnings, method_used.
}
\description{
This function provides unified visualization for numeric relationships between two continuous variables.
It can perform either regression analysis (with confidence and prediction bands) or
Spearman rank correlation analysis with appropriate visualizations and statistical output.
For regression, statistical assumptions are checked and warnings are issued if violated, but analysis proceeds.
}
\details{
Statistical Assumptions Checked:
Regression: Normality of residuals (Shapiro-Wilk test) and
homoscedasticity (Breusch-Pagan test). All regression analyses proceed even if
assumptions are violated, but appropriate warnings are issued.
Correlation: Spearman rank correlation requires no distributional assumptions.
}
\examples{
\dontrun{
# Generate sample data
set.seed(123)
x <- rnorm(50, mean = 10, sd = 2)
y <- 2 * x + rnorm(50, mean = 0, sd = 1)

# Regression analysis (default)
result1 <- vis_numeric(y, x, 
                      name_of_factor = "Predictor", 
                      name_of_sample = "Response")

# Spearman rank correlation
result2 <- vis_numeric(y, x, correlation = TRUE)
}

}
\seealso{
\code{\link{cor.test}}, \code{\link{lm}}, \code{\link{shapiro.test}}
}
\author{
Sabine Schilling
}
