Date: Mon, 23 Jan 2006 19:35:26 +0100
Reply-To: antoniababe@YAHOO.SE
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: antoniababe@YAHOO.SE
Subject: SV: Re: help with SAS programming
In-Reply-To: <s3d4cab8.030@mail6.amerus.com>
Content-Type: text/plain; charset=iso-8859-1
The independent variables are group and weight
In logistic regression the prob will look like
logit(probability of being alive at time j) = b0 +
b1*weight(at j=1) + b1*weight(at j=2) + ...+
b*weight(at j-1) + b*group
then the weight at each time point is the independent
variable.
--- Jiann-Shiun Huang <Jiann-Shiun.Huang@amerus.com>
skrev:
> Yen:
>
> What are independent variables in your model? I
> suppose that you
> want to use the weights in the three periods before
> the current time.
> If not, let us know what are your independent
> variables.
>
> J S Huang
> 1-515-557-3987
> fax 1-515-557-2422
>
> >>> <antoniababe@YAHOO.SE> 1/23/2006 12:16:48 PM >>>
> Hi,
> Thank you for giving me a so fast solution.
> But I am afraid I don't understand the solution yet.
> I I want to calculate the probability of being
> observed at time j=7 then this prob is based on the
> weights at times 1-6. Do I have to create a new
> variable that contains the weights up to time j-1
> every time I calculate the prob of being observed at
> time j ? I have a dataset of 550 animal and each
> animal is measured at least 20 times. If I want to
> calculate the prob of being alive for each animal at
> each time point then there will many probabilities.
>
> if I use the data you done for and use it im my
> model.
> Should I write
>
> Proc genmod data= weight4;
> > class group week animal;
> > model R = group week wghtL1 week*wghtL1 /
> > link=logit
> > dist=bin;
> > run;
>
>
>
> --- Jiann-Shiun Huang <Jiann-Shiun.Huang@amerus.com>
> skrev:
>
> > Yen:
> >
> > Use the following code to add wghtL1, wghtL2 and
> > wghtL3 to the file.
> > The rest is to write the model according to the
> new
> > variables. The
> > resulting output follows the code.
> >
> > data weight;
> > input Animal $ week Group $ Weight R;
> > cards;
> > 1 1 1 28.4 1
> > 1 2 1 28.6 1
> > 1 3 1 28.7 1
> > 1 4 1 29.7 1
> > 1 5 1 29.9 1
> > 1 6 1 30.1 1
> > 1 7 1 30.9 1
> > ;
> > run;
> >
> > proc sort data=weight;
> > by animal week;
> > run;
> >
> > data Weight4;
> > set weight;
> > wghtL1=lag(weight);
> > wghtL2=lag2(weight);
> > wghtL3=lag3(weight);
> > run;
> >
> > proc print;
> > run;
> >
> > ***** Output *****
> >
> >
> > wght
> > wght wght
> > Obs Animal week Group
> > Weight R L1
> > L2 L3
> >
> > 1 1 1 1
> > 28.4 1 .
> > . .
> > 2 1 2 1
> > 28.6 1 28.4
> > . .
> > 3 1 3 1
> > 28.7 1 28.6
> > 28.4 .
> > 4 1 4 1
> > 29.7 1 28.7
> > 28.6 28.4
> > 5 1 5 1
> > 29.9 1 29.7
> > 28.7 28.6
> > 6 1 6 1
> > 30.1 1 29.9
> > 29.7 28.7
> > 7 1 7 1
> > 30.9 1 30.1
> > 29.9 29.7
> >
> > J S Huang
> > 1-515-557-3987
> > fax 1-515-557-2422
> >
> > >>> <antoniababe@YAHOO.SE> 1/23/2006 10:51:26 AM
> >>>
> > Dear all,
> > I have a dataset like
> >
> > Obs Animal week Group Weight R
> >
> > 1 1 1 1 28.4 1
> > 2 1 2 1 28.6 1
> > 3 1 3 1 28.7 1
> > 4 1 4 1 29.7 1
> > 5 1 5 1 29.9 1
> > 6 1 6 1 30.1 1
> > 7 1 7 1 30.9 1
> >
> >
> > . .
> > . .
> >
> > 33508 550 13 1 28.1 1
> > 33509 550 14 1 28.0 1
> > 33510 550 15 1 29.6 1
> > 33511 550 16 1 28.4 1
> > 33512 550 17 1 29.7 1
> > 33513 550 19 1 28.5 1
> >
> >
> > I want to calculate the probability that for
> example
> > animal 1 is alive at time 4 depends on its weights
> > at
> > time 1, 2 and 3. This is done by using logistic
> > regression as follows
> >
> > Proc genmod data= new;
> > class group week animal;
> > model R = group week weight* week*weight* /
> > link=logit
> > dist=bin;
> > run;
> >
> > My question is how do I write in SAS so that
> weight*
> > contains the values of weight at time 1, 2 and 3.
> > Below is what I tried to do before using the proc
> > logistic.
> >
> > data new;
> > set bdw;
> > by animal;
> > weight*=lag(weight)
> > run;
> >
> > data new looks like
> >
> >
> > Obs Animal week Weight R weight*
> > 1 1 1 28.4 1 .
> > 2 1 2 28.6 1 28.4
> > 3 1 3 28.7 1 28.6
> > 4 1 4 29.7 1 28.7
> > 5 1 5 29.9 1 29.7
> > 6 1 6 30.1 1 29.9
> > 7 1 7 30.9 1 30.1
> > 8 1 8 31.6 1 30.9
> > 9 1 9 31.2 1 31.6
> >
> >
> > If I want to calculate the probability of being
> > alive
> > at time 4, then this prob only depends on weight
> at
> > time 3 and not at time 1 and 2, if I use the data
> > new.
> >
> >
> > Can anyone help me ? I want actually calculate the
> > prob of being alive for every time point.
> >
> > Thanks in advance,
> > Yen
> >
>
|