Calcite | Level 5

## How to fit nonlinear models with heterogeneous variance?

I have two variables. Independent Variable: ALT; and dependent variable: IL.
I would like to fit the following nonlinear model -> IL = 100 * (1-exp (-c * ALT)). I was using the following procedure:

``````PROC NLIN DATA=TEST METHOD=DUD;
PARAMETERS c=0.036;
MODEL IL=100*(1-exp(-c*ALT));
RUN;``````

However, as can be seen from the figure below, the data variance is heterogeneous:

What procedure to use to fit the model considering heterogeneous variance?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

5 REPLIES 5
Super User

Opal | Level 21

## Re: How to fit nonlinear models with heterogeneous variance?

Quantile regression, as suggested by @Ksharp  is a great idea. But it can't fit general non-linear relationships. You can turn your problem into a linear one by fitting

log(1-IL/100) = -c*ALT

by quantile regression. Do this by defining the new variable Z = log(1-IL/100) in a new dataset and fit with

model Z = ALT;

in proc quantreg.

Please tell us if this worked. Good luck!

PG
Calcite | Level 5

## Re: How to fit nonlinear models with heterogeneous variance?

Thank you for your response @Ksharp and @PGStats .
I know that you mean, but I would like to fit nonlinear models that same form which Littel (2006) show in your book with linear models. For example, for to fit heterogenous variance in linear models, he use an variance function for the following linear model: y = a + bx; with followling procedure:

``````proc nlmixed data=LR;
parms a=4.5 b=7.5 c=.01 sig2=5;
mean = a+b*x;
model y ~ normal(mean,sig2*exp(c*x));
predict mean out=mean df=16;
run;``````

The variance function is Var = σ²exp{xγ};
where σ² = sig² and γ = c.

I would like to know if I could use this same procedure for nonlinear models. And what function of variance could I use in place of σ²exp{xγ}.

REFERENCE

Littell, Ramon C., George A. Milliken, Walter W. Stroup, Russell D. Wolfinger, and Oliver Schabenberger. 2006. SAS® for Mixed Models, Second Edition. Cary, NC: SAS Institute Inc.

Super User

## Re: How to fit nonlinear models with heterogeneous variance?

proc nlmixed is for MIXED model. But yours is GLM .

I think you could try PROC GENMOD , in which you can customize variance function or marginal distribution.

or @Rick_SAS  might have some good ideas .

SAS Super FREQ

## Re: How to fit nonlinear models with heterogeneous variance?

Personally, I'd follow the advice of @PGStats .  If the problem did not easily transform to a linear model, I'd use iterative reweighted least squares in PROC NLIN. There is an example in the doc that shows how to use the _WEIGHT_ variable to handle heteroskedastic data.

Discussion stats
• 5 replies
• 927 views
• 2 likes
• 4 in conversation