% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/freqdist.R
\name{freqdist}
\alias{freqdist}
\title{Frequency distribution of multivariate numeric data with case weight}
\usage{
freqdist(
  x,
  weights = 1,
  npoints = NULL,
  min = NULL,
  max = NULL,
  prob = 0,
  wid = 6,
  dig = 1,
  maxf = NULL,
  rev = 0,
  class = 0,
  omitmiss = 0,
  midpoints = NULL,
  title = NULL,
  digits = 3,
  print = 0,
  plot = 0
)
}
\arguments{
\item{x}{numeric vector or column vector}

\item{weights}{case weight}

\item{npoints}{# of mid-points for each variable}

\item{min}{minimum value of mid-points}

\item{max}{maximum value of mid-points \cr
For the multivariate x, (npoints, min, max) can be vectors \cr
specifying different numbers for each variable.}

\item{prob}{= 1 to return relative frequency in stead of frequency}

\item{wid}{Format of mid-point value (wid.dig)}

\item{dig}{Format of mid-point value (wid.dig)}

\item{maxf}{max value of frequency for plot}

\item{rev}{= 1 to change the last element of x first.}

\item{class}{= 1 to  output the classification of each observation
to the mid-point.}

\item{omitmiss}{= 1 to omit the missing grids}

\item{midpoints}{a list of the vectors of predefied mid-point values \cr
For the multivariate x, midpoints defines the midpoints of
each variable,  not their Cartesian products.}

\item{title}{tile to be used in plot}

\item{digits}{Format for mid-points}

\item{print}{= 1 to print result}

\item{plot}{= 1 to plot historgam}
}
\value{
A list consisting of \cr
  midpoints=  list of midpoints \cr
  midpoints1= list of midpoints with lost values \cr
  midpindex   cartesian product of midpoints number \cr
  grid=       cartesian product of midpoints \cr
              grid[,j]=midpoints[[j]][midpindex[,j]], j=1,2,...,nvar \cr
  freq=       column vector of frequency at midpoints \cr
  breaks=     breaks associated with the midpoints \cr
  class=      classification of each obs into the midpoints if class=1. \cr
  classc=     classification of each obs into the midpoints class
   if class=1 . \cr
  nobs= sum of weights\cr
}
\description{
Frequency distribution of multivariate numeric data with case weight
}
\details{
(npoints, min, max)  defines the mid-points. \cr
   If min or max is NULL, min(x) and max(x) will be used. \cr
   midpoints has priority over (npoints, min, max).\cr
The out of range observations,  that is, those x satisfying \cr
 x < midpoints[1]     or   midpoints[npoints] < x \cr
 will be be included in midpoints[1] and midpoints[npoints], resp. \cr
\cr
Try this to see how the obs on the border are classified. \cr
   xx=c(1,2,3,4,5,6,7) \cr
   brks=c(0,2,4,6,8) \cr
   cc=cut(xx,brks) \cr
}
\examples{
set.seed(1701)
n <- 1000
X <- matrix(rnorm(2*n),n,2)
res <- freqdist( X, npoints=7,min=-3,max=3, print=1, weights=1, plot=1)

X <- expand.grid(seq(-3,3),seq(-3,3))
weight <- round(n*exp(-0.5*rowSums(X^2)))
res1 <- freqdist( X, weight, npoints=c(7,5),min=-3,max=3, print=1, plot=1)
res2 <- freqdist( X, weight, npoints=c(7,5),min=-3,max=3, print=1, class=1)
str(res2)

}
