Re: [R] ED50 from logistic model with interactions

2007-05-02 Thread Berwin A Turlach


On Wed, 02 May 2007 11:37:22 +1000
Kate Stark [EMAIL PROTECTED] wrote:

 [...] My model is:
 
 fit - glm(Mature ~ Season * Size - 1, family = binomial, data=dat)
 
 where Mature is a binary response, 0 for immature, 1 for mature. There
 are 3 Seasons.

I would use:

fit - glm(Mature ~ Season/Size - 1, family=binomial, data=dat)

With this parameterisation you get the three intercepts and the three
slopes directly (together with there standard errors from summary()).
Makes life simpler for your calculations.

 In Faraway(2006) he has an example using the delta method to calculate
 the StdErr, but again without any interactions. I can apply this for
 the first Season, as there is just one intercept and one slope
 coefficient, but for the other 2 Seasons, the slope is a combination
 of the Size coefficient and the Size*Season coefficient, [...]

Not with the above parameterisation, so life is easier.  I don't have
my copy of Faraway (2006) handy at the moment, so I cannot vouch that
you can use the method the describes now directly.  But I expect you
can. :)

 I could divide the data and do 3 different logistic regressions, one
 for each season, but while the Mat50 (i.e. mean Size at 50% maturity)
 is the same as that calculated by the separate lines regression, Im
 not sure how this may change the StdErr?

As far as I can tell, there should be no difference.  Compare the
estimates and their standard errors that you obtain from the 3
different logistic fits with the estimates and standard errors from the
parameterisation that I suggested.  They should be the same. 

Hope this helps.

Cheers,

Berwin

__
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] Simulation using parts of density function

2007-05-02 Thread Thür Brigitte

Thanks for your code! It is not exactly what I really want - but it is my 
fault, because my description was wrong...

It is not sim but rhater exp(rgamma(...)) that should not exceed 500. So 
I tried to modify your code but it doesn't really work. sim.test returns just 
1 value and not 999. 

My modified code:

sim.test - NULL
for(i in 1:999)
{sim-NULL
  remain - rpois(1,2000)
  x - remain
  while(remain0){
sim0-replicate(10*remain,
   exp(rgamma(1, scale = 0.5, shape = 12))
   )
sim-c(sim,sim0[sim0=500])
remain-(x - length(sim))
  }
  sim-sim[1:x]}
sim.test - rbind(sim.test, c(value=sum(sim)))

Thanks for any help,
Brigitte


-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 1. Mai 2007 20:18
An: Thür Brigitte
Cc: r-help@stat.math.ethz.ch
Betreff: RE: [R] Simulation using parts of density function

On 01-May-07 17:03:46, Thür Brigitte wrote:
 
 Hi
 
 My simulation with the followin R code works perfectly:
 sim - replicate(999, sum(exp(rgamma(rpois(1,2000),
 scale = 0.5, shape = 12
 
 But now I do not want to have values in object sim exceeding
 5'000'000, that means that I am just using the beginning of
 densitiy function gamma x  15.4. Is there a possibility to
 modify my code in an easy way?
 
 Thanks for any help!
 
 Regards, Brigitte

A somewhat extreme problem!

The easiest way to modify the code is as below -- certiainly easier
than writing a special function to draw random samples from the
truncated gamma distribution.

A bit of experimentation shows that, from your code above, about
10% of the results are = 500. So:

  sim-NULL
  remain - 999
  while(remain0){
sim0-replicate(10*remain,
   sum(exp(rgamma(rpois(1,2000), scale = 0.5, shape = 12)))
   )
sim-c(sim,sim0[sim0=500])
remain-(999 - length(sim))
  }
  sim-sim[1:999]

Results of a run:

  sum(sim500)
  [1] 0

  max(sim)
  [1] 4999696

  length(sim)
  [1] 999

It may be on the slow side (though not hugely -- on a quite slow
machine the above run was completed in 2min 5sec, while the
999-replicate in your original took 15sec. So about 8 times as long.
Most of this, of course, is taken up with the first round.

Hoping this helps,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 01-May-07   Time: 19:18:01
-- XFMail --
*** [EMAIL PROTECTED] scanned this email for malicious content and found it to 
be 
clean ***

__
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] Log-likelihood function

2007-05-02 Thread Doxastic

I've computed a loglinear model on a categorical dataset.  I would like to
test whether an interaction can be dropped by comparing the log-likelihoods
from two models(the model with the interaction vs. the model without). 
Since R does not immediately print the log-likelihood when I use the glm
function, I used SAS initially.  After searching for an extracting function,
I found one in R.  But, the log-likelihood given by SAS is different from
the one given by R.  I'm not sure if the logLik function in R is giving me
something I don't want.  Or if I'm misinterpreting the SAS output.  Can
anyone help?
-- 
View this message in context: 
http://www.nabble.com/Log-likelihood-function-tf3678882.html#a10280717
Sent from the R help mailing list archive at Nabble.com.

__
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] Get the difference of values to their own median value

2007-05-02 Thread Felix Wave
Hello,
I've got a matrix (mail end) with the colnames x, y, z. In this matrix
are different measurements. x and y are risign coordinates.

With the following line I got the median value of z for all x AND y witch
are the same (not every measurment in my list hast the same number of 
x and y values. Sometimes lines are missing.
MEDIAN  - na.omit( aggregate(INPUT[,3], by=list(INPUT[,2],INPUT[,1] ), 
FUN=median ) )


To see the failin of my measurments I want to get the difference between
every measurment and the detected median values.
The aim would be to have a list with different colums (for every measurment)
with the difference between measurment 1,2,3, ..., x and the median.

Has anybody an idea?

I though I could split the measurment list. The beginning of every measurment 
can be found with
START - grep( 0 0.0 0., INPUT) 
But not every measurment has the same length and I don't have always the
same number of measurments.



I hope you can help me.

Thank's a lot.
Felix




###
## My R Code ##
###
INPUT   - readLines(dat.dat)
INPUT   - gsub(^ , , INPUT)
INPUT   - t( sapply( strsplit(INPUT, split= ), as.numeric ) )
colnames(INPUT) - c(x, y, z )






#
## dat.dat ##
#
29 4.5 1.505713
29 4.6 1.580402
29 4.7 1.656875
29 4.8 1.735054
30 0 0
30 0.1 0.00096108
30 0.2 0.00323831
29 4.5 1.495148
29 4.6 1.568961
29 4.7 1.644467
30 0 0
30 0.1 0.00093699
30 0.2 0.00319411
30 0.3 0.00676619

__
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] Simulation using parts of density function

2007-05-02 Thread Prof Brian Ripley
Please do not send everything twice: you are using R-help in both the To: 
and Cc: fields.


I disagree with Ted: it _is_ much easier to create a generator for this 
purpose.


Consider

rtgamma - function(n, ..., tr = log(500))
{
p - pgamma(tr, ...)
qgamma(p*runif(n), ...)
}

as inversion (especially at C level) is plenty fast enough.


On Wed, 2 May 2007, Thür Brigitte wrote:



Thanks for your code! It is not exactly what I really want - but it is my 
fault, because my description was wrong...

It is not sim but rhater exp(rgamma(...)) that should not exceed 500. So I tried to 
modify your code but it doesn't really work. sim.test returns just 1 value and not 999.

My modified code:

sim.test - NULL
for(i in 1:999)
{sim-NULL
 remain - rpois(1,2000)
 x - remain
 while(remain0){
   sim0-replicate(10*remain,
  exp(rgamma(1, scale = 0.5, shape = 12))
  )
   sim-c(sim,sim0[sim0=500])
   remain-(x - length(sim))
 }
 sim-sim[1:x]}
sim.test - rbind(sim.test, c(value=sum(sim)))

Thanks for any help,
Brigitte


-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 1. Mai 2007 20:18
An: Thür Brigitte
Cc: r-help@stat.math.ethz.ch
Betreff: RE: [R] Simulation using parts of density function

On 01-May-07 17:03:46, Thür Brigitte wrote:


Hi

My simulation with the followin R code works perfectly:
sim - replicate(999, sum(exp(rgamma(rpois(1,2000),
scale = 0.5, shape = 12

But now I do not want to have values in object sim exceeding
5'000'000, that means that I am just using the beginning of
densitiy function gamma x  15.4. Is there a possibility to
modify my code in an easy way?

Thanks for any help!

Regards, Brigitte


A somewhat extreme problem!

The easiest way to modify the code is as below -- certiainly easier
than writing a special function to draw random samples from the
truncated gamma distribution.

A bit of experimentation shows that, from your code above, about
10% of the results are = 500. So:

 sim-NULL
 remain - 999
 while(remain0){
   sim0-replicate(10*remain,
  sum(exp(rgamma(rpois(1,2000), scale = 0.5, shape = 12)))
  )
   sim-c(sim,sim0[sim0=500])
   remain-(999 - length(sim))
 }
 sim-sim[1:999]

Results of a run:

 sum(sim500)
 [1] 0

 max(sim)
 [1] 4999696

 length(sim)
 [1] 999

It may be on the slow side (though not hugely -- on a quite slow
machine the above run was completed in 2min 5sec, while the
999-replicate in your original took 15sec. So about 8 times as long.
Most of this, of course, is taken up with the first round.

Hoping this helps,
Ted.


--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
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] missing package

2007-05-02 Thread raymond chiruka
l'm trying to find the survdiff package/function but it seems i cant get it 
how do l instal it if its not there
  thanks
  


   
-


[[alternative HTML version deleted]]

__
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] Log-likelihood function

2007-05-02 Thread Prof Brian Ripley
I think you need to learn about deviances, which R does print.

Log-likelihoods are only defined up to additive constants.  In this case 
the conventional constant differs if you view this as a Poisson or as a 
product-multinomial log-linear model, and R gives you the log-likelihood 
for a Poisson log-linear model (assuming you specified family=poisson). 
However, deviances and differences in log-likelihoods do not depend on 
which.

More details and worked examples can be found in MASS (the book, see the 
FAQ), including other ways to fit log-linear models in R.


On Tue, 1 May 2007, someone ashamed of his real name wrote:

 I've computed a loglinear model on a categorical dataset.  I would like to
 test whether an interaction can be dropped by comparing the log-likelihoods
 from two models(the model with the interaction vs. the model without).
 Since R does not immediately print the log-likelihood when I use the glm
 function, I used SAS initially.  After searching for an extracting function,
 I found one in R.  But, the log-likelihood given by SAS is different from
 the one given by R.  I'm not sure if the logLik function in R is giving me
 something I don't want.  Or if I'm misinterpreting the SAS output.  Can
 anyone help?


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] ? R 2.5.0 alpha bug

2007-05-02 Thread Stefan Grosse
The version 2.5.0 has left Alpha status long time ago and its final
version has been released so please try the new version.


Inman, Brant A. M.D. wrote:
 This email is intended to highlight 2 problems that I encountered
 running R 2.5.0 alpha on a Windows XP machine.

 #1 - Open script error

 If I click the Open folder icon on the toolbar, R opens my script
 files perfectly.  However, when I select File  Open Script 
 MyFileLocation, I get a fatal error that causes R to close immediately.
 This error was reproduced on 3 consecutive occasions but has been
 intermittent thereafter. One of these fatal errors resulted in a typical
 error reporting box being generated which I sent off.  I was not able to
 verify if this error has been reported and corrected in subsequent
 versions of 2.5.

 #2 - Bug reporting link on CRAN website broken

 I tried to report the bug listed above on the CRAN website but when I
 clicked on the bug reporting link on the left-hand side panel of the
 main site (http://bugs.r-project.org/cgi-bin/R) , I get an error page
 with the following message:

 The system encountered a fatal error 
 cannot open config file /home/sfe/r-bugs/jitterbug/R : No such file or
 directory
 The last error code was: No such file or directory 
 uid/gid=30/8 


 This has been submitted to r-devel.

 Brant Inman

 __
 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-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] Simulation using parts of density function

2007-05-02 Thread Ted Harding
On 02-May-07 07:45:48, Prof Brian Ripley wrote:
 Please do not send everything twice: you are using R-help in both the
 To: 
 and Cc: fields.
 
 I disagree with Ted: it _is_ much easier to create a generator for this
 purpose.
 
 Consider
 
 rtgamma - function(n, ..., tr = log(500))
 {
  p - pgamma(tr, ...)
  qgamma(p*runif(n), ...)
 }
 
 as inversion (especially at C level) is plenty fast enough.

Of course ... !!

Just to explain Brian's solution above:

Since pgamma(rgamma(...),...) is uniformly distributed on (0,1),
if rgamma is truncated to (0,tr) them pgamma(rgamma) will be
truncated to (0,pgamma(tr)), and hence uniformly distributed
on this range.

Best wishes,
Ted.




E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 02-May-07   Time: 09:16:08
-- XFMail --

__
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] hello

2007-05-02 Thread elyakhlifi mustapha
hello,
I have a problem with a R program I don't understand my errors
my program looks like this

 for(i in LE) {
+for(j in LEC[[i]]) {
+for(k in LR) {
+ donRep[[k]] - subset(don2, Id_Essai == 1006961  
Id_Cara == j  Id_Rep == k   Id_Geno != 65125, select = Val_O)
+ M[[j]] - matrix(rep(1, 3*length(donRep[[1]][,1])), 
nrow =length(donRep[[1]][,1]), ncol = 3)
+for(k in LR) {
+  M[[j]][,k] - as.numeric(as.character(donRep[[k]][,1]))
+}
+ }
+print(M[[j]])
+if (subset(donParCara, Id_Cara == j , select = Ana_C) == AV)
+   {print(cor(M[[j]], method = pearson))}  
else{print(cor(M[[j]], method = spearman))}
+ }
+   }
Erreur dans M[[j]][, k] - as.numeric(as.character(donRep[[k]][, 1])) : 
le nombre d'objets à remplacer n'est pas multiple de la taille du 
remplacement



and sometimes it run good but sometimes there are errors I don't understand 
why. Can you help me please?


  
___





[[alternative HTML version deleted]]

__
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] Log-likelihood function

2007-05-02 Thread Doxastic

You're right.  I do need to learn more.  I never learned null/residual
deviance.  I know the deviance is equivalent to an anova decompostion.  But
I've never dealt with it seperated like this.  

I understand deviance as the difference between two model's log-likelihood
difference between them and the most complex.  I want to compare two models
that are not the most complex.  That is why I wanted the log-likelihood.  

I am using the poisson distribution because my response is count data, so
the link is the log.  If the deviance in R is computed by comparing the
fitted model against the most saturated (which would make sense).  Then yes,
I can use that.  I just picked the log-likelihood because I'm comparing two
models.  And that's the best way.  But, it's equivalent if R compares the
fitted to the most complex.

I assumed the deviance print out tested the fitted model against the least
complex.  This tests whether the current model parameters can be dropped
(that's what I thought the null deviance meant).  I'm not sure what the
residaul deviance means though.  

My main concern is why the likelihood functions differed between SAS and R. 
If anyone has encountered this or understands why, I would appreciate some
help.



Prof Brian Ripley wrote:
 
 I think you need to learn about deviances, which R does print.
 
 Log-likelihoods are only defined up to additive constants.  In this case 
 the conventional constant differs if you view this as a Poisson or as a 
 product-multinomial log-linear model, and R gives you the log-likelihood 
 for a Poisson log-linear model (assuming you specified family=poisson). 
 However, deviances and differences in log-likelihoods do not depend on 
 which.
 
 More details and worked examples can be found in MASS (the book, see the 
 FAQ), including other ways to fit log-linear models in R.
 
 
 On Tue, 1 May 2007, someone ashamed of his real name wrote:
 
 I've computed a loglinear model on a categorical dataset.  I would like
 to
 test whether an interaction can be dropped by comparing the
 log-likelihoods
 from two models(the model with the interaction vs. the model without).
 Since R does not immediately print the log-likelihood when I use the
 glm
 function, I used SAS initially.  After searching for an extracting
 function,
 I found one in R.  But, the log-likelihood given by SAS is different from
 the one given by R.  I'm not sure if the logLik function in R is giving
 me
 something I don't want.  Or if I'm misinterpreting the SAS output.  Can
 anyone help?

 
 -- 
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/Log-likelihood-function-tf3678882.html#a10282152
Sent from the R help mailing list archive at Nabble.com.

__
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] missing package

2007-05-02 Thread John Kane

--- raymond chiruka [EMAIL PROTECTED] wrote:

 l'm trying to find the survdiff package/function
 but it seems i cant get it how do l instal it if its
 not there
   thanks
 I think you want the survival package.

__
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] missing values

2007-05-02 Thread elyakhlifi mustapha
hello,
I need your help for this example

 for(k in LR) {
+ donGeno[[k]] - as.numeric(levels(factor(subset(don2, Id_Essai == 1006961  
Id_Cara == LC[1]  Id_Rep == k, select = Id_Geno)[,1])))
+ print(donGeno[[k]])}
 [1] 65125 65126 65127 65128 65129 65130 65131 65132 65133 65134 65135 65136 
65137 65138 65139 65140 65141 65142 65143 65144 65171
 [1] 65126 65127 65128 65129 65130 65131 65132 65133 65134 65135 65136 65137 
65138 65139 65140 65141 65142 65143 65144 65171
 [1] 65125 65126 65127 65128 65129 65130 65131 65132 65133 65134 65135 65136 
65137 65138 65139 65140 65141 65142 65143 65144 65171

there are a missing value for the vector donGeno[[2]] in fact there aren't the 
value 65125 and I wanna cut this value in the others vectors and I tried to do 
this as follow

C - vector()
for(k in LR) {
C[k] - length(donGeno[[k]])
}
print(C)
na=match(rep(0,length(C)-sum(match(C,C[1],nomatch=0))),match(C,C[1],nomatch=0))
#print(na)
if(na==length(C)){
pos=match(0,match(donGeno[[na-1]],donGeno[[na]],nomatch=0))
for(k in 1:(na-1)) {
donGeno[[k]] - donGeno[[k]][1:(na-1)]
}
}
else{
pos=match(0,match(donGeno[[na+1]],donGeno[[na]],nomatch=0))
for(k in 1:(.))
}

but I wonder if there's better from this script?


  
___





[[alternative HTML version deleted]]

__
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] missing package

2007-05-02 Thread Petr Klasterecky
help.search(survdiff)
tells you it is in package survival. Most probably this package is not 
missing, nevertheless if it is, you can install it in a standard way 
using install.packages() or from the menu (Windows).

Petr

raymond chiruka napsal(a):
 l'm trying to find the survdiff package/function but it seems i cant get it 
 how do l instal it if its not there
   thanks
   
 
 

 -
 
 
   [[alternative HTML version deleted]]
 
 __
 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.
 

-- 
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic

__
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] length of the object is not a multiple of... [was: Re: hello]

2007-05-02 Thread Petr Klasterecky


elyakhlifi mustapha napsal(a):
 hello,
 I have a problem with a R program I don't understand my errors
 my program looks like this
 
 for(i in LE) {
 +for(j in LEC[[i]]) {
 +for(k in LR) {
 + donRep[[k]] - subset(don2, Id_Essai == 1006961  
 Id_Cara == j  Id_Rep == k   Id_Geno != 65125, select = Val_O)
 + M[[j]] - matrix(rep(1, 3*length(donRep[[1]][,1])), 
 nrow =length(donRep[[1]][,1]), ncol = 3)
 +for(k in LR) {
 +  M[[j]][,k] - as.numeric(as.character(donRep[[k]][,1]))
 +}
 + }
 +print(M[[j]])
 +if (subset(donParCara, Id_Cara == j , select = Ana_C) == 
 AV)
 +   {print(cor(M[[j]], method = pearson))}  
 else{print(cor(M[[j]], method = spearman))}
 + }
 +   }
 Erreur dans M[[j]][, k] - as.numeric(as.character(donRep[[k]][, 1])) : 
 le nombre d'objets ŕ remplacer n'est pas multiple de la taille du 
 remplacement
 
 
 
 and sometimes it run good but sometimes there are errors I don't understand 
 why. Can you help me please?

No we can't since we cannot reproduce your program. The error message 
says you are trying to assign a longer/shorter vector into a matrix. Add 
some print statements into your code and check how M[[j]] and 
donRep[[k]][,1] look like in each step of the loop.

And next time, read the posting guide and give a meaningfull subject and 
a reproducible example.

Petr

-- 
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic

__
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] to draw a smooth arc

2007-05-02 Thread Jim Lemon
(Ted Harding) wrote:
 This thread prompts me to ask about something I've
 been pondering for a while, as to whether there's an
 implementation somewhere ticked away in the R resources.
 
 So far, people have been responding to the original query
 in terms of increasing the numbers of points, and joining
 these by lines.
 
 However, if you're using PostScript output, you can draw
 really smooth curves by exploiting PS's curveto operator.
 This draws a cubic-curve segment in the following way:
 
 ...
 Anyway. The Question: is there a general function for the
 above kind of smooth curve-drawing?
 
Hi Ted,
My experience with this some years ago was in anti-aliasing visual 
stimuli presented on a PC monitor. The intended line was calculated 
pixel by pixel and the each pixel that the line touched was assigned a 
value based on a sawtooth function. The peak of the function was always 
exactly on the intended line and the luminance of the pixel was a linear 
function of the distance of its center along a perpendicular to the 
line. We used the width of a pixel as the lateral extent of the function 
with adequate success. The lines appeared smooth until the viewer could 
resolve the individual pixels. Wider lines used a trapezoidal 
distribution of luminance with the same slope on the limbs. I must note 
that we did not have to create our stimuli in real time, and this method 
might be too slow. However, I am fairly certain that if the function 
knew about the characteristics of the output device, one could base a 
curveto function on this.

Jim

__
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] Polar graph of time and tide

2007-05-02 Thread Jim Lemon
Alan E. Davis wrote:
 I have been trying to visualize times of lowest tides, month by month.
  I have tide predictions with times either in unix time or a text
 format, and heights in feet or meters.  I had been able to derive the
 clock times of each prediction.   I would now like to graph this data
 with points showing heights as r and times as theta, from  to
 2355.  There is a seasonal component: I am interested in displaying
 times of lowest tides in particular.
 
 I am sure this is so simple as to burden those on the list; I however
 have spent two evenings trying to figure out how to use polar.plot,
 and I'm not sure that's the best way to do this.  May I request some
 advice?  The docs with polar.plot are not complete, I fear.
 
 Thank you, begging for your indulgence,
 
Hi Alan,
Earl Glynn's advice is spot-on if you are trying to map tides onto the 
diurnal cycle. However, I get the impression that you want an annual 
cycle. If this is the case, it is probably best to go to the underlying 
function, radial.plot. Here is an example with some imaginary tides.

lowtide-sin(seq(1:12)+sin(seq(1,24,by=2)/10))
lowtide-rescale(lowtide,c(0,2355))
month.abbr-c(jan,Feb,Mar,Apr,May,Jun,
  Jul,Aug,Sep,Oct,Nov,Dec)
radial.plot(lowtide,labels=month.abbr,rp.type=s)

This plots time of lowest tide in a month as a symbol at a radial 
distance proportional to the 24 hour time of day. As you can see from 
running the example, the months of the year are displayed around the 
circumference of the plot. One annoyance is that the hours are displayed 
as 0-2500. As pretty handles that, you would have to set 
show.radial.grid to FALSE and manually draw the desired grid (a pain, 
but not impossible).

You could also place the symbols at the position in the month of the 
lowest tide by specifying radial.pos instead of letting the function 
spread them out evenly.

If you want to overlay a number of years, x should be a matrix and 
point.col can be chosen so that each year has a different color.

I would like to know of any deficiencies in the docs, as while I think I 
know what I'm talking about, it is you out there who have to understand it.

Jim

__
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] Log-likelihood function

2007-05-02 Thread Ross Darnell

Alternatively  generate the log-likelihood using the sum(dpois(y,
fitted(model), log = TRUE))


Regards

Ross Darnell


Doxastic wrote:
 
 You're right.  I do need to learn more.  I never learned null/residual
 deviance.  I know the deviance is equivalent to an anova decompostion. 
 But I've never dealt with it seperated like this.  
 
 I understand deviance as the difference between two model's log-likelihood
 difference between them and the most complex.  I want to compare two
 models that are not the most complex.  That is why I wanted the
 log-likelihood.  
 
 I am using the poisson distribution because my response is count data, so
 the link is the log.  If the deviance in R is computed by comparing the
 fitted model against the most saturated (which would make sense).  Then
 yes, I can use that.  I just picked the log-likelihood because I'm
 comparing two models.  And that's the best way.  But, it's equivalent if R
 compares the fitted to the most complex.
 
 I assumed the deviance print out tested the fitted model against the least
 complex.  This tests whether the current model parameters can be dropped
 (that's what I thought the null deviance meant).  I'm not sure what the
 residaul deviance means though.  
 
 My main concern is why the likelihood functions differed between SAS and
 R.  If anyone has encountered this or understands why, I would appreciate
 some help.
 
 
 
 Prof Brian Ripley wrote:
 
 I think you need to learn about deviances, which R does print.
 
 Log-likelihoods are only defined up to additive constants.  In this case 
 the conventional constant differs if you view this as a Poisson or as a 
 product-multinomial log-linear model, and R gives you the log-likelihood 
 for a Poisson log-linear model (assuming you specified family=poisson). 
 However, deviances and differences in log-likelihoods do not depend on 
 which.
 
 More details and worked examples can be found in MASS (the book, see the 
 FAQ), including other ways to fit log-linear models in R.
 
 
 On Tue, 1 May 2007, someone ashamed of his real name wrote:
 
 I've computed a loglinear model on a categorical dataset.  I would like
 to
 test whether an interaction can be dropped by comparing the
 log-likelihoods
 from two models(the model with the interaction vs. the model without).
 Since R does not immediately print the log-likelihood when I use the
 glm
 function, I used SAS initially.  After searching for an extracting
 function,
 I found one in R.  But, the log-likelihood given by SAS is different
 from
 the one given by R.  I'm not sure if the logLik function in R is
 giving me
 something I don't want.  Or if I'm misinterpreting the SAS output.  Can
 anyone help?

 
 -- 
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595
 
 __
 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.
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Log-likelihood-function-tf3678882.html#a10283755
Sent from the R help mailing list archive at Nabble.com.

__
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] Concepts question: environment, frame, search path

2007-05-02 Thread Duncan Murdoch
On 01/05/2007 11:34 AM, Prof Brian Ripley wrote:
 On Tue, 1 May 2007, Duncan Murdoch wrote:
 
 On 01/05/2007 12:29 AM, Graham Wideman wrote:
[...]
 Refman p122:  Environments consist of a frame, or collection of named
 objects, and a pointer to an enclosing environment.

 Is the or here explaining parenthetically that a frame is a collection of
 named objects, or is separating too alternative structures for an
 environment?
 The former.
 If the former, does this imply that a frame can contain arbitrary variables?
 Yes, but a frame isn't an R object, it's a concept that appears in
 descriptions, e.g. part of an environment, or the local variables
 created during function evaluation, etc.
 And pointer? Is that a type of thing in R?
 No, there are no pointers in R.  There are a couple of tricks to fake
 them (e.g. environment objects aren't copied when assigned, you just get
 a new reference to the same environment; this allows you to construct
 something like a pointer by wrapping an object in an environment), but I
 don't recommend using these routinely.
 
 Nevertheless, the statement is true.  R is implemented using pointers.

Yes, definitely.  I misread the original posting, and didn't notice that 
the pointer question was connected to the previous quote.

Duncan Murdoch

__
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] Degrees of freedom in repeated measures glmmPQL

2007-05-02 Thread Charlotte Burn
Hello,

I've just carried out my first good-looking model using glmmPQL, and
the output makes perfect sense in terms of how it fits with our
hypothesis and the graphical representation of the data. However,
please could you clarify whether my degrees of freedom are
appropriate?

I had 106 subjects,
each of them was observed about 9 times, creating 882 data points.
The subjects were in 3 treatment groups, so I have told the model to
include subject as a random factor nested within treatment.
There are two other variables and I'm interested in their two-way
interactions with Treatment.
I'm happy with the model structure, and the output generally looks right, but...

In the 'DF' column of the output table, it has 882 as the degrees of
freedom for all the variables (except Treatment itself, which has 0
degrees of freedom). At the bottom of the output, it says Groups:
Subjects = 106, Treatment = 3.

Should I be worried or is this what to expect?!

I was expecting it to be more like an ANOVA table, where the error
degrees of freedom should reflect the number of subjects, not all the
data points.

I can't see the usual differentiation between the numerater and
denominator/error degrees of freedom, so am I right in thinking the DF
column shows the error degrees of freedom? Or do glmms not work like
this?

Thank you very much in advance,
Charlotte

__
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] Log-likelihood function

2007-05-02 Thread Doxastic

Thanks.  I used this and it gave me the same result as the logLik function. 
The reason I ask is the SAS output gives me a loglik = 1089.  R gives me
-298.09583.  Both for my reduced model.  For the saturated (or complex)
model, SAS gives me an loglik = 1143.  R gives me -298.1993.  The problem is
these give two very different pictures about whether I can drop the
interaction.  However, I think the residual deviance in the R output is
equal to G^2.  So, I can just take the difference between those two.  If I
do this, I get a difference with an interpretation similar to that of what
comes from SAS.  So I think I'll just go with that.  But who knows if I'm
right (not me)?

Thanks!




Ross Darnell wrote:
 
 Alternatively  generate the log-likelihood using the sum(dpois(y,
 fitted(model), log = TRUE))
 
 
 Regards
 
 Ross Darnell
 
 
 Doxastic wrote:
 
 You're right.  I do need to learn more.  I never learned null/residual
 deviance.  I know the deviance is equivalent to an anova decompostion. 
 But I've never dealt with it seperated like this.  
 
 I understand deviance as the difference between two model's
 log-likelihood difference between them and the most complex.  I want to
 compare two models that are not the most complex.  That is why I wanted
 the log-likelihood.  
 
 I am using the poisson distribution because my response is count data, so
 the link is the log.  If the deviance in R is computed by comparing the
 fitted model against the most saturated (which would make sense).  Then
 yes, I can use that.  I just picked the log-likelihood because I'm
 comparing two models.  And that's the best way.  But, it's equivalent if
 R compares the fitted to the most complex.
 
 I assumed the deviance print out tested the fitted model against the
 least complex.  This tests whether the current model parameters can be
 dropped (that's what I thought the null deviance meant).  I'm not sure
 what the residaul deviance means though.  
 
 My main concern is why the likelihood functions differed between SAS and
 R.  If anyone has encountered this or understands why, I would appreciate
 some help.
 
 
 
 Prof Brian Ripley wrote:
 
 I think you need to learn about deviances, which R does print.
 
 Log-likelihoods are only defined up to additive constants.  In this case 
 the conventional constant differs if you view this as a Poisson or as a 
 product-multinomial log-linear model, and R gives you the log-likelihood 
 for a Poisson log-linear model (assuming you specified family=poisson). 
 However, deviances and differences in log-likelihoods do not depend on 
 which.
 
 More details and worked examples can be found in MASS (the book, see the 
 FAQ), including other ways to fit log-linear models in R.
 
 
 On Tue, 1 May 2007, someone ashamed of his real name wrote:
 
 I've computed a loglinear model on a categorical dataset.  I would like
 to
 test whether an interaction can be dropped by comparing the
 log-likelihoods
 from two models(the model with the interaction vs. the model without).
 Since R does not immediately print the log-likelihood when I use the
 glm
 function, I used SAS initially.  After searching for an extracting
 function,
 I found one in R.  But, the log-likelihood given by SAS is different
 from
 the one given by R.  I'm not sure if the logLik function in R is
 giving me
 something I don't want.  Or if I'm misinterpreting the SAS output.  Can
 anyone help?

 
 -- 
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595
 
 __
 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.
 
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Log-likelihood-function-tf3678882.html#a10284217
Sent from the R help mailing list archive at Nabble.com.

__
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] I need help

2007-05-02 Thread elyakhlifi mustapha
hello,
I need help because I don't understand the syntaxe else how can I write it 
for example I writed a script to cut missings values and I have errors 

 if(na==length(C)){
+   pos=match(0,match(donGeno[[na-1]],donGeno[[na]],nomatch=0))
+   for(k in 1:(na-1)) {
+  if(pos==1) {donGeno[[k]] - 
donGeno[[k]][2:C[k]]}
+if(pos==C[k]){donGeno[[k]] - donGeno[[k]][1:(C[k]-1)]}
+else{donGeno[[k]] - 
c(donGeno[[k]][1:(pos-1)],donGeno[[k]][(pos+1):C(k)])}
+ }
+}
 if(na==1){
+ pos=match(0,match(donGeno[[na+1]],donGeno[[na]],nomatch=0))
+ for(k in 2:length(C)){
+ if(pos==1) {donGeno[[k]] - donGeno[[k]][2:C[k]]}
+ if(pos==C[k]){donGeno[[k]] - donGeno[[k]][1:(C[k]-1)]}
+ else{donGeno[[k]] - c(donGeno[[k]][1:(pos-1)],donGeno[[k]][(pos+1):C(k)])}
+  }
+   }
 else{for(k in 1:(na-1)){
Erreur : erreur de syntaxe dans else
   if(pos==1) {donGeno[[k]] - donGeno[[k]][2:C[k]]}
   if(pos==C[k]){donGeno[[k]] - donGeno[[k]][1:(C[k]-1)]}
   else{donGeno[[k]] - c(donGeno[[k]][1:(pos-1)],donGeno[[k]][(pos+1):C(k)])}
Erreur : erreur de syntaxe dans   else
 }
Erreur : erreur de syntaxe dans }
   for(k in 1:(na-1)){
+if(pos==1) {donGeno[[k]] - donGeno[[k]][2:C[k]]}
+   if(pos==C[k]){donGeno[[k]] - donGeno[[k]][1:(C[k]-1)]}
+   else{donGeno[[k]] - c(donGeno[[k]][1:(pos-1)],donGeno[[k]][(pos+1):C(k)])}
+  }
Erreur dans C(k) : objet non interprétable comme un facteur
 }
Erreur : erreur de syntaxe dans }


Have you got some ideas?


  
___





[[alternative HTML version deleted]]

__
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] I need help

2007-05-02 Thread Duncan Murdoch
On 02/05/2007 8:11 AM, elyakhlifi mustapha wrote:
 hello,
 I need help because I don't understand the syntaxe else how can I write it 
 for example I writed a script to cut missings values and I have errors 
 
 if(na==length(C)){
 +   pos=match(0,match(donGeno[[na-1]],donGeno[[na]],nomatch=0))
 +   for(k in 1:(na-1)) {
 +  if(pos==1) {donGeno[[k]] - 
 donGeno[[k]][2:C[k]]}
 +if(pos==C[k]){donGeno[[k]] - donGeno[[k]][1:(C[k]-1)]}
 +else{donGeno[[k]] - 
 c(donGeno[[k]][1:(pos-1)],donGeno[[k]][(pos+1):C(k)])}
 + }
 +}
 if(na==1){
 + pos=match(0,match(donGeno[[na+1]],donGeno[[na]],nomatch=0))
 + for(k in 2:length(C)){
 + if(pos==1) {donGeno[[k]] - donGeno[[k]][2:C[k]]}
 + if(pos==C[k]){donGeno[[k]] - donGeno[[k]][1:(C[k]-1)]}
 + else{donGeno[[k]] - c(donGeno[[k]][1:(pos-1)],donGeno[[k]][(pos+1):C(k)])}
 +  }
 +   }
 else{for(k in 1:(na-1)){
 Erreur : erreur de syntaxe dans else

R will parse a complete statement if you enter one.  Your if() was 
complete before the else was entered, so the else got orphaned.

The usual convention to avoid this is to put the else on the same line 
as the brace that closes the if, e.g.

if(na==1){
  ...
} else {
  ...
}

Duncan Murdoch

   if(pos==1) {donGeno[[k]] - donGeno[[k]][2:C[k]]}
   if(pos==C[k]){donGeno[[k]] - donGeno[[k]][1:(C[k]-1)]}
   else{donGeno[[k]] - c(donGeno[[k]][1:(pos-1)],donGeno[[k]][(pos+1):C(k)])}
 Erreur : erreur de syntaxe dans   else
 }
 Erreur : erreur de syntaxe dans }
   for(k in 1:(na-1)){
 +if(pos==1) {donGeno[[k]] - donGeno[[k]][2:C[k]]}
 +   if(pos==C[k]){donGeno[[k]] - donGeno[[k]][1:(C[k]-1)]}
 +   else{donGeno[[k]] - 
 c(donGeno[[k]][1:(pos-1)],donGeno[[k]][(pos+1):C(k)])}
 +  }
 Erreur dans C(k) : objet non interprétable comme un facteur
 }
 Erreur : erreur de syntaxe dans }
 
 
 Have you got some ideas?
 
 
   
 ___
 
 
 
 
 
   [[alternative HTML version deleted]]
 
 
 
 
 
 __
 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-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] Odp: I need help

2007-05-02 Thread Petr PIKAL
Hi
[EMAIL PROTECTED] napsal dne 02.05.2007 14:11:51:

 hello,
 I need help because I don't understand the syntaxe else how can I 
write it 
 for example I writed a script to cut missings values and I have errors 
 
  if(na==length(C)){
 + pos=match(0,match(donGeno[[na-1]],donGeno[[na]],nomatch=0))
 +   for(k in 1:(na-1)) {
 +  if(pos==1) {donGeno[[k]] 
- 
 donGeno[[k]][2:C[k]]}
 +if(pos==C[k]){donGeno[[k]] - donGeno[[k]][1:(C[k]-1)]}
 +else{donGeno[[k]] - 
c(donGeno[[k]][1:(pos-1)],donGeno[[k]][(pos+1):C(k)])}
 + }
 +}
  if(na==1){
 + pos=match(0,match(donGeno[[na+1]],donGeno[[na]],nomatch=0))
 + for(k in 2:length(C)){
 + if(pos==1) {donGeno[[k]] - donGeno[[k]][2:C[k]]}
 + if(pos==C[k]){donGeno[[k]] - donGeno[[k]][1:(C[k]-1)]}
 + else{donGeno[[k]] - 
c(donGeno[[k]][1:(pos-1)],donGeno[[k]][(pos+1):C(k)])}
 +  }
 +   }
  else{for(k in 1:(na-1)){
 Erreur : erreur de syntaxe dans else
if(pos==1) {donGeno[[k]] - donGeno[[k]][2:C[k]]}
if(pos==C[k]){donGeno[[k]] - donGeno[[k]][1:(C[k]-1)]}
else{donGeno[[k]] - 
c(donGeno[[k]][1:(pos-1)],donGeno[[k]][(pos+1):C(k)])}
 Erreur : erreur de syntaxe dans   else
  }
 Erreur : erreur de syntaxe dans }
for(k in 1:(na-1)){
 +if(pos==1) {donGeno[[k]] - donGeno[[k]][2:C[k]]}
 +   if(pos==C[k]){donGeno[[k]] - donGeno[[k]][1:(C[k]-1)]}
 +   else{donGeno[[k]] - 
c(donGeno[[k]][1:(pos-1)],donGeno[[k]][(pos+1):C(k)])}
 +  }
 Erreur dans C(k) : objet non interprétable comme un facteur
  }
 Erreur : erreur de syntaxe dans }
 
 
 Have you got some ideas?
 

What about to try to provide some reproducible example as suggested in 
posting guide. I believe your messy code can be evaluated in much more 
neat and concise way without so many ifs and fors. Maybe you can uncover 
some by yourself what trying to write a simple reproducible example. I am 
reluctant to decipher what you want to achieve but maybe you want retain 
only common values of several sets. So e.g. from match help page

## The intersection of two sets :
intersect - function(x, y) y[match(x, y, nomatch = 0)]
 x-sample(1:100, 50)
 y-1:50
 x2-sample(1:100,50)

 intersect(x,x2)
 [1] 39 87 66  7 64 79 62 98  6 95 96 35 74 36  3 50 58 97 52 33 61 88 47 
17 32 11 76 25
 intersect(y,intersect(x,x2))
 [1]  3  6  7 11 17 25 32 33 35 36 39 47 50

Regarding the error message

 if (1==1) print(25) else print(30)
[1] 25
 if (1==2) print(25) else print(30)
[1] 30
 if (1==1) print(25)
[1] 25
 else print(30)
Error: syntax error, unexpected ELSE in else


From help page
In particular, you ***should not have a newline between } and else to 
avoid a syntax error*** in entering a if ... else construct at the 
keyboard or via source. For that reason, one 
(somewhat extreme) attitude of defensive programming is to always use 
braces, e.g., for if clauses

Regards
Petr


 
 
 
___
 
 
 
 
 
[[alternative HTML version deleted]]
 
 __
 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-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] Get the difference of values to their own median value

2007-05-02 Thread Gabor Grothendieck
Use ave.  Also its easier to use read.table to read it in and then
convert it to a matrix if that's what you want.

Input - 29 4.5 1.505713
29 4.6 1.580402
29 4.7 1.656875
29 4.8 1.735054
30 0 0
30 0.1 0.00096108
30 0.2 0.00323831
29 4.5 1.495148
29 4.6 1.568961
29 4.7 1.644467
30 0 0
30 0.1 0.00093699
30 0.2 0.00319411
30 0.3 0.00676619

cn - c(x, y, z)
# replace next line with this:
#  INPUT - as.matrix(read.table(dat.dat, col.names = cn))
INPUT - as.matrix(read.table(textConnection(Input), col.names = cn))

INPUT[,3] - ave(INPUT[,3], INPUT[,1], INPUT[,2], FUN = median)



On 5/2/07, Felix Wave [EMAIL PROTECTED] wrote:
 Hello,
 I've got a matrix (mail end) with the colnames x, y, z. In this matrix
 are different measurements. x and y are risign coordinates.

 With the following line I got the median value of z for all x AND y witch
 are the same (not every measurment in my list hast the same number of
 x and y values. Sometimes lines are missing.
 MEDIAN  - na.omit( aggregate(INPUT[,3], by=list(INPUT[,2],INPUT[,1] ), 
 FUN=median ) )


 To see the failin of my measurments I want to get the difference between
 every measurment and the detected median values.
 The aim would be to have a list with different colums (for every measurment)
 with the difference between measurment 1,2,3, ..., x and the median.

 Has anybody an idea?

 I though I could split the measurment list. The beginning of every measurment
 can be found with
 START - grep( 0 0.0 0., INPUT)
 But not every measurment has the same length and I don't have always the
 same number of measurments.



 I hope you can help me.

 Thank's a lot.
 Felix




 ###
 ## My R Code ##
 ###
 INPUT   - readLines(dat.dat)
 INPUT   - gsub(^ , , INPUT)
 INPUT   - t( sapply( strsplit(INPUT, split= ), as.numeric ) )
 colnames(INPUT) - c(x, y, z )






 #
 ## dat.dat ##
 #
 29 4.5 1.505713
 29 4.6 1.580402
 29 4.7 1.656875
 29 4.8 1.735054
 30 0 0
 30 0.1 0.00096108
 30 0.2 0.00323831
 29 4.5 1.495148
 29 4.6 1.568961
 29 4.7 1.644467
 30 0 0
 30 0.1 0.00093699
 30 0.2 0.00319411
 30 0.3 0.00676619

 __
 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-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] repeated measures and recurrent events data

2007-05-02 Thread Luis Guillermo Diaz Monroy
Hello,

I need a data set on repeated measures and recurrent events data which had been 
registered on the same subject. This is very important to my thesis work.


Thanks a lot,

Luis Guillermo Díaz Monroy
Profesor Asociado
Universidad Nacional de Colombia

__
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] ED50 from logistic model with interactions

2007-05-02 Thread Christian Ritz
Hi Kate,

try looking at the package 'drc' on CRAN and in particular look at the 
example in the help page for the dataset 'daphnids' (?daphnids).

You can obtain arbitrary ED values with approximate standard errors 
using the function 'ED'.


Christian

__
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] how to concatinate the elements of some text vectors cat() or print() ?

2007-05-02 Thread John Kane
I have some comment text taken from a SAS data file. 
It is stored in two vectors and is difficult to read.
I would like to simply concatentate the individual
entries and end up with a character vector that give
me one line of text per comment.

I cannot see how to do this, yet it must be very easy.
 I have played around with cat() and print with no
success.  Would someone kindly point out where I
am going wrong?

Thanks

Simple Example:

 aa - LETTERS[1:5]
 bb - letters[1:5]
  cat(aa[1], bb[1])# works for individuals 
 cat(aa,bb)#(concatinates entire vectors)
 
 
# Using sink I might get it to work if I could figure
out how to escape a
# new line command. encodeString does not seem
appropriate here.
 harry - c(rep(NA,5))
 for (i in 1:5 ) {
 cat (aa[i],bb[i])
 }

__
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] NAs introduced by coercion in dist()

2007-05-02 Thread slomascolo

I work with Windows and use R version 2.4.1. I am JUST starting to learn this
program...

I get this warning message 'NAs introduced by coercion' while trying to
build a distance matrix (to be analyzed with NMDS later) from a 336 x 100
data matrix.  The original matrix has lots of zeros and no missing values,
but I don't think this should matter.

I searched this forum and people have suggested that the warning should be
ignored but when I try to print the distance matrix I only get the row
numbers (the matrix seems to be 'empty') and I'm not being able to judge
whether the matrix worked or not.

To get the distance matrix I wrote:
dist.PxMx - dist (PeaksMatrix, method='euclidean', diag=FALSE, upper=FALSE)

I tried including the p argument (included in the help for dist()) and
leaving it out, but that didn't seem to change anything.  I think that's
required for one distance measure though, not for euclidean dist. 

Should I really ignore this warning? If so, why am I not being able to see
the distance matrix?
-- 
View this message in context: 
http://www.nabble.com/NAs-introduced-by-coercion-in-dist%28%29-tf3680727.html#a10286358
Sent from the R help mailing list archive at Nabble.com.

__
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] KS test pvalue estimation using mctest (library truncgof)

2007-05-02 Thread D ANIELLO CLAUDIA \(MPS - 05966\)
Hi,
I'm trying to evaluate a Monte Carlo p-value (using truncgof package) on
a left truncated sample.
From an empirical sample I've estimated a generalized pareto
distribution parameters (xi, beta, threshold) (I've used fExtremes pkg).
I'm in doubt on what of the following command is the most appropriate:
Let:
x-sample
t-threshold
xt-x[xt]
xihat-gpdFit(x, threshold=t, type = pwm)$par.ests[1]
betahat-gpdFit(x, threshold=t, type = pwm)$par.ests[2]
(1)
ks.test(xt,pgpd,list(xi=xihat,beta=betahat),H=t,estfun =
as.list(gpdFit(x, 0)$par.ests), tol = 1e-02)
(2)
ks.test(xt,pgpd,list(xi=xihat,beta=betahat),H=t,estfun =
as.list(gpdFit(x, t)$par.ests), tol = 1e-02)
(3)
ks.test(xt,pgpd,list(xi=xihat,beta=betahat,mu=t),estfun =
as.list(gpdFit(x, t)$par.ests), tol = 1e-02)

Someone have ever faced this problem? I need to understand the role of
threshold in the Monte Carlo sampling from the GPD.
In the 1st case I've obtained high value of statistics and p-value, in
the second same value of statistic and very low p-value, in the 3rd low
statistic and p-value always equal to 1.

Thank you very much in advance
Regards
Claudia

__
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] Few contributed binaries for Mac OS X?

2007-05-02 Thread Ista Zahn
Dear all,

After upgrading to R 2.5.0 on my Intel-based Mac I find that there  
are only a few binary packages available. I've installed most of the  
packages I need from source, but am having trouble compiling RGtk2.  
Will Mac binary packages be available for R 2.5.0?

Thanks,

Ista Zahn
http://izahn.homedns.org

__
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] Degrees of freedom in repeated measures glmmPQL

2007-05-02 Thread Charlotte Burn
Apologies, I made a mistake with my maths. The degrees of freedom look
correct, assuming they are the denominator and that glmms work this
way. I just under-estimated the number of data points I had. Sorry.

Charlotte


On 02/05/07, Charlotte Burn [EMAIL PROTECTED] wrote:
 Hello,

 I've just carried out my first good-looking model using glmmPQL, and
 the output makes perfect sense in terms of how it fits with our
 hypothesis and the graphical representation of the data. However,
 please could you clarify whether my degrees of freedom are
 appropriate?

 I had 106 subjects,
 each of them was observed about 9 times, creating 882 data points.
 The subjects were in 3 treatment groups, so I have told the model to
 include subject as a random factor nested within treatment.
 There are two other variables and I'm interested in their two-way
 interactions with Treatment.
 I'm happy with the model structure, and the output generally looks right, 
 but...

 In the 'DF' column of the output table, it has 882 as the degrees of
 freedom for all the variables (except Treatment itself, which has 0
 degrees of freedom). At the bottom of the output, it says Groups:
 Subjects = 106, Treatment = 3.

 Should I be worried or is this what to expect?!

 I was expecting it to be more like an ANOVA table, where the error
 degrees of freedom should reflect the number of subjects, not all the
 data points.

 I can't see the usual differentiation between the numerater and
 denominator/error degrees of freedom, so am I right in thinking the DF
 column shows the error degrees of freedom? Or do glmms not work like
 this?

 Thank you very much in advance,
 Charlotte



-- 
--
Dr Charlotte C. Burn
Department of Animal Welfare and
Behaviour
School of Clinical Veterinary Science
University of Bristol
Langford House
Bristol BS40 5DU
Tel: 0117 9219134
http://seis.bristol.ac.uk/~frccb/charlotteburn.html

__
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] Polar graph of time and tide

2007-05-02 Thread Gabor Grothendieck
On 5/2/07, Jim Lemon [EMAIL PROTECTED] wrote:
 Alan E. Davis wrote:
  I have been trying to visualize times of lowest tides, month by month.
   I have tide predictions with times either in unix time or a text
  format, and heights in feet or meters.  I had been able to derive the
  clock times of each prediction.   I would now like to graph this data
  with points showing heights as r and times as theta, from  to
  2355.  There is a seasonal component: I am interested in displaying
  times of lowest tides in particular.
 
  I am sure this is so simple as to burden those on the list; I however
  have spent two evenings trying to figure out how to use polar.plot,
  and I'm not sure that's the best way to do this.  May I request some
  advice?  The docs with polar.plot are not complete, I fear.
 
  Thank you, begging for your indulgence,
 
 Hi Alan,
 Earl Glynn's advice is spot-on if you are trying to map tides onto the
 diurnal cycle. However, I get the impression that you want an annual
 cycle. If this is the case, it is probably best to go to the underlying
 function, radial.plot. Here is an example with some imaginary tides.

 lowtide-sin(seq(1:12)+sin(seq(1,24,by=2)/10))
 lowtide-rescale(lowtide,c(0,2355))
 month.abbr-c(jan,Feb,Mar,Apr,May,Jun,
  Jul,Aug,Sep,Oct,Nov,Dec)


 radial.plot(lowtide,labels=month.abbr,rp.type=s)

Note that month.abb is built into R so one could eliminate the
month.abbr- line and write:

radial.plot(lowtide, labels = month.abb, rp.type = s)

__
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] how to concatinate the elements of some text vectors cat() or print() ?

2007-05-02 Thread Liaw, Andy
Is paste() what you're looking for?

Andy 

From: John Kane
 
 I have some comment text taken from a SAS data file. 
 It is stored in two vectors and is difficult to read.
 I would like to simply concatentate the individual
 entries and end up with a character vector that give
 me one line of text per comment.
 
 I cannot see how to do this, yet it must be very easy.
  I have played around with cat() and print with no
 success.  Would someone kindly point out where I
 am going wrong?
 
 Thanks
 
 Simple Example:
 
  aa - LETTERS[1:5]
  bb - letters[1:5]
   cat(aa[1], bb[1])# works for individuals 
  cat(aa,bb)#(concatinates entire vectors)
  
  
 # Using sink I might get it to work if I could figure
 out how to escape a
 # new line command. encodeString does not seem
 appropriate here.
  harry - c(rep(NA,5))
  for (i in 1:5 ) {
  cat (aa[i],bb[i])
  }
 
 __
 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.
 
 
 


--
Notice:  This e-mail message, together with any attachments,...{{dropped}}

__
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] ED50 from logistic model with interactions

2007-05-02 Thread Rubén Roa
Kate Stark wrote:
 Hi,

 I was wondering if someone could please help me. I am doing a logistic
 regression to compare size at maturity between 3 seasons. My model is:

 fit - glm(Mature ~ Season * Size - 1, family = binomial, data=dat)

 where Mature is a binary response, 0 for immature, 1 for mature. There
 are 3 Seasons.

 The Season * Size interaction is significant. I would like to compare the 
 size at 50% maturity between Seasons, which I have calculated as:

 Mat50_S1 - -fit$coef[1]/fit$coef[4]
 Mat50_S2 - -fit$coef[2]/(fit$coef[4] + fit$coef[5])
 Mat50_S3 - -fit$coef[3]/(fit$coef[4] + fit$coef[6])

 But I am not sure how to calculate the standard error around each of
 these estimates. The p.dose function from the MASS package does this
 automatically, but it doesn’t seem to allow interaction terms.

 In Faraway(2006) he has an example using the delta method to calculate
 the StdErr, but again without any interactions. I can apply this for the
 first Season, as there is just one intercept and one slope coefficient,
 but for the other 2 Seasons, the slope is a combination of the Size
 coefficient and the Size*Season coefficient, and I am not sure how to use 
 the covariance matrix in the delta calculation.

 I could divide the data and do 3 different logistic regressions, one for
 each season, but while the Mat50 (i.e. mean Size at 50% maturity) is the
 same as that calculated by the separate lines regression, Im not sure how 
 this may change the StdErr?

 Regards,

 Kate
   
Hi,
Maybe you can re-parameterize the logistic model in such a way that the 
size at 50% maturity for each season are explicit parameters in the 
model, so the support function is maximized for those arguments and you 
get the standard errors directly. For example, the following code 
estimate the size at 50% maturity when the only predictor variable is 
size. I guess you can use it to generalize to the case of an additional 
factor such as season. I wrote this code as a translation from ADMB to R 
so it is rather detailed (it uses nlm for maximization). count is real 
data from a squid population and size (l) is in cm. Note in prop.ini, 
prop.est, and prop.fit the reparameterization that introduces the size 
at 50% maturity directly (along with the size at 95% maturity).
Rubén Roa-Ureta

l-sort(c(8:33,8:33))
mat-rep.int(x=c(0,1),times=26)
imat-rep.int(x=c(1,0),times=26)
count-c(2,0,3,0,3,0,6,0,7,0,9,0,6,0,3,0,6,0,2,0,4,0,1,0,4,1,2,1,2,0,1,2,1,1,2,0,1,2,2,2,0,0,1,1,0,0,0,0,0,0,0,1)
l.plot-8:33
contot-vector(mode=numeric,length=26)
prop.obs-vector(mode=numeric,length=26)
for (i in 1:26) {
countot[i]-count[i*2-1]+count[i*2]
ifelse(countot[i]0,prop.obs[i]-count[i*2]/countot[i],NA)
}
l_50=25
l_95=35
prop.ini-1/(1+exp((log(1/19))*((l.plot-l_50)/(l_95-l_50
plot(l.plot,prop.obs)
lines(l.plot,prop.ini)
fn-function(p){
prop.est-1/(1+exp(log(1/19)*(l-p[1])/(p[2]-p[1])));
iprop.est-1-prop.est;
negloglik--sum(count*(mat*log(prop.est)+imat*log(iprop.est)));
}
prop.lik-nlm(fn,p=c(25.8,33.9),hessian=TRUE)
prop.lik
L_50-prop.lik$estimate[1]
L_95-prop.lik$estimate[2]
prop.covmat-solve(prop.lik$hessian)
seL_50-sqrt(prop.covmat[1,1])
seL_95-sqrt(prop.covmat[2,2])
covL_50_95-prop.covmat[1,2]
prop.fit-1/(1+exp((log(1/19))*((l_plot-L_50)/(L_95-L_50
plot(l.plot,prop.obs,pch=19,xlab=Length (cm),ylab=Proportion Mature)
lines(l.plot,prop.fit)
text(x=12.5,y=0.9,expression(paste(p(l)=,frac(1,1+e^frac(ln(1/19)(l-l[50]),(l[95]-l[50]))
text(x=12.5,y=0.7,expression(paste(hat(l)[50],=25.8)))
text(x=12.5,y=0.55,expression(paste(hat(l)[95],=34.0)))

__
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] NAs introduced by coercion in dist()

2007-05-02 Thread Peter Dalgaard
slomascolo wrote:
 I work with Windows and use R version 2.4.1. I am JUST starting to learn this
 program...

 I get this warning message 'NAs introduced by coercion' while trying to
 build a distance matrix (to be analyzed with NMDS later) from a 336 x 100
 data matrix.  The original matrix has lots of zeros and no missing values,
 but I don't think this should matter.

 I searched this forum and people have suggested that the warning should be
 ignored but when I try to print the distance matrix I only get the row
 numbers (the matrix seems to be 'empty') and I'm not being able to judge
 whether the matrix worked or not.

 To get the distance matrix I wrote:
 dist.PxMx - dist (PeaksMatrix, method='euclidean', diag=FALSE, upper=FALSE)

 I tried including the p argument (included in the help for dist()) and
 leaving it out, but that didn't seem to change anything.  I think that's
 required for one distance measure though, not for euclidean dist. 

 Should I really ignore this warning? If so, why am I not being able to see
 the distance matrix?
   
That error message is often generated by things like

 as.numeric(X)
[1] NA
Warning message:
NAs introduced by coercion

so the immediate suspicion is that your data are not what you think they
are.

The output of str(PeaksMatrix) should be illuminating.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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] ROracle issues

2007-05-02 Thread Don MacQueen
You may have a confusion between 64 bit and 32 bit versions. (I'm not 
certain; I haven't studied your transcript in complete detail, but 
rather just noticed a couple of things.)

There are a lot of references in your transcript to 64 bit libraries, 
e.g. gcc -I/usr/lib64 ... but I think that $ORACLE_HOME/lib is a 
reference to Oracle's 32 bit libraries.

ROracle offers some INSTALL flags to specify 32 bit or 64 bit, so you 
might try figuring out which one you want, and specifying it.

There is also the R-sig-db mailing list, which might be a better place to ask.

-Don


At 11:15 AM -0600 4/30/07, Matt Anthony wrote:
Hi all -



I am trying to install ROracle for linux machines ... I have read the
INSTALL documentation and followed the directions for setting the paths
as follows:



export PATH=/app/oracle/product/10.2.0/db_1/bin:$PATH

[EMAIL PROTECTED] ~]$ export
LD_LIBRARY_PATH=/usr/lib:/usr/lib64:/lib:/app/oracle/product/10.1.0/db_1
/lib32:/app/oracle/product/10.1.0/db_1/lib:/app/oracle/product/10.1.0/db
_1/lib64



As directed by the INSTALL document. Executing the install by running



sudo R CMD INSTALL ROracle_0.5-8.tar.gz



gives me the following:



* Installing *source* package 'ROracle' ...

checking for gcc... gcc

checking for C compiler default output... a.out

checking whether the C compiler works... yes

checking whether we are cross compiling... no

checking for suffix of executables...

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ANSI C... none needed

checking how to run the C preprocessor... gcc -E

configure: creating ./config.status

config.status: creating src/Makevars

config.status: creating src/Makefile

** libs

** arch -

R CMD COMPILE RS-DBI.c

make[1]: Entering directory `/tmp/R.INSTALL.e14574/ROracle/src'

gcc -I/usr/lib64/R/include -I/usr/lib64/R/include
-DRS_ORA_SQLGLS_WORKAROUND -I/usr/local/include-fpic  -O2 -g
-std=gnu99 -c RS-DBI.c -o RS-DBI.o

make[1]: Leaving directory `/tmp/R.INSTALL.e14574/ROracle/src'

proc CODE=ANSI_C MODE=ORACLE INCLUDE=/usr/lib64/R/include \

 PARSE=NONE LINES=false PREFETCH=1 RS-Oracle.pc

proc: error while loading shared libraries: libclntsh.so.10.1: cannot
open shared object file: No such file or directory

make: *** [RS-Oracle.c] Error 127

ERROR: compilation failed for package 'ROracle'

** Removing '/usr/lib64/R/library/ROracle'





Now, to check for the libclntsh.so.10.1 file, did the following:



CD $ORACLE_HOME/lib

Ls



In which the file libclntsh.so.10.1 actually does exist, even though the
error message seems to imply it doesn't. I have searched the archives
but found no record of a solution to this problem, and the documentation
provided with the package does not address this issue as far as I can
tell. Can someone please explain/point me in the right direction?



Thank you



Matt















Matt Anthony | Senior Statistician| 303.327.1761 |
[EMAIL PROTECTED]
10155 Westmoor Drive | Westminster, CO 80021 | FAX 303.327.1650






   [[alternative HTML version deleted]]

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


-- 
--
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA

__
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] RE : add arrows to barchart with groups

2007-05-02 Thread GOUACHE David
Hello and thank you for this first response

I'll rephrase what I mean by more general: in a case where I have only 2 
levels in groups, but in which I have more than 2 levels for variable s, and in 
a case where the second bar is not necessarily higher than the first.
Thanks in advance.
Best regards,

David Gouache
Arvalis - Institut du Végétal


-Message d'origine-
De : Deepayan Sarkar [mailto:[EMAIL PROTECTED] 
Envoyé : vendredi 27 avril 2007 19:52
À : GOUACHE David
Cc : r-help@stat.math.ethz.ch
Objet : Re: [R] add arrows to barchart with groups

On 4/27/07, GOUACHE David [EMAIL PROTECTED] wrote:
 Hello Rhelpers,

 I am trying to represent the following data (hereafter named donnees) in a 
 barchart with a grouping variable :


 sitetraitement  dates   res
 1   NT  17/10/2005  normal  76.2
 1   T   17/10/2005  normal  103.2
 1   NT  23/11/2005  tardif  81.6
 1   T   23/11/2005  tardif  98
 2   NT  15/10/2005  normal  72.71
 2   T   15/10/2005  normal  94.47
 2   NT  15/11/2005  tardif  79.65
 2   T   15/11/2005  tardif  94.7

 barchart(res~s|site,groups=traitement,data=donnees)

 What I'd like to do is for each site represent with an arrow the difference 
 in value of variable res between normal and tardif values of variable s.
 I've found one way of doing it:


 trellis.focus(panel,1,1)
 xx-trellis.panelArgs()$x
 yy-trellis.panelArgs()$y
 panel.arrows(as.numeric(xx)[c(1,3)]-0.1,yy[c(1,3)],as.numeric(xx)[c(1,3)]-0.1,yy[c(2,4)],lwd=2,code=3)
 panel.text(as.numeric(xx)[c(1,3)]-0.35,c(87,87),paste(yy[c(2,4)]-yy[c(1,3)],\nq/ha),font=2)
 trellis.focus(panel,2,1)
 xx-trellis.panelArgs()$x
 yy-trellis.panelArgs()$y
 panel.arrows(as.numeric(xx)[c(1,3)]-0.1,yy[c(1,3)],as.numeric(xx)[c(1,3)]-0.1,yy[c(2,4)],lwd=2,code=3)
 panel.text(as.numeric(xx)[c(1,3)]-0.35,c(87,87),paste(yy[c(2,4)]-yy[c(1,3)],\nq/ha),font=2)
 trellis.unfocus()

 But I would prefer doing this within a custom panel function so I can apply 
 it more generally, and I haven't been able to figure out how...
 Could anyone give me a hand?

The obvious analog (just copy/pasting your code) is:

my.panel - function(x, y, ...)
{
panel.barchart(x, y, ...)
xx - x
yy - y
panel.arrows(as.numeric(xx)[c(1,3)]-0.1, yy[c(1,3)],
 as.numeric(xx)[c(1,3)]-0.1, yy[c(2,4)],
 lwd = 2, code = 3)
panel.text(as.numeric(xx)[c(1,3)] - 0.35, c(87,87),
   paste(yy[c(2,4)] - yy[c(1,3)], \nq/ha),
   font=2)
}

and this seems to work:

barchart(res~s|site,groups=traitement,data=donnees,
 panel = my.panel)

barchart(res~s|site,groups=traitement,data=donnees,
 panel = my.panel,
 origin = 0)

I'm not sure what else you are looking for and what you mean by more
general. For example, it's not clear what you want to happen If you
have more than 2 levels in 'groups', or if the second bar is not
always higher than the first.

-Deepayan

__
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] NAs introduced by coercion in dist()

2007-05-02 Thread Silvia Lomascolo

It was suggested that the 'NAs introduced by coercion' message might be
warning me that my data are not what they should be.  I checked this using
str(PeaksMatrix), as suggested, and the data seem to be what I thought they
were: 

'data.frame':   335 obs. of  127 variables:
 $ Code   : Factor w/ 335 levels A1MR,A1MU,..: 1 2 3 4 5 6 7 8 9 10 ...
 $ P3.70  : num  0 0 0 0 0 0 0 0 0 0 ...
 $ P3.97  : num  0 0 0 0 0 0 0 0 0 0 ...
 $ P4.29  : num  0 0 0 0 0 0 0 0 0 0 ...
 $ P4.90  : num  0 0 0 0 0 0 0 0 0 0 ...
 $ P6.30  : num  0 0 0 0 0 0 0 0 0 0 ...
 $ P6.45  : num  7.73 0 0 0 0 0 4.03 0 0 0 ...
 $ P6.55  : num  0 0 0 0 0 0 0 0 0 0 ...

...

I do have 335 observations, 127 variables that are named P3.70, 3.97, P4.29,
etc..  This was a relief, but I still don't know whether the distance matrix
is what it should be.  I tried 'str(dist.PxMx)', which is the name of my
distance matrix, but I get something that has not much meaning to me, an
unexperienced R user:

Class 'dist'  atomic [1:55945] 329.6 194.9 130.1  70.7 116.9 ...
  ..- attr(*, Size)= int 335
  ..- attr(*, Labels)= chr [1:335] 1 2 3 4 ...
  ..- attr(*, Diag)= logi FALSE
  ..- attr(*, Upper)= logi FALSE
  ..- attr(*, method)= chr euclidean
  ..- attr(*, call)= language dist(x = PeaksMatrix, method = euclidean,
diag = FALSE, upper = FALSE,  p = 2)

Any more suggestions, please?



Silvia Lomascolo wrote:
 
 I work with Windows and use R version 2.4.1. I am JUST starting to learn
 this program...
 
 I get this warning message 'NAs introduced by coercion' while trying to
 build a distance matrix (to be analyzed with NMDS later) from a 336 x 100
 data matrix.  The original matrix has lots of zeros and no missing values,
 but I don't think this should matter.
 
 I searched this forum and people have suggested that the warning should be
 ignored but when I try to print the distance matrix I only get the row
 numbers (the matrix seems to be 'empty') and I'm not being able to judge
 whether the matrix worked or not.
 
 To get the distance matrix I wrote:
 dist.PxMx - dist (PeaksMatrix, method='euclidean', diag=FALSE,
 upper=FALSE)
 
 I tried including the p argument (included in the help for dist()) and
 leaving it out, but that didn't seem to change anything.  I think that's
 required for one distance measure though, not for euclidean dist. 
 
 Should I really ignore this warning? If so, why am I not being able to see
 the distance matrix?
 

-- 
View this message in context: 
http://www.nabble.com/NAs-introduced-by-coercion-in-dist%28%29-tf3680727.html#a10286882
Sent from the R help mailing list archive at Nabble.com.

__
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] Log-likelihood function

2007-05-02 Thread Robert A LaBudde
At 07:30 AM 5/2/2007, Doxastic wrote:
Thanks.  I used this and it gave me the same result as the logLik function.
The reason I ask is the SAS output gives me a loglik = 1089.  R gives me
-298.09583.  Both for my reduced model.  For the saturated (or complex)
model, SAS gives me an loglik = 1143.  R gives me -298.1993.  The problem is
these give two very different pictures about whether I can drop the
interaction.  However, I think the residual deviance in the R output is
equal to G^2.  So, I can just take the difference between those two.  If I
do this, I get a difference with an interpretation similar to that of what
comes from SAS.  So I think I'll just go with that.  But who knows if I'm
right (not me)?

Some comments:

1. Use summary() on your glm() object to get a fuller display of 
post-fit statistics, including the starting (null) and residual deviances.

2. The deviance is - 2 L, where L = ln(likelihood).

3. To test two nested models for the difference in covariates, 
subtract the two residual deviances and two d.f. and perform a 
chi-square test. This can be done nicely by anova() on the two glm() objects.

4. Check the coefficients in your SAS and R models and make sure you 
are performing the same fit in both cases.


Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: [EMAIL PROTECTED]
Least Cost Formulations, Ltd.URL: http://lcfltd.com/
824 Timberlake Drive Tel: 757-467-0954
Virginia Beach, VA 23464-3239Fax: 757-467-2947

Vere scire est per causas scire

__
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] stringification magic in subset?

2007-05-02 Thread ivo welch
dear R wizards:

I am trying to replace subset() with my own version that first checks
that each name in the select statement has a corresponding name in the
data set.  preferably, it would have the same syntax and semantics as
subset() otherwise.

alas, subset works in interesting ways:

subset(d, select=col1)

works just like

subset(d, select=col1)

somehow, subset manages to stringify its argument in such cases.  Is
it possible to duplicate the subset method one-for-one?

a minor question---where do I find the source definition such as that
of subset(), which is defined in

 subset
function (x, ...)
UseMethod(subset)
environment: namespace:base


any help, as usual, appreciated.

regards,

/ivo

__
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] upgrade to 2.5

2007-05-02 Thread Iasonas Lamprianou
Hi I am using R version 2.4.1. How can I upgrade to version 2.5 without having 
to install all the packages again? 
Thanks
Jason
 
Dr. Iasonas Lamprianou
Department of Education
The University of Manchester
Oxford Road, Manchester M13 9PL, UK
Tel. 0044 161 275 3485
[EMAIL PROTECTED]


  ___

now.

[[alternative HTML version deleted]]

__
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] A Question about knnFinder

2007-05-02 Thread Saptarshi Guha

Hello,
	Thanks to the author for writing knnFinder. I seem to have problem  
with a data set found here (http://www.stat.purdue.edu/~sguha/random/ 
mydata.csv)

This is the R-Code

ma-read.csv(~/mydata.csv)
ma-as.matrix(ma)
rownames(ma)-NULL
colnames(ma)-NULL
#ma is a 390x2 matrix

library(knnFinder)
ne-nn(ma,p=5)

However,  ne$nn.idx is the zero matrix and ne$nn.dist is the  
matrix whose entries are all 1000.

Could someone point out where I'm going wrong?
Thanks
Saptarshi

Saptarshi Guha | [EMAIL PROTECTED] | http://www.stat.purdue.edu/~sguha



PGP.sig
Description: This is a digitally signed message part
__
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] Query about RODBC to access MySQL from Windows

2007-05-02 Thread lalitha viswanath
Hi
I am trying to use RODBC in R installed on Windows to
access MySQL database (on a linux box).
I set up a DSN and specified this DSN in R as follows
library(RODBC);
channel - odbcConnect(mysqldsn);
RODB Connection 5
Details:
  case=nochange
  PORT=3306

Although this seems to connect properly, running any
command yields NO results.
i.e. sqlQuery(channel, show tables) yields 0 rows
when there are close to 500 tables in the database.
Ditto with any other query. It does not cause an
error, but it returns 0 rows.

The USER DSN mysqldsn is set up as follows :-
host : zion.xxx.xxx.xxx
default database : default_db
port : 3306
username : uname
password : pwd

Running  use default_db; show tables; command from
the command prompt on the db server returns 500 rows.

I find this problem while running any query. 
Running select * from tname limit 100 returns 0 rows
whereas tname has around a million records.

In the past, I have used MySQL clients for Windows to
access  the database without encountering any such
problem

I even tried setting up the mysqldsn DSN as a system
DSN instead of a user DSN.

I would like to know
a) whether this is a permissions issue at some level
b) whether there is any solution for this problem in R



Thanks
Lalitha

__
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] stringification magic in subset?

2007-05-02 Thread Sundar Dorai-Raj


ivo welch said the following on 5/2/2007 8:13 AM:
 dear R wizards:
 
 I am trying to replace subset() with my own version that first checks
 that each name in the select statement has a corresponding name in the
 data set.  preferably, it would have the same syntax and semantics as
 subset() otherwise.
 
 alas, subset works in interesting ways:
 
 subset(d, select=col1)
 
 works just like
 
 subset(d, select=col1)
 
 somehow, subset manages to stringify its argument in such cases.  Is
 it possible to duplicate the subset method one-for-one?
 
 a minor question---where do I find the source definition such as that
 of subset(), which is defined in
 
 subset
 function (x, ...)
 UseMethod(subset)
 environment: namespace:base
 
 any help, as usual, appreciated.
 
 regards,
 
 /ivo
 
 __
 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.


Try:

methods(subset)

which will point you to subset.data.frame. The latter code will answer 
your questions.

HTH,

--sundar

__
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] NAs introduced by coercion in dist()

2007-05-02 Thread Peter Dalgaard
Silvia Lomascolo wrote:
 It was suggested that the 'NAs introduced by coercion' message might be
 warning me that my data are not what they should be.  I checked this using
 str(PeaksMatrix), as suggested, and the data seem to be what I thought they
 were: 

 'data.frame':   335 obs. of  127 variables:
  $ Code   : Factor w/ 335 levels A1MR,A1MU,..: 1 2 3 4 5 6 7 8 9 10 ...
  $ P3.70  : num  0 0 0 0 0 0 0 0 0 0 ...
  $ P3.97  : num  0 0 0 0 0 0 0 0 0 0 ...
  $ P4.29  : num  0 0 0 0 0 0 0 0 0 0 ...
  $ P4.90  : num  0 0 0 0 0 0 0 0 0 0 ...
  $ P6.30  : num  0 0 0 0 0 0 0 0 0 0 ...
  $ P6.45  : num  7.73 0 0 0 0 0 4.03 0 0 0 ...
  $ P6.55  : num  0 0 0 0 0 0 0 0 0 0 ...

 ...

 I do have 335 observations, 127 variables that are named P3.70, 3.97, P4.29,
 etc..  This was a relief, but I still don't know whether the distance matrix
 is what it should be.  I tried 'str(dist.PxMx)', which is the name of my
 distance matrix, but I get something that has not much meaning to me, an
 unexperienced R user:

 Class 'dist'  atomic [1:55945] 329.6 194.9 130.1  70.7 116.9 ...
   ..- attr(*, Size)= int 335
   ..- attr(*, Labels)= chr [1:335] 1 2 3 4 ...
   ..- attr(*, Diag)= logi FALSE
   ..- attr(*, Upper)= logi FALSE
   ..- attr(*, method)= chr euclidean
   ..- attr(*, call)= language dist(x = PeaksMatrix, method = euclidean,
 diag = FALSE, upper = FALSE,  p = 2)

 Any more suggestions, please?


   
Actually, you seem to have 126 variables plus a factor called Code,
which has non-numeric levels. I think you probably want to lose that one
before calculating distances.
 Silvia Lomascolo wrote:
   
 I work with Windows and use R version 2.4.1. I am JUST starting to learn
 this program...

 I get this warning message 'NAs introduced by coercion' while trying to
 build a distance matrix (to be analyzed with NMDS later) from a 336 x 100
 data matrix.  The original matrix has lots of zeros and no missing values,
 but I don't think this should matter.

 I searched this forum and people have suggested that the warning should be
 ignored but when I try to print the distance matrix I only get the row
 numbers (the matrix seems to be 'empty') and I'm not being able to judge
 whether the matrix worked or not.

 To get the distance matrix I wrote:
 dist.PxMx - dist (PeaksMatrix, method='euclidean', diag=FALSE,
 upper=FALSE)

 I tried including the p argument (included in the help for dist()) and
 leaving it out, but that didn't seem to change anything.  I think that's
 required for one distance measure though, not for euclidean dist. 

 Should I really ignore this warning? If so, why am I not being able to see
 the distance matrix?

 

   


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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] reference in article

2007-05-02 Thread Tomas Mikoviny
Hi all R positive,

does anyone know how to refer R  in article?

thanks

tomas

__
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] Read every second line from ASCII file

2007-05-02 Thread Roland Rau
Dear all,

I just realized that I forgotten to write some kind of final email for 
this thread and to thank you for your help.
It seems that the recommeneded procedure in such circumstances has three 
steps:
1) readLines()
2) select the desired lines
3) strsplit()

Thanks Ferdinand, Jim, and Paul!
Roland

Roland Rau wrote:
 Dear all,
 
 I have an ASCII file where records are separated by a blank. I would 
 like to read those data; however, only the data in rows 1, 3, 5, 7, ... 
 are important; the other lines (2,4,6,8,) contain no useful 
 information for me.
 So far I used awk/gawk to do it:
 gawk '{if ((FNR % 2) != 0) {print $0}}' infile.txt  outfile.txt
 
 What is the recommended way to accomplish this in R?
 Simply reading the whole file, and deleting all the even-numbered lines 
 is not straightforward since these lines have different length (whereas 
 lines 1,3,5,7,... have the same length).
 
 I 'RSiteSearched' for read every second line from a file but this 
 search did not yield the desired result.
 Also trying out the arguments nrows and skip from read.table()  did not 
 help.
 
 Maybe someone knows an easy way to do it from within R? -- of course not 
 using system(gawk ) :-)
 If not, it does not matter too much since I get the job done easily with 
 awk.
 
 Thanks,
 Roland
 
 
 


__
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] choose.dir

2007-05-02 Thread Antje
Hi all,

I have written a R-script under Windows using choose.dir. Now, I have
seen that this function is missing at MacOS. Does anybody know an
alternative?

Antje

__
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] sorting in barplot

2007-05-02 Thread Romain . Mayor
Thank you for your answer,

But I think it doesn't work, because the function bargraph.CI (I use it
because barplot doesn't have a standard error option) use two internally
function(one for mean and the other for standard error) which use something
like tapply (which sort the factors by alphabet). If I decompose the two
function and  than reorder one time with mean and one other time with
standard error, so it doesn't match on the graph.
I try also so: bargraph.CI(x.factor = REGION, response = MOY_FST, data =
Fst2,ylab = Average Fst by pair of
populations,reorder(Fst2$REGION,Fst2$MOY_FST,mean))
with tihs Fst2 table:
  REGION MOY_FST
1  AR   0.039
2  AR   0.040
3  AR   0.041
4  AR   0.041
5  AR   0.044
6  AR   0.051
7  AR   0.055
8  AR   0.058
9  AR   0.069
10 AR   0.076
11   HT-S   0.080
12   HT-S   0.084
13   HT-S   0.090
14   HT-S   0.091
15   HT-S   0.094
16   HT-S   0.096
17 GE   0.079
18 GE   0.086
19 GE   0.095
20 GE   0.104
21 GE   0.107
22 GE   0.118
23 GE   0.119
24 GE   0.137
25 GE   0.139
26 GE   0.152
27 GE   0.178

But it doesn't work well.

RM, best regards.



   
 Marc Schwartz 
 [EMAIL PROTECTED] 
 mcast.net  A 
   [EMAIL PROTECTED]
 01.05.2007 19:49   cc 
   r-help@stat.math.ethz.ch
 Objet 
 Veuillez répondre Re: [R] sorting in barplot  
 à 
 [EMAIL PROTECTED] 
 cast.net  
   
   
   




On Tue, 2007-05-01 at 19:33 +0200, [EMAIL PROTECTED] wrote:
 Hello,

 I'm trying to sort my bargraph.CI plot (function like barplot in the
 SCIPLOT package) by the mean of the response variable.

 Does somebody have a trick for it.

 Thank you.

 Romain Mayor, PHD student.

If it is built on top of barplot(), then by default, the factor levels
of your response variable will determine the order of the bars in the
plot.

See ?reorder.factor for more details relative to defining the order
based upon the mean of the variable. There is an example there of using
the median.

HTH,

Marc Schwartz

__
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] reference in article

2007-05-02 Thread Doran, Harold
citation() 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Tomas Mikoviny
 Sent: Wednesday, May 02, 2007 11:44 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] reference in article
 
 Hi all R positive,
 
 does anyone know how to refer R  in article?
 
 thanks
 
 tomas
 
 __
 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-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] reference in article

2007-05-02 Thread Dimitris Rizopoulos
try

citation()


Best,
Dimitris


Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm


- Original Message - 
From: Tomas Mikoviny [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Wednesday, May 02, 2007 5:44 PM
Subject: [R] reference in article


 Hi all R positive,

 does anyone know how to refer R  in article?

 thanks

 tomas

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


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

__
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] Query about finding correlations

2007-05-02 Thread lalitha viswanath
Hi
I have a dataframe which has 3 columns of numeric data
A,B,C each of which has been obtained independent of
the other.

We are trying to find out, which of A or B cause C
i.e. We are hypothesising that C is the effect and
either A or B, not both is the cause.

i.e. A causes C and this cause-effect relationship
explains B.

The data for A contains more noise than that for B.
We are working with around 1000 points.

I would greatly appreciate any inputs on the best
statistcal approach to tackle this problem. 
I am thinking that we can find correlation
coefficients between A and C, and between B and C, but
I am not sure this answers the question.
Also we do not know whether the correlation between
them is linear or non linear.

Thanks
Lalitha

__
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] stringification magic in subset?

2007-05-02 Thread ivo welch
Beautiful.  thank you.  /ivo

 Try:

 methods(subset)

 which will point you to subset.data.frame. The latter code will answer
 your questions.

 HTH,

 --sundar


__
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] reference in article

2007-05-02 Thread Thomas Lumley
On Wed, 2 May 2007, Tomas Mikoviny wrote:

 Hi all R positive,

 does anyone know how to refer R  in article?


Every time you start R it says (in part)

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

-thomas

__
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] choose.dir

2007-05-02 Thread niederlein-rstat
Hi all,

I have written a R-script under Windows using choose.dir. Now, I have
seen that this function is missing at MacOS. Does anybody know an
alternative?

Antje

   
-
Kennt man wirklich jeden über 3 Ecken? Die Antworten gibt's bei Yahoo! Clever.
[[alternative HTML version deleted]]

__
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] Reenviar: repeated measures and recurrent events data

2007-05-02 Thread Luis Guillermo Diaz Monroy


Luis Guillermo Díaz Monroy
Profesor Asociado
Universidad Nacional de Colombia---BeginMessage---
Hello,

I need a data set on repeated measures and recurrent events data which had been 
registered on the same subject. This is very important to my thesis work.


Thanks a lot,

Luis Guillermo Díaz Monroy
Profesor Asociado
Universidad Nacional de Colombia

__
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.
---End Message---
__
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] Read every second line from ASCII file

2007-05-02 Thread Gabor Grothendieck
I typically wouldn't use strsplit but would reread it using read.table
and textConnection as in:

http://www.mail-archive.com/r-help@stat.math.ethz.ch/msg84752.html


On 5/2/07, Roland Rau [EMAIL PROTECTED] wrote:
 Dear all,

 I just realized that I forgotten to write some kind of final email for
 this thread and to thank you for your help.
 It seems that the recommeneded procedure in such circumstances has three
 steps:
 1) readLines()
 2) select the desired lines
 3) strsplit()

 Thanks Ferdinand, Jim, and Paul!
 Roland

 Roland Rau wrote:
  Dear all,
 
  I have an ASCII file where records are separated by a blank. I would
  like to read those data; however, only the data in rows 1, 3, 5, 7, ...
  are important; the other lines (2,4,6,8,) contain no useful
  information for me.
  So far I used awk/gawk to do it:
  gawk '{if ((FNR % 2) != 0) {print $0}}' infile.txt  outfile.txt
 
  What is the recommended way to accomplish this in R?
  Simply reading the whole file, and deleting all the even-numbered lines
  is not straightforward since these lines have different length (whereas
  lines 1,3,5,7,... have the same length).
 
  I 'RSiteSearched' for read every second line from a file but this
  search did not yield the desired result.
  Also trying out the arguments nrows and skip from read.table()  did not
  help.
 
  Maybe someone knows an easy way to do it from within R? -- of course not
  using system(gawk ) :-)
  If not, it does not matter too much since I get the job done easily with
  awk.
 
  Thanks,
  Roland
 
 
 
 

 __
 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-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] choose.dir

2007-05-02 Thread Gabor Grothendieck
I don't have a Mac but perhaps this works:

library(tcltk)
tclvalue(tkchooseDirectory())

On 5/2/07, Antje [EMAIL PROTECTED] wrote:
 Hi all,

 I have written a R-script under Windows using choose.dir. Now, I have
 seen that this function is missing at MacOS. Does anybody know an
 alternative?

 Antje

 __
 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-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] sorting in barplot

2007-05-02 Thread Marc Schwartz
Romain,

Try this before calling bargraph.CI():

 Fst2$REGION - reorder(Fst2$REGION, Fst2$MOY_FST, mean)

This will reorder the factor levels for REGION, based upon the mean
value of MOY_FST for each region. Thus, your REGIONS should then be
sorted by increasing mean values in the plot.

For example, note the factor levels for REGION at first:

 str(Fst2)
'data.frame':   27 obs. of  2 variables:
 $ REGION : Factor w/ 3 levels AR,GE,HT-S: 1 1 1 1 1 1 1 1 1 1 ...
 $ MOY_FST: num  0.039 0.04 0.041 0.041 0.044 0.051 0.055 0.058 0.069 0.076 ...


Now, note them after using reorder.factor():

 Fst2$REGION - reorder(Fst2$REGION, Fst2$MOY_FST, mean)

 str(Fst2)
'data.frame':   27 obs. of  2 variables:
 $ REGION : Factor w/ 3 levels AR,HT-S,GE: 1 1 1 1 1 1 1 1 1 1 ...
 $ MOY_FST: num  0.039 0.04 0.041 0.041 0.044 0.051 0.055 0.058 0.069 0.076 ...


This is consistent with the means for each REGION:

 tapply(Fst2$MOY_FST, Fst2$REGION, mean)
AR   HT-S GE 
0.0514 0.08916667 0.11945455 



Unless the author of the CRAN package that you are using has internally
altered the factor levels for the variable, you should be OK.

Another alternative, if needed, would be to use the barplot2() function
in the gplots package, or simply use barplot() and then add the CI's
using arrows() or segments().  There is an example of doing this in the
help for both functions.

HTH,

Marc

On Wed, 2007-05-02 at 17:36 +0200, [EMAIL PROTECTED] wrote:
 Thank you for your answer,
 
 But I think it doesn't work, because the function bargraph.CI (I use it
 because barplot doesn't have a standard error option) use two internally
 function(one for mean and the other for standard error) which use something
 like tapply (which sort the factors by alphabet). If I decompose the two
 function and  than reorder one time with mean and one other time with
 standard error, so it doesn't match on the graph.
 I try also so: bargraph.CI(x.factor = REGION, response = MOY_FST, data =
 Fst2,ylab = Average Fst by pair of
 populations,reorder(Fst2$REGION,Fst2$MOY_FST,mean))
 with tihs Fst2 table:
   REGION MOY_FST
 1  AR   0.039
 2  AR   0.040
 3  AR   0.041
 4  AR   0.041
 5  AR   0.044
 6  AR   0.051
 7  AR   0.055
 8  AR   0.058
 9  AR   0.069
 10 AR   0.076
 11   HT-S   0.080
 12   HT-S   0.084
 13   HT-S   0.090
 14   HT-S   0.091
 15   HT-S   0.094
 16   HT-S   0.096
 17 GE   0.079
 18 GE   0.086
 19 GE   0.095
 20 GE   0.104
 21 GE   0.107
 22 GE   0.118
 23 GE   0.119
 24 GE   0.137
 25 GE   0.139
 26 GE   0.152
 27 GE   0.178
 
 But it doesn't work well.
 
 RM, best regards.
 
 
 

  Marc Schwartz 
  [EMAIL PROTECTED] 
  mcast.net  A 
[EMAIL PROTECTED]
  01.05.2007 19:49   cc 
r-help@stat.math.ethz.ch
  Objet 
  Veuillez répondre Re: [R] sorting in barplot  
  à 
  [EMAIL PROTECTED] 
  cast.net  



 
 
 
 
 On Tue, 2007-05-01 at 19:33 +0200, [EMAIL PROTECTED] wrote:
  Hello,
 
  I'm trying to sort my bargraph.CI plot (function like barplot in the
  SCIPLOT package) by the mean of the response variable.
 
  Does somebody have a trick for it.
 
  Thank you.
 
  Romain Mayor, PHD student.
 
 If it is built on top of barplot(), then by default, the factor levels
 of your response variable will determine the order of the bars in the
 plot.
 
 See ?reorder.factor for more details relative to defining the order
 based upon the mean of the variable. There is an example there of using
 the median.
 
 HTH,
 
 Marc Schwartz
 
 


__
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] Query about finding correlations

2007-05-02 Thread Lalitha Viswanath
Hi
This is not a homework assignment :)
Me and my manager are trying to understand the problem better. In the
meanwhile, we thought we would post the problem on this forum to seek some
input from statisticians who possibly do this kind of analyses everyday and
hence are possibly more proficient with R and/or any recommended
methodologies.

Lalitha

On 5/2/07, Stefan Grosse [EMAIL PROTECTED] wrote:

 How about making your homeworks yourselfes?

 lalitha viswanath wrote:
  Hi
  I have a dataframe which has 3 columns of numeric data
  A,B,C each of which has been obtained independent of
  the other.
 
  We are trying to find out, which of A or B cause C
  i.e. We are hypothesising that C is the effect and
  either A or B, not both is the cause.
 
  i.e. A causes C and this cause-effect relationship
  explains B.
 
  The data for A contains more noise than that for B.
  We are working with around 1000 points.
 
  I would greatly appreciate any inputs on the best
  statistcal approach to tackle this problem.
  I am thinking that we can find correlation
  coefficients between A and C, and between B and C, but
  I am not sure this answers the question.
  Also we do not know whether the correlation between
  them is linear or non linear.
 
  Thanks
  Lalitha
 
  __
  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.
 
 
 



[[alternative HTML version deleted]]

__
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] Query about finding correlations

2007-05-02 Thread Stefan Grosse
I am sorry if I misinterpreted this but this questions looks/looked very
like a very basic one about statistical inference... (have a look at the
Manuals/contributed documentation e.g. Faraway)

Lalitha Viswanath wrote:
 Hi
 This is not a homework assignment :)
 Me and my manager are trying to understand the problem better. In the
 meanwhile, we thought we would post the problem on this forum to seek
 some input from statisticians who possibly do this kind of analyses
 everyday and hence are possibly more proficient with R and/or any
 recommended methodologies.

 Lalitha

 On 5/2/07, *Stefan Grosse* [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:

 How about making your homeworks yourselfes?

 lalitha viswanath wrote:
  Hi
  I have a dataframe which has 3 columns of numeric data
  A,B,C each of which has been obtained independent of
  the other.
 
  We are trying to find out, which of A or B cause C
  i.e. We are hypothesising that C is the effect and
  either A or B, not both is the cause.
 
  i.e. A causes C and this cause-effect relationship
  explains B.
 
  The data for A contains more noise than that for B.
  We are working with around 1000 points.
 
  I would greatly appreciate any inputs on the best
  statistcal approach to tackle this problem.
  I am thinking that we can find correlation
  coefficients between A and C, and between B and C, but
  I am not sure this answers the question.
  Also we do not know whether the correlation between
  them is linear or non linear.
 
  Thanks
  Lalitha
 
  __
  R-help@stat.math.ethz.ch mailto: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
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 


 

 No virus found in this incoming message.
 Checked by AVG Free Edition. 
 Version: 7.5.467 / Virus Database: 269.6.2/784 - Release Date: 01.05.2007 
 14:57


__
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] reference in article

2007-05-02 Thread Peter Dalgaard
Tomas Mikoviny wrote:
 Hi all R positive,

 does anyone know how to refer R  in article?

 thanks

 tomas
   
Like this (well, almost!  This is from R 2.4.1 - 2007 on the most recent
version)

 citation()

To cite R in publications use:

  R Development Core Team (2006). R: A language and environment for
  statistical computing. R Foundation for Statistical Computing,
  Vienna, Austria. ISBN 3-900051-07-0, URL http://www.R-project.org.

A BibTeX entry for LaTeX users is

  @Manual{,
title = {R: A Language and Environment for Statistical Computing},
author = {{R Development Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2006},
note = {{ISBN} 3-900051-07-0},
url = {http://www.R-project.org},
  }

We have invested a lot of time and effort in creating R, please cite it
when using it for data analysis. See also ‘citation(pkgname)’ for
citing R packages.


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


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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] Multiple scatterplots

2007-05-02 Thread Kostadin Cholakov
Hi,

I have to plot three Ziph distributions for three languages where the
x value represents the rank of a given word and the y value represents
the relative frequency of this word in the corpus. Is there some way
so that I can plot all three distributions on a single scatterplot,
preferably with different colours :) I tried to find something in the
R manual but there are no such examples :( Thank you!

__
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] Query about finding correlations

2007-05-02 Thread Stefan Grosse
How about making your homeworks yourselfes?

lalitha viswanath wrote:
 Hi
 I have a dataframe which has 3 columns of numeric data
 A,B,C each of which has been obtained independent of
 the other.

 We are trying to find out, which of A or B cause C
 i.e. We are hypothesising that C is the effect and
 either A or B, not both is the cause.

 i.e. A causes C and this cause-effect relationship
 explains B.

 The data for A contains more noise than that for B.
 We are working with around 1000 points.

 I would greatly appreciate any inputs on the best
 statistcal approach to tackle this problem. 
 I am thinking that we can find correlation
 coefficients between A and C, and between B and C, but
 I am not sure this answers the question.
 Also we do not know whether the correlation between
 them is linear or non linear.

 Thanks
 Lalitha

 __
 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-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] Multiple scatterplots

2007-05-02 Thread Kostadin Cholakov
Hi,

I have to plot three Ziph distributions for three languages where the
x value represents the rank of a given word and the y value represents
the relative frequency of this word in the corpus. Is there some way
so that I can plot all three distributions on a single scatterplot,
preferably with different colours :) I tried to find something in the
R manual but there are no such examples :( Thank you!

__
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] upgrade to 2.5

2007-05-02 Thread Sundar Dorai-Raj


Iasonas Lamprianou said the following on 5/2/2007 8:25 AM:
 Hi I am using R version 2.4.1. How can I upgrade to version 2.5 without 
 having to install all the packages again? 
 Thanks
 Jason
  

You may find the following link relevant.

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/75359.html

HTH,

--sundar

__
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] choose.dir

2007-05-02 Thread Antje
Thank you. For Windows it works, I'll check whether it also works for Mac :)


Gabor Grothendieck schrieb:
 I don't have a Mac but perhaps this works:
 
 library(tcltk)
 tclvalue(tkchooseDirectory())
 
 On 5/2/07, Antje [EMAIL PROTECTED] wrote:
 Hi all,

 I have written a R-script under Windows using choose.dir. Now, I have
 seen that this function is missing at MacOS. Does anybody know an
 alternative?

 Antje

 __
 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-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] Query about finding correlations

2007-05-02 Thread Alberto Monteiro
Lalitha Viswanath wrote:
 
 We are trying to find out, which of A or B cause C
 i.e. We are hypothesising that C is the effect and
 either A or B, not both is the cause.
 (...) 
 I would greatly appreciate any inputs on the best
 statistcal approach to tackle this problem. 
 I am thinking that we can find correlation
 coefficients between A and C, and between B and C, but
 I am not sure this answers the question.
 Also we do not know whether the correlation between
 them is linear or non linear.
 
If the causation (not the correlation) is not linear,
then the correlation (which is linear, always) may not
be the best indicator.

Take, as an extreme case, this:

A - (-50:50) + 100 * rnorm(101)
B - abs((-50):50) + 10 * rnorm(101)
C - A^2 / 50 + rnorm(101)
cor(A, C)
cor(B, C)

A is obviously the cause of C, but B (in some cases)
is better correlated to C than A to C.

Alberto Monteiro

__
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] upgrade to 2.5

2007-05-02 Thread Gabor Grothendieck
On 5/2/07, Sundar Dorai-Raj [EMAIL PROTECTED] wrote:


 Iasonas Lamprianou said the following on 5/2/2007 8:25 AM:
  Hi I am using R version 2.4.1. How can I upgrade to version 2.5 without 
  having to install all the packages again?
  Thanks
  Jason
 

 You may find the following link relevant.

 http://finzi.psych.upenn.edu/R/Rhelp02a/archive/75359.html


if you use Windows XP.

__
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] Query about finding correlations

2007-05-02 Thread Lalitha Viswanath
Hi
Thanks for your input. I stand corrected.
The causation is not linear.
We wish to find out which is the cause and under what circumstances. i.e. at
what points along a scale for C, is A the cause and when does B become the
cause, if at all.
As a crude analyses, we assumed that the above is not the case (i.e. either
A causes C all the time or B causes C all the time) and obtained correlation
coefficients using lmFit , however as you rightly mentioned, it is not of
much help to us.
We are trying to find out whether ages of proteins(A) or their rates of
evolution(B) influences parameter C.
There is an obvious correlation between A and B which needs to fulfil the
hypothesis as well.
I am checking out wald.test(eba), HypothesisTesting(fBasics), O8.Tests,
O6.LinearModels(limma) amongst others presently.
Thanks
Lalitha

On 5/2/07, Alberto Monteiro [EMAIL PROTECTED] wrote:

 Lalitha Viswanath wrote:
 
  We are trying to find out, which of A or B cause C
  i.e. We are hypothesising that C is the effect and
  either A or B, not both is the cause.
  (...)
  I would greatly appreciate any inputs on the best
  statistcal approach to tackle this problem.
  I am thinking that we can find correlation
  coefficients between A and C, and between B and C, but
  I am not sure this answers the question.
  Also we do not know whether the correlation between
  them is linear or non linear.
 
 If the causation (not the correlation) is not linear,
 then the correlation (which is linear, always) may not
 be the best indicator.

 Take, as an extreme case, this:

 A - (-50:50) + 100 * rnorm(101)
 B - abs((-50):50) + 10 * rnorm(101)
 C - A^2 / 50 + rnorm(101)
 cor(A, C)
 cor(B, C)

 A is obviously the cause of C, but B (in some cases)
 is better correlated to C than A to C.

 Alberto Monteiro



[[alternative HTML version deleted]]

__
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] Multiple scatterplots

2007-05-02 Thread John Kane
Your title and your posting do not say the same thing.
 

Assuming you want all three distributions on one
scatter plot does this help?

aa - 1:10
bb - 11:2
cc  - bb^2
dd - c(3,4,7,9,11,32,11,14,5,9)

plot(aa,cc, col=red)
points(aa,bb, col=blue)
points(aa,dd, col=green)

Also in plotting it is a good idea to look at all the
variations etc that you can get with par()

Type  ?par 

--- Kostadin Cholakov [EMAIL PROTECTED] wrote:

 Hi,
 
 I have to plot three Ziph distributions for three
 languages where the
 x value represents the rank of a given word and the
 y value represents
 the relative frequency of this word in the corpus.
 Is there some way
 so that I can plot all three distributions on a
 single scatterplot,
 preferably with different colours :) I tried to find
 something in the
 R manual but there are no such examples :( Thank
 you!
 
 __
 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-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] Free Webinar: Vendor Neutral Intro to Data Mining for AbsoluteBeginners, May 23, 2007

2007-05-02 Thread Brian Koch
Lisa: Can we expect to see R used [exclusively, I would hope] during
your demonstration?  Learning how data mining models work: the inputs,
the outputs, and the nature of the predictive mechanism only makes
sense for me if I can follow/retrace your steps on my systems.  Thank
you.

Brian J. Koch
Data Manager
Decision Development Inc


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lisa Solomon
Sent: Tuesday, May 01, 2007 1:46 PM
To: r-help
Subject: [R] Free Webinar: Vendor Neutral Intro to Data Mining for
AbsoluteBeginners, May 23, 2007

ONLINE VENDOR NEUTRAL INTRO TO DATA MINING FOR ABSOLUTE BEGINNERS (no
charge)

A non-technical data mining introduction for absolute beginners May 23,
2007, 10AM - 11AM PST Future Sessions (June 14, Sept 7)

To register for the webinar
---
1. Go to https://salford.webex.com/salford/onstage/g.php?d=928318845t=a
2. Click Enroll. 
3. On the registration form, enter your information and then click
Submit.

Once you have registered, you will receive a confirmation email message
with instructions on how to join the event, as well as audio and system
requirements.  Please read this confirmation email carefully!

This one-hour webinar is a perfect place to start if you are new to data
mining and have little-to-no background in statistics or machine
learning. 

In one hour, we will discuss:

**Data basics: what kind of data is required for data mining and
predictive analytics; In what format must the data be; what steps are
necessary to prepare data appropriately 

**What kinds of questions can we answer with data mining

**How data mining models work: the inputs, the outputs, and the nature
of the predictive mechanism 

**Evaluation criteria: how predictive models can be assessed and their
value measured 

**Specific background knowledge to prepare you to begin a data mining
project.

Please do not hesitate to contact me if you have any questions.

Sincerely,
Lisa Solomon
[EMAIL PROTECTED]

__
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-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] How to install previous packages after upgrading to R 2.5.0?

2007-05-02 Thread Jeffrey Wood
Hello,




I have just upgraded from R-2.4.1 to R-2.5.0 for Windows.

I had installed a large number of add-on packages under 2.4.1. Is there an easy 
way to install (or load, if that's the easier way) those packages under 2.5.0, 
without having to install each package by hand?

Thanks,
Jeff

__
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] R GUI in Ubuntu Feisty?

2007-05-02 Thread duggula

Hello Andy,

I had the same problem in Feisty and now I fixed it.
I updated to Java 6 through the repositories from Feisty.
Then I choosed java 6 with sudo update-alternatives --config java.
After that I started R with sudo R.
If you had already installed JGR, but it doesn't run you have to write:  

JGR(update=TRUE)

This is shown when you run 

library(JGR)

I wish you luck,
greetings Ralph






Andy Weller wrote:
 
 Dear all,
 
 After an update from Ubuntu Edgy to Feisty, I seem to have lost package
 JGR()!?
 
 I have updated my sources.list to point to the Feisty repos at 
 http://cran.ch.r-project.org/ and re-installed JGR() via:
 
 $ sudo rm -rf /usr/local/lib/R/site-packages/*
 $ sudo R CMD javareconf
 $ sudo R
   install.packages(JGR,dep=TRUE)
   library(JGR)
   JGR()
 
 However, I get the problem:
 
 export: 41: graphics,: bad variable name
 
 and JGR() doesn't want to start, R just hangs. I have r-base-dev and 
 sun-java5-jdk installed.
 
 Does anyone have any clues as to how to get this working?
 
 Thanks in advance, Andy
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/R-GUI-in-Ubuntu-Feisty--tf3670710.html#a10295067
Sent from the R help mailing list archive at Nabble.com.

__
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] upgrade to 2.5

2007-05-02 Thread Robert A LaBudde
At 01:41 PM 5/2/2007, you wrote:
On 5/2/07, Sundar Dorai-Raj [EMAIL PROTECTED] wrote:
 
 
  Iasonas Lamprianou said the following on 5/2/2007 8:25 AM:
   Hi I am using R version 2.4.1. How can I upgrade to version 2.5 
 without having to install all the packages again?
   Thanks
   Jason
  
 
  You may find the following link relevant.
 
  http://finzi.psych.upenn.edu/R/Rhelp02a/archive/75359.html
 

if you use Windows XP.

This link was useful to me, as I am new to R. (Win2000, R-2.5.0)

What I have been doing is using a file compare utility (Beyond 
Compare in my case) to move files in the old library directory to 
the new one, if the files are missing in the new one. Then I perform 
an update.packages command.

This procedure appears to work without problem.

It would seem much preferable to have all packages saved in an 
installation-independent directory, instead of a library directory 
under R's installation directory. Then, of course, no update would be 
necessary.

I can't find how this option is settable in R, other than a direct 
argument to library() or install.package().

How does one shift the R default libraries location to a particular directory?

Thanks.


Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: [EMAIL PROTECTED]
Least Cost Formulations, Ltd.URL: http://lcfltd.com/
824 Timberlake Drive Tel: 757-467-0954
Virginia Beach, VA 23464-3239Fax: 757-467-2947

Vere scire est per causas scire

__
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] How to install previous packages after upgrading to R 2.5.0?

2007-05-02 Thread Duncan Murdoch
On 02/05/2007 5:12 PM, Jeffrey Wood wrote:
 Hello,
 
 
 
 
 I have just upgraded from R-2.4.1 to R-2.5.0 for Windows.
 
 I had installed a large number of add-on packages under 2.4.1. Is there an 
 easy way to install (or load, if that's the easier way) those packages under 
 2.5.0, without having to install each package by hand?

I'm not sure if this counts as installing by hand, but (assuming you 
have a network connection) you can use the menu system to see the list 
of CRAN packages, and install the ones you want from there.  If you have 
some of your own non-CRAN packages, Install package from local .zip 
file allows multiple files to be selected and installed.

The only combination that's not so easy is installing from source 
.tar.gz files, but a shell command to loop over *.tar.gz could probably 
be written.

Duncan Murdoch

__
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] upgrade to 2.5

2007-05-02 Thread Sundar Dorai-Raj


Robert A LaBudde said the following on 5/2/2007 2:39 PM:
 At 01:41 PM 5/2/2007, you wrote:
 On 5/2/07, Sundar Dorai-Raj [EMAIL PROTECTED] wrote:

 Iasonas Lamprianou said the following on 5/2/2007 8:25 AM:
 Hi I am using R version 2.4.1. How can I upgrade to version 2.5 
 without having to install all the packages again?
 Thanks
 Jason

 You may find the following link relevant.

 http://finzi.psych.upenn.edu/R/Rhelp02a/archive/75359.html

 if you use Windows XP.
 
 This link was useful to me, as I am new to R. (Win2000, R-2.5.0)
 
 What I have been doing is using a file compare utility (Beyond 
 Compare in my case) to move files in the old library directory to 
 the new one, if the files are missing in the new one. Then I perform 
 an update.packages command.
 
 This procedure appears to work without problem.
 
 It would seem much preferable to have all packages saved in an 
 installation-independent directory, instead of a library directory 
 under R's installation directory. Then, of course, no update would be 
 necessary.
 
 I can't find how this option is settable in R, other than a direct 
 argument to library() or install.package().
 
 How does one shift the R default libraries location to a particular directory?
 


Set an environment variable R_LIBS. See the R Installation and 
Administration manual (Section 6).

HTH,

--sundar

__
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] How to install previous packages after upgrading to R 2.5.0?

2007-05-02 Thread John C Frain
Rename the library subdirectory in your new installation to something
like library.new.  Copy the library subdirectory in the old
distribution to the new installation.  Copy the contents of the
renamed library.new to the the directory copied from the old
distribution.  You should then start your new R and update packages
from the menu.  Check and ensure that you have not enabled automatic
loading of packages in /etc/Rprofile.site (eg to run Sciviews or
similar)  For further information see the Windows FAQ.

Regards
John Frain

On 02/05/07, Jeffrey Wood [EMAIL PROTECTED] wrote:
 Hello,




 I have just upgraded from R-2.4.1 to R-2.5.0 for Windows.

 I had installed a large number of add-on packages under 2.4.1. Is there an 
 easy way to install (or load, if that's the easier way) those packages under 
 2.5.0, without having to install each package by hand?

 Thanks,
 Jeff

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



-- 
John C Frain
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]

__
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] Multiple scatterplots

2007-05-02 Thread Bert Gunter
Please note: in R you can specify (some of the) graphics parameters as the
appropriate length vectors. So your plot example below can also be done as,
for example:

plot(
rep.int(aa,3),c(cc,bb,dd),col=rep(c(red,blue,green),e=length(aa)))

However, this doesn't seem to fit the posted request, where maybe something
like a trellis plot of the different distributions is what is wanted?? --
but I may well misunderstand.
 
Bert Gunter
Genentech Nonclinical Statistics


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of John Kane
Sent: Wednesday, May 02, 2007 11:06 AM
To: Kostadin Cholakov; r-help@stat.math.ethz.ch
Subject: Re: [R] Multiple scatterplots

Your title and your posting do not say the same thing.
 

Assuming you want all three distributions on one
scatter plot does this help?

aa - 1:10
bb - 11:2
cc  - bb^2
dd - c(3,4,7,9,11,32,11,14,5,9)

plot(aa,cc, col=red)
points(aa,bb, col=blue)
points(aa,dd, col=green)

Also in plotting it is a good idea to look at all the
variations etc that you can get with par()

Type  ?par 

--- Kostadin Cholakov [EMAIL PROTECTED] wrote:

 Hi,
 
 I have to plot three Ziph distributions for three
 languages where the
 x value represents the rank of a given word and the
 y value represents
 the relative frequency of this word in the corpus.
 Is there some way
 so that I can plot all three distributions on a
 single scatterplot,
 preferably with different colours :) I tried to find
 something in the
 R manual but there are no such examples :( Thank
 you!
 
 __
 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-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-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] Is R's fast fourier transform function different from fft2 in Matlab?

2007-05-02 Thread Li Li
Hi All,

I found mvfft in R and fft2 in Matlab give different result
and can't figure out why. My example is:

In R:
 matrix(c(1,4,2,20), nrow=2)
 [,1] [,2]
[1,]12
[2,]4   20
 mvfft(matrix(c(1,4,2,20), nrow=2))
  [,1]   [,2]
[1,]  5+0i  22+0i
[2,] -3+0i -18+0i

In Matlab:
fft2([1,2;4,20])

ans=

27   -17
-21   15

Does any function in R generate teh same result as what from Matlab?
Thanks,

Li

[[alternative HTML version deleted]]

__
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] how to reproduce the same sampled units?

2007-05-02 Thread Santanu Pramanik
Hi all,
 
Is it possible to generate the same sample number of times in R? In
SAS, using the option seed it is possible to reproduce exactly the
same sample. Is there any such feature in R which I can use? 
 
For further clarity,
 
for (i in 1:2)
{
samp = sample(1:1000,100,replace = FALSE)
print(samp)
}
 
For the above simulation, is it possible to generate the same sampled
units twice?
 
Any suggestion would be gratefully acknowledged.
Thanks,
Santanu
 
Santanu Pramanik
JPSM,1218J Lefrak Hall
University of Maryland,College Park
Phone no.-301-314-9916
 
 

[[alternative HTML version deleted]]

__
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] how to reproduce the same sampled units?

2007-05-02 Thread Ted Harding
On 02-May-07 23:25:18, Santanu Pramanik wrote:
 Hi all,
  
 Is it possible to generate the same sample number of times in R?
 In SAS, using the option seed it is possible to reproduce exactly
 the same sample. Is there any such feature in R which I can use? 
  
 For further clarity,
  
 for (i in 1:2)
 {
 samp = sample(1:1000,100,replace = FALSE)
 print(samp)
 }

  For the above simulation, is it possible to generate the same sampled
 units twice?
  
 Any suggestion would be gratefully acknowledged.
 Thanks,
 Santanu

Have a look at set.seed():

  ?set.seed

You will of course have to invoke it before you do your first run.
You cannot find out what the seed was afterwards!

For example (your example somewhat reduced):

  for (i in 1:2)
  {
  samp = sample(1:1000,10,replace = FALSE)
  print(samp)
  }
# [1] 984 587  26 920 304 247 434 392 650 279
# [1] 178 619 458 208 389 629 988 263 598 308

  for (i in 1:2)
  {
  set.seed(512534)
  samp = sample(1:1000,10,replace = FALSE)
  print(samp)
  }
# [1] 271 106 570 621 257 663 399 454 983 805
# [1] 271 106 570 621 257 663 399 454 983 805

Best wishes,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 03-May-07   Time: 00:56:43
-- XFMail --

__
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] upgrade to 2.5

2007-05-02 Thread Gabor Grothendieck
On 5/2/07, Robert A LaBudde [EMAIL PROTECTED] wrote:
 At 01:41 PM 5/2/2007, you wrote:
 On 5/2/07, Sundar Dorai-Raj [EMAIL PROTECTED] wrote:
  
  
   Iasonas Lamprianou said the following on 5/2/2007 8:25 AM:
Hi I am using R version 2.4.1. How can I upgrade to version 2.5
  without having to install all the packages again?
Thanks
Jason
   
  
   You may find the following link relevant.
  
   http://finzi.psych.upenn.edu/R/Rhelp02a/archive/75359.html
  
 
 if you use Windows XP.

 This link was useful to me, as I am new to R. (Win2000, R-2.5.0)

 What I have been doing is using a file compare utility (Beyond
 Compare in my case) to move files in the old library directory to
 the new one, if the files are missing in the new one. Then I perform
 an update.packages command.

 This procedure appears to work without problem.

 It would seem much preferable to have all packages saved in an
 installation-independent directory, instead of a library directory
 under R's installation directory. Then, of course, no update would be
 necessary.

You can do that but there is the limitation that the old version of
R will become unusable with the common library as newer versions of
packages, unable to work with the older version of R, get installed.  If each
version of R has its own library then you won't likely have that problem.

__
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] How to install previous packages after upgrading to R 2.5.0?

2007-05-02 Thread Gabor Grothendieck
On 5/2/07, Jeffrey Wood [EMAIL PROTECTED] wrote:
 Hello,




 I have just upgraded from R-2.4.1 to R-2.5.0 for Windows.

 I had installed a large number of add-on packages under 2.4.1. Is there an 
 easy way to install (or load, if that's the easier way) those packages under 
 2.5.0, without having to install each package by hand?

This was just discussed in another thread but batchfiles on CRAN (which is
a collection of Windows XP batch files, not an R package) contains
movedir.bat and copydir.bat that will move or copy your packages from
one version of R to another.  See the home page:

   http://code.google.com/p/batchfiles/

which gives links to the README where its explained and to the CRAN
download area from where you can download it.

movedir.bat is very fast (only a few seconds) but your packages will then
only reside in the new version of R.  copydir.bat is slower but makes
copies rather than moving the packages.  Neither will overwrite anything
so they are both pretty safe to use.

__
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] Is R's fast fourier transform function different from fft2 in Matlab?

2007-05-02 Thread Sundar Dorai-Raj


Li Li said the following on 5/2/2007 4:06 PM:
 Hi All,
 
 I found mvfft in R and fft2 in Matlab give different result
 and can't figure out why. My example is:
 
 In R:
 matrix(c(1,4,2,20), nrow=2)
  [,1] [,2]
 [1,]12
 [2,]4   20
 mvfft(matrix(c(1,4,2,20), nrow=2))
   [,1]   [,2]
 [1,]  5+0i  22+0i
 [2,] -3+0i -18+0i
 
 In Matlab:
 fft2([1,2;4,20])
 
 ans=
 
 27   -17
 -21   15
 
 Does any function in R generate teh same result as what from Matlab?
 Thanks,
 
 Li
 

I don't know Matlab or any of its functions, but the following produces 
the same output.

z - matrix(c(1, 4, 2, 20), nrow = 2)
Re(fft(z))

And from ?fft:

When 'z' contains an array, 'fft' computes and returns the multivariate 
(spatial) transform.

HTH,

--sundar

__
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] about using read.table

2007-05-02 Thread hassen62
Hi,Dear R users, I have a file text nommed chif which contains 16 lines and 4 
columns in the disc dur. I have a difficulty to read this file in R console I 
have used the following command
chif - read.table(c:/chif.txt, header=T, sep= )
I have obtained from R console:undefined file! Can you please help me.Thank you 
in advance.
[[alternative HTML version deleted]]

__
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] Building package: What does this message about rcompgen imply?

2007-05-02 Thread Peter Dunn
Hi all

I'm updating a package for submission to CRAN, and I am getting
an error message I never have seen before, and can't find out
what it implies or means (and hence, what I need to do to fix
it).

After running R CMD check, I get this:

snip
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd cross-references ... WARNING
Error in .find.package(package, lib.loc) :
there is no package called 'rcompgen'
Execution halted
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
snip


I am informed: There is no package called 'rcompgen'.  True;
I never knew there was one, so I certainly never asked for
it to be loaded.  (I can search all the files in the package directory
and the string  rcompgen  never appears either, and nor does the
string  find.package.)  So somewhere, this package must be deemed 
necessary to install.  (I have checked all dependencies too: none of
those packages need  rcompgen  either.)

I can get this package from CRAN and install it of course, but I
don't think I need it.  (Not that I fully understand what it is for
or what it does...).  I'm sure it implies there is a problem in
my package, but i don't know what problem that is.

So can anyone help me:  Why does R think I need package  rcompgen?
What error/mistake in my Rd files would invoke this?  Where should
I be looking, and what sort of problem might I be looking for?

Thanks as always.

P.

-- 
Dr Peter Dunn  |  dunn at usq.edu.au
Faculty of Sciences, USQ; http://www.sci.usq.edu.au/staff/dunn
Aust. Centre for Sustainable Catchments: www.usq.edu.au/acsc

This email (including any attached files) is confidential an...{{dropped}}

__
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] how to reproduce the same sampled units?

2007-05-02 Thread Kenneth Cabrera
?set.seed

On Wed, 02 May 2007 18:25:18 -0500, Santanu Pramanik  
[EMAIL PROTECTED] wrote:

 Hi all,
 Is it possible to generate the same sample number of times in R? In
 SAS, using the option seed it is possible to reproduce exactly the
 same sample. Is there any such feature in R which I can use?
 For further clarity,
 for (i in 1:2)
 {
 samp = sample(1:1000,100,replace = FALSE)
 print(samp)
 }
 For the above simulation, is it possible to generate the same sampled
 units twice?
 Any suggestion would be gratefully acknowledged.
 Thanks,
 Santanu
 Santanu Pramanik
 JPSM,1218J Lefrak Hall
 University of Maryland,College Park
 Phone no.-301-314-9916

   [[alternative HTML version deleted]]

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



-- 
Kenneth Roy Cabrera Torres
Cel 315 504 9339

__
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] Building package: What does this message about rcompgen imply?

2007-05-02 Thread Prof Brian Ripley
We don't have any of the basic details the posting guide asks for!

If this is R 2.5.0, rcompgen is a recommended package and ought to be 
installed.  If it is not, then .check_Rd_refs cannot cross-check 
references against all the standard and recommended packages, and that 
looks like the cause of the error.

If it is an earler version of R, the advice in the posting guide to update 
applies.  CRAN will be checking on 2.5.0 and later.


On Thu, 3 May 2007, Peter Dunn wrote:

 Hi all

 I'm updating a package for submission to CRAN, and I am getting
 an error message I never have seen before, and can't find out
 what it implies or means (and hence, what I need to do to fix
 it).

 After running R CMD check, I get this:

 snip
 * checking foreign function calls ... OK
 * checking R code for possible problems ... OK
 * checking Rd files ... OK
 * checking Rd cross-references ... WARNING
 Error in .find.package(package, lib.loc) :
there is no package called 'rcompgen'
 Execution halted
 * checking for missing documentation entries ... OK
 * checking for code/documentation mismatches ... OK
 * checking Rd \usage sections ... OK
 snip


 I am informed: There is no package called 'rcompgen'.  True;
 I never knew there was one, so I certainly never asked for
 it to be loaded.  (I can search all the files in the package directory
 and the string  rcompgen  never appears either, and nor does the
 string  find.package.)  So somewhere, this package must be deemed
 necessary to install.  (I have checked all dependencies too: none of
 those packages need  rcompgen  either.)

 I can get this package from CRAN and install it of course, but I
 don't think I need it.  (Not that I fully understand what it is for
 or what it does...).  I'm sure it implies there is a problem in
 my package, but i don't know what problem that is.

 So can anyone help me:  Why does R think I need package  rcompgen?
 What error/mistake in my Rd files would invoke this?  Where should
 I be looking, and what sort of problem might I be looking for?

 Thanks as always.

 P.



-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
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] Building package: What does this message about rcompgen imply?

2007-05-02 Thread Dirk Eddelbuettel

Peter,

On 3 May 2007 at 10:43, Peter Dunn wrote:
| After running R CMD check, I get this:
| 
| snip
| * checking foreign function calls ... OK
| * checking R code for possible problems ... OK
| * checking Rd files ... OK
| * checking Rd cross-references ... WARNING
| Error in .find.package(package, lib.loc) :
| there is no package called 'rcompgen'
| Execution halted

Are you by chance on Debian (or Ubuntu)?  

I couldn't make r-recommended 'Depends:' on r-cran-rcompgen because the later
was taking some time to come throught the 'new package' queue that has to be
manually inspected, checked, approved, ... by the Debian ftpmaster.  It is
now in unstable.

In any event, with R 2.5.0, and with or without Debian,

install.packages(rcompgen)

from within R (possibly running as root) should install it for you.

Subsequent Debian R packages will have r-recommended depends on
r-cran-rcompgen, and r-cran-codetools (which is delayed a bit more as I made
a mistake in the very first version I uploaded).

Regards, Dirk

-- 
Hell, there are no rules here - we're trying to accomplish something. 
  -- Thomas A. Edison

__
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] Building package: What does this message about rcompgen imply?

2007-05-02 Thread Peter Dunn
Dirk

 On 3 May 2007 at 10:43, Peter Dunn wrote:
 | After running R CMD check, I get this:
 |
 | snip
 | * checking foreign function calls ... OK
 | * checking R code for possible problems ... OK
 | * checking Rd files ... OK
 | * checking Rd cross-references ... WARNING
 | Error in .find.package(package, lib.loc) :
 | there is no package called 'rcompgen'
 | Execution halted

 Are you by chance on Debian (or Ubuntu)?

Bingo.

The short answer seems to be that I do need  rcompgen  to be
installed, and my Debian system didn't do that.  Easy fixed though.

Thanks.

P.

 version
   _
platform   i486-pc-linux-gnu
arch   i486
os linux-gnu
system i486, linux-gnu
status
major  2
minor  5.0
year   2007
month  04
day23
svn rev41293
language   R
version.string R version 2.5.0 (2007-04-23)


-- 
Dr Peter Dunn  |  dunn at usq.edu.au
Faculty of Sciences, USQ; http://www.sci.usq.edu.au/staff/dunn
Aust. Centre for Sustainable Catchments: www.usq.edu.au/acsc

This email (including any attached files) is confidential an...{{dropped}}

__
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] Survival statistics--displaying multiple plots

2007-05-02 Thread Gregory Pierce
Hello all!

I am once again analyzing patient survival data with chronic liver disease. 

The severity of the liver disease is given by a number which is continuously
variable. I have referred to this number as meld--model for end stage
liver disease--which is the result of a mathematical calculation on
underlying laboratory values. So, for example, I can generate a Kaplan-Meier
plot of patients undergoing a TIPS procedure with the following:

plot(survfit(Surv(days,status==1),subset(tips,meld10)) 

where tips is my data set, days is the number of days alive, and meld is
the meld score.

What I would like to do is display the survival graphs of patients with
meld10, 10meld20, and meld20. I am unsure about how to go about this.

Any suggestions would be appreciated.

Greg

__
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] Building package: What does this message about rcompgen imply?

2007-05-02 Thread Dirk Eddelbuettel

Peter,

On 3 May 2007 at 12:23, Peter Dunn wrote:
|  Are you by chance on Debian (or Ubuntu)?
| 
| Bingo.
| 
| The short answer seems to be that I do need  rcompgen  to be
| installed, and my Debian system didn't do that.  Easy fixed though.

Yes, sorry. I realized relatively late that we needed the two new packages,
and did not get them into the queue in time for the R 2.5.0 release, despite
an upload made during my vacation :) As this tends to take two to three weeks
with the number of packages going into Debian, I ended up missing this by a
few days.

Sorry for the trouble, and glad you got it working now.

Dirk

-- 
Hell, there are no rules here - we're trying to accomplish something. 
  -- Thomas A. Edison

__
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] Is R's fast fourier transform function different from fft2 in Matlab?

2007-05-02 Thread Li Li
Thanks for both replies.
Then I found the ifft2 from Matlab gives different result from fft( ,
inverse=T) from R.
An example:
in R:
 temp  - matrix(c(1,4,2, 20), nrow=2)
 fft(temp)
   [,1]   [,2]
[1,]  27+0i -17+0i
[2,] -21+0i  15+0i
 fft(temp,inverse=T)
   [,1]   [,2]
[1,]  27+0i -17+0i
[2,] -21+0i  15+0i

In Matlab:
 A = [1,2;4,20];
 fft2(A)
Ans =
   27-17
  -21 15
ifft2(A)
Ans=
   6.7500-4.2500
  -5.2500  3.7500

I also tried mvfft with inverse but can't get same result with ifft2. Does
any function work?
Thanks,

Li

On 5/2/07, Sundar Dorai-Raj  [EMAIL PROTECTED] wrote:


 I don't know Matlab or any of its functions, but the following produces
 the same output.

 z - matrix(c(1, 4, 2, 20), nrow = 2)
 Re(fft(z))

 And from ?fft:

 When 'z' contains an array, 'fft' computes and returns the multivariate
 (spatial) transform.

 HTH,

 --sundar


[[alternative HTML version deleted]]

__
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] Survival statistics--displaying multiple plots

2007-05-02 Thread Gregory Pierce
I should clarify. I can generate plots for each category individually but
not for all three on the same chart.

Greg

-Original Message-
From: Gregory Pierce [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 02, 2007 10:21 PM
To: 'r-help@stat.math.ethz.ch'
Subject: Survival statistics--displaying multiple plots

Hello all!

I am once again analyzing patient survival data with chronic liver disease. 

The severity of the liver disease is given by a number which is continuously
variable. I have referred to this number as meld--model for end stage
liver disease--which is the result of a mathematical calculation on
underlying laboratory values. So, for example, I can generate a Kaplan-Meier
plot of patients undergoing a TIPS procedure with the following:

plot(survfit(Surv(days,status==1),subset(tips,meld10)) 

where tips is my data set, days is the number of days alive, and meld is
the meld score.

What I would like to do is display the survival graphs of patients with
meld10, 10meld20, and meld20. I am unsure about how to go about this.

Any suggestions would be appreciated.

Greg

__
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] Is R's fast fourier transform function different from fft2 in Matlab?

2007-05-02 Thread Robert A LaBudde
Discrete Fourier transforms can be normalized in different ways.

Some apply the whole normalization to the forward transform, some to 
the reverse transform, some apply the square root to each, and some 
don't normalize at all (in which case the reverse of the forward 
transform will need scaling).

The latter apparently the case with R, according to your values.

Note that the R and the MatLab answers agree to within a scale factor 
for each row.

At 10:53 PM 5/2/2007, Li-Li wrote:
Thanks for both replies.
Then I found the ifft2 from Matlab gives different result from fft( ,
inverse=T) from R.
An example:
in R:
  temp  - matrix(c(1,4,2, 20), nrow=2)
  fft(temp)
[,1]   [,2]
[1,]  27+0i -17+0i
[2,] -21+0i  15+0i
  fft(temp,inverse=T)
[,1]   [,2]
[1,]  27+0i -17+0i
[2,] -21+0i  15+0i

In Matlab:
  A = [1,2;4,20];
  fft2(A)
Ans =
27-17
   -21 15
 ifft2(A)
Ans=
6.7500-4.2500
   -5.2500  3.7500

I also tried mvfft with inverse but can't get same result with ifft2. Does
any function work?


Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: [EMAIL PROTECTED]
Least Cost Formulations, Ltd.URL: http://lcfltd.com/
824 Timberlake Drive Tel: 757-467-0954
Virginia Beach, VA 23464-3239Fax: 757-467-2947

Vere scire est per causas scire

__
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] Survival statistics--displaying multiple plots

2007-05-02 Thread Robert A LaBudde
? layout()
? par()

E.g.,

layout(matrix(c(1,2,3),1,3,byrow=TRUE) #3 plots side-by-side

Then use plot() three times to generate each of your graphs.

At 11:14 PM 5/2/2007, Greg wrote:
I should clarify. I can generate plots for each category individually but
not for all three on the same chart.

Greg

-Original Message-
From: Gregory Pierce [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 02, 2007 10:21 PM
To: 'r-help@stat.math.ethz.ch'
Subject: Survival statistics--displaying multiple plots

Hello all!

I am once again analyzing patient survival data with chronic liver disease.

The severity of the liver disease is given by a number which is continuously
variable. I have referred to this number as meld--model for end stage
liver disease--which is the result of a mathematical calculation on
underlying laboratory values. So, for example, I can generate a Kaplan-Meier
plot of patients undergoing a TIPS procedure with the following:

 plot(survfit(Surv(days,status==1),subset(tips,meld10))

where tips is my data set, days is the number of days alive, and meld is
the meld score.

What I would like to do is display the survival graphs of patients with
meld10, 10meld20, and meld20. I am unsure about how to go about this.

Any suggestions would be appreciated.


Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: [EMAIL PROTECTED]
Least Cost Formulations, Ltd.URL: http://lcfltd.com/
824 Timberlake Drive Tel: 757-467-0954
Virginia Beach, VA 23464-3239Fax: 757-467-2947

Vere scire est per causas scire

__
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] Is R's fast fourier transform function different from fft2 in Matlab?

2007-05-02 Thread Sundar Dorai-Raj
Li Li said the following on 5/2/2007 7:53 PM:
 Thanks for both replies.
 Then I found the ifft2 from Matlab gives different result from fft( ,
 inverse=T) from R.
 An example:
 in R:
 temp  - matrix(c(1,4,2, 20), nrow=2)
 fft(temp)
[,1]   [,2]
 [1,]  27+0i -17+0i
 [2,] -21+0i  15+0i
 fft(temp,inverse=T)
[,1]   [,2]
 [1,]  27+0i -17+0i
 [2,] -21+0i  15+0i
 
 In Matlab:
 A = [1,2;4,20];
 fft2(A)
 Ans =
27-17
   -21 15
 ifft2(A)
 Ans=
6.7500-4.2500
   -5.2500  3.7500
 
 I also tried mvfft with inverse but can't get same result with ifft2. Does
 any function work?


This is easily explained if you read ?fft and the description of the 
'inverse' argument in the Value section. Please do read the help pages 
as the posting guide suggests.

  Re(fft(temp, inverse = TRUE)/4)

--sundar

__
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] Survival statistics--displaying multiple plots

2007-05-02 Thread Petr Klasterecky
Have a look at
?lines
?points
?plot - the option add, add=TRUE

You will have to specify proper limits on both axes, otherwise you may 
only see parts of the graphs. Some functions in the survival library 
also allow stratified analyses in which case the plots account for 
different strata.

Petr

Gregory Pierce napsal(a):
 I should clarify. I can generate plots for each category individually but
 not for all three on the same chart.
 
 Greg
 
 -Original Message-
 From: Gregory Pierce [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, May 02, 2007 10:21 PM
 To: 'r-help@stat.math.ethz.ch'
 Subject: Survival statistics--displaying multiple plots
 
 Hello all!
 
 I am once again analyzing patient survival data with chronic liver disease. 
 
 The severity of the liver disease is given by a number which is continuously
 variable. I have referred to this number as meld--model for end stage
 liver disease--which is the result of a mathematical calculation on
 underlying laboratory values. So, for example, I can generate a Kaplan-Meier
 plot of patients undergoing a TIPS procedure with the following:
 
 plot(survfit(Surv(days,status==1),subset(tips,meld10)) 
 
 where tips is my data set, days is the number of days alive, and meld is
 the meld score.
 
 What I would like to do is display the survival graphs of patients with
 meld10, 10meld20, and meld20. I am unsure about how to go about this.
 
 Any suggestions would be appreciated.
 
 Greg
 
 __
 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.
 

-- 
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic

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


  1   2   >