auto-update(nvim): 2025-03-02 23:45:29
This commit is contained in:
parent
34b9104855
commit
6355a6467f
2 changed files with 127 additions and 0 deletions
90
documents/by-course/pstat-120a/hw6/main.typ
Normal file
90
documents/by-course/pstat-120a/hw6/main.typ
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
#import "@youwen/zen:0.1.0": *
|
||||||
|
#import "@preview/cetz:0.3.2"
|
||||||
|
|
||||||
|
#show: zen.with(
|
||||||
|
title: "Homework 6",
|
||||||
|
author: "Youwen Wu",
|
||||||
|
date: "Winter 2025",
|
||||||
|
)
|
||||||
|
|
||||||
|
#show figure: it => {
|
||||||
|
pad(y: 10pt, it)
|
||||||
|
}
|
||||||
|
#set enum(spacing: 2em)
|
||||||
|
|
||||||
|
#let correction = content => {
|
||||||
|
set text(fill: red)
|
||||||
|
box(stroke: 1pt, inset: 5pt, content)
|
||||||
|
}
|
||||||
|
|
||||||
|
#let subproblems = content => {
|
||||||
|
set enum(numbering: "a)")
|
||||||
|
content
|
||||||
|
}
|
||||||
|
|
||||||
|
#rect[
|
||||||
|
Initial score: $16/16$
|
||||||
|
]
|
||||||
|
|
||||||
|
#rect[
|
||||||
|
#set text(fill: red)
|
||||||
|
Revised score: $16/16$
|
||||||
|
]
|
||||||
|
|
||||||
|
1. $
|
||||||
|
M_X (t) = EE[e^(X t)] = sum_(S_X) e^(x t) p_X (x) \
|
||||||
|
= e^(-6t) 4 / 9 + e^(-2t) 1 / 9 + 2 / 9 (1+e^(3t))
|
||||||
|
$
|
||||||
|
|
||||||
|
2. We're looking for $EE[e^(X t)]$.
|
||||||
|
$
|
||||||
|
M_X (t) = integral_(-infinity) e^(x t) dot 1 / 2 e^(-|x|) dif x \
|
||||||
|
1 / 2 integral_(-infinity)^0 e^(x t + x) dif x + 1 / 2 integral_0^infinity e^(-x(1-t)) dif x \
|
||||||
|
= 1 / 2 [1 / (1+t) - 0] - 1 / 2 [0 - 1 / (1-t)] \
|
||||||
|
= 1 / 2 [1 / (1+t) + 1 / (1-t)]
|
||||||
|
$
|
||||||
|
Note that the MGF is only defined for $t in (-1,1)$.
|
||||||
|
|
||||||
|
3. #subproblems[
|
||||||
|
1. Consider the MGF evaluated at 0
|
||||||
|
$
|
||||||
|
[(dif M_X (t)) / (dif t)]_(t=0) = [-4 / 3 e^(-4t) + 5 / 6 e^(5t)]_(t=0) = -1 / 2
|
||||||
|
$
|
||||||
|
For the variance we evaluate the second derivative instead.
|
||||||
|
$
|
||||||
|
[(dif^2 M_X (t)) / (dif t^2)]_(t=0) = [16 / 3 e^(-4t) + 25 / 6 e^(5t)]_(t=0) = 19 / 2
|
||||||
|
$
|
||||||
|
And then
|
||||||
|
$
|
||||||
|
"Var"(X) = 19 / 2 - (-1 / 2)^2 = 37 / 4
|
||||||
|
$
|
||||||
|
2. The PMF is $M_X (t) = sum _k e^(k t) p_X (k) = 1/2 + 1/3^(-4t) + 1/6 e^(5t)$
|
||||||
|
|
||||||
|
Then $EE[X]$ and $EE[X^2]$ are
|
||||||
|
$
|
||||||
|
EE[X] = sum_k k dot p_X (k) = -4 / 3 + 5 / 6 = -1 / 2 \
|
||||||
|
EE[X^2] = sum_k k^2 dot p_X (k) \
|
||||||
|
= 16 / 3 + 25 / 6 = 19 / 2
|
||||||
|
$
|
||||||
|
So indeed our variance and mean match up.
|
||||||
|
]
|
||||||
|
4. The MGF is given by $X ~ "Pois"(3)$
|
||||||
|
$
|
||||||
|
M_X (t) = e^(3(e^t - 1))
|
||||||
|
$
|
||||||
|
So the answer is
|
||||||
|
$
|
||||||
|
P(X=4) = e^(-3) 3^4 / 4! = 0.16803
|
||||||
|
$
|
||||||
|
|
||||||
|
5. Let $Y = (X-1)^2$. The support of $Y$ is ${4,1,9}$. The PMF of $Y$ is
|
||||||
|
$
|
||||||
|
P(Y=4) = 1 / 7 \
|
||||||
|
P(Y=1) = 2 / 7 \
|
||||||
|
P(Y=9) = 4 / 7
|
||||||
|
$
|
||||||
|
|
||||||
|
6. $X ~ "Gamma"(2,1)$ and it has MGF
|
||||||
|
$
|
||||||
|
M_X (t) = 1 / ((1-t)^2)
|
||||||
|
$
|
37
documents/by-course/pstat-120a/hw6/package.nix
Normal file
37
documents/by-course/pstat-120a/hw6/package.nix
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
typstPackagesCache,
|
||||||
|
typixLib,
|
||||||
|
cleanTypstSource,
|
||||||
|
flakeSelf,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
src = cleanTypstSource ./.;
|
||||||
|
commonArgs = {
|
||||||
|
typstSource = "main.typ";
|
||||||
|
|
||||||
|
fontPaths = [
|
||||||
|
# Add paths to fonts here
|
||||||
|
# "${pkgs.roboto}/share/fonts/truetype"
|
||||||
|
];
|
||||||
|
|
||||||
|
virtualPaths = [
|
||||||
|
# Add paths that must be locally accessible to typst here
|
||||||
|
# {
|
||||||
|
# dest = "icons";
|
||||||
|
# src = "${inputs.font-awesome}/svgs/regular";
|
||||||
|
# }
|
||||||
|
];
|
||||||
|
|
||||||
|
XDG_CACHE_HOME = typstPackagesCache;
|
||||||
|
SOURCE_DATE_EPOCH = builtins.toString flakeSelf.lastModified;
|
||||||
|
};
|
||||||
|
|
||||||
|
in
|
||||||
|
typixLib.buildTypstProject (
|
||||||
|
commonArgs
|
||||||
|
// {
|
||||||
|
inherit src;
|
||||||
|
}
|
||||||
|
)
|
Loading…
Reference in a new issue