Programming the statistical procedures from SAS

NLMIXED procedure

Reply
Frequent Contributor
Posts: 81

NLMIXED procedure

Dear all,

I have a data set like this;

ID Sex Age Weight

1    F    10      20

1    F    22      60

2    M    9       15

2    M   18      54

I'm trying to estimate a Brody growth function parameters (a,b and k) using nlmixed procedure;

How can i estimate Brody parameters for each sex, and how can i found significantly difference or non-significantly between them for each of the parameters?

The Brody function is:

y=a[1- {b*exp(-k*t)}]+e

y=observation (Weight)

exp=natural logarithms

t=Age

e= Residual

I used SAS9.1.3., could anyone please help me with that?

Thanks alot.

Zana

Super Contributor
Posts: 287

Re: NLMIXED procedure

You can do something like this:

proc nlmixed data=mydata ;

  parms amu=72, bmu=2.5, kmu=0.15,asigma=0.2,bsigma=0.02,ksigma=0.02,difa=0,difb=0,difk=0,error=0.1;

  bounds amu>0,bmu>0,kmu>0,error>0,asigma>0,bsigma>0,ksigma>0;

  mean=a*(1- (b*exp(-k*age)));

  model weight~normal(mean,error);

  random a b k ~ normal ([amu+sex*difa,bmu+sex*difb,kmu+sex*difk],[asigma,0,bsigma,0,0,ksigma]) subject=id;

run;

Here I assume that a,b and k is normal distrubuted with same variance, and I model it so that the difference in the meanvalue is a parameter to be estimated. Then you get in the output window the statistical test of whether the differences (difa,difb and difk) is zero. I recoded the sex-variable to be 0 or 1 instead of F or M.

Frequent Contributor
Posts: 81

Re: NLMIXED procedure

Thanks Jac, but this program have an error so i can't found any output.

ERROR: Quadrature accuracy of 0.000100 could not be achieved with 31 points.  The achieved accuracy was 1.000000.

NOTE: PROCEDURE NLMIXED used (Total process time):

      real time           9.79 seconds

      cpu time            9.79 seconds

In the other hand, i know about parameters (a,b & k). I expect nearly a=40, b=0.5 and k=0.01. So, i think they can't have the same variance.

Thanks for your kind.

Zana

Super Contributor
Posts: 287

Re: NLMIXED procedure

You can try make a fixed-effect version of the model in order find good starting values for the meanvalues in the random-effect model. That may help you solve the convergence problem.

I got the suggested program to Work, but that was on a simulated dataset. I therefore knew some good startingvalues for the variance-parameters. But these values may not Work good for your data.

Frequent Contributor
Posts: 81

Re: NLMIXED procedure

Dear Jacob, thank you so much. Please see my attached data file, and let me i have your idea about that.

Tanks for your kind.

Zana

Attachment
Super Contributor
Posts: 287

Re: NLMIXED procedure

Sorry, I couldn't get it to converge either when I used your data. I suspect that the parameters are too Associated with each other. When I only had "a" as a mixed effect then I could get it to converge.

Your were right that the variances are not the same for the three parameters - that was also not what I meant, I was just very unprecise. I meant equal variance across gender.

Respected Advisor
Posts: 2,655

Re: NLMIXED procedure

One thing that often helps with non-convergence is a reparameterization or a rescaling of the variables. With the initial values of a and k differing by 4 orders of magnitude, and initial estimates of variance for the parameters being at least that far off, consider rescaling Age as Age/100, and increasing the initial value of k to 1.

Also, consider ridging.  Rather than the default quasi-Newton optimizer, consider using TECH=NRRIDG in the PROC NLMIXED statement.

Steve Denham

Ask a Question
Discussion stats
  • 6 replies
  • 720 views
  • 0 likes
  • 3 in conversation