Skip to main content
deleted 88 characters in body
Source Link
prl900
  • 122
  • 1
  • 9

MSE Variance|Bias decomposition

The key for understanding the previous MSE decomposition is to realise that $\theta$ represents a point variable with a fixed value and $\hat{\theta}$ represents a vector containing samples from the estimator (random variable).

As clarification, this formula does not apply to the case where $\theta$ represents a series of values and $\hat{\theta}$ contains element-wise estimations of these points.

A simple numpy example that verifies the previous formula might be useful for understanding this:

import numpy as np

# theta is the target value (point)
theta = 10
# theta_hat contains estimations of theta (vector of 1000 samples)
theta_hat = np.random.normal(theta,0.2,1000)

mse = np.mean(np.square(theta-theta_hat))

var = np.var(theta_hat)
bias = np.mean(theta_hat) - theta

print("MSE result:", mse)
print("Decomposed result:", var + bias*bias)

Which in my case returns 0.042668116306306667042668... in both cases. So, the decomposition stands, at least, up to the 18th decimal place in numpy.

MSE Variance|Bias decomposition

The key for understanding the previous MSE decomposition is to realise that $\theta$ represents a point variable with a fixed value and $\hat{\theta}$ represents a vector containing samples from the estimator (random variable).

As clarification, this formula does not apply to the case where $\theta$ represents a series of values and $\hat{\theta}$ contains element-wise estimations of these points.

A simple numpy example that verifies the previous formula might be useful for understanding this:

import numpy as np

# theta is the target value (point)
theta = 10
# theta_hat contains estimations of theta (vector of 1000 samples)
theta_hat = np.random.normal(theta,0.2,1000)

mse = np.mean(np.square(theta-theta_hat))

var = np.var(theta_hat)
bias = np.mean(theta_hat) - theta

print("MSE result:", mse)
print("Decomposed result:", var + bias*bias)

Which in my case returns 0.042668116306306667 in both cases. So, the decomposition stands, at least, up to the 18th decimal place in numpy.

MSE Variance|Bias decomposition

The key for understanding the previous MSE decomposition is to realise that $\theta$ represents a point variable with a fixed value and $\hat{\theta}$ represents a vector containing samples from the estimator (random variable).

As clarification, this formula does not apply to the case where $\theta$ represents a series of values and $\hat{\theta}$ contains element-wise estimations of these points.

A simple numpy example that verifies the previous formula might be useful for understanding this:

import numpy as np

# theta is the target value (point)
theta = 10
# theta_hat contains estimations of theta (vector of 1000 samples)
theta_hat = np.random.normal(theta,0.2,1000)

mse = np.mean(np.square(theta-theta_hat))

var = np.var(theta_hat)
bias = np.mean(theta_hat) - theta

print("MSE result:", mse)
print("Decomposed result:", var + bias*bias)

Which in my case returns 0.042668... in both cases.

added 44 characters in body
Source Link
prl900
  • 122
  • 1
  • 9

MSE Variance|Bias decomposition

The key for understanding the previous MSE decomposition is to realise that $\theta$ represents a point variable with a fixed value and $\hat{\theta}$ represents a vector containing samples from the estimator (random variable).

As clarification, this formula does not apply to the case where $\theta$ represents a series of values and $\hat{\theta}$ contains element-wise estimations of these points.

A simple numpy example that verifies the previous formula might be useful for understanding this:

import numpy as np

# Θtheta is the target value (point)
Θtheta = 10
# Θ_esttheta_hat contains estimations of Θtheta (vector of 1000 samples)
Θ_esttheta_hat = np.random.normal(Θtheta,0.2,1000)

mse = np.mean(np.square(Θtheta-Θ_hattheta_hat))

biasvar = np.mean(Θ)-np.meanvar(Θ_hattheta_hat)
varbias = np.varmean(Θ_hattheta_hat) - theta

print("MSE result:", mse)
print("Decomposed result:", var + bias*bias)

Which in my case returns 0.042668116306306667 in both cases. So, the decomposition stands, at least, up to the 18th decimal place in numpy.

MSE Variance|Bias decomposition

The key for understanding the previous MSE decomposition is to realise that $\theta$ represents a point variable with a fixed value and $\hat{\theta}$ represents a vector containing samples from the estimator (random variable).

As clarification, this formula does not apply to the case where $\theta$ represents a series of values and $\hat{\theta}$ contains element-wise estimations of these points.

A simple numpy example that verifies the previous formula might be useful for understanding this:

import numpy as np

# Θ is the target value (point)
Θ = 10
# Θ_est contains estimations of Θ (vector of 1000 samples)
Θ_est = np.random.normal(Θ,0.2,1000)

mse = np.mean(np.square(Θ-Θ_hat))

bias = np.mean(Θ)-np.mean(Θ_hat)
var = np.var(Θ_hat)

print("MSE result:", mse)
print("Decomposed result:", var + bias*bias)

Which in my case returns 0.042668116306306667 in both cases. So, the decomposition stands, at least, up to the 18th decimal place in numpy.

MSE Variance|Bias decomposition

The key for understanding the previous MSE decomposition is to realise that $\theta$ represents a point variable with a fixed value and $\hat{\theta}$ represents a vector containing samples from the estimator (random variable).

As clarification, this formula does not apply to the case where $\theta$ represents a series of values and $\hat{\theta}$ contains element-wise estimations of these points.

A simple numpy example that verifies the previous formula might be useful for understanding this:

import numpy as np

# theta is the target value (point)
theta = 10
# theta_hat contains estimations of theta (vector of 1000 samples)
theta_hat = np.random.normal(theta,0.2,1000)

mse = np.mean(np.square(theta-theta_hat))

var = np.var(theta_hat)
bias = np.mean(theta_hat) - theta

print("MSE result:", mse)
print("Decomposed result:", var + bias*bias)

Which in my case returns 0.042668116306306667 in both cases. So, the decomposition stands, at least, up to the 18th decimal place in numpy.

Source Link
prl900
  • 122
  • 1
  • 9

MSE Variance|Bias decomposition

The key for understanding the previous MSE decomposition is to realise that $\theta$ represents a point variable with a fixed value and $\hat{\theta}$ represents a vector containing samples from the estimator (random variable).

As clarification, this formula does not apply to the case where $\theta$ represents a series of values and $\hat{\theta}$ contains element-wise estimations of these points.

A simple numpy example that verifies the previous formula might be useful for understanding this:

import numpy as np

# Θ is the target value (point)
Θ = 10
# Θ_est contains estimations of Θ (vector of 1000 samples)
Θ_est = np.random.normal(Θ,0.2,1000)

mse = np.mean(np.square(Θ-Θ_hat))

bias = np.mean(Θ)-np.mean(Θ_hat)
var = np.var(Θ_hat)

print("MSE result:", mse)
print("Decomposed result:", var + bias*bias)

Which in my case returns 0.042668116306306667 in both cases. So, the decomposition stands, at least, up to the 18th decimal place in numpy.