# prepare: Prepares a multivariate data set for use in nls / evrunge In nlsrk: Runge-Kutta Solver for Function nls()

## Description

Utility :
Modifies a multivariate `data.frame` for fitting a nonlinear model defined by a system of first order Ordinary Differential Equations. In the original `data.frame`, the data must be arrange in nfunct + 1 columns, nfunct being the dimension of the ODE system. One of the column must be the observation times (or in general the observations of the independent variable). The others colums are the observations of the functions. `prepare` returns the same data set with a single column for time (repeated nfunct times), and a single column for the concatenated observations. A third column is created as a `factor` indexing the original column (1 for the first, 2 for the second, etc)

## Usage

 `1` ```prepare(x = data.frame, ntime = 1, cols = c(2:(length(x[1, ])))) ```

## Arguments

 `x` a data.frame : one column for time and one for each function `ntime` numeric : the number of the column coding for time (independent variable) `cols` numeric vector : the numbers of the columns corresponding to each dependent variable

## Details

Prepares the data set as an entry for `nls` which is basically univariate. The formula in `nls` must involve `evrunge`. As `nls` considers the observations as univariate, the criterion used in the least-square process is that of the trace of the variance-covariance matrix of the residuals.

## Value

A data.frame with columns :

 `t` time repeated as many times as necessary `y` concatenated observed trajectories `traj` factor : number of the trajectory

## Author(s)

Jean-Sebastien Pierre [email protected]

`frunge`, `dfdt`,`multirunge`,`evrunge`,`sys`,`nls`
 ```1 2 3``` ```data(syslin.don) syslin<-prepare(syslin.don) summary(syslin) ```