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
13 changes: 13 additions & 0 deletions CompPack/CompPack.Rproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX
Empty file added CompPack/debug.log
Empty file.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ Collate:
'nearest.R'
'around.R'
'nearest.loc.R'
'Bootstrap.R'
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export(Bootstrap)
export(around)
export(em.mixnorm)
export(grid.sect)
Expand Down
20 changes: 20 additions & 0 deletions R/Bootstrap.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#' Bootstrap
#'
#' @description
#' This function is used for estimating standard errors when the distribution is not know.
#'
#' @param x a vector.
#' @param Boots The number of bootstraps.
#' @param fn the function you want to bootstrap.
#'
#' @author Tyler Hunt \email{tyler@@psychoanalytix.com}
#'
#' @export


Bootstrap<-function(x, Boots=100, fn){
n=length(x)
lings<-replicate(Boots, fn(sample(x,n, replace=TRUE)))

list(se=sd(lings), lings=lings)
}
2 changes: 1 addition & 1 deletion R/around.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#'
#' @description Find the location of values around a specified value
#'
#' @param x a vector, matrix, or data frame.
#' @param x a vector.
#' @param value specified value
#'
#' @author Tyler Hunt \email{tyler@@psychoanalytix.com}
Expand Down
4 changes: 2 additions & 2 deletions R/maxbound.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#' Maxbound Optimization
#'
#' @param f the function to be optimized
#' @param lo the lower bound
#' @param hi the upper bound
#' @param lo the lower bound.
#' @param hi the upper bound.
#'
#' @export

Expand Down
2 changes: 1 addition & 1 deletion R/pois.proc.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Generate a Poisson Process
#'
#' @param end the end time.
#' @param end the end time desired.
#' @param rate the rate of occurrence.
#'
#' @author Tyler Hunt \email{tyler@@psychoanalytix.com}
Expand Down
28 changes: 21 additions & 7 deletions R/rand.norm.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
#' Generate Random Normal Variables
#' Generate A Random Normal Variable
#'
#' @param n Number of observations
#' @param mean vector of means
#' @param sd vector of standard deviations
#' @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
#'
#' @author Tyler Hunt \email{tyler@@psychoanalytix.com}
#' @author Damon McCafferty \email{damon.mccafferty@@economics.utah.edu}
#'
#' @export

rand.norm<-function(n, mean, sd){
qnorm( replicate( n, wich.hill() ) )*sd + mean
function(mu,sig)
{

u<-(2*wichmannhill()-1)
v<-(2*wichmannhill()-1)

s<-u^2+v^2

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

s<-u^2+v^2
}
sig*sqrt(-2*log(s)/s)*u + mu
}
6 changes: 3 additions & 3 deletions R/rand.unif.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#' Generate Random Uniform Variables
#'
#' @param n Number of observations
#' @param min lower limit of the distribution
#' @param max upper limit of the distribution
#' @param n Number of observations.
#' @param min lower limit of the distribution.
#' @param max upper limit of the distribution.
#'
#' @author Tyler Hunt \email{tyler@@psychoanalytix.com}
#'
Expand Down
Empty file added debug.log
Empty file.
21 changes: 21 additions & 0 deletions man/Bootstrap.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
\name{Bootstrap}
\alias{Bootstrap}
\title{Bootstrap}
\usage{
Bootstrap(x, Boots = 100, fn)
}
\arguments{
\item{x}{a vector.}

\item{Boots}{The number of bootstraps.}

\item{fn}{the function you want to bootstrap.}
}
\description{
This function is used for estimating standard errors when
the distribution is not know.
}
\author{
Tyler Hunt \email{tyler@psychoanalytix.com}
}

2 changes: 1 addition & 1 deletion man/around.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
around(x, value)
}
\arguments{
\item{x}{a vector, matrix, or data frame.}
\item{x}{a vector.}

\item{value}{specified value}
}
Expand Down