calcinvnls2 - Evaluate the Inverse of an nls2 Regression Function


On to:
DESCRIPTION
USAGE
REQUIRED-ARGUMENTS
OPTIONAL-ARGUMENTS
VALUE
CONSTRAINTS
BUGS
SIDE-EFFECTS
SEE-ALSO
EXAMPLE



DESCRIPTION:

Calculate the inverse of an `nls2' regression function.

The regression function, "f", being defined by:
y=f(x, theta)+epsilon
the inverse function, denoted here by "f-1":
x=f-1(y, theta)+nu
is calculated on given values of the abscissa x, of the parameters theta, and, possibly of second level parameters.
"calcinvnls2" calculates also the derivatives of "f-1" with respect to the parameters theta and with respect to the ordinate y, and, if defined, the variance of y.


USAGE:
calcinvnls2(file, ord, theta, gamf=NULL, gamv=NULL)

Sommaire


REQUIRED ARGUMENTS:

file
a character string equal to the pathname of the operating-system file that contains the formal description of "f-1" (see `nls2.inv').
ord
a vector that contains the values of y.
theta
a vector that contains the values of the parameters theta.
If it is labelled, only the elements whose names are present in the `paract' declaration of the description-file of "f-1" are taken into account. If it is not labelled, its values must be sorted according to the declaration.

Sommaire


OPTIONAL ARGUMENTS:

gamf
the vector of the values of the second level parameters that occur in the expression of x. (i.e parameters introduced by the `pbisabs' declaration of the description-file of "f-1").
If it is labelled, only the elements whose names are present in the "pbisabs" declaration are taken into account. If it is not labelled, its values must be sorted according to the declaration.
gamv
same as the argument `gamf' as to the second level parameters that occur in the expression of the variance of y. (i.e parameters introduced by the `pbisvar' declaration of the description-file of "f-1").

VALUE:

a list with the following components:
"inv": the values of "f-1". A vector of same length as the argument `ord'.
"d.inv.p": the derivatives of "f-1" with respect to the parameters theta. A matrix whose number of rows is equal to the length of the argument `ord' and number of columns is equal to the length of the `paract' declaration of the description-file of "f-1".
"d.inv.o": the derivatives of "f-1" with respect to y. A vector of same length as the argument `ord'.
"variance": the variance of y. A vector of same length as the argument `ord'.


Sommaire

CONSTRAINTS:

- The function `loadnls2' should have been previously called with arguments "model" and "inv" set to non NULL values.
- x must be univariate.


BUGS:

On some platforms, you should previoulsy create the programme to calculate the inverse function, by using the crInv command: see loadnls2

SIDE EFFECTS:

If no program has been previously loaded to calculate the inverse function (see `loadnls2'), an operating-system file is created which contains the C-program that corresponds to the formal description. If this file already exists, it is replaced.


SEE ALSO:

`calib.nls2', `loadnls2', `nls2.inv', `nls2.myinv'.


Sommaire

EXAMPLE:

The description-file, named "modelinv", is the following:

 abs x;
 ord y;
 paract n, d, b, g;
 aux a1,a2;
 subroutine;
 begin
 a1=(y-n)/(d-n);
 a2= if (a1>0)
  then -log10(a1)/g
 else 1
 fi;
 x=(log10(-1+exp(a2))-1)/b;
 end


Generation of the C-file:
crInv modelinv > modelinv.c
The commands of the S-session are:
  loadnls2(model="",inv="modelinv.c")
  theta <- c(133.3967, 2756.068, 3.287238, 0.6014407)
  names(theta) <-  c("n", "d", "b", "g")
  invnls2.out  <- calcinvnls2(file="modelinv", 
                               ord=c(297,300), 
                               theta=theta)

Sommaire


- Mon Sep 30 1996 -