% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mprocuste.R
\name{pm}
\alias{pm}
\title{Performs a procruste model on a set of coordinate matrices}
\usage{
pm(
  formula,
  data,
  subset,
  weights,
  na_action,
  method = "qr",
  singular_ok = TRUE,
  tol = 1e-07,
  model = TRUE,
  x = TRUE,
  y = TRUE,
  A = TRUE,
  nrand = 100
)
}
\arguments{
\item{formula}{an object of class \code{\link[stats]{formula}} (or one that
can be coerced to that class): a symbolic description of the model to be
fitted. The details of model specification are given under ‘Details’.}

\item{data}{an optional procmod frame, list or environment (or object
coercible by \code{\link[ProcMod]{as_procmod_frame}} to a procmod frame)
containing the variables in the model. If not found in data, the variables
are taken from environment(formula), typically the environment from which
\code{pm} is called.}

\item{subset}{subset    an optional vector specifying a subset of observations
to be used in the fitting process.}

\item{weights}{an optional vector of weights to be used in the fitting
process. Should be NULL or a numeric vector. If non-NULL, weighted least
squares is used with weights weights (that is, minimizing sum(w*e^2));
otherwise ordinary least squares is used. See also ‘Details’,}

\item{na_action}{a function which indicates what should happen when the data
contain NAs. The default is set by the \code{na.action} setting of
\code{\link[base]{options}}, and is \code{\link[stats]{na.fail}} if that is
unset. The ‘factory-fresh’ default is \code{\link[stats]{na.omit}}. Another
possible value is NULL, no action. Value \code{\link[stats]{na.exclude}} can
be useful.}

\item{method}{the method to be used; for fitting, currently only \code{method
= "qr"} is supported; \code{method = "procmod_model"} returns the model
frame (the same as with \code{model = TRUE}, see below).}

\item{singular_ok}{a logical value. If \code{FALSE} a singular fit is an
error.}

\item{tol}{tolerance for the \code{\link[base]{qr}} decomposition. Default is
1e-7.}

\item{model, x, y, A}{logicals. If \code{TRUE} the corresponding components of
the fit (the procmod model frame, the model matrix, the response, the
procrustean rotation matrices) are returned.}

\item{nrand}{number of randomisation used to estimate the mean
covariance observed between two random matrix.
If rand is \code{NULL} or equal to \code{0}, no correction
is estimated and the raw procrustean covariances are
estimated.}
}
\description{
Performs a procruste model on a set of coordinate matrices
}
\examples{
  library(vegan)
  data(bacteria)
  data(eukaryotes)
  data(soil)
  data(climat)
  data(geography)

  dataset <- procmod_frame(euk = vegdist(decostand(eukaryotes,
                                                   method = "hellinger"),
                                         method = "euclidean"),
                           bac = vegdist(decostand(bacteria,
                                                   method = "hellinger"),
                                         method = "euclidean"),
                           soil = scale(soil,
                                        center = TRUE,
                                        scale  = TRUE),
                           clim = scale(climat,
                                        center = TRUE,
                                        scale  = TRUE),
                           geo = geography)

   m <- pm(euk ~ bac + soil + clim + geo, data = dataset, nrand=100)
   m

}
\author{
Eric Coissac

Christelle Gonindard-Melodelima
}
