Not applicable
Posts: 0

# need help

Dear all,

I have an error in the communication between my program and the data table (variables).
For a Bertalanffy growth curve I had programmed the following program (see below). Now I have a Problem with my variables in the data table and I don´t find the error.
These are my variables:
Paar Zeit Laenge Id Id2 Id3 Id4 Id5 Id6 Id7 Id8 Id9 Id10 Id11 Id12 Id13 Id14 Id15 Id16 Id17 Id18 Id19 Id20 Id21 Id22 Id23 Id24
Paar is nominal, the rest numeric.
Zeit=Time in days (range from 1-160)
Laenge= Height (range from 10.1 -19.00 cm)
The other variables stands for each animal (1,0,0,0,0........,2,1,0,0,0...,3,2,1,0,0 etc.)
Can anyone help me with this problem? Thank you very much!

Here is the program:

DATA test;
RETAIN L0 12
dL0 2
Lunendl 16
dLunendl 1.5
k 0.007
dk -0.001;
Do Id = 0,1;
Do t = 0 To 154 BY 7;
L0eff = L0 + dL0 * Id;
LUeff = Lunendl + dLunendl*Id;
keff = k + dk*Id;
L = L0eff +
(LUeff- L0eff) * (1-Exp(-keff * t)) + 0.01*RANNOR(12345);
KEEP t Id L;
Output;
End;
End;
RUN;

*** Anpassung von-Bertalanffy für zwei Tiere (ein Paar) simultan
*** maximales Modell: alle Parameter können spezifisch pro Tier sein;

PROC NLIN DATA=test OUTEST=param MAXITER=10000;
PARM L0=11 12 13
dL0 = 1.5 To 2.5 BY 0.5
Lunendl=15 16 17
dLunendl = 1.5 To 2.5 BY 0.5
k= 0.0006 0.0007 0.0008
dk = -0.0001 0.0000 0.0001
;
L0eff = L0 + dL0 * Id;
LUeff = Lunendl + dLunendl*Id;
keff = k + dk*Id;
MODEL L = L0eff +
(LUeff- L0eff) * (1-Exp(-keff * t));
Output OUT=test P=PredL1 R=Res1 L95m=CiuL1 U95m=CioL1;
TITLE "[1] Anpassung von 2 von-Bertalanffy-Kurven";
RUN;

Symbol1 V=CIRCLE I=NONE C=RED;
Symbol2 V=NONE I=Join C=BLUE;
Symbol3 V=NONE I=Join C=BLUE L=3;

PROC GPLOT DATA=test;
PLOT L * t = 1
PredL * t = 2
CiuL * t = 3
CioL * t = 3 / OVERLAY;
TITLE "[1] Anpassung von 2 von-Bertalanffy-Kurven";
RUN;
QUIT;

PROC UNIVARIATE DATA=test PLOT NORMAL;
VAR Res1;
HISTOGRAM Res1 / NORMAL(Color=RED);
BY Id;
TITLE1 "[1] Anpassung von 2 von-Bertalanffy-Kurven";
TITLE2 "[1] Test der Residuen auf Normalverteilung";
RUN;

DATA Test;
Set test;
BY Id;
If FIRST.Id Then LagRes1 = .;
Else LagRes1 = LAG(Res1);
RUN;

PROC CORR DATA=Test;
VAR Res1 LagRes1;
BY Id;
TITLE1 "[1] Anpassung von 2 von-Bertalanffy-Kurven";
TITLE2 "[1] Test der Residuen auf Autokorrelation 1. Ordnung";
RUN;

*** Anpassung von-Bertalanffy für zwei Tiere (ein Paar) simultan
*** eingeschränktes Modell: alle Parameter bis auf Maximum können spezifisch
pro Tier sein;

PROC NLIN DATA=test OUTEST=param MAXITER=10000;
PARM L0=11 12 13
dL0 = 1.5 To 2.5 BY 0.5
Lunendl=15 16 17
k= 0.0006 0.0007 0.0008
dk = -0.0001 0.0000 0.0001
;
L0eff = L0 + dL0 * Id;
LUeff = Lunendl;
keff = k + dk*Id;
MODEL L = L0eff +
(LUeff- L0eff) * (1-Exp(-keff * t));
Output OUT=test P=PredL2 L95m=CiuL2 U95m=CioL2;
TITLE "[2] Anpassung von 2 von-Bertalanffy-Kurven";
RUN;

Symbol1 V=CIRCLE I=NONE C=RED;
Symbol2 V=NONE I=Join C=BLUE;
Symbol3 V=NONE I=Join C=BLUE L=3;

PROC GPLOT DATA=test;
PLOT L * t = 1
PredL * t = 2
CiuL * t = 3
CioL * t = 3 / OVERLAY;
TITLE "[2] Anpassung von 2 von-Bertalanffy-Kurven, eingeschränktes Modell";
RUN;
QUIT;

*** Anpassung von-Bertalanffy für zwei Tiere (ein Paar) simultan
*** weiter eingeschränktes Modell: alle Parameter bis auf Maximum können spezifisch
pro Tier sein;

PROC NLIN DATA=test OUTEST=param MAXITER=10000;
PARM L0=11 12 13
dL0 = 1.5 To 2.5 BY 0.5
Lunendl=15 16 17
k= 0.0006 0.0007 0.0008
;
L0eff = L0 + dL0 * Id;
LUeff = Lunendl;
keff = k ;
MODEL L = L0eff +
(LUeff- L0eff) * (1-Exp(-keff * t));
Output OUT=test P=PredL3 L95m=CiuL3 U95m=CioL3;
TITLE "[3] Anpassung von 2 von-Bertalanffy-Kurven";
RUN;

Symbol1 V=CIRCLE I=NONE C=RED;
Symbol2 V=NONE I=Join C=BLUE;
Symbol3 V=NONE I=Join C=BLUE L=3;

PROC GPLOT DATA=test;
PLOT L * t = 1
PredL * t = 2
CiuL * t = 3
CioL * t = 3 / OVERLAY;
TITLE "[3] Anpassung von 2 von-Bertalanffy-Kurven, weiter eingeschränktes Modell";
RUN;
QUIT;

End Sub
Super Contributor
Posts: 260

## Re: need help

When I run your program, I have errors in the Gplot procedures : the variable names are wrong. In the first you, the correct code would be :
[pre]PROC GPLOT DATA=test;
PLOT L * t = 1
PredL1 * t = 2
CiuL1 * t = 3
CioL1 * t = 3 / OVERLAY;
TITLE "[1] Anpassung von 2 von-Bertalanffy-Kurven";
RUN;
QUIT;
[/pre]
(there are "1" missing on three of the variables names)
Bad copy & paste, it seems. And same problems with the other two Gplot procs.

I don't know if it was the problem you were pointing at (I don't know of Bertalanffy growth curves at all) but I hope it will help...
Regards.
Olivier
Not applicable
Posts: 0

## Re: need help

Thank you very much Oliver. Now it works fine. But in my plot a have a line between the two independent graphs. can you say me what I can do to eleminate this connecting line?

best regards
Super Contributor
Posts: 260

## Re: need help

What you need to separate both lines is to add a "blank" line (an observation with missing values) between the two blocks... And then add the SKIPMISS option in the PLOT statement (causing the lines to pause when meeting a missing value).
For example :[pre]
DATA work.test ;
SET work.test ;
BY id ;
OUTPUT ; /* save current obs */
IF LAST.id THEN DO ;
CALL MISSING(OF l--res1) ;
OUTPUT ; /* insert "blank" line */
END ;
RUN ;
Symbol1 V=CIRCLE I=NONE C=RED;
Symbol2 V=NONE I=Join C=BLUE;
Symbol3 V=NONE I=Join C=BLUE L=3;

PROC GPLOT DATA=test;
PLOT L * t = 1
PredL1 * t = 2
CiuL1 * t = 3
CioL1 * t = 3 / OVERLAY SKIPMISS ;
TITLE "[1] Anpassung von 2 von-Bertalanffy-Kurven";
RUN;
QUIT;
[/pre]
Regards.
Olivier
Discussion stats
• 3 replies
• 152 views
• 0 likes
• 2 in conversation