[R] (no subject)

2014-10-10 Thread Tasnuva Tabassum
I want to get rid of this thread. what to do?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R crash

2013-04-09 Thread Tasnuva Tabassum
I have a generalized linear model to solve. I used package "geepack". When
I use the correlation structure "unstructured", I get a messeage that- R
GUI front-end has stopped working. Why this happens? What is the solution?
The r codes are as follows:
a<-read.table("d:/bmt.txt",header=T")
cutoffs<-c(1.75,3.34,5.09,6.93,9.11,11.8,15.3,20.1,23.7,27.3,30.9,34.3,37.6,41.5,46.5,51.1,57,63,73.1,93.68)
a$icr <- REL
library(pseudo)
pseudo <- pseudoci(time=a$TIME,event=a$icr,tmax=cutoffs)

#rearranging data
b <- NULL
 for(it in 1:length(pseudo$time)){
 b <- rbind(b,cbind(a,pseudo = pseudo$pseudo[[1]][,it],
 tpseudo = pseudo$time[it],id=1:nrow(a)))
 }
 b <- b[order(b$id),]


 library(geepack)

fit3 <-  geese(pseudo ~ as.factor(AGE) + as.factor(WEIGHT) +
as.factor(HEIGHT) ,
data =b, id=id, jack = TRUE, scale.fix=TRUE,
mean.link = "logit", corstr="unstructured")

#The results using the AJ variance estimate
cbind(mean = round(fit3$beta,4), SD = round(sqrt(diag(fit3$vbeta.ajs)),4),
Z = round(fit3$beta/sqrt(diag(fit3$vbeta.ajs)),4),
PVal = round(2-2*pnorm(abs(fit3$beta/sqrt(diag(fit3$vbeta.ajs,4))

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] confidence interval calculation for gee

2013-04-07 Thread Tasnuva Tabassum
Hello,
I have the following r-codes for solving a quasilikelihood estimating
equation:

>library(geepack)
>fit<-geese(y~x1+x2+x3,jack=TRUE,id=id,scale.fix=TRUE,data=dat,mean.link =
"logit", corstr="independence")


Now my question is how can I calculate the confidence interval of the
parameters of the above model "fit"?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Confidence Interval Calculation

2013-04-07 Thread Tasnuva Tabassum
Hello,
I have the following r-codes for solving a quasilikelihood estimating
equation:

>library(geepack)
>fit<-geese(y~x1+x2+x3,jack=TRUE,scale.fix=TRUE,data=dat,mean.link =
"logit", corstr="independence")


Now my question is how can I calculate the confidence interval of the
parameters of the above model "fit"?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help on indicator variables

2013-03-22 Thread Tasnuva Tabassum
Thanks all. you guys are really helpful.


On Fri, Mar 22, 2013 at 2:48 PM, peter dalgaard  wrote:

> What Bill says, plus the fact that the default handling of logicals in
> modelling is to convert them to factors and then use treatment contrasts,
> which will effectively give you the right indicator variables automagically
> (This in contrast to SAS where you can confuse yourself by declaring a 0/1
> variable as a CLASS variable):
>
> > cond <- rep(c(TRUE, FALSE),4)
> > y <- rnorm(8)
> > lm(y~cond)
>
> Call:
> lm(formula = y ~ cond)
>
> Coefficients:
> (Intercept) condTRUE
> -0.5741   1.1845
>
> > lm(y~as.numeric(cond))
>
> Call:
> lm(formula = y ~ as.numeric(cond))
>
> Coefficients:
>  (Intercept)  as.numeric(cond)
>  -0.57411.1845
>
>
> On Mar 21, 2013, at 15:49 , William Dunlap wrote:
>
> > I would use a logical variable, with values TRUE and FALSE, instead
> > of a numeric indicator.  E.g., I find the following easier to follow
> >bL <- ABS==1 | DEFF==1
> >if (any(bL)) { do.this() }
> > than
> >bN <- ifelse(ABS == 1 | DEFF == 1, 1, 0)
> >if (any(bN == 1)) { do.this() }
> > The latter leaves me wondering what other values bN might have;
> > the former makes it clear this is a TRUE/FALSE dichotomy.
> >
> > Logicals get converted to numbers (FALSE->0, TRUE->1) when used in
> > arithmetic so you can do, e.g., mean(bL) to see what proportion of
> > your cases satisfy the condition.
> >
> > Bill Dunlap
> > Spotfire, TIBCO Software
> > wdunlap tibco.com
> >
> >
> >> -Original Message-
> >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf
> >> Of Tasnuva Tabassum
> >> Sent: Thursday, March 21, 2013 6:03 AM
> >> To: R help
> >> Subject: [R] Help on indicator variables
> >>
> >> I have two indicator variables ABS and DEFF. I want to create another
> >> indicator variable which will take value 1 if either ABS=1 or DEFF=1.
> >> Otherwise, it will take value 0. How can I make that?
> >>
> >>  [[alternative HTML version deleted]]
> >>
> >> __
> >> R-help@r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> --
> Peter Dalgaard, Professor
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd@cbs.dk  Priv: pda...@gmail.com
>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Help on indicator variables

2013-03-21 Thread Tasnuva Tabassum
I have two indicator variables ABS and DEFF. I want to create another
indicator variable which will take value 1 if either ABS=1 or DEFF=1.
Otherwise, it will take value 0. How can I make that?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Comparing Cox model with Competing Risk model

2013-03-17 Thread Tasnuva Tabassum
Thanks.:)


On Sat, Mar 16, 2013 at 12:51 PM, Heinz Tuechler  wrote:

> Dear Terry,
>
> as soon as the vignette is ready, I would be very happy, to know about it.
> Will you send a note to r-help, or will it be announced in some other way?
>
> best regards,
>
> Heinz
>
>
> On 08.03.2013 15:12, Terry Therneau wrote:
>
>> -- begin included message --
>> I have a competing risk data where a patient may die from either AIDS or
>> Cancer. I want to compare the cox model for each of the event of interest
>> with a competing risk model. In the competing risk model the cumulative
>> incidence function is used directly.
>>
>> -end inclusion ---
>>   If you do want to persue the Fine-Gray model I would suggest using
>> software that already exists.  Find the "Task Views" tab on CRAN, and
>> follow it to "survival" and then look at the competing risks section.
>> There is a lot to offer.  I would trust it more than rolling your own
>> function.
>>
>>   As an aside, modeling the subdistribution function is ONE way of
>> dealing with competing risks, but not everyone thinks that it is the
>> best way to proceed.  The model corresponds to a biology that I find
>> unlikely, though it makes for nice math.  Since the alternative is
>> discussed in a vignette that I haven't-yet-quite-written we won't persue
>> that any further, however. :-)
>>
>> Terry Therneau
>>
>> __**
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/**listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/**posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Comparing Cox model with Competing Risk model

2013-03-07 Thread Tasnuva Tabassum
I have a competing risk data where a patient may die from either AIDS or
Cancer. I want to compare the cox model for each of the event of interest
with a competing risk model. In the competing risk model the cumulative
incidence function is used directly. I used the jackknife (pseudovalue) of
the cumulative incidence function for each cause (AIDS or Cancer) in a
generalized estimating equation. I used the following code:

>library(pseudo)
>cutoffs<-c(0.5,5.5,10.5,15.5)
>pseudo<-pseudoci(time,event,tmax=cutoffs)
>library(geepack)
>fit<-geese(pseudo~as.factor(Age)+as.factor(Sex),data=b,id=id, jack = TRUE,
scale.fix=TRUE,
mean.link = "logit", corstr="independence").



I want to know whether I am doing the right thing?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Choosing Grid points for computing Cumulative Incidence Function

2013-02-27 Thread Tasnuva Tabassum
I have a competing risk data where two risks: relapse and death can be
considered as responsible for the failure of treatment.

 I want to find the cumulative incidence function for each of the risk, at
10 grid points. How can I choose the grid points from the continuous
 lifetime variable TIME?

What will happen if I choose more than 10 grid points?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Merging value labels into indicator variable.

2013-02-26 Thread Tasnuva Tabassum
Thanx all, I found my answer. I prefer Peter's second solution.


On Tue, Feb 26, 2013 at 11:59 PM, Berend Hasselman  wrote:

>
> On 26-02-2013, at 18:45, Tasnuva Tabassum  wrote:
>
> > I have a vaiable named NAM having value : 1,2,3,4,5,6,7,8,9.  I want to
> > make an indicator variable that will take value 1 if NAM=7 or NAM=8 or
> > NAM=9. How can I do that?
> > I usually do: Var001<- ifelse(NAM==7,1,0) for the simplest case.
>
>
> How about
>
> Var001<- ifelse(NAM>=7 &  NAM<=9,1,0)
>
>
> Berend
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Merging value labels into indicator variable.

2013-02-26 Thread Tasnuva Tabassum
I have a vaiable named NAM having value : 1,2,3,4,5,6,7,8,9.  I want to
make an indicator variable that will take value 1 if NAM=7 or NAM=8 or
NAM=9. How can I do that?
I usually do: Var001<- ifelse(NAM==7,1,0) for the simplest case.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Selecting First Incidence from Longitudinal Data

2013-02-23 Thread Tasnuva Tabassum
Hi
Thank you very much, but I forgot to tell that I also want to include the
patients for which no complication occurred. That is, for my data I want to
include patient no. 4, for which the COMPL value will be 0.

In that case, what R function should I write?


On Sat, Feb 23, 2013 at 12:23 PM, Xiaogang Su  wrote:

> My bad. I didn't try it out with the real data. Here you go. HTH, X
>
> dat <- read.table(text="
> IDCOMPL  SEX  HEREDITY
> 10  1  2
> 10  1  2
> 13  1  2
> 20  0  1
> 21  0  1
> 22  0  1
> 22  0  1
> 30  0  1
> 30  0  1
> 30  0  1
> 30  0  1
> 32  0  1
> 40  1  2
> 40  1  2
> ", header = TRUE)
>
> dat0 <- dat[dat$COMPL!=0, ]
> dat0$sequence <- as.vector(unlist(lapply(aggregate(dat0$ID,
> by=list(dat0$ID),FUN=length)$x, FUN=function(x){seq(1, x)})))
> dat0 <- dat0[dat0$sequence==1, ]
> dat0
>
>
>
> On Sat, Feb 23, 2013 at 2:09 PM, arun  wrote:
>
>> HI,
>> Tried your approach:
>>
>>
>>  dat1$sequence <- as.vector(unlist(lapply( aggregate(dat1$ID,
>> by=list(dat1$ID),FUN=length)$x, FUN=function(x){seq(1, x)})))
>>  dat0 <- dat1[dat1$sequence==1 & dat1$COMPL!= 0, ] #your second solution
>>  dat0
>> #[1] ID   COMPLSEX  HEREDITY sequence
>> #<0 rows> (or 0-length row.names)
>>
>>
>> dat1[dat1$sequence==1,] #here the OP wanted first incidence where COMPL!=0
>> #   ID COMPL SEX HEREDITY sequence
>> #1   1 0   121
>> #4   2 0   011
>> #8   3 0   011
>> #13  4 0   121
>> A.K.
>>
>>
>>
>> - Original Message -
>> From: Xiaogang Su 
>> To: Rui Barradas 
>> Cc: r-help@r-project.org
>> Sent: Saturday, February 23, 2013 2:15 PM
>> Subject: Re: [R] Selecting First Incidence from Longitudinal Data
>>
>> Try this:
>> dat$sequence <- as.vector(unlist(lapply( aggregate(dat$ID, by=list(x),
>> FUN=length)$x, FUN=function(x){seq(1, x
>> dat0 <- dat[dat$sequence==1, ]
>>
>> HTH, X
>>
>>
>> On Sat, Feb 23, 2013 at 1:07 PM, Rui Barradas 
>> wrote:
>>
>> > Hello,
>> >
>> > You can use ?aggregate and ?head to do what you want. Try the following.
>> >
>> >
>> >
>> > dat <- read.table(text="
>> >
>> > IDCOMPL  SEX  HEREDITY
>> > 10  1  2
>> > 10  1  2
>> > 13  1  2
>> > 20  0  1
>> > 21  0  1
>> > 22  0  1
>> > 22  0  1
>> > 30  0  1
>> > 30  0  1
>> > 30  0  1
>> > 30  0  1
>> > 32  0  1
>> > 40  1  2
>> > 40  1  2
>> > ", header = TRUE)
>> >
>> > aggregate(. ~ ID, data = subset(dat, COMPL != 0), head, 1)
>> >
>> >
>> > Hope this helps,
>> >
>> > Rui Barradas
>> >
>> > Em 23-02-2013 14:28, Tasnuva Tabassum escreveu:
>> >
>> >  I have a longitudinal competing risk data of the form:
>> >>
>> >> IDCOMPL  SEX   HEREDITY
>> >> 1 0   1  2
>> >> 1 0   1  2
>> >> 1 3   1  2
>> >> 2 0   0  1
>> >> 2 1   0  1
>> >> 2 2   0  1
>> >> 2 2   0  1
>> >> 3 0   0  1
>> >> 3 0   0  1
>> >> 3 0   0  1
>> >> 3 0   0  1
>> >> 3 2   0  1
>> >> 4 0   1  2
>> >> 4 0   1  2.
>> >>
>> >> Where, COMPL= health complication of diabetic patients which has value
>> >> labels   as  0= no complication,1=coronary heart disease,
>> 2=retinopathy,
>> >> 3=
>> >> nephropathy.
>> >>
>> >>
>> >> I want to select only the first complication that occurred to each
>> >> patient.
>> >> What R function can I use?
>> >>
>> >> [[alternative HTML version deleted]]
>> >>
>> >> __**
>> >> R-help@r-project.

[R] Selecting First Incidence from Longitudinal Data

2013-02-23 Thread Tasnuva Tabassum
I have a longitudinal competing risk data of the form:

IDCOMPL  SEX   HEREDITY
1 0   1  2
1 0   1  2
1 3   1  2
2 0   0  1
2 1   0  1
2 2   0  1
2 2   0  1
3 0   0  1
3 0   0  1
3 0   0  1
3 0   0  1
3 2   0  1
4 0   1  2
4 0   1  2.

Where, COMPL= health complication of diabetic patients which has value
labels   as  0= no complication,1=coronary heart disease, 2=retinopathy, 3=
nephropathy.


I want to select only the first complication that occurred to each patient.
What R function can I use?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Calculating Cumulative Incidence Function

2013-02-05 Thread Tasnuva Tabassum
Hello,
I have a problem regarding calculation of Cumulative Incidence Function.
The event of interest is failure of bone-marrow transplantation, which may
occur due to relapse or death in remission. The data set that I have
consists of- lifetime variable, two indicator variables-one for relapse and
one for death in remission, and the other variables are donor type (having
3 categories), disease type(having 3 categories), disease stage(having 3
categories) and karnofsky score (having 2 categories).

I want to create an R function for cumulative incidence function for the
event (failure of bone-marrow transplantation) due to relapse (cause-1) and
also for the event (failure of bone-marrow transplantation) due to death in
remission (cause-2). Can anyone help me please?
Tas.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Cumulative Incidence Function and Pseudovalue

2013-02-01 Thread Tasnuva Tabassum
Hi,
I want to write own R functions for cumulative incidence function and also
for the pseudovalue of the cumulative incidence function.
Can you help me?
Tas.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.