Learn R Programming

pbdDEMO (version 0.2-0)

mpi.demo: MPI Demonstration

Description

These functions are examples of simple statistics via MPI calls.

Usage

mpi.stat(x.gbd)
  mpi.bin(x.gbd, breaks = pi/3 * (-3:3))
  mpi.quantile(x.gbd, prob = 0.5)
  mpi.ols(y.gbd, X.gbd)

Arguments

x.gbd
a GBD vector.
breaks
a set to break data in groups.
prob
a desired probability for quantile.
y.gbd
a GBD vector.
X.gbd
a GBD matrix.

Value

  • mpi.stat returns sample mean and sample variance.

    mpi.bin returns binning counts for the given breaks.

    mpi.quantile returns a quantile.

    mpi.ols returns ordinary least square estimates (beta_hat).

Details

x.gbd and y.gbd are vectors with length N.gbd. X.gbd is a matrix with dimension N.gbd * p and exists on all processors. N.gbd may be vary across processors.

For demonstration purpose, these objects should not contains weird values such NA.

References

Programming with Big Data in R Website: http://r-pbd.org/

Examples

Run this code
### Under command mode, run the demo with 4 processors by
### (Use Rscript.exe for windows system)
mpiexec -np 4 Rscript -e "demo(sample_stat,'pbdDEMO',ask=F,echo=F)"
mpiexec -np 4 Rscript -e "demo(binning,'pbdDEMO',ask=F,echo=F)"
mpiexec -np 4 Rscript -e "demo(quantile,'pbdDEMO',ask=F,echo=F)"
mpiexec -np 4 Rscript -e "demo(ols,'pbdDEMO',ask=F,echo=F)"
mpiexec -np 4 Rscript -e "demo(gbd2dmat,'pbdDEMO',ask=F,echo=F)"
mpiexec -np 4 Rscript -e "demo(balance,'pbdDEMO',ask=F,echo=F)"

Run the code above in your browser using DataLab