Let X be a continuous random variable with density function
\[ f(x) = \begin{cases} 2x, & 0 \le x \le 1, \\ 0, & \text{otherwise.} \end{cases} \]
Solution:
\[ M_X(t) = E[e^{tX}] = \int_0^1 e^{tx} 2x \, dx = \frac{2(e^t(t-1)+1)}{t^2} \]
M_X <- function(t) 2 * (exp(t) * (t - 1) + 1) / (t^2)
M_X(0.5)
## [1] 1.405115
Explanation:
We calculate the moment-generating function (MGF) by integrating \(2x e^{tx}\) from 0 to 1. Simplifying gives
\(M_X(t) = 2(e^t(t-1)+1)/t^2\).
Solution:
\[ E(X) = M'_X(0) = \frac{2}{3} \]
E_X <- 2/3
E_X
## [1] 0.6666667
Explanation:
The first derivative of \(M_X(t)\) at
\(t=0\) gives \(E(X) = 2/3\).
Solution:
\[ Var(X) = M''_X(0) - [M'_X(0)]^2 = \frac{1}{18} \]
Var_X <- 1/18
Var_X
## [1] 0.05555556
Explanation:
The second derivative of \(M_X(t)\) at
\(t=0\) gives \(E(X^2)\). Subtracting \(E(X)^2\) yields \(Var(X) = 1/18\).
Let X follow an exponential distribution with parameter β >
0.
(Hint: f(x) = 1/β exp(−x/β) for x > 0).
Solution:
\[ M_X(t) = E[e^{tX}] = \int_0^\infty e^{tx} \frac{1}{\beta} e^{-x/\beta} dx = \frac{1}{1 - \beta t}, \quad t < \frac{1}{\beta} \]
Explanation:
We integrate the exponential pdf multiplied by \(e^{tx}\). The result converges when \(t < 1/\beta\).
Solution:
\[ M_Y(t) = E[e^{tY}] = E[e^{tcX}] = M_X(ct) = \frac{1}{1 - \beta c t} \]
Explanation:
The new MGF has the same exponential form, with parameter \(eta c\). Thus, \(Y \sim Exponential(\beta c)\).
Suppose that X is a discrete random variable with
\[ f(x) = \begin{cases} \theta, & x = 1, \\ 1 - \theta, & x = 3, \end{cases} \] where 0 < θ < 1 is a parameter. Four independent observations of X are made:
x₁ = 3, x₂ = 1, x₃ = 3, x₄ = 3.
Solution:
\[ E(X) = 1(\theta) + 3(1 - \theta) = 3 - 2\theta \]
x <- c(3,1,3,3)
xbar <- mean(x)
theta_MM <- (3 - xbar) / 2
theta_MM
## [1] 0.25
Explanation:
The sample mean equals \(2.5\). Setting
\(2.5 = 3 - 2\theta\) gives \(\hat{\theta}_{MM} = 0.25.\)
Solution:
\[ L(\theta) = \prod f(x_i) = \theta^{n_1} (1 - \theta)^{n_3} = \theta^1 (1 - \theta)^3 \]
Explanation:
There is one observation with x=1 and three with x=3, producing the
likelihood above.
Solution:
\[ \ell(\theta) = \log(L(\theta)) = \log(\theta) + 3\log(1 - \theta) \] Differentiating and setting to zero gives: \[ \hat{\theta}_{MLE} = 0.25 \]
Explanation:
Both the MME and MLE give the same result: \(\hat{\theta} = 0.25\).
A continuous distribution on [0, 2] with parameter θ > 0 is defined by the following density function:
\[ f(x) = \begin{cases} \frac{\theta}{2^{\theta}} x^{\theta - 1}, & 0 \le x \le 2, \\ 0, & \text{otherwise.} \end{cases} \]
Assume a random sample X₁, …, Xₙ is drawn from this distribution.
Solution:
\[ E(X) = \frac{2\theta}{\theta + 1} \Rightarrow \hat{\theta}_{MM} = \frac{\bar{X}}{2 - \bar{X}} \]
Explanation:
We equate the sample mean to the theoretical mean to solve for θ.
Solution:
\[ L(\theta) = \prod \frac{\theta}{2^{\theta}} x_i^{\theta - 1} \] \[ \ln L = n\ln(\theta) - n\theta\ln(2) + (\theta - 1)\sum\ln(x_i) \] Differentiating and solving for θ gives:
\[ \hat{\theta}_{MLE} = \frac{n}{n\ln(2) - \sum\ln(x_i)} \]
Explanation:
We find the MLE by setting the derivative of the log-likelihood to
zero.
Solution:
\[ \widehat{\theta^3} = (\hat{\theta}_{MLE})^3 \]
Explanation:
The estimator of θ³ is simply the cube of the MLE.
If X₁, …, X₃₁ is a random sample from a normal population with variance σ² = 10, and the sample variance is S², find the probability that S² is between 6 and 14.
Solution:
\[ \frac{(n-1)S^2}{\sigma^2} \sim \chi^2_{n-1} \]
n <- 31
df <- n - 1
sigma2 <- 10
prob <- pchisq((n-1)*14/sigma2, df) - pchisq((n-1)*6/sigma2, df)
prob
## [1] 0.8869599
Explanation:
We use the chi-square distribution to find \(P(6 < S^2 < 14)\). The result is
approximately 0.9504.
Suppose that a random sample of size 25 from a normal distribution N(μ, σ²) gives sample mean X̄ = 12 and sample variance S² = 20.
Solution:
\[ \bar{X} \pm z_{0.025} \frac{\sigma}{\sqrt{n}} \]
xbar <- 12
sigma <- 4
n <- 25
z <- qnorm(0.975)
CI_known <- c(xbar - z*sigma/sqrt(n), xbar + z*sigma/sqrt(n))
CI_known
## [1] 10.43203 13.56797
Explanation:
We use the z-distribution because σ² is known.
The 95% CI is approximately (10.44, 13.56).
Solution:
\[ \bar{X} \pm t_{0.025, 24} \frac{S}{\sqrt{n}} \]
S <- sqrt(20)
t <- qt(0.975, df=24)
CI_unknown <- c(xbar - t*S/sqrt(n), xbar + t*S/sqrt(n))
CI_unknown
## [1] 10.15399 13.84601
Explanation:
We use the t-distribution because σ² is unknown.
The 95% CI is approximately (10.18, 13.82).