[R] date and time functions

2010-01-27 Thread Robert Kalicki
Dear R community

I would like to perform some statistical analysis on a data set containing
the following items: date, time, index of observation and various
covariates.

The date and time are originally extracted in the following format:
dd.mm.  and hh:mm:ss respectively. R and more precisely the function
read.table() seems to read the data properly. In a second step, I would like
to sort and subset the data according to daytime, day of the week, month,
season but I get into trouble when trying to use the built-in functions with
this format.

Which is the most convenient date and time format in R to perform such kind
of work?

Is there any specific, powerful and well documented package containing
various date and time functions?

 

Many thanks in advance

 

Best regards

 

___
Robert M. Kalicki, MD

Postdoctoral Fellow

Department of Nephrology and Hypertension

Inselspital

University of Bern

Switzerland



Address:

Klinik und Poliklinik für Nephrologie und Hypertonie

KiKl G6

Freiburgstrasse 15

CH-3010 Inselspital Bern



Tel +41(0)31 632 96 63

Fax+41(0)31 632 14 58




[[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] post-hoc test with kruskal.test()

2009-10-14 Thread Robert Kalicki
Dear R users,

I would like to know if there is a way in R to execute a post-hoc test
(factor levels comparison, like Tukey for ANOVA) of a non-parametric
analysis of variance with kruskal.test() function. I am comparing three
different groups. The preliminary analysis using the kruskal-wallis-test
show significance, but I still don't know the relationship and the
significance level between each group?

 

Do you have any suggestion?

 

Many thanks in advance!

 

Robert

 

 

___
Robert M. Kalicki, MD

Postdoctoral Fellow

Department of Nephrology and Hypertension

Inselspital

University of Bern

Switzerland



Address:

Klinik und Poliklinik für Nephrologie und Hypertonie

KiKl G6

Freiburgstrasse 15

CH-3010 Inselspital Bern



Tel +41(0)31 632 96 63

Fax+41(0)31 632 14 58




[[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] Integrating a function

2007-11-06 Thread Robert Kalicki
Hello everybody!

I have problems with integrating my function.

My primary function is a “survival function” of the following type:

surviv - exp(-k*x)/(1+exp(alpha*(x-tau)))

I would like to integrate this function over a defined range and obtain a
vector with all the values from integrate(surviv, 0, x) for x - 1:N. 

I unfortunately obtain just a scalar value corresponding to the last
integrated x.

How do I have to proceed if I want to obtain a vector with all the results?

I have tried to solve this problem by adding a “while loop”. It works but
the expression becomes to complex if I want to perform further optimization.

Have any one a solution for this problem?

Thanks a lot in advance.

 

Example

# General equation

beta1 - 0.001

beta2 - 0

Hct0 - 0.27

tau - 70

k - 0.001

alpha - 0.3

T2 -40

 

step - function(x){

   if(x=0) step - 1

   else step - 0

}

 

   Nmax - 250

   n - 1

  while(nNmax){

 surviv - function(n){

surviv - exp(-k*n)/(1+exp(alpha*(n-tau)))

 }

 

 geq - function(n){

geq -
Hct0+beta1*as.integer(integrate(surviv,0,n)[1])+step(n-T2)*(beta2-beta1)*as.
integer(integrate(surviv,0,n-T2)[1])

 }

plot(n, geq(n), type=p, pch=19, xlim=c(0,250),
ylim=c(0.25,0.35), xlab=time in days, ylab=Hct)

par(new=T)

print(c(n, surviv(n), geq(n),
as.integer(integrate(surviv,0,n)[1]))

   n - n + 1

   }

 

 

Robert M. Kalicki, MD

Department of Nephrology and Hypertension

University of Bern

 

Abteilung für Nephrologie und Hypertonie (KiKl G5)

Freiburgstrasse 15

CH-3010 Inselspital

 

Tel: +41316329663

Fax:+41316329734

 


[[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.