<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Errant Graph when ploting predicted values from proc nlin in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Errant-graph-when-plotting-predicted-values-from-proc-nlin/m-p/695293#M20632</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/354468"&gt;@RobinN&lt;/a&gt;&amp;nbsp;, you just need to sort your graph by time before you do the plot. Please see the example below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data fungi;
     input time germrate;
     datalines;
9       0
9       0
9       0
9       0
9       0
9       0
9       0
9       0
12      1
12      1
12      1
9       1
12      2
12      3
12      4
12      4
12      5
12      5
15      11
15      18
15      20
15      21
9       22
15      24
15      27
15      27
9       28
9       28
9       29
9       31
9       33
15      34
15      37
18      43
18      45
18      52
18      52
18      54
15      55
18      58
18      58
18      63
18      71
21      72
12      73
21      74
12      74
12      76
12      76
12      77
21      78
15      79
12      80
21      81
15      82
21      83
21      84
21      84
24      85
15      85
24      86
21      86
24      87
21      87
21      87
24      88
24      90
24      90
24      90
21      90
18      90
18      91
15      91
24      92
24      92
21      92
21      92
21      92
18      92
24      93
24      93
18      93
15      93
24      94
24      94
24      95
24      96
18      96
21      97
18      98
96      99
96      100
96      99
96      98
96      97
96      100

   ;


proc nlin  data=fungi;
 	parms   Pmax=98 teta=15 ;d=6 ;

 	model germrate = Pmax*(1-(1/(1+((time/teta)**d))));
run;

proc nlin data=fungi method=newton;   
	parameters  Pmax=98 teta=15 ;d=6 ;  
	model germrate = Pmax*(1-(1/(1+((time/teta)**d)))); 
	output out=nlinout predicted=pred l95m=l95mean u95m=u95mean l95=l95ind u95=u95ind; 
run; 
proc print data=nlinout; 
run;

data filler;   
do time = 0 to 96 by 2;     
predict=1;     
output;   
end; 
run;

data fitthis; 
set fungi filler; 
run;

proc nlin data=fitthis method=newton;   
	parameters  Pmax=98 teta=15 ;d=6 ;  
	model germrate = Pmax*(1-(1/(1+((time/teta)**d))));   
	output out=nlinout predicted=pred l95m=l95mean u95m=u95mean; 
run; 

proc print data=nlinout(where=(predict=1)); run;

proc sort data = nlinout;
  by time;
run;

proc sgplot data=nlinout;

   scatter x=time y=germrate;
   series x=time y=pred;
   band upper=u95mean lower=l95mean x=time ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 29 Oct 2020 17:36:44 GMT</pubDate>
    <dc:creator>djrisks</dc:creator>
    <dc:date>2020-10-29T17:36:44Z</dc:date>
    <item>
      <title>Errant graph when plotting predicted values from proc nlin</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Errant-graph-when-plotting-predicted-values-from-proc-nlin/m-p/695291#M20631</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently working on a SAS Programm to fit my data of a germinating fungus to a given logistic function. This works fine for now, as the estimated values fit well to the data and predicted values based on that function seem acceptable. But when I try to plot this data the resulting graph looks like this:&amp;nbsp;&lt;SPAN style="font-family: inherit;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RobinN_0-1603991172959.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51218iB8C9F83570EA93D0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RobinN_0-1603991172959.png" alt="RobinN_0-1603991172959.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone has any suggestions regarding this problem? I'm using SAS University Edition / SAS Studio 3.8&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code used to create this graph is as follows:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data fungi;
     input time germrate;
     datalines;
9       0
9       0
9       0
9       0
9       0
9       0
9       0
9       0
12      1
12      1
12      1
9       1
12      2
12      3
12      4
12      4
12      5
12      5
15      11
15      18
15      20
15      21
9       22
15      24
15      27
15      27
9       28
9       28
9       29
9       31
9       33
15      34
15      37
18      43
18      45
18      52
18      52
18      54
15      55
18      58
18      58
18      63
18      71
21      72
12      73
21      74
12      74
12      76
12      76
12      77
21      78
15      79
12      80
21      81
15      82
21      83
21      84
21      84
24      85
15      85
24      86
21      86
24      87
21      87
21      87
24      88
24      90
24      90
24      90
21      90
18      90
18      91
15      91
24      92
24      92
21      92
21      92
21      92
18      92
24      93
24      93
18      93
15      93
24      94
24      94
24      95
24      96
18      96
21      97
18      98
96      99
96      100
96      99
96      98
96      97
96      100

   ;


proc nlin  data=fungi;
 	parms   Pmax=98 teta=15 ;d=6 ;

 	model germrate = Pmax*(1-(1/(1+((time/teta)**d))));
run;

proc nlin data=fungi method=newton;   
	parameters  Pmax=98 teta=15 ;d=6 ;  
	model germrate = Pmax*(1-(1/(1+((time/teta)**d)))); 
	output out=nlinout predicted=pred l95m=l95mean u95m=u95mean l95=l95ind u95=u95ind; 
run; 
proc print data=nlinout; 
run;

data filler;   
do time = 0 to 96 by 2;     
predict=1;     
output;   
end; 
run;

data fitthis; 
set fungi filler; 
run;

proc nlin data=fitthis method=newton;   
	parameters  Pmax=98 teta=15 ;d=6 ;  
	model germrate = Pmax*(1-(1/(1+((time/teta)**d))));   
	output out=nlinout predicted=pred l95m=l95mean u95m=u95mean; 
run; 

proc print data=nlinout(where=(predict=1)); run;

proc sgplot data=nlinout;

   scatter x=time y=germrate;
   series x=time y=pred;
   band upper=u95mean lower=l95mean x=time ;
   
   run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 17:37:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Errant-graph-when-plotting-predicted-values-from-proc-nlin/m-p/695291#M20631</guid>
      <dc:creator>RobinN</dc:creator>
      <dc:date>2020-10-29T17:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: Errant Graph when ploting predicted values from proc nlin</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Errant-graph-when-plotting-predicted-values-from-proc-nlin/m-p/695293#M20632</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/354468"&gt;@RobinN&lt;/a&gt;&amp;nbsp;, you just need to sort your graph by time before you do the plot. Please see the example below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data fungi;
     input time germrate;
     datalines;
9       0
9       0
9       0
9       0
9       0
9       0
9       0
9       0
12      1
12      1
12      1
9       1
12      2
12      3
12      4
12      4
12      5
12      5
15      11
15      18
15      20
15      21
9       22
15      24
15      27
15      27
9       28
9       28
9       29
9       31
9       33
15      34
15      37
18      43
18      45
18      52
18      52
18      54
15      55
18      58
18      58
18      63
18      71
21      72
12      73
21      74
12      74
12      76
12      76
12      77
21      78
15      79
12      80
21      81
15      82
21      83
21      84
21      84
24      85
15      85
24      86
21      86
24      87
21      87
21      87
24      88
24      90
24      90
24      90
21      90
18      90
18      91
15      91
24      92
24      92
21      92
21      92
21      92
18      92
24      93
24      93
18      93
15      93
24      94
24      94
24      95
24      96
18      96
21      97
18      98
96      99
96      100
96      99
96      98
96      97
96      100

   ;


proc nlin  data=fungi;
 	parms   Pmax=98 teta=15 ;d=6 ;

 	model germrate = Pmax*(1-(1/(1+((time/teta)**d))));
run;

proc nlin data=fungi method=newton;   
	parameters  Pmax=98 teta=15 ;d=6 ;  
	model germrate = Pmax*(1-(1/(1+((time/teta)**d)))); 
	output out=nlinout predicted=pred l95m=l95mean u95m=u95mean l95=l95ind u95=u95ind; 
run; 
proc print data=nlinout; 
run;

data filler;   
do time = 0 to 96 by 2;     
predict=1;     
output;   
end; 
run;

data fitthis; 
set fungi filler; 
run;

proc nlin data=fitthis method=newton;   
	parameters  Pmax=98 teta=15 ;d=6 ;  
	model germrate = Pmax*(1-(1/(1+((time/teta)**d))));   
	output out=nlinout predicted=pred l95m=l95mean u95m=u95mean; 
run; 

proc print data=nlinout(where=(predict=1)); run;

proc sort data = nlinout;
  by time;
run;

proc sgplot data=nlinout;

   scatter x=time y=germrate;
   series x=time y=pred;
   band upper=u95mean lower=l95mean x=time ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Oct 2020 17:36:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Errant-graph-when-plotting-predicted-values-from-proc-nlin/m-p/695293#M20632</guid>
      <dc:creator>djrisks</dc:creator>
      <dc:date>2020-10-29T17:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: Errant Graph when ploting predicted values from proc nlin</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Errant-graph-when-plotting-predicted-values-from-proc-nlin/m-p/695294#M20633</link>
      <description>I meant to say, sort your data instead of sort your graph...</description>
      <pubDate>Thu, 29 Oct 2020 17:39:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Errant-graph-when-plotting-predicted-values-from-proc-nlin/m-p/695294#M20633</guid>
      <dc:creator>djrisks</dc:creator>
      <dc:date>2020-10-29T17:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Errant Graph when ploting predicted values from proc nlin</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Errant-graph-when-plotting-predicted-values-from-proc-nlin/m-p/695296#M20634</link>
      <description>This was quite easy and obvious. Many thanks for your quick help!</description>
      <pubDate>Thu, 29 Oct 2020 17:42:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Errant-graph-when-plotting-predicted-values-from-proc-nlin/m-p/695296#M20634</guid>
      <dc:creator>RobinN</dc:creator>
      <dc:date>2020-10-29T17:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Errant Graph when ploting predicted values from proc nlin</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Errant-graph-when-plotting-predicted-values-from-proc-nlin/m-p/695297#M20635</link>
      <description>You're welcome! When you're doing series and band plots it's best to sort your data beforehand by the variable on the x-axis &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Thu, 29 Oct 2020 17:45:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Errant-graph-when-plotting-predicted-values-from-proc-nlin/m-p/695297#M20635</guid>
      <dc:creator>djrisks</dc:creator>
      <dc:date>2020-10-29T17:45:57Z</dc:date>
    </item>
  </channel>
</rss>

