Re: [R] retrieve p-value from a cox.obj

2007-08-31 Thread Bernardo Rangel Tura
On Wed, 2007-08-29 at 08:40 -0700, clearsky wrote:
> I have a cox.obj named obj, 
> obj <- coxph( Surv(time, status) ~ group, surv.data)
> now I want to retrieve the p-value from obj, so that I can run this hundreds
> of times and plot out the distribution of the p-value. could anyone tell me
> how to get p-value from obj?
> 
> thanks,
Hi Clearsky

try: summary(obj)$waldtest[3]


-- 
Bernardo Rangel Tura, M.D,Ph.D
National Institute of Cardiology
Brazil

__
R-help@stat.math.ethz.ch 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] Sequential Rank Test

2007-08-27 Thread Bernardo Rangel Tura
Hi R-Masters


I need use a sequential approach in serie of cases, but may data  is not
normal.

If data is normal distribution is very easy create analysis using
likelihood ratio like of Wald test.

But in my case I need use a non-parametric test (Mann-Whitney).

I was use:  RSiteSearch("sequential rank test") but not solve my
problem.

Do you know routine or package implement sequential rank test in R?

Thanks in advance


-- 
Bernardo Rangel Tura, M.D,Ph.D
National Institute of Cardiology
Brazil

__
R-help@stat.math.ethz.ch 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] Flow Cytometry Standard, fcs format in R.

2007-07-16 Thread Bernardo Rangel Tura
On Fri, 2007-07-13 at 16:06 -0300, Horacio Castellini wrote:
> Hi all.
> How do I extract date from fcs format file with R. I.e I'd like
> make statistical analysis using R-program, but I don't know if there
> are R-packets for fcs format file, and using examples.
> 
> Thanks.

Hi Horacio!

Is possible using rflowcyt or prada available in
http://www.bioconductor.org

In Rnews have article about this:

http://cran.r-project.org/doc/Rnews/Rnews_2006-5.pdf

Bernardo Rangel Tura, MD, Ph.D
National Institute of Cardiology
Rio de Janeiro - Brazil

__
R-help@stat.math.ethz.ch 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] enable-R-shlib ?

2007-04-11 Thread Bernardo Rangel Tura

Hi R Masters!


Recently I migrated to Ubuntu Linux [I a former windows user].

Now I think compile a 64-bit R version for my computer [Turion AMD], but
I not sure if using the configure option --enable-R-shlib.

I note this option is usefull for some GUI like gnomeGui and JGR, but
this will go penalty performace so I ask:

1- I must using this option?

2- If I using this option, have an another option wich i gain performace
[like --enable-Blas]?

Thanks for all






-- 
Bernardo Rangel Tura, M.D, PhD
National Institute of Cardiolgy
Rio de Janeiro - Brasil

__
R-help@stat.math.ethz.ch 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] compile errors with rgl-0.70.570 on FreeBSD

2007-04-08 Thread Bernardo Rangel Tura
On Wed, 2007-04-04 at 21:12 +0200, Rainer Hurling wrote:
> Thank you for your work on rgl.
> 
> Reading in another thread about your new (inofficial) version of rgl 
> (see below) I tried it with R version 2.5.0 alpha (2007-03-31 r40986) 
> under FreeBSD 7.0-CURRENT. Unfortunately I got the following error:
> 
> ---
> #R CMD INSTALL rgl_0.70.570.tar.gz
> * Installing to library '/usr/local/lib/R/library'
> * Installing *source* package 'rgl' ...
> checking for libpng-config... yes
> configure: using libpng-config
> configure: using libpng dynamic linkage
> checking for X... libraries /usr/X11R6/lib, headers /usr/X11R6/include
> checking GL/gl.h usability... no
> checking GL/gl.h presence... no
> checking for GL/gl.h... no
> checking GL/glu.h usability... no
> checking GL/glu.h presence... no
> checking for GL/glu.h... no
> configure: error: missing required header GL/gl.h
> ERROR: configuration failed for package 'rgl'
> ** Removing '/usr/local/lib/R/library/rgl'
> ** Restoring previous '/usr/local/lib/R/library/rgl'
> ---

Rainer,

I have same problem in my Ubuntu.
I solve instaling OpenGl in system, in my case I install this debian
poackages:

freeglut3, freeglut3-dev, libgl1-mesa-dev, libglu1-mesa-dev, libice-dev,
libsm-dev, libx11-dev, libxau-dev, libxdmcp-dev, libxext-dev, libxt-dev,
mesa-common-dev, x11proto-core-dev, x11proto-input-dev, x11proto-kb-dev,
x11proto-xext-dev, xlibmesa-gl-dev and xtrans-dev

If you install similar packages in your system  I think your problem
will be solve.

-- 
Bernardo Rangel Tura, M.D, PhD
National Institute of Cardiolgy
Rio de Janeiro - Brasil

__
R-help@stat.math.ethz.ch 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] error installing packages

2007-03-20 Thread Bernardo Rangel Tura
On Wed, 2007-03-07 at 09:33 -0800, Bricklemyer, Ross S wrote:
> I was finally able to get R to 'configure', 'make', and 'install' on Mandriva 
> 2007.  Itried to install gnomeGUI and I received an error.  See below.  At 
> what step do I make R a shared library?  Where did I go wrong?
> 
> Ross
> 
> ==
> downloaded 74Kb
> 
> * Installing *Frontend* package 'gnomeGUI' ...
> Using R Installation in R_HOME=/usr/local/lib64/R
> R was not built as a shared library
> Need a shared R library
> ERROR: configuration failed for package 'gnomeGUI'
> * Removing '/usr/local/lib64/R/library/gnomeGUI'
> 
> The downloaded packages are in
> /root/tmp/RtmpkHUeyA/downloaded_packages
> Warning message:
> installation of package 'gnomeGUI' had non-zero exit status in: 
> install.packages(c("gnomeGUI"))
> =


Hi Ross!

I use Ubuntu and instaling R using Synaptic. In this software have this
observation about GnomeGUI:

As of R 2.1.0, this interface is no longer provided with the upstream
sources. As such, this package is now an empty stub that will be removed
in a subsequent revision of the Debian package.

So I think  gnomeGUI not instalable in R now...
-- 
Bernardo Rangel Tura,M.D.,Ph.D
National Institute of Cardiology
Rio de Janeiro - Brazil

__
R-help@stat.math.ethz.ch 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] Sigmoidal fitting

2007-03-04 Thread Bernardo Rangel Tura
On Sat, 2007-03-03 at 16:30 -0500, Cressoni, Massimo (NIH/NHLBI) [F]
wrote:
> I am trying to write a function that fits a sigmoid given a X and Y vector 
> guessing the start parameters.
> I use nls. What I did (enclosed) seems to work well with many data points but 
> if I want to fit small
> vectors like :
> 
> pressure <- c(5,15,9,35,45)
> gas <- c(1000,2000,3000,4000,5000)
> 
> it do not work. The help page says that it do no not work on zero residual 
> data.
> 
> Massimo Cressoni

Hi Massimo

I think which this script solve your question

pressure <- c(5,9,15,35,45)
gas <- c(1000,2000,3000,4000,5000)
plot(gas,pressure)
model.1 <- nls(pressure ~ SSlogis(gas, ASym, xmid, scal)))
coef.sig<-coef(summary(model.1))[,1]
est.p<-coef.sig[1]/(1+exp((coef.sig[2]-gas)/coef.sig[3]))
points(gas,est.p,col=2)
----

If you need more help just need a mail


-- 
Bernardo Rangel Tura,M.D.,Ph.D
National Institute of Cardiology
Rio de Janeiro - Brazil

__
R-help@stat.math.ethz.ch 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] prop.trend.test issue

2006-12-04 Thread Bernardo Rangel tura
At 03:55 AM 12/3/2006, Ethan Johnsons wrote:
>I have the clinical study data.
>
>Year 0   Year 3
>Retinol (nmol/L)N   Mean +-sd   Mean +-sd
>Vitamin A group 73  1.89+-0.36  2.06+-0.53
>Trace group57  1.83+-0.31 1.78+-0.30
>
>where N is the number of male for the clinical study.
>
>I want to test if the mean serum retinol has increased over 3 years
>among subjects in the vitamin A group.


If  You desire check mean serum retinol has increased over 3 years in 
vitamin A group.
You may use t.test
Look this example:

#Generate random Data

set.seed(123)
VitA1<-rnorm(73,1.89,.36)
Trace1<-rnorm(57,1.83,0.31)
VitA2<-rnorm(73,2.06,.53)
Trace2<-rnorm(57,1.78,0.30)

# Calculate diference Year 3 - Year 0

dVitA<-VitA2-VitA1
dTrace<-Trace2-Trace1

# Testing diference
t.test(dVitA,dTrace)


 Welch Two Sample t-test

data:  dVitA and dTrace
t = 2.2762, df = 117.746, p-value = 0.02464
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
  0.02756874 0.39659494
sample estimates:
   mean of x   mean of y
  0.15905162 -0.05303022





Bernardo Rangel Tura, MD, Phd
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil

__
R-help@stat.math.ethz.ch 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] Colour-coded Editor for R Code

2006-11-07 Thread Bernardo Rangel tura
At 07:11 AM 11/6/2006, Jon Minton wrote:
>Do any of you know any simple programming editors for R scripts which offer
>basic colour-coding and bracket-matching facilities?
>
>Dregging through scripts to find a missing comma or parentheses is something
>I'd rather do less of...
>
>
>
>Jon Minton

Well

If you use windows I recomend Tinn-R

https://sourceforge.net/projects/tinn-r


Bernardo Rangel Tura, MD, PHD
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil

__
R-help@stat.math.ethz.ch 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] plotCI

2006-09-24 Thread Bernardo Rangel tura
Hi R masters!


I need a Help with plot confidence intervals  for one equation. I use 
library gplots and plotCI command in this script:

require(gplots)

ano <-1980:2002

rf<-exp(91.37162-0.04720281*ano)

ciw.f<-sqrt(1.766073e-08)

plotCI(ano,rf,uiw=ciw.f)



But in the graph not shown the errors bar and  I have this error msg

zero-length arrow is of indeterminate angle and so skipped


Well, where is my eror?


Thanks in advance

Bernardo Rangel Tura, MD, PhD
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil

__
R-help@stat.math.ethz.ch 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] Call for Beta Testers: R+ (read R plus) for Solaris and Linux:

2006-08-14 Thread Bernardo Rangel tura
At 12:21 PM 8/8/2006, [EMAIL PROTECTED] wrote:

>We look forward to hearing your comments and inputs on R+ ... please
>feel free to suggest a final name for our commercially supported R.

I don´t understanding this mail.

Is possible exist a commercial version of R?

If R source is licensed for GPL as free software 
other people can make a commercial version?


[]s
Tura

__
R-help@stat.math.ethz.ch 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] Excel to R

2006-07-15 Thread Bernardo Rangel tura

>Hi peolple!


I have a many excel tables with mode than 100 variables. And I want 
use R to analize that.

But I have a problem, a group of this variables (more than 50) in any 
table is a factor and other part is a number.

Tha factors variables have tha values enconde this form (1=Yes,2=No and 9 = NA)

Well I use this scripts to import the database

require(RODBC)
channel <- odbcConnectExcel("f:/teste.xls")
data <- sqlFetch(channel, "Sheet1")
  summary(data)
qw  ee
  Min.   :1.000   Min.   :1.000
  1st Qu.:1.000   1st Qu.:1.500
  Median :1.000   Median :2.000
  Mean   :1.333   Mean   :2.429
  3rd Qu.:1.750   3rd Qu.:3.500
  Max.   :2.000   Max.   :4.000
  NA's   :1.000


But qw is a factor (and is colnum type isvtext)

Is possible modify my script for this utcome

 > summary(data)
 qw  ee
  1   :4   Min.   :1.000
  2   :2   1st Qu.:1.500
  NA's:1   Median :2.000
   Mean   :2.429
   3rd Qu.:3.500
   Max.   :4.000


Thanks in advance

Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] generalized hypergeometric function

2006-04-15 Thread Bernardo Rangel tura
Hi R-masters

I need compute generalized hypergeometric function.
I look in R-project and R-help list and not find nothing about 
generalized hypergeometric function

Is possible calculate the generalized hypergeometric function?

Somebody have a script for this?



Thanks in advance

Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to compare areas under ROC curves calculated with ROCR package

2006-03-24 Thread Bernardo Rangel tura
At 11:54 AM 3/23/2006, Frank Samuelson wrote:
>The seROC routine you included is an very good approximation to the
>standard error of the Mann-Whitney-Wilcoxon/Area under the ROC curve
>statistic.  It is derived from negative exponential models, but works
>very well in general (e.g. Hanley and McNeil, Diagnostic Radiology,
>1982, v. 143, p. 29).
>A more general estimator of the variance is given by Campbell,
>Douglas and Bailey, Proc. Computers in Cardiology, 1988, p.267)
>I've implemented that in R code included below.   It is not an unbiased
>estimator, but it is very close.
>
>The cROC function is probably not what you want, however.
>It assumes that the data from the two different area measures
>are independent.  You said your measures are "from the same dataset."
>Your different AUC measures will be highly correlated.
>There are a number of methods to deal with correlated ROC curves
>in existence.
>
>If you are interested in performing hypothesis testing on the difference
>in AUC of two parameters, I would suggest a permutation test.
>Permuting the ranks of the data between parameters is
>simple and works well.


Laurent, Jarek, Frank

My routines seROC and cROC was developed based in the paper

A method of comparing the areas under Receiver 
Operating Characteristic curves derived from the same cases.
Hanley JA & McNeil BJ, Radiology 1983 148 839-43

The seROC is calculation of standart error of ROC 
and cROC is calculation of statistical significance for two AUC in same sample.
I don´t documented this rotine but it assume that 
the data from the two different area measures are DEPENDENT.

A dependency of two measure is fix with 
incorporation of Pearson correlation among this measures.

I wait that this information helps yours to fix this problem.

Well... If you s think I can help yours just talk.



Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Hierarchical log-linear models

2006-03-11 Thread Bernardo Rangel tura

Hi R-masters!

I try using package gRbase for fit a Hierarchical log-linear models 
and show as graphical model.


I using data about patients of my Hospital (file sm.csv) and my script  is :


setwd("F:/INCL/TURA")
dados<-read.csv("sm.csv")
attach(dados)
tab1<-table(obesidade,HAS,TG,DM,HDL)
require(gRbase)
dados.g <- as.gmData(tab1)
m2 <-hllm(~obesidade*HAS*TG*DM*HDL,dados.g)
m2.f <- fit(m2,engine="loglm")

Well my doubt is why

dynamic.Graph(m2) is the same model of dynamic.Graph(m2.f)

Where I wrong?



Thanks in advance

Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil obesidade,HAS,TG,DM,HDL,SM
N,S,S,S,S,N
N,S,N,S,S,N
N,S,N,S,N,N
S,S,S,S,S,S
S,S,S,S,S,S
N,S,N,S,S,N
S,S,S,N,S,S
N,S,N,S,S,N
N,N,N,N,S,N
N,N,N,S,S,N
N,S,N,S,N,N
N,N,S,S,S,N
N,S,S,S,S,N
N,S,N,S,S,N
N,S,N,N,S,N
S,S,N,S,S,S
N,S,N,N,S,N
N,S,S,S,S,N
S,S,N,S,N,S
N,S,N,S,S,N
N,S,N,S,S,N
N,S,N,N,S,N
N,S,N,S,S,N
N,S,N,S,N,N
N,S,N,N,N,N
N,S,N,N,S,N
S,S,N,S,N,S
S,S,N,S,N,S
N,N,S,S,N,N
N,S,S,N,S,N
N,N,N,S,S,N
N,S,N,S,S,N
S,S,N,S,S,S
N,S,N,S,N,N
N,S,N,S,S,N
N,S,N,S,N,N
S,S,S,S,N,S
N,S,N,S,S,N
N,S,N,S,N,N
N,S,N,S,S,N
N,S,S,S,S,N
N,S,N,S,N,N
S,S,N,S,N,S
S,S,S,S,S,S
S,S,S,S,N,S
N,N,N,N,S,N
N,S,N,N,S,N
N,S,N,S,N,N
N,N,S,S,S,N
S,S,N,S,S,S
N,S,S,S,N,N
N,N,S,S,N,N
N,N,S,N,S,N
N,S,N,S,S,N
N,S,N,S,S,N
N,S,N,N,S,N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
N,S,N,S,S,N
N,N,N,S,S,N
S,S,S,S,S,S
N,S,N,N,S,N
N,S,N,S,N,N
N,N,N,S,N,N
N,N,N,S,S,N
N,S,S,N,S,N
N,S,S,N,S,N
N,S,N,N,S,N
N,S,N,S,S,N
N,S,N,S,S,N
N,S,N,N,S,N
S,S,S,S,S,S
N,S,S,N,S,N
N,S,S,S,N,N
N,S,N,S,S,N
N,S,N,S,S,N
N,S,N,N,S,N
N,S,S,N,S,N
N,S,S,N,N,N
N,S,S,N,S,N
N,S,N,N,S,N
N,S,N,N,S,N
N,S,N,N,S,N
N,S,N,S,S,N
N,S,N,N,S,N
N,S,N,N,S,N
N,S,N,S,S,N
N,S,N,S,S,N
N,S,S,N,S,N
N,S,N,S,S,N
N,S,N,S,S,N
N,S,N,S,S,N
N,S,N,S,S,N
N,S,N,S,S,N
N,S,N,S,S,N
N,S,N,S,S,N
N,S,N,S,S,N
S,S,N,S,S,S
S,S,N,S,N,S
N,S,N,N,N,N
N,N,S,S,N,N
N,N,N,S,N,N
N,S,N,S,S,N
N,N,N,N,S,N

Re: [R] How can I use r-cran-lmtest?

2006-03-01 Thread Bernardo Rangel tura
At 12:28 AM 3/2/2006, Savio Ramos wrote:
>Hi,
>
>I installed the package r-cran-lmtest in a Debian Sid but I can't 
>use it. I typed "lmtest" but nothing occur.
>
>Any help?
>
>Thanks.


Hi Savio!

The Lmtest is a package for

Testing Linear Regression Models.

This is a organized group of rotines, data files, help files etc abou 
this theme.

for use this package  You have type:

require(lmtest)
help(package="lmtest")



Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Fitdistr and MLE for parameter lambda of Poisson distribution

2006-02-14 Thread Bernardo Rangel tura
At 09:35 AM 2/10/2006, Gregor Gorjanc wrote:
>Hello!
>
>I would like to get MLE for parameter lambda of Poisson distribution. I
>can use fitdistr() for this. After looking a bit into the code of this
>function I can see that value for lambda and its standard error is
>estimated via
>
>estimate <- mean(x)
>sds <- sqrt(estimate/n)
>
>Is this MLE? With my poor math/stat knowledge I thought that MLE for
>Poisson parameter is (in mixture of LaTeX code)
>
>l(\lambda|x) \propto \sum^n_{i=1}(-\lambda + x_iln(\lambda)).
>
>Is this really equal to (\sum^n_{i=1} x_i) / n
>
>--
>Lep pozdrav / With regards,
>  Gregor Gorjanc

Gregor,

If I understood your LaTeX You is rigth.

If you don´t know have a command wich make this for you:  fitdistr()

Look:


 > d<- rpois(50,5)
 > d
  [1]  6  4  6  4  5  5  4 11  7  5  7  3  5 
10  4  9  4  2  4  5  4  4  9  3 10
[26]  4  3  9  6  7  5  4  2  7  3  6  7  8  6  6  3  3  3  2  5  4  3  8  5  7
 > library(MASS)
 > fitdistr(d,"Poisson")
 lambda
   5.320
  (0.3261901)






[]s
Tura

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Coefficient of association for 2x2 contingency tables

2005-12-06 Thread Bernardo Rangel tura
At 04:48 PM 12/6/2005, Alexandre Santos Aguiar wrote:
>Hi,
>
>Found no measure of association or correlation for 2x2 contingency tables in
>fullrefman.pdf or google. Can someone point to a package that implements such
>calculations?
>
>Thanx.
>
>--
>
> Alexandre Santos Aguiar


IN vcd poackage have many measure.
If You Know formulae do do you create a function, example
epitable<-function(exposure, outcome,OR=F,RISK=F)
   {
   tab <- table(exposure, outcome,deparse.level = 2)
   a <- tab[1,1]; b <- tab[1,2]; c <- tab[2,1]; d <- tab[2,2]
   m1<-a+b; m2<-c+d; p1<-a/m1; p2<-c/m2
   if(RISK){
 rr <- (a / (a + b)) / (c / (c + d))
 se.log.rr <- sqrt((b / a) / (a + b) + (d / c) / (c + d))
 lci.rr <- exp(log(rr) - 1.96 * se.log.rr)
 uci.rr <- exp(log(rr) + 1.96 * se.log.rr)
 rd<-p1-p2
 se.rd.mle<-((p1*(1-p1))/m1)-((p2*(1-p2))/m2)
 se.rd.ub<-((p1*(1-p1))/(m1-1))-((p2*(1-p2))/(m2-1))
 lci.rd.mle<- rd - 1.96*se.rd.mle
 uci.rd.mle<- rd + 1.96*se.rd.mle
 lci.rd.ub<- rd - 1.96*se.rd.ub
 uci.rd.ub<- rd + 1.96*se.rd.ub
 }
   if(OR){
 or <- (a / b) / (c / d)
 se.log.or <- sqrt(1 / a + 1 / b + 1 / c + 1 / d)
 lci.or <- exp(log(or) - 1.96 * se.log.or)
 uci.or <- exp(log(or) + 1.96 * se.log.or)
 }
   print(tab)
   chi<-chisq.test(tab,correct=F)
if (OR | RISK){
 cat("_")
 cat("\n   Estimate  95% CI ")
 cat("\n_\n")
 }
if (RISK){
 cat("RR",round(rr,3),"", 
round(lci.rr,3), round(uci.rr,3), "\n")
 cat("RD",round(rd,3),"", 
round(lci.rd.mle,3), round(uci.rd.mle,3), " (MLE)\n")
 cat(" ", round(lci.rd.ub,3), 
round(uci.rd.ub,3), " (UB)\n")}
if (OR){cat("OR", round(or,3), "  ", round(lci.or,3), 
round(uci.or,3), "\n")}
if (OR | RISK){cat("_\n")}
   print(chi)
   }

FA<-rbinom(250,1,.3)
obito<-rbinom(250,1,.1)
epitable(FA,obito,RISK=T)




Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Distribution fitting problem

2005-11-08 Thread Bernardo Rangel Tura
At 10:32 2/11/2005, you wrote:

>I am using the MASS library function
>
>fitdistr(x, dpois, list(lambda=2))
>
>but I get
>
>Error in optim(start, mylogfn, x = x, hessian = TRUE, ...) :
> Function cannot be evaluated at initial parameters
>In addition: There were 50 or more warnings (use warnings() to see the first
>50)
>
>and all the first 50 warnings say
>
>1:  non-integer x = 1.45
>etc
>
>Can anyone tell me what I am doing wrong. p.s. the data was read in from
>a .csv file that I wrote using octave

Mark,

Try fitdistr(x, "Poisson")

I think this is enough for fit Poisson distribuition for your data


Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 


--

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Converting PROC NLMIXED code to NLME

2005-10-08 Thread Bernardo Rangel Tura
At 20:40 7/10/2005, Singh, Jatinder wrote:
>NLME
>
>kidney.nlme<-nlme(model=rtime~
>(event*
>((b1*age+b2*sex+b3*gn+b4*an+b5*pkn+u)+log(delta)+log(gamma)+(gamma-1)*lo
>g(rtime))
>+((-exp(b1*age+b2*sex+b3*gn+b4*an+b5*pkn+u))*delta*(rtime**gamma))
>),
>fixed=list(delta~1,gamma~1,b1~1,b2~1,b3~1,b4~1,b5~1),
>random=u~1|patient,
>start=c(delta=0.03,gamma=1.1,b1=-0.003,b2=-1.2,b3=0.09,b4=0.35,b5=-1.43)
>,
>data=(kidney),
>method="ML",
>na.action=na.include
>)

Hi!

Try change "na.action=na.include" for "na.action=na.omit"

The singularity occurs because the fixed effects matrix is not of full rank 
due to the unused factor levels.




Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 


--

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] missing values in step procedure

2005-10-08 Thread Bernardo Rangel Tura
At 11:11 7/10/2005, you wrote:

>Hi,
>I have the problem that for the step procedure stops due to missing
>values. There are no options in Step or stepAIC to handle missing
>values. Is there any way to run stepwise modelselection in R in an
>automated way in this case?
>
>Here is the last step before it stops. Hope someone knows. Best regards,
>Andreas
>
>Step:  AIC= 1999.16
>  EF ~ SF120_KS + SF120_PS + HADA0 + SOZU0 + LVEDD + logPROBNP +
> ALTER + SD0_01 + ASE_UK + DS140POS + RSQSICH0 + SD0_01:ASE_UK +
> SD0_01:DS140POS + SD0_01:RSQSICH0 + ASE_UK:DS140POS +
>ASE_UK:RSQSICH0 +
> DS140POS:RSQSICH0 + SD0_01:ASE_UK:RSQSICH0 +
>SD0_01:DS140POS:RSQSICH0 +
> ASE_UK:DS140POS:RSQSICH0
>
>Df Sum of Sq RSS AIC
>- SOZU0 1   3.0 25356.0  1997.2
>- HADA0 1   7.6 25360.6  1997.3
>- ALTER 1  13.0 25365.9  1997.4
>- SF120_PS  1  14.7 25367.6  1997.5
>- ASE_UK:DS140POS:RSQSICH0  1  20.1 25373.1  1997.6
>- SD0_01:DS140POS:RSQSICH0  1  44.8 25397.7  1998.0
>- SD0_01:ASE_UK:RSQSICH01  54.4 25407.4  1998.2
>  25352.9  1999.2
>- LVEDD 1 382.2 25735.1  2004.6
>- SF120_KS  1 476.4 25829.3  2006.4
>- logPROBNP 1 891.9 26244.9  2014.4
>Error in step(mod2, direction = "back") :
> number of rows in use has changed: remove missing values?

Andreas

Try

data<-na.omit(original database) before you run step() or stepAIC()




Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil  


--

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Fisher's method in discriminant analysis

2005-09-07 Thread Bernardo Rangel Tura
At 13:15 5/9/2005, you wrote:

>Hi,
>
>   I'm using mda library to solve a discriminant
>analysis. I get results, but the thing is that I want
>to use Fisher's method to obtain the classification
>functions and I'm lost in what I should do: libraries
>to use, ... Can anybody give me a clue??

Hi Carlos,

I think you need something this
require(mda)
data(iris)
attach(iris)
irisfit <- mda(Species ~ ., data = iris)
irisfit$fit$coef[,1:2]
r1<- 
-4.23481161+0.37972423*Sepal.Length+0.59682846*Sepal.Width+0.01575609*Petal.Length+0.11009570*Petal.Width
r2<-0.31169082-0.05826293*Sepal.Length-0.23855482*Sepal.Width+0.18922693*Petal.Length+0.03917652*Petal.Width
plot(r1,r2,pch = 21, bg = c("red", "green3", "blue")[unclass(iris$Species)])




Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil  


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] loglinear model selection

2005-08-30 Thread Bernardo Rangel Tura
Hi R-masters!

I have a problem and need your help.
I have 9 discrete variables with 2 levels each.
In exploratory analisys I generate one matrix with chi-square for tables 
with 2 ariables each with this script

setwd("F:/")
dados<-read.csv("log.csv")[,2:10]
dados.x<-matrix(NA,ncol=9,nrow=9)
for(i in 1:8){
for(j in (i+1):9){
tab<-table(dados[,i],dados[,j])
dados.x[i,j]<-round(as.numeric(chisq.test(tab)$statistic),3)
dados.x[j,i]<-round(as.numeric(chisq.test(tab)$statistic),3)
  }
}
dados.x

The result is:

[,1]   [,2]   [,3]   [,4]   [,5]   [,6]   [,7]  [,8]   [,9]
  [1,]NA  3.589  6.351  3.957  4.269  0.851  2.955 1.188  1.975
  [2,] 3.589 NA  9.664 24.596 12.510 26.284  8.580 3.608  6.574
  [3,] 6.351  9.664 NA 25.054 10.300 12.189 19.811 0.192 11.744
  [4,] 3.957 24.596 25.054 NA 50.032 35.587 22.401 1.950 26.631
  [5,] 4.269 12.510 10.300 50.032 NA 80.876 54.954 0.127 61.573
  [6,] 0.851 26.284 12.189 35.587 80.876 NA 57.346 0.741 49.738
  [7,] 2.955  8.580 19.811 22.401 54.954 57.346 NA 1.520 80.615
  [8,] 1.188  3.608  0.192  1.950  0.127  0.741  1.520NA  0.311
  [9,] 1.975  6.574 11.744 26.631 61.573 49.738 80.615 0.311 NA

Now I need fit a loglinear model with this variables, but I need know have 
a command with generate ALL models with the set this 8 vairables (ALL minus 
[,8]) incluindind the interactions.

Can Anyone Help me?



Thanks in advance

Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R: to the power

2005-07-16 Thread Bernardo Rangel Tura
At 10:11 12/7/2005, [EMAIL PROTECTED] wrote:

>hi all
>
>why does R do this:
>
>(-8)^(1/3)=NaN
>
>the answer should be : -2

Allan

In my computer:
 > (-8)^(1/3)
[1] NaN

 > -8^(1/3)
[1] -2

 > -(8^(1/3))
[1] -2


The problem is -8 or the problem is (-8) ?


[]s
Tura 


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Tree Structured Survival Analysis

2005-06-07 Thread Bernardo Rangel Tura

Hi People!

Have someone  package with: Tree Structured Survival Analysis  in R?


Thanks in advance

Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Problem in lme longitudinal model

2005-05-17 Thread Bernardo Rangel Tura
Hi R-masters!
I trying model Heart disease mortality in my country with a lme model like 
this:

m1.lme<-lme(log(rdeath)~age*year,random=~age|year,data=dados)
where: rdeath is rate of mortality per 10 person per age and year
   age: age of death (22 27 32 37 42 47 52 57 62 67 72 77 82)
   year: year of death (1980:2002)
I don´t have problem to fit  the model, but in residual analysis I have one 
problem.

If i type acf(m1.lme$residuals) the graph show 4 plot with a sin curve (a 
example in attach) and I get this variogram:

> Variogram(m1.lme)
  variog dist n.pairs
1  0.39390651 276
2  0.64864522 253
3  0.96798703 230
4  1.27650944 207
5  1.41581475 184
6  1.42646856 161
7  1.40486087 138
8  1.19026138 115
9  0.96193309  92
10 0.7037427   10  69
11 0.8591257   11  46
12 1.2215657   12  23
Well
I need help for solution this problem
Somebody can help me?
Thanks in advance
Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 

No virus found in this outgoing message.
Checked by AVG Anti-Virus.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] help im lme()

2005-03-31 Thread Bernardo Rangel Tura
Hi R people!
I have a doubt in lme().
I use this model:
m2.lme<-lme(log(cmort)~idade+ano,random=~idade|ano,data=dados)
If i use summary I recive this output:
> summary(m2.lme)
Linear mixed-effects model fit by REML
 Data: dados
   AIC  BIClogLik
  1139.313 1170.554 -562.6563
Random effects:
 Formula: ~idade | ano
 Structure: General positive-definite, Log-Cholesky parametrization
StdDev   Corr
(Intercept) 3.131076e-03 (Intr)
idade   3.515018e-05 -0.042
Residual5.687940e-01
...etc...
I know the value of Residula random effects is m2.lme$sigma but how do I 
find the value of idade or intercept random effects

Thanks in advance
Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] problem with legend

2005-03-19 Thread Bernardo Rangel Tura
I have problem with legend command. Please look this script:
>dcbv.fm
Time Series:
Start = 1980
End = 2002
Frequency = 1
 [1] 2994.023 3388.414 3111.762 2990.967 3077.438 3058.274 3049.934 2974.130
 [9] 2889.659 2801.790 2631.391 2661.700 2312.526 2518.968 2567.044 2443.952
[17] 2117.638 2042.461 2025.816 1939.560 1640.775 1583.609 1659.912
> dcbv.ms
Time Series:
Start = 1980
End = 2002
Frequency = 1
 [1] 3700.239 4076.438 3856.495 3680.345 3871.887 3789.770 3831.173 3768.876
 [9] 3585.572 3754.374 3372.859 3419.667 3185.194 3319.215 3445.845 3265.214
[17] 2773.961 2661.904 2669.835 2569.190 2187.719 2217.756 2196.378
>plot(dcbv.ms,ylim=c(min(dcbv.fm),max(dcbv.ms)))
>lines(dcbv.fm,col=2)
>legend(1984,2500,c("DCVB-MS","DCBV-FM"),col=c(1,2),cex=.6,fill=T)
At end of script the legend of plot have only one color: black. I think the 
legend will have two colors: black and red.

Where I make mistake?
version
 _
platform i386-pc-mingw32
arch i386
os   mingw32
system   i386, mingw32
status
major2
minor0.1
year 2004
month11
day      15
language R
Thanks in advance
Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Database reorganization

2005-03-12 Thread Bernardo Rangel Tura
Hi people,
I need reorganization several databases. I would like to know if that is 
possible in R. My problem is like that:

original data base:
Age x1980   x1981
1   5   8
3   7   9
5   9   15
7   11  20
future data base
yearage x
19801   5
19803   7
19805   9
19807   11
19811   8
19813   9
19815   15
19817   20

Thanks in advance
Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Lecture

2005-02-06 Thread Bernardo Rangel Tura
Hi R-masters!
I you receive an invitation to make a lecture about R in Medical School of 
Federal University of Rio de Janeiro.

 The goal of the lecture is to stimulate the use of R instead of others 
statiscal software in the Medical School.


 It would like to hear tour suggestions on which topics to present in the 
lecture.
Thanks in advance
Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] update.packages

2004-12-31 Thread Bernardo Rangel Tura
Hi R-masters!
First of All: Happy new Year !
I have one doubt. I one time for week command in R update.packages() for 
recive new versions of packages in my R, I also subscribe R-pkgs for recive 
notices of new packages.

But I discover other packages in CRAN without notices in R-pkgs. So How to 
I mantain my R- system update with all packages in CRAN (New versions of my 
packages and install New packages)

Thanks in advance
Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] AUC for logistic regression [was: (no subject)]

2004-12-16 Thread Bernardo Rangel Tura
At 20:21 15/12/2004, Kerry Bush wrote:
Your formula is only a trapzoidal approximation to the
theoretical AUC. It might be downward biased. I am
also wondering if there is a funcion in R that can
compute the MLE estimate for AUC.
Kerry I agree with you. But I dont Know compute the MLE estimate for AUC 
and its standatr error.
Second I dont know MLE(AUC)/SE is normal so I dont konw wich test use.
Third I dont konw compute the correction is necessary because the test in 
same population.

If You explain me this topics I upgrade the funciotn with pleasure.
But same with a possible downward bias the function solve Roman problem...
Thanks in advance
Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] AUC for logistic regression [was: (no subject)]

2004-12-15 Thread Bernardo Rangel Tura
At 17:07 15/12/2004, Spencer Graves wrote:
Dear R-helper,
I would like to compare the AUC of two logistic regression models (same 
population). Is it possible with R ?

Thank you
Roman Rouzier

Roman
If I understand your question You have 2 ROC curve from same dataset. In 
this case you can use a routine create for me :

seROC<-function(AUC,na,nn){
a<-AUC
q1<-a/(2-a)
q2<-(2*a^2)/(1+a)
se<-sqrt((a*(1-a)+(na-1)*(q1-a^2)+(nn-1)*(q2-a^2))/(nn*na))
se
}
cROC<-function(AUC1,na1,nn1,AUC2,na2,nn2,r){
se1<-seROC(AUC1,na1,nn1)
se2<-seROC(AUC2,na2,nn2)
sed<-sqrt(se1^2+se2^2-2*r*se1*se2)
zad<-(AUC1-AUC2)/sed
p<-dnorm(zad)
a<-list(zad,p)
a
}
The first function (seROC) calculate teh standart error of ROC curve, the 
second function (cROC) compare ROC curves .

The parameters:
AUC - area under curve
na - number of positives results
nn - number total tests (positives +negatives)
r - correlation of two numeric variables
Best wishes


Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 

--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] noncommutative addition: NA+NaN != NaN+NA

2004-09-07 Thread Bernardo Rangel Tura
At 06:17 07/09/2004, you wrote:

Hi guys.
Check this out:
 NaN +NA
[1] NaN
 NA + NaN
[1] NA
I thought "+" was commutative by definition.   What's going on?
In my version, both cases is NA:
>  NaN +NA
[1] NA
> NA + NaN
[1] NA
>
R.version
 _
platform i386-pc-mingw32
arch i386
os   mingw32
system   i386, mingw32
status
major1
minor9.1
year 2004
month06
day  21
language R

Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil  
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] Cox regression for prevalence estimates

2004-09-07 Thread Bernardo Rangel Tura
At 09:27 07/09/2004, you wrote:
Bernardo Rangel Tura wrote:
At , The Michaelson Institute wrote:
How can R be used to calculate the prevalence ratios using Cox regression +
robust variance estimates ?
Well,
In Design package have a command: cph
This command have a option "robsut" with default=FALSE, but in help is write:
" ... robust if TRUE a robust variance estimate is returned. ..."
I think that is your response...
bye
Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil
No, robust is an option to coxph, not cph.  cph uses 'after the fit' 
correction using the robcov or bootcov functions in Design.

--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University
Sorry Frank!
I made a digitation mistake, but I think yours package answers the Tomas 
Karpati´s need.

Thanks in advance
Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil  
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] Cox regression for prevalence estimates

2004-09-07 Thread Bernardo Rangel Tura
At , The Michaelson Institute wrote:
How can R be used to calculate the prevalence ratios using Cox regression +
robust variance estimates ?
Well,
In Design package have a command: cph
This command have a option "robsut" with default=FALSE, but in help is write:
" ... robust if TRUE a robust variance estimate is returned. ..."
I think that is your response...
bye
Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] newsgroup on R

2004-09-03 Thread Bernardo Rangel Tura
At 08:51 02/09/2004, you wrote:
HI, by newsgroup, I mean a kind of user forum like MATLABs 
http://newsreader.mathworks.com/WebX?14@@/comp.soft-sys.matlab

where anyone can post a question, without receiving unnecessary emails daily
Hi Bin Jiang!
I visit the url: http://gmane.org/info.php?group=gmane.comp.lang.r.general 
and in this site is possible read and post messages in R-help list without 
recive e-mails dialy.

So is not necessary newsgroups for solve your problem.
Cheers.
Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil  
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] Probability(Markov chain transition matrix)

2004-05-02 Thread Bernardo Rangel Tura
At 17:25 30/04/2004, you wrote:
>So we come up with Transition matrix stating probabilities of each state
>
>FromTo NC   0   1 2 3
>NC  0.79  0.21  0  00
>0  0.09  0.73 0.18 00
>1  0.09  0.51  0   0.40  0
>2  0.09  0.38  0  0   0.55
>3  0.06  0.32  0  0   0.62
>
>
>Thus if one starts with all the accounts having no credit ð0 =(1,0,0,0,0), after one 
>period the distribution of account is ð1=(0.79, 0.21, 0, 0, 0)  
>after subsequent periods, it becomes
>
>Ð2=(0.64, 0.32, 0.04, 0, 0),
>Ð3= (0.540, 0.387, 0.058, 0.015, 0)
>Ð4=(0.468,0.431, 0.070, 0.023, 0.008)
>Ð5=(0.417, 0.460, 0.077, 0.028, 0.018)
>and 
>Ð10=(0.315, 0.512, 0.091, 0.036, 0.046)

Hi 


I create a rotine for a problem like this, I hope this is useful for you

#
##MARKOV CHAIN ## 
## ##
## ini- initial state  ## 
## trans- transition matrix##
## n - number of transitions   ##
## f - ini%*%trans ##  
## fase - f consolidate##
## ## 
#



#  initial state

ini<-matrix(c(10,0,0,0,0,0,0,0,0),nrow=3,ncol=3)

#  transition matrix
#
#  [,1] [,2] [,3]
# [1,] 0.85  0.1  0.05
# [2,] 0.00  0.7  0.3
# [3,] 0.00  0.0  1.0
#
# In R the command is

trans<-matrix(c(.85,0,0,.1,.7,0,0.05,0.3,1),ncol=3)

markov<-function(ini,trans,n){
  l<-ncol(ini)
  fase<-matrix(0,nrow=l,ncol=l)
  fases<-array(0,dim=c(nrow(ini),ncol(ini),n))
  for (i in 1:n){
f<-ini%*%trans
for (w in 1:l){fase[w,w]<-sum(f[,w])}
  ini<-fase
  fases[,,i]<-fase
# print(fase)
# 
# Fase allow calcule de value for transition:
# If sate 1 value 0,95, state 2 value 0,3 and  state 3
# value 0 QALY. 
# I´m calculate de value of any transition if
#  print(sum(fase%*%c(.95,.3,0)))
#
# 

  }
  return(fases)
}

a<-markov(ini,trans,5)

For your case:

ini<-matrix(c(1,rep(0,24)),ncol=5)
trans<-matrix(c(0.79,0.21,0,0,0,0.09,0.73,0.18,0,0,0.09,0.51,0,0.40,0,0.09,0.38,0,0,0.55,0.06,0.32,0,0,0.62),ncol=5)
solv<-markov(ini,trans,10)
> solv[,,10]
  [,1]  [,2]  [,3]  [,4]  [,5]
[1,] 0.3173366 0.000 0.000 0.000 0.000
[2,] 0.000 0.2876792 0.000 0.000 0.000
[3,] 0.000 0.000 0.2875772 0.000 0.000
[4,] 0.000 0.000 0.000 0.2886571 0.000
[5,] 0.000 0.000 0.000 0.000 0.2810951








Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] Changing Gui preferences

2004-04-24 Thread Bernardo Rangel Tura
At 06:05 24/04/2004, you wrote:

>I'm not sure how to find 'HOME' but I presume that it is the path that appears in the 
>'Change directory' box when you open this through the gui. In which case for me 
>'HOME' is
>
>C:\apps\R\rw1090
>
>Now I have 3 versions of Rconsole near here. They are in
>
>C:\apps\R\rw1090\etc
>C:\apps\R\rw1090   and
>C:\apps\R
>
>I still don't know how to change my Gui preferences!

Murray,

I don´t use win XP, I use win 98 SE.
In my system I know de 'HOME' with a simple procedure:

1- Look R shortcut
2- Right Click in R shortcut
3- Choose properties
4- Look satrt in box
5- de directorie in box is the 'HOME'



Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil  
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] Fit system of equations

2004-02-09 Thread Bernardo Rangel Tura
Hi R-masters

I have this system of equations

R(x,t)= a(t)+b(x,t)
a(t) = c + d*t
b(t) = e + f*t

where 
x is a vetor of age<-c(37,42,47,52,57,62,67,72,77,83),
t is vetor of year (1980:2000)
R(x,t) = Rate of mortality in age x on year t
a(t) = base mortality on year t
b(x,t) = exponential rate of mortality for age x on year t
b(t) = exponential rate of mortality on year t

I wish is possible fit this system in R?
Case positive Which the best method?



Thanks in advance

Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] multiple plots in different windows

2004-02-06 Thread Bernardo Rangel Tura
At 14:29 05-02-2004, you wrote:

>Hi all,
>I'd like to generate a number of plots to compare different
>vectors I have stored in a list. To do this I do something like
>(in a linux system):
>
>for(i in 1:L) {
> X11()
> plot(listOfFunctions[[i]])
>}
>
>First question is: is this the right way to create several plots (in
>different windows) ?

Hi 

I think wich the correct code is:

>for(i in 1:L) {
>windows()
> plot(listOfFunctions[[i]])
>}

This work in my computer.

I dont know thje answer for your second question


Best wishes

Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil  
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] NLS mensagem error...

2004-01-14 Thread Bernardo Rangel Tura
Hi R-masters,

I have a problem with nls() and my research data. Look this example:



X2000<-c(1.205268,2.850695,5.100860,8.571610,15.324513,25.468599,39.623418,61.798856,91.470006,175.152509)
age<-c(37,42,47,52,57,62,67,72,77,82)
fit <- nls(X2000~R*exp(A*age),start=list(R=.1,A=.1))

Error mensage:

Error in nls(X2000 ~ R * exp(A * age), start = list(R = 0.1, A = 0.1)) : 
singular gradient
In addition: Warning message: 
no finite arguments to min; returning Inf

How I fix this problem? Other command? 


Thanks in advance

Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] Fit non-linear regressor

2004-01-09 Thread Bernardo Rangel Tura
Hi R masters,

Sorry for first mensage, this is orignal text...

y<-c(2.8150,3.5239,4.0980,4.5845,5.0709,5.4824,5.8427,6.3214,6.7349,7.3651)
x<-c(37,42,47,52,57,62,67,72,77,82)

I need fit R and A in y=f(x)=R*exp(A*x), with minimize sd= sqrt(SRR/(n-2)) where SRR 
is Sum of the Square of the Residuals 
and n is number of data points (in this case 10)

How do I make this?


Thanks in advance

Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] Fit non-linear regressor

2004-01-08 Thread Bernardo Rangel Tura



Thanks in advance

Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil 
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] Fitdistr Error in new VR version

2003-12-18 Thread Bernardo Rangel Tura

>Hi R-Masters

I found a strange error in fitdistr():


In case of VR Version 7.1-11

k21stsList<-c(0.76697,0.57642,0.75938,0.82616,0.93706,0.77377,0.58923,0.37157,0.60796,1.00070,0.97529,0.62858,0.63504,0.68697,0.61714,0.75227,1.16390,0.66702,0.83578)

fitdistr(k21stsList, "normal",list(mean = 0.5, sd = 0.1))
 mean  sd
 0.74584591   0.17908744 
(0.04108548) (0.02904255)
 

In case of VR Version 7.1-13

k21stsList<-c(0.76697,0.57642,0.75938,0.82616,0.93706,0.77377,0.58923,0.37157,0.60796,1.00070,0.97529,0.62858,0.63504,0.68697,0.61714,0.75227,1.16390,0.66702,0.83578)

fitdistr(k21stsList, "normal",list(mean = 0.5, sd = 0.1))
 mean  sd
 0.74584591   0.17908744 
(0.04108548) (0.02904255)

Error in fitdistr(k21stsList, "normal", list(mean = 0.5, sd = 0.1)) : 
supplying pars for the Normal is not supported


Why this occur?

[]s
Tura 

---



__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] MASS fitdistr()

2003-11-29 Thread Bernardo Rangel Tura
At 15:49 27-11-2003, you wrote:
>Dear R experts,
>
>I am trying to use the R MASS library fitdistr() to fit the following
>list:
>
>k21stsList<-c(0.76697,0.57642,0.75938,0.82616,0.93706,0.77377,0.58923,0.37157,0.60796,1.00070,0.97529,0.62858,0.63504,0.68697,0.61714,0.75227,1.16390,0.66702,0.83578)
>
>as follows,
>
>library(MASS)
>fitdistr(k21stsList, "normal")
>
>But, I get
>
>Error in fitdistr(k21stsList, "normal") : 'start' must be a named list

Hi

You don´t put the start list, something like this

fitdistr(k21stsList, "normal",list(mean = 0.5 sd = 0.1))

  mean      sd
  0.74584591   0.17908744 
 (0.04108548) (0.02904255)




Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] stepAIC problem

2003-10-12 Thread Bernardo Rangel Tura
At 09:46 05-10-2003, Hiroto Miyoshi wrote:
>Dear R-users
>
>I have a probelm running stepAIC in R1.7.1
>(...)
>--small example
>> library(MASS)
>> x1<-runif(100)
>> x2<-runif(100)
>> x3<-runif(100)
>> x4<-runif(100)
>> x5<-runif(100)
>> y<-x1+x2+x3+runif(100)
>> t<-data.frame(y=y,x1=x1,x2=x2,x3=x3,x4=x4,x5=x5)
>> x<-lm(y~x1+x2+x3+x4+x5,data=t)
>> stepAIC(x)
>Start:  AIC= -247.61
> y ~ x1 + x2 + x3 + x4 + x5
>
>   Df Sum of Sq  RSS  AIC
>- x51 3.747e-067.456 -249.608
>- x41 0.0267.483 -249.254
> 7.456 -247.609
>- x11 4.866   12.322 -199.375
>- x21 8.182   15.639 -175.543
>- x31 8.597   16.054 -172.922
>Error in as.data.frame.default(data) : can't coerce function into a
>data.frame

Hiroto,

In My computer with R 1.7.1 e R 1.8.0 (win 98 SE) don´t have this error... 


[]s
Tura

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Help with Temporal series

2003-06-02 Thread Bernardo Rangel Tura


Good afternoon R-masters,  
  
I am with some doubts in the R, see the script below:

m<-c(69.6,67.3,75.6,74.3,64.7,60,65.7,62.5,66.5)
d<-c(11.6,15,17.8,18.3,11.2,11,4.6,5.8,7)
year<-c(1994,1995,1996,1997,1998,1999,2000,2001,2002)
male<-ts(m,start=c(1994))
death<-ts(d,start=c(1994))
data<-data.frame(year,death,male)
require(ts)
d100<-HoltWinters(data$death,gamma=0)
m100<-HoltWinters(data$male,gamma=0)
par(mfrow=c(3,1))
plot(d100,main="Death")
plot(m100,main="Male")
ccf(male,death)


I have 2 doubts:

1 - How to I should interpret the third graph?
2 - Has a hypothesis test to evaluate the cross-correlation it is significant in R?
Thanks in advance

Bernardo Rangel Tura, MD, MSc
National Institute of Cardiology Laranjeiras
Rio de Janeiro Brazil

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help