Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ Collate:
'around.R'
'nearest.loc.R'
'Bootstrap.R'
'polar.norm.R'
'jackknife.R'
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export(Bootstrap)
export(around)
export(em.mixnorm)
export(grid.sect)
export(jackknife)
export(maxbound)
export(mc)
export(mixnorm)
Expand All @@ -10,6 +11,7 @@ export(nearest.loc)
export(newton.raph)
export(plot.mc)
export(pois.proc)
export(polar.norm)
export(rand.exp)
export(rand.mvnorm)
export(rand.norm)
Expand Down
1 change: 1 addition & 0 deletions R/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rand.norm.R
2 changes: 1 addition & 1 deletion R/jackknife.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#'
#' @author Damon McCafferty \email{damon.mccafferty@@economics.utah.edu}
#'
#' @example x = runif(10, 0, 1)
#' @examples x = runif(10, 0, 1)
#' mean(x)
#' jackknife(x,mean)
#'
Expand Down
27 changes: 27 additions & 0 deletions R/polar.norm.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#' Generate A Random Normal Variable
#'
#' @description A method for generating a random normal variable based upon the polar method.
#' @param mu mean of a normal distribution
#' @param sig variance of a normal distribution
#'
#' @author Damon McCafferty \email{damon.mccafferty@@economics.utah.edu}
#'
#' @export

polar.norm<-function(mu, sig)
{

u<-(2*wich.hill()-1)
v<-(2*wich.hill()-1)

s<-u^2+v^2

while(s==0||s>=1)
{
u<-(2*wich.hill()-1)
v<-(2*wich.hill()-1)

s<-u^2+v^2
}
sig*sqrt(-2*log(s)/s)*u + mu
}
28 changes: 7 additions & 21 deletions R/rand.norm.R
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
#' Generate A Random Normal Variable
#' Generate Random Normal Variables
#'
#' @description A method for generating a random normal variable based upon the polar method.
#' @param mu mean of a normal distribution
#' @param sigma variance of a normal distribution
#' @param n Number of observations
#' @param mean vector of means
#' @param sd vector of standard deviations
#'
#' @author Damon McCafferty \email{damon.mccafferty@@economics.utah.edu}
#' @author Tyler Hunt \email{tyler@@psychoanalytix.com}
#'
#' @export

function(mu,sig)
{

u<-(2*wich.hill()-1)
v<-(2*wich.hill()-1)

s<-u^2+v^2

while(s==0||s>=1)
{
u<-(2*wich.hill()-1)
v<-(2*wich.hill()-1)

s<-u^2+v^2
}
sig*sqrt(-2*log(s)/s)*u + mu
rand.norm<-function(n, mean, sd){
qnorm( replicate( n, wich.hill() ) )*sd + mean
}
36 changes: 36 additions & 0 deletions man/jackknife.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
\name{jackknife}
\alias{jackknife}
\title{Resamples Data using the Jackknife Method}
\usage{
jackknife(x, t)
}
\arguments{
\item{x}{a vector}

\item{t}{estimation of parameter}
}
\value{
est orignial estimation of parameter

jkest jackknife estimation of parameter

jkvar jackknife estimation of variance

jkbias jackknife estimate of biasness of parameter

jkbiascorr bias corrected parameter estimate
}
\description{
This function is used for estimating standard errors when
the distribution is not know.
}
\examples{
x = runif(10, 0, 1)
mean(x)
jackknife(x,mean)
}
\author{
Damon McCafferty
\email{damon.mccafferty@economics.utah.edu}
}

4 changes: 2 additions & 2 deletions man/maxbound.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
\arguments{
\item{f}{the function to be optimized}

\item{lo}{the lower bound}
\item{lo}{the lower bound.}

\item{hi}{the upper bound}
\item{hi}{the upper bound.}
}
\description{
Maxbound Optimization
Expand Down
2 changes: 1 addition & 1 deletion man/pois.proc.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
pois.proc(end = 200, rate = 1)
}
\arguments{
\item{end}{the end time.}
\item{end}{the end time desired.}

\item{rate}{the rate of occurrence.}
}
Expand Down
20 changes: 20 additions & 0 deletions man/polar.norm.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
\name{polar.norm}
\alias{polar.norm}
\title{Generate A Random Normal Variable}
\usage{
polar.norm(mu, sig)
}
\arguments{
\item{mu}{mean of a normal distribution}

\item{sig}{variance of a normal distribution}
}
\description{
A method for generating a random normal variable based
upon the polar method.
}
\author{
Damon McCafferty
\email{damon.mccafferty@economics.utah.edu}
}

6 changes: 3 additions & 3 deletions man/rand.unif.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
rand.unif(n, min = 0, max = 1)
}
\arguments{
\item{n}{Number of observations}
\item{n}{Number of observations.}

\item{min}{lower limit of the distribution}
\item{min}{lower limit of the distribution.}

\item{max}{upper limit of the distribution}
\item{max}{upper limit of the distribution.}
}
\description{
Generate Random Uniform Variables
Expand Down