function sheet09

fprintf('p-Wert für k = 3, n = 1000, pi0 = 99.9%% = %f\n', ...
        one_sided_binominal(3, 1000, 0.999));

X = [1.311, 1.136, 1.81, 0.827, -0.173, 0.351, -1.949, 0.973, ...
     0.617, -0.091, -0.155, -0.581, 0.452, 0.879, 0.17];

fprintf('Exakter p-Wert für Daten (1) = %f\n', ...
        one_sided_gaussian(X));

fprintf('Boostrapped p-Wert für Daten (1), N = 9999 = %f\n', ...
        one_sided_gaussian_bootstrap(X, 9999));

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Your solutions below

% 1. Compute the p-value for a one-sided bionminal test.
%
% Input:
%   k: observed incidents
%   n: total number of samples
%   pi0: probability under H_0
%
% Note: you may use "binopdf" or "binocdf", but no built in test
% functions.
function P = one_sided_binominal(k, n, pi0)
% ...

% 2. Compute the exact one-sided Gaussian test for
%    mean 0 and variance 0.
%
% Input:
%   X: sample realizations
%
% Note: you may use "normcdf", but no built in test functions.
function P = one_sided_gaussian(X)
% ...

% 3. Compute a bootstrap estimate as in "Resamplingschema 2.1"
%
% Input:
%    X: sample realizations
%    B: number of boostrap samples
function P = one_sided_gaussian_bootstrap(X, B)
% ...
