Type: | Package |
Title: | Hypothesis Testing Based on Neyman-Pearson Lemma and Likelihood Ratio Test |
Version: | 0.1.1 |
Maintainer: | Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com> |
Description: | Error type I and Optimal critical values to test statistical hypothesis based on Neyman-Pearson Lemma and Likelihood ratio test based on random samples from several distributions. The families of distributions are Bernoulli, Exponential, Geometric, Inverse Normal, Normal, Gamma, Gumbel, Lognormal, Poisson, and Weibull. This package is an ideal resource to help with the teaching of Statistics. The main references for this package are Casella G. and Berger R. (2003,ISBN:0-534-24312-6 , "Statistical Inference. Second Edition", Duxbury Press) and Hogg, R., McKean, J., and Craig, A. (2019,ISBN:013468699, "Introduction to Mathematical Statistic. Eighth edition", Pearson). |
License: | GPL-3 |
Encoding: | UTF-8 |
RoxygenNote: | 7.2.3 |
Imports: | gamlss, gamlss.dist |
NeedsCompilation: | no |
Packaged: | 2024-09-09 03:06:28 UTC; CARLOS |
Author: | Carlos Alberto Cardozo Delgado [aut, cre, cph] |
Repository: | CRAN |
Date/Publication: | 2024-09-09 06:00:02 UTC |
Critical Value Given a Nominal Error Type I Associated with a Bernoulli Distribution
Description
ber_c_opt
is used to obtain a critical value to achieve a nominal error type I when we use a random sample from a Bernoulli distribution.
Usage
ber_c_opt(
alpha = 0.1,
n = 150,
theta0 = 1,
c1 = 0.001,
c2 = 0.99,
R = 15000,
delta = 0.005,
tolerance = 0.01,
max_iter = 100
)
Arguments
alpha |
numeric, represents a nominal error type I. Default value is 0.1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents the location parameter under the null hypothesis of a sample from a Bernoulli distribution. Default value is 0.5. |
c1 |
numeric, represents a lower bound to the critical value. Default value is 1e-03. |
c2 |
numeric, represents an upper bound to the critical value. Default value is 0.99. |
R |
numeric, represents the number of replicates. Default value is 15000. |
delta |
numeric, represents a precision parameter. Default value is 0.005. |
tolerance |
numeric, represents a relative precision with respect a given alpha. Default value is 0.01. |
max_iter |
integer, represents the maximum number of iterations. Default value is 100. |
Value
A list with number of replicates, sample size, nominal error type I, and empirical critical value obtained associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Critical value when we use a random sample of size 100 from a Bernoulli distribution
# given a nominal error type I equals to 0.1 and R = 12000
# to test H_0: theta = 0.7 vs H_1: theta != 0.7
ber_c_opt(alpha=0.1,n=100,theta0=0.7,R=12000)
Empirical Error Type I Associated with a Bernoulli Distribution
Description
ber_errorI
is used to obtain an empirical error type I when we use a random sample from a Bernoulli distribution.
Usage
ber_errorI(c = 1, n = 150, theta0 = 0.5, R = 12000)
Arguments
c |
numeric, represents a positive value that defines a critical region. Default value is 1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents the location parameter under the null hypothesis of a sample from a Bernoulli distribution. Default value is 0.5. |
R |
numeric, represents the number of replicates. Default value is 15000. |
Value
A list with number of replicates, sample size, and critical value that were used in the calculation of error type I associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Error type I when we use a random sample of size 200 from a Bernoulli distribution,
# a critical value c = 0.45 and R = 20000 to test H_0: theta = 0.7 vs H_1: theta != 0.7
ber_errorI(0.45,n=100,theta0=0.7,R=20000)
Critical Value Given a Nominal Error Type I Associated with a Exponential Distribution
Description
exp_c_opt
is used to obtain a critical value to achieve a nominal error type I when we use a random sample from a Exponential distribution.
Usage
exp_c_opt(
alpha = 0.1,
n = 100,
theta0 = 1,
c1 = 0.001,
c2 = 0.99,
R = 15000,
delta = 0.005,
tolerance = 0.01,
max_iter = 100
)
Arguments
alpha |
numeric, represents a nominal error type I. Default value is 0.1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents the location parameter under the null hypothesis of a sample from a Exponential distribution. Default value is 0.5. |
c1 |
numeric, represents a lower bound to the critical value. Default value is 1e-03. |
c2 |
numeric, represents an upper bound to the critical value. Default value is 0.99. |
R |
numeric, represents the number of replicates. Default value is 15000. |
delta |
numeric, represents a precision parameter. Default value is 0.005. |
tolerance |
numeric, represents a relative precision with respect a given alpha. Default value is 0.01. |
max_iter |
integer, represents the maximum number of iterations. Default value is 100. |
Value
A list with number of replicates, sample size, nominal error type I, and empirical critical value obtained associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Critical value when we use a random sample of size 200 from a Exponential distribution
# given a nominal error type I equals to 0.1 and R = 15000
# to test H_0: theta = 2 vs H_1: theta != 2
exp_c_opt(alpha=0.1,n=200,theta0=2,R=15000)
Empirical Error Type I Associated with an Exponential Distribution
Description
exp_errorI
is used to obtain an empirical error type I when we use a random sample from an Exponential distribution.
Usage
exp_errorI(c = 1, n = 100, theta0 = 1, R = 15000)
Arguments
c |
numeric, represents a positive value that defines a critical region. Default value is 1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents the location parameter under the null hypothesis of a sample from an Exponential distribution. Default value is 1. |
R |
numeric, represents the number of replicates. Default value is 15000. |
Value
A list with number of replicates, sample size, and critical value that were used in the calculation of error type I associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Error type I when we use a random sample of size 200 from an Exponential distribution,
# a critical value c = 0.24 and R = 20000 to test H_0: theta = 2 vs H_1: theta != 2
exp_errorI(c=0.24,n=200,theta0=2,R=20000)
Critical Value Given a Nominal Error Type I Associated with a Gamma Distribution
Description
gamma_c_opt
is used to obtain a critical value to achieve a nominal error type I when we use a random sample from a Gamma distribution.
Usage
gamma_c_opt(
alpha = 0.1,
n = 100,
theta0 = 1,
beta = 1,
c1 = 0.001,
c2 = 0.999,
R = 1000,
delta = 0.005,
tolerance = 0.01,
max_iter = 100
)
Arguments
alpha |
numeric, represents a nominal error type I. Default value is 0.1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents a location under the null hypothesis of a sample from a Gamma distribution. Default value is 1. |
beta |
numeric, represents the scale parameter of a Gamma distribution. It is assumed known and its default value is 1. |
c1 |
numeric, represents a lower bound to the critical value. Default value is 1e-03. |
c2 |
numeric, represents an upper bound to the critical value. Default value is 0.99. |
R |
numeric, represents the number of replicates. Default value is 1000. |
delta |
numeric, represents a precision parameter. Default value is 0.005. |
tolerance |
numeric, represents a relative precision with respect a given alpha. Default value is 0.01. |
max_iter |
integer, represents the maximum number of iterations. Default value is 100. |
Value
A list with number of replicates, sample size, nominal error type I, and empirical critical value obtained associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Critical value when we use a random sample of size 50 from a Gamma distribution
# given a nominal error type I equals to 0.1 and R = 100
# to test H_0: theta = 3 vs H_1: theta != 3
gamma_c_opt(alpha=0.1,n=50,theta0=3,beta=1,R=100)
Empirical Error Type I Associated with a Gamma Distribution
Description
gamma_errorI
is used to obtain an empirical error type I when we use a random sample from a Gamma distribution.
Usage
gamma_errorI(c = 1, n = 150, theta0 = 1, beta = 1, R = 15000)
Arguments
c |
numeric, represents a positive value that defines a critical region. Default value is 1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents the shape parameter under the null hypothesis of a sample from a Gamma distribution. Default value is 1. |
beta |
numeric, represents the scale parameter of a Gamma distribution. It is assumed known and its default value is 1. |
R |
numeric, represents the number of replicates. Default value is 15000. |
Value
A list with number of replicates, sample size, and critical value that were used in the calculation of error type I associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Error type I when we use a random sample of size 120 from a Gamma distribution,
# a critical value c = 0.5 and R = 200 to test H_0: theta = 1.5 vs H_1: theta != 1.5
gamma_errorI(0.5,n=120,theta0=1.5,R=200)
Critical Value Given a Nominal Error Type I Associated with a Geometric Distribution
Description
geom_c_opt
is used to obtain a critical value to achieve a nominal error type I when we use a random sample from a Geometric distribution.
Usage
geom_c_opt(
alpha = 0.1,
n = 100,
theta0 = 0.5,
c1 = 0.001,
c2 = 0.999,
R = 15000,
delta = 0.005,
tolerance = 0.01,
max_iter = 100
)
Arguments
alpha |
numeric, represents a nominal error type I. Default value is 0.1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents the probability parameter under the null hypothesis of a sample from a Geometric distribution. Default value is 0.5. |
c1 |
numeric, represents a lower bound to the critical value. Default value is 1e-03. |
c2 |
numeric, represents an upper bound to the critical value. Default value is 0.99. |
R |
numeric, represents the number of replicates. Default value is 15000. |
delta |
numeric, represents a precision parameter. Default value is 0.005. |
tolerance |
numeric, represents a relative precision with respect a given alpha. Default value is 0.01. |
max_iter |
integer, represents the maximum number of iterations. Default value is 100. |
Value
A list with number of replicates, sample size, nominal error type I, and empirical critical value obtained associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Critical value when we use a random sample of size 80 from a Geometric distribution
# given a nominal error type I equals to 0.1 and R = 10000
# to test H_0: theta = 0.25 vs H_1: theta != 0.25
geom_c_opt(alpha=0.1,n=80,theta0=0.25,R=10000)
Empirical Error Type I Associated with a Geometric Distribution
Description
geom_errorI
is used to obtain an empirical error type I when we use a random sample from a Geometric distribution.
Usage
geom_errorI(c = 1, n = 150, theta0 = 0.5, R = 15000)
Arguments
c |
numeric, represents a positive value that defines a critical region. Default value is 1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents the probability parameter under the null hypothesis of a sample from a Geometric distribution. Default value is 0.5. |
R |
numeric, represents the number of replicates. Default value is 15000. |
Value
A list with number of replicates, sample size, and critical value that were used in the calculation of error type I associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Error type I when we use a random sample of size 60 from a Geometric distribution,
# a critical value c = 0.01 and R = 20000 to test H_0: theta = 0.5 vs H_1: theta != 0.5
geom_errorI(0.01,n=60,theta0=0.5,R=20000)
Critical Value Given a Nominal Error Type I Associated with a Gumbel Distribution
Description
gumbel_c_opt
is used to obtain a critical value to achieve a nominal error type I when we use a random sample from a Gumbel distribution.
Usage
gumbel_c_opt(
alpha = 0.1,
n = 100,
theta0 = 1,
sigma = 1,
c1 = 0.001,
c2 = 0.999,
R = 1000,
delta = 0.005,
tolerance = 0.01,
max_iter = 100
)
Arguments
alpha |
numeric, represents a nominal error type I. Default value is 0.1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents a location under the null hypothesis of a sample from a Gumbel distribution. Default value is 0.5. |
sigma |
numeric, represents the scale parameter of a Gumbel distribution. It is assumed known and its default value is 1. |
c1 |
numeric, represents a lower bound to the critical value. Default value is 1e-03. |
c2 |
numeric, represents an upper bound to the critical value. Default value is 0.99. |
R |
numeric, represents the number of replicates. Default value is 1000. |
delta |
numeric, represents a precision parameter. Default value is 0.005. |
tolerance |
numeric, represents a relative precision with respect a given alpha. Default value is 0.01. |
max_iter |
integer, represents the maximum number of iterations. Default value is 100. |
Value
A list with number of replicates, sample size, nominal error type I, and empirical critical value obtained associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Critical value when we use a random sample of size 50 from a Gumbel distribution
# given a nominal error type I equals to 0.1 and R = 100
# to test H_0: theta = 3 vs H_1: theta != 3
gumbel_c_opt(alpha=0.1,n=50,theta0=3,sigma=1,R=100)
Empirical Error Type I Associated with a Gumbel Distribution
Description
gumbel_errorI
is used to obtain an empirical error type I when we use a random sample from a Gumbel distribution.
Usage
gumbel_errorI(c = 1, n = 150, theta0 = 0, sigma = 1, R = 15000)
Arguments
c |
numeric, represents a positive value that defines a critical region. Default value is 1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents the location parameter under the null hypothesis of a sample from a Gumbel distribution. Default value is 0. |
sigma |
numeric, represents the scale parameter of a Gumbel distribution. It is assumed known and its default value is 1. |
R |
numeric, represents the number of replicates. Default value is 15000. |
Value
A list with number of replicates, sample size, and critical value that were used in the calculation of error type I associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Error type I when we use a random sample of size 150 from a Gumbel distribution,
# a critical value c = 0.5 and R = 500 to test H_0: theta = 3 vs H_1: theta != 3
library(gamlss.dist)
gumbel_errorI(0.5,n=150,theta0=3,R=500)
Critical Value Given a Nominal Error Type I Associated with a Inverse Normal Distribution
Description
invnormal_c_opt
is used to obtain a critical value to achieve a nominal error type I when we use a random sample from a Inverse Normal distribution.
Usage
invnormal_c_opt(
alpha = 0.1,
n = 100,
theta0 = 1,
sigma = 1,
c1 = 0.001,
c2 = 0.999,
R = 1000,
delta = 0.005,
tolerance = 0.01,
max_iter = 100
)
Arguments
alpha |
numeric, represents a nominal error type I. Default value is 0.1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents a location under the null hypothesis of a sample from a Inverse Normal distribution. Default value is 0.5. |
sigma |
numeric, represents the scale parameter of a Inverse Normal distribution. It is assumed known and its default value is 1. |
c1 |
numeric, represents a lower bound to the critical value. Default value is 1e-03. |
c2 |
numeric, represents an upper bound to the critical value. Default value is 0.99. |
R |
numeric, represents the number of replicates. Default value is 1000. |
delta |
numeric, represents a precision parameter. Default value is 0.005. |
tolerance |
numeric, represents a relative precision with respect a given alpha. Default value is 0.01. |
max_iter |
integer, represents the maximum number of iterations. Default value is 100. |
Value
A list with number of replicates, sample size, nominal error type I, and empirical critical value obtained associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Critical value when we use a random sample of size 40 from a Inverse Normal distribution
# given a nominal error type I equals to 0.1 and R = 80
# to test H_0: theta = 3 vs H_1: theta != 3
invnormal_c_opt(alpha=0.1,n=40,theta0=3,sigma=1,R=80)
Empirical Error Type I Associated with a Inverse Normal Distribution
Description
invnormal_errorI
is used to obtain an empirical error type I when we use a random sample from a Inverse Normal distribution.
Usage
invnormal_errorI(c = 1, n = 150, theta0 = 1, sigma = 1, R = 15000)
Arguments
c |
numeric, represents a positive value that defines a critical region. Default value is 1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents the location parameter under the null hypothesis of a sample from a Inverse Normal distribution. Default value is 1. |
sigma |
numeric, represents the scale parameter of a Inverse Normal distribution. It is assumed known and its default value is 1. |
R |
numeric, represents the number of replicates. Default value is 15000. |
Value
A list with number of replicates, sample size, and critical value that were used in the calculation of error type I associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Error type I when we use a random sample of size 50 from a Inverse Normal distribution,
# a critical value c = 0.5 and R = 100 to test H_0: theta = 3 vs H_1: theta != 3
library(gamlss.dist)
invnormal_errorI(0.5,n=50,theta0=3,R=100)
Critical Value Given a Nominal Error Type I Associated with a Log Normal Distribution
Description
lognorm_c_opt
is used to obtain a critical value to achieve a nominal error type I when we use a random sample from a Log Normal distribution.
Usage
lognorm_c_opt(
alpha = 0.1,
n = 100,
theta0 = 1,
sdlog = 1,
c1 = 0.001,
c2 = 0.999,
R = 1000,
delta = 0.005,
tolerance = 0.01,
max_iter = 100
)
Arguments
alpha |
numeric, represents a nominal error type I. Default value is 0.1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents a location under the null hypothesis of a sample from a Log Normal distribution. Default value is 1. |
sdlog |
numeric, represents the scale parameter of a Log Normal distribution. It is assumed known and its default value is 1. |
c1 |
numeric, represents a lower bound to the critical value. Default value is 1e-03. |
c2 |
numeric, represents an upper bound to the critical value. Default value is 0.99. |
R |
numeric, represents the number of replicates. Default value is 1000. |
delta |
numeric, represents a precision parameter. Default value is 0.005. |
tolerance |
numeric, represents a relative precision with respect a given alpha. Default value is 0.01. |
max_iter |
integer, represents the maximum number of iterations. Default value is 100. |
Value
A list with number of replicates, sample size, nominal error type I, and empirical critical value obtained associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Critical value when we use a random sample of size 100 from a Log Normal distribution
# given a nominal error type I equals to 0.1 and R = 200
# to test H_0: theta = 3 vs H_1: theta != 3
lognorm_c_opt(alpha=0.1,n=100,theta0=3,sdlog=1,R=200)
Empirical Error Type I Associated with a Log Normal Distribution
Description
lognorm_errorI
is used to obtain an empirical error type I when we use a random sample from a Log Normal distribution.
Usage
lognorm_errorI(c, n = 150, theta0 = 0, sdlog = 1, R = 15000)
Arguments
c |
numeric, represents a positive value that defines a critical region. Default value is 1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents the natural logarithm of location parameter under the null hypothesis of a sample from a Log Normal distribution. Default value is 0. |
sdlog |
numeric, represents the natural logarithm of scale parameter of a Log normal distribution. It is assumed known and its default value is 1. |
R |
numeric, represents the number of replicates. Default value is 15000. |
Value
A list with number of replicates, sample size, and critical value that were used in the calculation of error type I associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Error type I when we use a random sample of size 50 from an Log Normal distribution,
# a critical value c = 0.5 and R = 500 to test H_0: theta = 0 vs H_1: theta != 0
lognorm_errorI(c=0.5,n=50,theta0=0,sdlog=1,R=500)
Critical Value Given a Nominal Error Type I Associated with a Normal Distribution
Description
norm_c_opt
is used to obtain a critical value to achieve a nominal error type I when we use a random sample from a Normal distribution.
Usage
norm_c_opt(
alpha = 0.1,
n = 100,
theta0 = 0,
sd = 1,
c1 = 0.001,
c2 = 0.999,
R = 15000,
delta = 0.005,
tolerance = 0.01,
max_iter = 100
)
Arguments
alpha |
numeric, represents a nominal error type I. Default value is 0.1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents the probability parameter under the null hypothesis of a sample from a Normal distribution. Default value is 0.5. |
sd |
numeric, represents the scale parameter of a ]Normal distribution. It is assumed known and its default value is 1. |
c1 |
numeric, represents a lower bound to the critical value. Default value is 1e-03. |
c2 |
numeric, represents an upper bound to the critical value. Default value is 0.99. |
R |
numeric, represents the number of replicates. Default value is 15000. |
delta |
numeric, represents a precision parameter. Default value is 0.005. |
tolerance |
numeric, represents a relative precision with respect a given alpha. Default value is 0.01. |
max_iter |
integer, represents the maximum number of iterations. Default value is 100. |
Value
A list with number of replicates, sample size, nominal error type I, and empirical critical value obtained associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Critical value when we use a random sample of size 100 from a Normal distribution
# given a nominal error type I equals to 0.1 and R = 10000
# to test H_0: theta = 0 vs H_1: theta != 0
norm_c_opt(alpha=0.1,n=100,theta0=0,sd=1,R=10000)
Empirical Error Type I Associated with a Normal Distribution
Description
norm_errorI
is used to obtain an empirical error type I when we use a random sample from a Normal distribution.
Usage
norm_errorI(c = 1, n = 100, theta0 = 0, sd = 1, R = 15000)
Arguments
c |
numeric, represents a positive value that defines a critical region. Default value is 1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents the location parameter under the null hypothesis of a sample from a Normal distribution. Default value is 0. |
sd |
numeric, represents the scale parameter of a Normal distribution. It is assumed known and its default value is 1. |
R |
numeric, represents the number of replicates. Default value is 15000. |
Value
A list with number of replicates, sample size, and critical value that were used in the calculation of error type I associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Error type I when we use a random sample of size 70 from an Normal distribution,
# a critical value c = 0.65 and R = 20000 to test H_0: theta = 0 vs H_1: theta != 0
norm_errorI(0.65,70,theta0=0,sd=1,R=20000)
Critical Value Given a Nominal Error Type I Associated with a Poisson Distribution
Description
pois_c_opt
is used to obtain a critical value to achieve a nominal error type I when we use a random sample from a Poisson distribution.
Usage
pois_c_opt(
alpha = 0.1,
n = 150,
theta0 = 1,
c1 = 0.001,
c2 = 0.99,
R = 15000,
delta = 0.005,
tolerance = 0.01,
max_iter = 100
)
Arguments
alpha |
numeric, represents a nominal error type I. Default value is 0.1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents the location parameter under the null hypothesis of a sample from a Poisson distribution. Default value is 1. |
c1 |
numeric, represents a lower bound to the critical value. Default value is 1e-03. |
c2 |
numeric, represents an upper bound to the critical value. Default value is 0.99. |
R |
numeric, represents the number of replicates. Default value is 15000. |
delta |
numeric, represents a precision parameter. Default value is 0.005. |
tolerance |
numeric, represents a relative precision with respect a given alpha. Default value is 0.01. |
max_iter |
integer, represents the maximum number of iterations. Default value is 100. |
Value
A list with number of replicates, sample size, nominal error type I, and empirical critical value obtained associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Critical value when we use a random sample of size 200 from a Poisson distribution
# given a nominal error type I equals to 0.1 and R = 15000
# to test H_0: theta = 2 vs H_1: theta != 2
pois_c_opt(alpha=0.1,n=200,theta0=2,R=15000)
Empirical Error Type I Associated with a Poisson Distribution
Description
pois_errorI
is used to obtain an empirical error type I when we use a random sample from a Poisson distribution.
Usage
pois_errorI(c = 1, n = 100, theta0 = 1, R = 15000)
Arguments
c |
numeric, represents a positive value that defines a critical region. Default value is 1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents the location parameter under the null hypothesis of a sample from a Poisson distribution. Default value is 1. |
R |
numeric, represents the number of replicates. Default value is 15000. |
Value
A list with number of replicates, sample size, and critical value that were used in the calculation of error type I associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Error type I when we use a random sample of size 200 from an Poisson distribution,
# a critical value c = 0.85 and R = 20000 to test H_0: theta = 2 vs H_1: theta != 2
pois_errorI(0.85,n=100,theta0=2,R=20000)
Critical Value Given a Nominal Error Type I Associated with a Weibull Distribution
Description
weibull_c_opt
is used to obtain a critical value to achieve a nominal error type I when we use a random sample from a Weibull distribution.
Usage
weibull_c_opt(
alpha = 0.1,
n = 100,
theta0 = 1,
sigma = 1,
c1 = 0.001,
c2 = 0.999,
R = 1000,
delta = 0.005,
tolerance = 0.01,
max_iter = 100
)
Arguments
alpha |
numeric, represents a nominal error type I. Default value is 0.1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents a location under the null hypothesis of a sample from a Weibull distribution. Default value is 0.5. |
sigma |
numeric, represents the scale parameter of a Weibull distribution. It is assumed known and its default value is 1. |
c1 |
numeric, represents a lower bound to the critical value. Default value is 1e-03. |
c2 |
numeric, represents an upper bound to the critical value. Default value is 0.99. |
R |
numeric, represents the number of replicates. Default value is 1000. |
delta |
numeric, represents a precision parameter. Default value is 0.005. |
tolerance |
numeric, represents a relative precision with respect a given alpha. Default value is 0.01. |
max_iter |
integer, represents the maximum number of iterations. Default value is 100. |
Value
A list with number of replicates, sample size, nominal error type I, and empirical critical value obtained associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Critical value when we use a random sample of size 50 from a Weibull distribution
# given a nominal error type I equals to 0.1 and R = 100
# to test H_0: theta = 3 vs H_1: theta != 3
weibull_c_opt(alpha=0.1,n=50,theta0=3,sigma=1,R=100)
Empirical Error Type I Associated with a Weibull Distribution
Description
weibull_errorI
is used to obtain an empirical error type I when we use a random sample from a Weibull distribution.
Usage
weibull_errorI(c = 1, n = 150, theta0 = 1, sigma = 1, R = 15000)
Arguments
c |
numeric, represents a positive value that defines a critical region. Default value is 1. |
n |
numeric, represents the size of the sample. Default value is 100. |
theta0 |
numeric, represents the location parameter under the null hypothesis of a sample from a Weibull distribution. Default value is 1. |
sigma |
numeric, represents the scale parameter of a Weibull distribution. It is assumed known and its default value is 1. |
R |
numeric, represents the number of replicates. Default value is 15000. |
Value
A list with number of replicates, sample size, and critical value that were used in the calculation of error type I associated with a likelihood ratio statistic.
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>.
References
Casella, G. and Berger, R. (2003). Statistical Inference, Second Edition. Duxbury Press.
Hogg, R., McKean, J., and Craig, A. (2019) Introduction to Mathematical Statistic. Eighth edition. Pearson.
Examples
# Error type I when we use a random sample of size 150 from a Weibull distribution,
# a critical value c = 0.5 and R = 500 to test H_0: theta = 3 vs H_1: theta != 3
library(gamlss.dist)
weibull_errorI(0.5,n=150,theta0=3,R=500)