demog: ~~function to do ... ~~

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

~~ A concise (1-5 lines) description of what the function does. ~~

Usage

1
demog(t, int = 1)

Arguments

t

~~Describe t here~~

int

~~Describe int here~~

Details

~~ If necessary, more details than the description above ~~

Value

~Describe the value returned If it is a LIST, use

comp1

Description of 'comp1'

comp2

Description of 'comp2'

...

Note

~~further notes~~

~Make other sections like Warning with Warning .... ~

Author(s)

~~who you are~~

References

~put references to the literature/web site here ~

See Also

~~objects to See Also as help, ~~~

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function(t,int=1){
	if(int>1){t<-round(t/int);}
	t<-sort(t); t.rle<-rle(t); d<-px<-lx<-c();
	ts<-1:max(t.rle$values);
	for(i in ts){
		
		j<-match(i,t.rle$values);
		if(is.na(j)){d<-c(d,0);}else{d<-c(d,t.rle$lengths[j]);}
	}
	for(i in ts) {
		lx<-c(lx,(sum(d)-sum(d[1:i]))/sum(d));
	}
	for(i in ts) {px<-c(px,lx[i+1]/lx[i]);}
	ux<- -log(px); ux[is.infinite(ux)]<-NA; lnux<-log(ux); lnux[is.infinite(lnux)]<-NA;
	out<-cbind(ts,d,lx,px,ux,lnux);
	colnames(out)<-c("time","deaths","lx","px","ux","lnux");
	data.frame(out);
  }

Survomatic documentation built on May 2, 2019, 4:09 p.m.

Related to demog in Survomatic...