Calcite | Level 5

## How to define class-like variable in PROC NLMIXED?

I'm trying to model the some variable according to the normal distribution with the following parameters:

- It has some mean, depending on in which class it is (for this I have the indicator variables V3,V4,V5,V6 which for each entry one is 1, the others are 0) and some variance depending on a few parameters: the group, subgroup, device and method. Now all these have some normal distribution with mean 0 and unknown variance (it is the variance that I want to model), but all groups are identically distributed (so group 1 and 2 follow the same distribution), but within a group all values are the same (so the contribution that being in group 1 yields to every sample in the group is the same). In total I get

V2 = mean + variance caused by group + variance caused by subgroup + variance caused by device + variance caused by method

Where all variances are stochastic and assumed to be normal(0,x) where I want to find the 4 x's..

I wanted to do this with proc NLmixed and classifying the group,subset,device,method as class variables, but that doesn't exist... so my question is how to deal with this problem? The code I have is

PROC NLMIXED DATA=para1;

PARMS a = 0.00001, b = 0.000001, c = 0.000001,d = 0.000001,e = 0.000001;
mu = a + b*V3 + c*V4 + d*V5 + e*V6;
sigma = ???;
MODEL V2 ~ Normal(mu,sigma);
RUN;

where if I take for example sigma=0.00001 I can find the a,b,c,d,e I'm looking for, but I also want to estimate the variances.

Pyrite | Level 9

## Re: How to define class-like variable in PROC NLMIXED?

@Ajktulm wrote:

I'm trying to model the some variable according to the normal distribution with the following parameters:

- It has some mean, depending on in which class it is (for this I have the indicator variables V3,V4,V5,V6 which for each entry one is 1, the others are 0) and some variance depending on a few parameters: the group, subgroup, device and method. Now all these have some normal distribution with mean 0 and unknown variance (it is the variance that I want to model), but all groups are identically distributed (so group 1 and 2 follow the same distribution), but within a group all values are the same (so the contribution that being in group 1 yields to every sample in the group is the same). In total I get

V2 = mean + variance caused by group + variance caused by subgroup + variance caused by device + variance caused by method

Where all variances are stochastic and assumed to be normal(0,x) where I want to find the 4 x's..

I wanted to do this with proc NLmixed and classifying the group,subset,device,method as class variables, but that doesn't exist... so my question is how to deal with this problem? The code I have is

PROC NLMIXED DATA=para1;

PARMS a = 0.00001, b = 0.000001, c = 0.000001,d = 0.000001,e = 0.000001;
mu = a + b*V3 + c*V4 + d*V5 + e*V6;
sigma = ???;
MODEL V2 ~ Normal(mu,sigma);
RUN;

where if I take for example sigma=0.00001 I can find the a,b,c,d,e I'm looking for, but I also want to estimate the variances.

See example 82.6:

https://support.sas.com/documentation/onlinedoc/stat/141/nlmixed.pdf

Discussion stats