2024-03-22

Point Estimation

  • Definition: Point Estimation is the method used to estimate an unknown variable of a population based on sample data. The result is a single, best estimate for the variable of interest. Point Estimation covers a broad range of methods, one example is ‘Sample Variance’.

  • Purpose: The purpose of point estimation is to serve as a practical means of making inferences. Getting the mean of the sample data gives us an idea of the average value in the dataset.

  • Application Field: Point estimation applies to all fields where data exists. biology, engineering, statistics, etc.

Sample Variance Math

The sample variance \(s^2\) is calculated using the following formula:

\[s^2 = \frac{\sum_{i=1}^{n} (x_i - \bar{x})^2}{n-1}\]

Where:

  • \(s^2\) is the sample variance,

  • \(x_i\) represents individual data points in the sample,

  • \(\bar{x}\) is the sample mean, and

  • \(n\) is the sample size.

Code for Sample Variance

Using height data, this is how sample variance is calculated below:

# Extract heights
heights <- HeightWeight$Height.Inches.

n <- length(heights) # Number of observations
mean_heights <- mean(heights) # Mean of heights
sum_sq_dev <- sum((heights - mean_heights)^2)# Sum of squared deviations
sampleVar <- sum_sq_dev / (n - 1) # Sample variance

#From this, we can use variance to determine
#the Standard Deviation for visualizations
std_Dev = sqrt(sampleVar)

Sample Variance Visualization

Sample Variance itself isn’t nornmally visualized, but helps in the creation of a Standard Deviation which normally is and is done above.

Interval Estimation

  • Similar to Point Estimation, Interval Estimation uses sample data to calculate for an unknown variable. However, unlike Point Estimation, Interval Estimation generates an interval of values instead of an individual point.

  • Purpose: The purpose of interval estimation, like Point Estimation, is to serve as a practical means of making inferences, but expand it from a single point to a general range where majority of the data lies.

  • Application Field: Interval estimation applies to all fields where data exists. biology, engineering, statistics, etc. However, it excels most in fields where data does not follow a simple patten, this an interval range is better suited.

Population Confidence Interval Math

The Population Confidence Interval \(\mu\) is calculated using the following formula:

\[ \mu = \bar{x} \pm z \left( \frac{\sigma}{\sqrt{n}} \right) \] Where:

  • \(\bar{x}\) is the sample mean

  • \(z\) is the z-score corresponding to the desired confidence level (e.g., 1.96 for a 95% confidence level)

  • \(\sigma\) is the population standard deviation

  • \(n\) is the sample size.

Code for Confidence Interval

Using the weights data from the Height-Weight data we imported, an Confidence Interval can be calculated like so:

# Example data (weights)
weights <- HeightWeight$Weight.Pounds.

# Calculate sample statistics
sample_mean <- mean(weights)
sample_sd <- sd(weights)
n <- length(weights)
confidence_level <- 0.95 # Choose confidence level (e.g., 95%)
critical_value <- qnorm((1 + confidence_level) / 2) # Determine critical value
margin_of_error <- critical_value * (sample_sd / sqrt(n)) # Calculate margin of error

# Construct confidence interval
lower_bound <- sample_mean - margin_of_error
upper_bound <- sample_mean + margin_of_error
cat("Confidence Interval (", confidence_level * 100, "%): +
    [", lower_bound, ", ", upper_bound, "]\n")

Confidance Intrval Visualization

Point & Interval Estimation Using Plotly

**Disclaimer: Only 100th of the dataset is used as using all makes the graph too dense (25,000 -> 250)

Resource