[R] dot diagram

2006-04-09 Thread Jinsong Zhao
Hi,

I am wondering whether there is a function that could plot 
a dot diagram like the output of following code.

Thanks in advance!

Best wishes!

Jinsong


-my dirty code here-

mydata - c(26,26,27,27,27,27,28,28,28,28,28,28,28,28,28,
28,28,28,28,29,29,29,29,29,29,29,29,29,29,29,
30,30,30,30,30,30,30,30,31,31,31,31,32,33,33,
33,34,34,35,43)

my.dot.plot - function(x, ...) {
x.table - table(x)
x.x - as.numeric(names(x.table))
x.y - as.numeric(x.table)
n - length(x.x)
x.final - NULL
for (i in 1:n) {
tmp - data.frame(x=rep(x.x[i], x.y[i]), y=1:x.y[i])
x.final - rbind(x.final, tmp)
}
plot(x.final, yaxt=n, ylab=, pch=19, frame.plot=FALSE, ...)
}

my.dot.plot(mydata, xlab =speed, xlim=c(25,45))

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


Re: [R] copying and pasting to R in linux

2006-04-09 Thread Larry Howe
Louis,

OK, I don't use any GUI, just the command line. Everything works fine on the 
command line.

I had the same problem with downloaded Suse 10. It doesn't contain all the 
same packages that the purchased version does. You have to do Yast / 
Installation Source and add installation sources. They are listed at 
http://en.opensuse.org/Package_Repositories

Larry

On Saturday 08 April 2006 23:49, you wrote:
 Here are the combinations I have tried:

 Standard R gui, kwrite cut and paste small files, source small files
 Standard R gui, kate same as above
 Standard R gui, office word processor same as above
 Tk R gui source works fine, but doesn't support cut and paste

 By the way I just installed suse 10.0 from the downloaded cd's and when I
 try to install the latest R rpm, I am told I am missing a couple of support
 files. Any suggestions here?

 On Saturday 08 April 2006 16:19, Larry Howe wrote:
  On Saturday 08 April 2006 16:27, louis homer wrote:
   When I use R, I am accustomed to developing programs in a text
   processor, and then copying from the text processor and pasting into R.
   This usually works fine, except that using the default text processor
   in Suse 9.0, long programs don't transfer completely. Using the
   'source' program, also only works with small programs. Suggestions?
 
  Hmmm...I'm using Suse 9 and 10, and I don't have that problem. Can you
  give some more detail? By the default editor, do you mean KWrite? It's OK
  but Kate is somewhat better for programming. It's hidden way inside the
  start menu so I usually just go Start / Run command / kate.
 
  Are you saying that
 
  - create R script in editor
  - save script
  - start R
  - source(name of file)
 
  does not work?
 
  Larry Howe
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html

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


Re: [R] (IT WAS) Aggregating an its series

2006-04-09 Thread vittorio
Thanks for the brilliant solution.

***AGAIN***

Now - just to go deeper into the **same subject** on which I'm really supposed 
to work very soon - if I want to aggregate by date only data, say, before 
noon (12.00.00) what should I do?

Ciao
Vittorio


Alle 16:13, venerdì 07 aprile 2006, Whit Armstrong ha scritto:
 aggregate(base,by=list(as.factor(format(dates(base),%Y%m%d))),mean,na.
 rm=T)


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Vittorio
 Sent: Friday, April 07, 2006 11:38 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Aggregating an its series

 I'm using a very long irregular time-series of air temperature and
 relative humidity of this kind (this is an extract only)

 its.format(%
 Y%d%m %X)

  base

  T  H
 20020601 12.00.00 27.1 47
 20020601 15.00.00 29.1 39
 20020601 18.00.00 27.4 39
 20020601 21.00.00 24.0 40
 20020602 0.00.00  22.0 73
 20020602 3.00.00 19.2 49
 20020602 6.00.00  19.5 74
 20020602 9.00.00  24.8 45
 20020602 12.00.00 27.7 NA
 20020602 15.00.00 29.2 39
 20020602 18.00.00 27.2 44
 20020602 21.00.00 23.9 50
 20020603 0.00.00  21.0 75
 20020603 3.00.00 19.6 65
 20020603 6.00.00  19.8 71
 20020603 9.00.00  23.2 67
 20020603 12.00.00 24.9 65
 20020603 15.00.00 21.7 74
 20020603 18.00.00 22.8 63
 20020603 21.00.00 21.2 75
 20020604 0.00.00  18.0 91

 I would like to
 aggregate T and H by day and produce another its of this kind

  aggr

T   H
 20020601 NA NA
 20020602 NA NA
 20020603 NA NA
 20020604 NA NA

 where the daily average of T and H (not counting the NA
 values) is is put in aggr.

 What is the quickest way to get this
 result?

 Thanks

 Vittorio

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

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

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


[R] type converters not being saved to workspace

2006-04-09 Thread Joseph Wang
Any one can explain why this happens or any work arounds?

 setClass('foo')
[1] foo
 setAs('foo', 'character', function(from) from)
 showMethods('coerce')

Function coerce:
from = ANY, to = array
from = ANY, to = call
from = ANY, to = character
from = ANY, to = complex
from = ANY, to = environment
from = ANY, to = expression
from = ANY, to = function
from = ANY, to = integer
from = ANY, to = list
from = ANY, to = logical
from = ANY, to = matrix
from = ANY, to = name
from = ANY, to = numeric
from = ANY, to = single
from = ANY, to = ts
from = ANY, to = vector
from = ANY, to = NULL
from = foo, to = character
 q()
Save workspace image? [y/n/c]: y


(restart)

 showMethods('coerce')

Function coerce:
from = ANY, to = array
from = ANY, to = call
from = ANY, to = character
from = ANY, to = complex
from = ANY, to = environment
from = ANY, to = expression
from = ANY, to = function
from = ANY, to = integer
from = ANY, to = list
from = ANY, to = logical
from = ANY, to = matrix
from = ANY, to = name
from = ANY, to = numeric
from = ANY, to = single
from = ANY, to = ts
from = ANY, to = vector
from = ANY, to = NULL
from = NULL, to = OptionalFunction


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


Re: [R] Boxplot using Formula

2006-04-09 Thread Dieter Menne
Matt Goff goff at nawwal.org writes:

 
 
 The problem is that boxplot is displaying groups that are empty in the  
 plot.
 

Call factor() again on the groups, which will drop levels. You can do that in an
extra line, or on-the-fly:

data-data.frame(values=c(1:25), groups=rep(c(A,B,C,D,E),
 each=5))
data = subset(data,groups!=C)

boxplot(values~factor(groups), data=data)

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


Re: [R] dim(x) error message in lme (nlme package)

2006-04-09 Thread Dieter Menne
Andreas Svensson andreas.svensson at bio.ntnu.no writes:

 
 I had a suspicion that you can't have the lme4 package loaded when using 
 lme (from the nlme package), and lo! I get the full summary of lme only 
 if lme4 is NOT loaded.

Yes, currently the two don't coexist well, so better make sure to use only on 
at a time.

Dieter

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


Re: [R] Multiple ablines

2006-04-09 Thread Dieter Menne
G. Alex Janevski galexski at umich.edu writes:

 
 points(y~x, pch=*, col=black)
 lm(y~x)
 fm=lm(y~x)
 abline(fm, col=red)
 
 This works. The problem arises in that I would like to run my simulation 
 multiple times, to plot the data points together on the same plot, and 
 more importantly the regression lines of the simulated data. Therefore, 
 I have placed the code within the loop of the simulation. This works 
 fine for points(), I can watch the additional points being added to the 
 plot as the simulations run. However, when I include abline() it gives 
 this error: Error in abline(a, b, h, v, untf, col, lty, lwd, ...) :
 'a' and 'b' must be finite
 
 I can take the code as written and place it outside of the loop and it 
 works fine, plotting the points and regression line for the data of the 
 last run of the simulation. 
...

Just a guess: try to call plot(...) in each repetition of the loop once; points 
and lines require an existing plot, where scaling etc. is already defined.

Dieter

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


Re: [R] type converters not being saved to workspace

2006-04-09 Thread Prof Brian Ripley
It is recommended that you use a package for this sort of thing.

When a package is loaded, the S4 methods it contains are merged into the 
metadata.  When the global environment is loaded, they are not.  Call 
'cacheMetaData(1)' to do so.

[This looks like a bug: cacheMetaData is called on .GlobalEnv in the 
startup code for package methods, but seems not to work when called from 
there.  I think this is because package methods is not at that point on 
the search path (the call is from .onLoad) and hence the coerce() generic 
is not visible to cacheMetaData.  If you have S4 code in a package, it 
will ensure that package methods is attached before your package is 
loaded.]

On Sun, 9 Apr 2006, Joseph Wang wrote:

 Any one can explain why this happens or any work arounds?

 setClass('foo')
 [1] foo
 setAs('foo', 'character', function(from) from)
 showMethods('coerce')

 Function coerce:
 from = ANY, to = array
 from = ANY, to = call
 from = ANY, to = character
 from = ANY, to = complex
 from = ANY, to = environment
 from = ANY, to = expression
 from = ANY, to = function
 from = ANY, to = integer
 from = ANY, to = list
 from = ANY, to = logical
 from = ANY, to = matrix
 from = ANY, to = name
 from = ANY, to = numeric
 from = ANY, to = single
 from = ANY, to = ts
 from = ANY, to = vector
 from = ANY, to = NULL
 from = foo, to = character
 q()
 Save workspace image? [y/n/c]: y


 (restart)

 showMethods('coerce')

 Function coerce:
 from = ANY, to = array
 from = ANY, to = call
 from = ANY, to = character
 from = ANY, to = complex
 from = ANY, to = environment
 from = ANY, to = expression
 from = ANY, to = function
 from = ANY, to = integer
 from = ANY, to = list
 from = ANY, to = logical
 from = ANY, to = matrix
 from = ANY, to = name
 from = ANY, to = numeric
 from = ANY, to = single
 from = ANY, to = ts
 from = ANY, to = vector
 from = ANY, to = NULL
 from = NULL, to = OptionalFunction


 __
 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


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


Re: [R] Boxplot using Formula

2006-04-09 Thread Sundar Dorai-Raj


Matt Goff wrote:
 I am trying to use the formula interface for the boxplot.
 Currently running R 2.2.1 on Windows XP.
 
 The problem is that boxplot is displaying groups that are empty in the  
 plot.
 
 The following example demonstrates what it is happening (though my actual  
 situation is a little more complicated):
 
 
data-data.frame(values=c(1:25), groups=rep(c(A,B,C,D,E),  
each=5))
boxplot(data$values~data$groups, subset=data$groups!=C)
 
 
 The plot includes a space for level C with no boxplot.  I would like to  
 have only those levels with associated boxplots be shown in the figure.   
 So in this case, there should only be values A, B, D, and E evenly  
 spaced along the horizontal axis.
 
 I am a little confused because I am reusing old code and I don't remember  
 having this issue before, so perhaps there have been some changes in the  
 behavior of the boxplot function since the last time I use the code.
 
 It seems like there's probably a simple solution, but I'm not seeing it.
 
 Thanks,
 
 Matt Goff
 
 __
 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

Hi, Matt,

I'm afraid you cannot do what you want with boxplot.formula. You have at 
least two options:

1) Supply only data that has no empty levels.
2) Create a new function that does what you need:

## add `drop.unused.levels' argument to boxplot.formula
boxplot2 -
function (formula, data = NULL, ...,
   subset, na.action = NULL,
   drop.unused.levels = TRUE)
{
 if (missing(formula) || (length(formula) != 3))
 stop('formula' missing or incorrect)
 m - match.call(expand.dots = FALSE)
 if (is.matrix(eval(m$data, parent.frame(
 m$data - as.data.frame(data)
 m$... - NULL
 m$na.action - na.action
 m$drop.unused.levels - drop.unused.levels
 m[[1]] - as.name(model.frame)
 mf - eval(m, parent.frame())
 response - attr(attr(mf, terms), response)
 boxplot(split(mf[[response]], mf[-response]), ...)
}

values - 1:25
groups - factor(rep(c(A,B,C,D,E), each=5))
boxplot2(values ~ groups, subset = groups != C)

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


[R] Primitives

2006-04-09 Thread Diethelm Wuertz
How one can make a list of all functions in R's base
package which are given as Primitives like abs, sqrt
cumsum (but not log) ?

Thanks a lot
Diethelm Wuertz

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


Re: [R] R-help Digest, Vol 38, Issue 9

2006-04-09 Thread isaac . martin
Mi nueva dirección de correo es: [EMAIL PROTECTED]

New e-mail address: [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


Re: [R] Primitives

2006-04-09 Thread Duncan Murdoch
On 4/9/2006 5:46 AM, Diethelm Wuertz wrote:
 How one can make a list of all functions in R's base
 package which are given as Primitives like abs, sqrt
 cumsum (but not log) ?

There's an is.primitive() test function; you just need to get all 
objects, and test them one by one.

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


Re: [R] cross product

2006-04-09 Thread Antonio, Fabio Di Narzo
2006/4/8, He, Yulei [EMAIL PROTECTED]:

 Hi, there.



 How do I calculate the cross-product in the form of
 \sum_{i=1}^{n}X_{i}^{t} \Sigma X_{i} using R code without using do loop?
 X_{i} is the covariate matrix for subject I, \Sigma is the covariance
 matrix.


If I don't miss something in the matrix algebra, maybe you want the
following:

 crossprod(crossprod(t(X),sigma),X)

where X is the 'n by d' matrix of covariates, and sigma the 'd by d' matrix
of assigned covariances.

Antonio, Fabio Di Narzo.

Thanks for your help.



 Yulei




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


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


Re: [R] more documentation on lmer?

2006-04-09 Thread Henrik Parn
Dear Bill,

You might check Faraway's 'Extending the Linear Model with R: 
Generalized Linear, Mixed Effects and Nonparametric Regression Models' 
(2006). Without having read the book properly, at least I noticed that 
package lme4 and the function lmer is used in the examples.

Best regards,
Henrik


Hello. Is there any documentation on the lmer function in the lme4 
package beyond what was published in the May 2005 R News (vol.5/1)? As 
well, has the nonlinear version of lmer appeared yet?  

Bill Shipley

-- 

Henrik Pärn
Department of Biology
NTNU
7491 Trondheim
Norway

+47 735 96282 (office)
+47 909 89 255 (mobile)
+47 735 96100 (fax)

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


[R] Calculation of r.squared for linear model with offset

2006-04-09 Thread Ross Darnell
R^2 for a model is usually defined as 1-RSS/TSS where TSS is the SS 
about the mean and RSS is the residual SS from the model.

Consider the model in R

z - runif(20)
y - z+rnorm(20)
my.model - lm(y~offset(z))
summary(my.model)$r.squared

Here the RSS is equivalent to the TSS and
gives 0 when it should (IMHO and a few others perhaps) be

1 - RSS/TSS(corrected for the mean only)

RSS = sum(resid(my.model)^2)
TSS = sum((y-mean(y))^2)

Have I missed this somewhere in the FAQ's or elsewhere?

Regards
Ross Darnell

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


Re: [R] dot diagram

2006-04-09 Thread Gabor Grothendieck
Don't know about a function but it can be done in one plot statement
like this:

plot(seq(x) - match(x, x) ~ x, list(x = sort(mydata)),
xlim=c(25,45), ylab =, yaxt=n, pch=19, frame.plot=FALSE)

On 4/9/06, Jinsong Zhao [EMAIL PROTECTED] wrote:
 Hi,

 I am wondering whether there is a function that could plot
 a dot diagram like the output of following code.

 Thanks in advance!

 Best wishes!

 Jinsong


 -my dirty code here-

 mydata - c(26,26,27,27,27,27,28,28,28,28,28,28,28,28,28,
28,28,28,28,29,29,29,29,29,29,29,29,29,29,29,
30,30,30,30,30,30,30,30,31,31,31,31,32,33,33,
33,34,34,35,43)

 my.dot.plot - function(x, ...) {
x.table - table(x)
x.x - as.numeric(names(x.table))
x.y - as.numeric(x.table)
n - length(x.x)
x.final - NULL
for (i in 1:n) {
tmp - data.frame(x=rep(x.x[i], x.y[i]), y=1:x.y[i])
x.final - rbind(x.final, tmp)
}
plot(x.final, yaxt=n, ylab=, pch=19, frame.plot=FALSE, ...)
 }

 my.dot.plot(mydata, xlab =speed, xlim=c(25,45))

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


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


[R] adding a row to a matrix

2006-04-09 Thread Tim Smith
Hi All,
  This is probably a very simple question. I was trying to add a row to the 
rows in a matrix. For example:
   
   a - matrix(1:6,2,3)
 
 b - a[1,]
 
 print(a)
 [,1] [,2] [,3]
[1,]135
[2,]246
 
 print(b)
[1] 1 3 5
   
  I now want to add 'b' to every row of 'a', so the end result should look like:
   [,1] [,2] [,3]
[1,]26   10
[2,]37   11
   
  But if I do c = apply(a,1,+,b), I get:
   c
 [,1] [,2]
[1,]23
[2,]67
[3,]   10   11
  Now, I could easily transform this to get what I want, but I'd like to know 
how I could get the result without many intermediate steps ( I have large 
matrices, so transforming them at each step would not be efficient).
   
  If someone could point me in the right direction, that would be a great help.
   
  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


Re: [R] RFC: default background on lattice plots (conclusion)

2006-04-09 Thread Deepayan Sarkar
I haven't heard any more comments on this, and R 2.3.0 is almost here,
so I'll bring this thread to a close. I have changed the default theme
to the old PDF default for all devices (except postscript, which still
defaults to color=FALSE) in the latest lattice (part of R-alpha now).
It's easy enough to get the old defaults back, instructions are given
in ?trellis.device.

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


Re: [R] adding a row to a matrix

2006-04-09 Thread Christos Hatzis
You can try sweep:

sweep(a,2,b,+) 

-Christos

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tim Smith
Sent: Sunday, April 09, 2006 11:28 AM
To: r-help@stat.math.ethz.ch
Subject: [R] adding a row to a matrix

Hi All,
  This is probably a very simple question. I was trying to add a row to the
rows in a matrix. For example:
   
   a - matrix(1:6,2,3)
 
 b - a[1,]
 
 print(a)
 [,1] [,2] [,3]
[1,]135
[2,]246
 
 print(b)
[1] 1 3 5
   
  I now want to add 'b' to every row of 'a', so the end result should look
like:
   [,1] [,2] [,3]
[1,]26   10
[2,]37   11
   
  But if I do c = apply(a,1,+,b), I get:
   c
 [,1] [,2]
[1,]23
[2,]67
[3,]   10   11
  Now, I could easily transform this to get what I want, but I'd like to
know how I could get the result without many intermediate steps ( I have
large matrices, so transforming them at each step would not be efficient).
   
  If someone could point me in the right direction, that would be a great
help.
   
  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

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


[R] configure error

2006-04-09 Thread R. A. L. Carter
*I've been trying for several weeks to install R-2.2.1 on a PC with 
an AMD Athlon 64 2800*+* processor running Mandriva 2006_64.  After 
unpacking R-2.2.1.tar.gz I ran ./configure.  However, configure stopped 
prematurely with the message  *configure:27295: WARNING: gfortran and 
gcc disagree on int and double configure:27297: error: Maybe change 
CFLAGS or FFLAGS?*  Altough I've looked in both the R_Help archive and 
R Installation and Administration,  I can't find any documentation 
which says what settings should be for CFLAGS or FFLAGS. I tried to 
mimic the settings shown on page 31 of R Installation and Administration 
but that failed too.*

*Does anyone know what the settings should be for this case?  Any 
advice would be greatly appreciated.

Richard Carter
*

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


[R] lm$effects in lm()

2006-04-09 Thread Cal Stats
Hi ..
  
 lm() returns an effects component in its output. I read the explanation in 
R but was not quite clear.
  
  say my response is Y
  and design matrix is X
  
  say X has QR decomposition X=QR
  
  is effects = Q (Q'Q)^-1 Q' Y  ???
  
  i am sure this is wrong as it did not match the output from lm() . what is 
the actual calculation.
  
  Harsh.
  
  

-

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


Re: [R] configure error

2006-04-09 Thread Larry Howe
On Sunday 09 April 2006 11:41, R. A. L. Carter wrote:
 prematurely with the message  *configure:27295: WARNING: gfortran and
 gcc disagree on int and double configure:27297: error: Maybe change
 CFLAGS or FFLAGS?*  Altough I've looked in both the R_Help archive and

This is primarily a guess, but it sounds like your version of gfortran isn't 
compatible with your version of gcc.

Larry Howe

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


[R] logistic regression model with non-integer weights

2006-04-09 Thread Ramón Casero Cañas

When fitting a logistic regression model using weights I get the
following warning

 data.model.w - glm(ABN ~ TR, family=binomial(logit), weights=WEIGHT)
Warning message:
non-integer #successes in a binomial glm! in: eval(expr, envir, enclos)

Details follow

***

I have a binary dependent variable of abnormality

ABN = T, F, T, T, F, F, F...

and a continous predictor

TR = 1.962752 1.871123 1.893543 1.685001 2.121500, ...



As the number of abnormal cases (ABN==T) is only 14%, and there is large
overlapping between abnormal and normal cases, the logistic regression
found by glm is always much closer to the normal cases than for the
abnormal cases. In particular, the probability of abnormal is at most 0.4.

Coefficients:
Estimate Std. Error z value Pr(|z|)
(Intercept)   0.7607 0.7196   1.057   0.2905
TR2  -1.4853 0.4328  -3.432   0.0006 ***
---

I would like to compensate for the fact that the a priori probability of
abnormal cases is so low. I have created a weight vector

 WEIGHT - ABN
 WEIGHT[ ABN == TRUE ] -  1 / na / 2
 WEIGHT[ ABN == FALSE ] -  1 / nn / 2

so that all weights add up to 1, where ``na'' is the number of abnormal
cases, and ``nn'' is the number of normal cases. That is, normal cases
have less weight in the model fitting because there are so many.

But then I get the warning message at the beginning of this email, and I
suspect that I'm doing something wrong. Must weights be integers, or at
least greater than one?

Regards,

-- 
Ramón Casero Cañas

http://www.robots.ox.ac.uk/~rcasero/wiki
http://www.robots.ox.ac.uk/~rcasero/blog

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

Re: [R] adding a row to a matrix

2006-04-09 Thread Gabor Grothendieck
Try this:

t(t(a)+b)

On 4/9/06, Tim Smith [EMAIL PROTECTED] wrote:
 Hi All,
  This is probably a very simple question. I was trying to add a row to the 
 rows in a matrix. For example:

   a - matrix(1:6,2,3)
 
  b - a[1,]
 
  print(a)
 [,1] [,2] [,3]
 [1,]135
 [2,]246
 
  print(b)
 [1] 1 3 5

  I now want to add 'b' to every row of 'a', so the end result should look 
 like:
   [,1] [,2] [,3]
 [1,]26   10
 [2,]37   11

  But if I do c = apply(a,1,+,b), I get:
   c
 [,1] [,2]
 [1,]23
 [2,]67
 [3,]   10   11
  Now, I could easily transform this to get what I want, but I'd like to know 
 how I could get the result without many intermediate steps ( I have large 
 matrices, so transforming them at each step would not be efficient).

  If someone could point me in the right direction, that would be a great help.

  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


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


[R] using latex() function with other .sty files

2006-04-09 Thread Brian Quinif
I am having some problems using the latex() function in the Hmisc
package.  When I turned on the ctable option in latex(), the LaTeX
code produced by latex()somehow conflicts with the style back my
unversity uses for theses.  Has anyone on the list had a similar
conflict and been able to fix it.

One simple fix I know of is to have ctable=FALSE.  The tables work
fine then, but I prefer the look (and other options) of ctable=TRUE.

This is by no means an urgent request, since I can simply turn of the
ctable option, but if anyone does know of a fix, I'd certainly
appreciate the help.

Thanks

Brian

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


Re: [R] (IT WAS) Aggregating an its series

2006-04-09 Thread Whit Armstrong
Just strip off the hours component of the dates, then take a subset of the data 
where the hour is = 12.

I did not execute this, so you might need to change it a bit: 

hours - as.integer(format(dates(base),%H))

new.data - base[hours = 12,]

aggregate(new.data,by=list(as.factor(format(dates(new.data),%Y%m%d))),mean,na.rm=T)


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of vittorio
Sent: Sunday, April 09, 2006 6:12 AM
To: r-help@stat.math.ethz.ch
Subject: Re: [R] (IT WAS) Aggregating an its series

Thanks for the brilliant solution.

***AGAIN***

Now - just to go deeper into the **same subject** on which I'm really supposed 
to work very soon - if I want to aggregate by date only data, say, before noon 
(12.00.00) what should I do?

Ciao
Vittorio


Alle 16:13, venerdì 07 aprile 2006, Whit Armstrong ha scritto:
 aggregate(base,by=list(as.factor(format(dates(base),%Y%m%d))),mean,na.
 rm=T)


 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Vittorio
 Sent: Friday, April 07, 2006 11:38 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Aggregating an its series

 I'm using a very long irregular time-series of air temperature and 
 relative humidity of this kind (this is an extract only)

 its.format(%
 Y%d%m %X)

  base

  T  H
 20020601 12.00.00 27.1 47
 20020601 15.00.00 29.1 39
 20020601 18.00.00 27.4 39
 20020601 21.00.00 24.0 40
 20020602 0.00.00  22.0 73
 20020602 3.00.00 19.2 49
 20020602 6.00.00  19.5 74
 20020602 9.00.00  24.8 45
 20020602 12.00.00 27.7 NA
 20020602 15.00.00 29.2 39
 20020602 18.00.00 27.2 44
 20020602 21.00.00 23.9 50
 20020603 0.00.00  21.0 75
 20020603 3.00.00 19.6 65
 20020603 6.00.00  19.8 71
 20020603 9.00.00  23.2 67
 20020603 12.00.00 24.9 65
 20020603 15.00.00 21.7 74
 20020603 18.00.00 22.8 63
 20020603 21.00.00 21.2 75
 20020604 0.00.00  18.0 91

 I would like to
 aggregate T and H by day and produce another its of this kind

  aggr

T   H
 20020601 NA NA
 20020602 NA NA
 20020603 NA NA
 20020604 NA NA

 where the daily average of T and H (not counting the NA
 values) is is put in aggr.

 What is the quickest way to get this
 result?

 Thanks

 Vittorio

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

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

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

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


Re: [R] adding a row to a matrix

2006-04-09 Thread Tim Smith
Thanks Christosworked a treat!



Christos Hatzis [EMAIL PROTECTED] wrote: You can try sweep:

sweep(a,2,b,+) 

-Christos

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tim Smith
Sent: Sunday, April 09, 2006 11:28 AM
To: r-help@stat.math.ethz.ch
Subject: [R] adding a row to a matrix

Hi All,
  This is probably a very simple question. I was trying to add a row to the
rows in a matrix. For example:
   
   a - matrix(1:6,2,3)
 
 b - a[1,]
 
 print(a)
 [,1] [,2] [,3]
[1,]135
[2,]246
 
 print(b)
[1] 1 3 5
   
  I now want to add 'b' to every row of 'a', so the end result should look
like:
   [,1] [,2] [,3]
[1,]26   10
[2,]37   11
   
  But if I do c = apply(a,1,+,b), I get:
   c
 [,1] [,2]
[1,]23
[2,]67
[3,]   10   11
  Now, I could easily transform this to get what I want, but I'd like to
know how I could get the result without many intermediate steps ( I have
large matrices, so transforming them at each step would not be efficient).
   
  If someone could point me in the right direction, that would be a great
help.
   
  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





-

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


[R] help on using 'sum' in writng a function

2006-04-09 Thread skim033
Hi, I am writing a function that includes 'sum' function 
such as:
f-function(x){
c-c(-1,0,1)
f-sum(c+x)
}
expecting f to be -1+x+0+x+1+x=3x. But I found out that f is 
sum(x). So, f is always a scalar, which means that f(c(0,1)) 
is not a vector as c(0,3), but 3(0+1)=3. I would like to ask 
you helping me in solving this problem. I would like to 
thank you in advance.
Sungsu.
UC riverside.

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


Re: [R] help on using 'sum' in writng a function

2006-04-09 Thread Gabor Grothendieck
If c is c(c1, c2, c3) and x is c(x1, x2, x3) then
c+x is (c1+x1, c2+x2, c3+x3)
so sum(c+x) is c1+x1+c2+x2+c3+x3 = sum(c) + sum(x)

What you were expecting is given by:

rowSums(outer(1:4, c(-1,0,1), +))  # gives c(3, 6, 9, 12)

Review the Introduction to R manual and also look at ?outer and ?rowSums


On 4/9/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi, I am writing a function that includes 'sum' function
 such as:
 f-function(x){
 c-c(-1,0,1)
 f-sum(c+x)
 }
 expecting f to be -1+x+0+x+1+x=3x. But I found out that f is
 sum(x). So, f is always a scalar, which means that f(c(0,1))
 is not a vector as c(0,3), but 3(0+1)=3. I would like to ask
 you helping me in solving this problem. I would like to
 thank you in advance.
 Sungsu.
 UC riverside.

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


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


Re: [R] help on using 'sum' in writng a function

2006-04-09 Thread Gabor Grothendieck
Or, of course, if you are willing to reduce it then its just

sum(c) + length(c) * x

On 4/9/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 If c is c(c1, c2, c3) and x is c(x1, x2, x3) then
 c+x is (c1+x1, c2+x2, c3+x3)
 so sum(c+x) is c1+x1+c2+x2+c3+x3 = sum(c) + sum(x)

 What you were expecting is given by:

 rowSums(outer(1:4, c(-1,0,1), +))  # gives c(3, 6, 9, 12)

 Review the Introduction to R manual and also look at ?outer and ?rowSums


 On 4/9/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Hi, I am writing a function that includes 'sum' function
  such as:
  f-function(x){
  c-c(-1,0,1)
  f-sum(c+x)
  }
  expecting f to be -1+x+0+x+1+x=3x. But I found out that f is
  sum(x). So, f is always a scalar, which means that f(c(0,1))
  is not a vector as c(0,3), but 3(0+1)=3. I would like to ask
  you helping me in solving this problem. I would like to
  thank you in advance.
  Sungsu.
  UC riverside.
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
 


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


Re: [R] Primitives

2006-04-09 Thread Diethelm Wuertz
Duncan Murdoch wrote:

 On 4/9/2006 5:46 AM, Diethelm Wuertz wrote:

 How one can make a list of all functions in R's base
 package which are given as Primitives like abs, sqrt
 cumsum (but not log) ?


 There's an is.primitive() test function; you just need to 

Sorry when I ask again, how to list all functions in R's
base installation?
Thanks Diethelm Wuertz

 get all objects, and test them one by one.

 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


[R] calculation of r (corelation coefficient) from models

2006-04-09 Thread S Nakagawa
Dear R users

This is a stats question rather than R question. For continuous predictors, we
get estimates of slopes and their se and t values (slope/se) in R ouptput. If
we have a model with more than one continuous variable (i.e., multiple
regression), we get slope, se and t value for each continuous predictor. Here
is my question - is there any way I can calculate r value or correlation
(partial correlation?) between each continuous predicator and response, using
these parameters in R output? If I just have one response and one predictor, I
would use cor.test(x, y) or cor(x, y) function but I was wondering whether I
could calculate correlation coefficient for each predictor from a statistical
model. 

Cohen’s d (dimensionless effect size) is very easy to calculate from t values
and sample size when I have categorical (dichotomous) predictors, but I could
not get r (correlation coefficient; another dimensionless effect size) when I
have continuous predictors using t values or related statistics from models. 

Thank you very much

Shinichi

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


Re: [R] Primitives

2006-04-09 Thread Duncan Murdoch
On 4/9/2006 5:57 PM, Diethelm Wuertz wrote:
 Duncan Murdoch wrote:
 
 On 4/9/2006 5:46 AM, Diethelm Wuertz wrote:

 How one can make a list of all functions in R's base
 package which are given as Primitives like abs, sqrt
 cumsum (but not log) ?

 There's an is.primitive() test function; you just need to 
 
 Sorry when I ask again, how to list all functions in R's
 base installation?

ls(baseenv()) or ls(package:base)

will give you all their names.  So you need to use something like

names - ls(baseenv())
result - rep(FALSE, length(names))
for (i in seq(along=names)) {
   result[i] - is.primitive(get(names[i], envir=baseenv()))
}
names[result]

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


[R] Re : AUC under spline curve

2006-04-09 Thread ssim

Dear R list,

I  have fitted cubic regression spline with fixed degree of freedom to a
set of data using package mgcv. Now I want to calculate the area under the
spline curve. Someone has suggested me to use trapezoidal rule. Do you know
if someone has written a package that will carry out that analysis, and
where can I download it ?

Thanks in advance.


Stella

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


[R] SE estimates for treatment groups from nlme

2006-04-09 Thread Katherine A Grieve
I am wondering how to obtain SE estimates for fixed effects from a nonlinear 
mixed effects model? 

I have fixed effects corresponding to three factors A, B and C with 2, 3 and 3 
levels respectively. I have fit a model of the following general form:

nlme1-nlme(y~ SasympOrig(x, Asym, lrc), data=df, fixed=list(Asym~A*B*C, 
lrc~A*B*C),
start=c(fixef(ETR.nlme)[1], rep(0,17), fixef(ETR.nlme)[2], rep(0,17))) 

I am using the default (contr.treatment and contr.poly). The summary table 
(tTable) gives me the baseline coefficients and a list of differences and I 
have no trouble calculating the coefficients for any of my treatment groups by 
forming the correct linear combination of coefficients. However, I don't 
understand how to obtain the standard errors for these linear combinations from 
the summary report. What I want to obtain would be 18 parameter estimates with 
appropriate SEs for my 18 different groups (A*B*C=2*3*3=18).

In response to a similar posting, it was recommended to use the function 
estimable in the package gregmisc. I have looked at this and cannot figure 
out how to apply it in my situation. Any help would be greatly appreciated.

Thanks,
Katie


Katie Grieve
Quantitative Ecology and Resource Management
University of Washington

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


[R] help on using sum in writng a function again

2006-04-09 Thread skim033
Hi, thanks for your reply. 
Here I would like to ask you again more directly.
The following is what I had for now.
The function to begin with is 
dnorm(theta+2*pi*j,0,1)*(pnorm(((2*pi*(k+1)-rho*
(theta+2*pi*j)).

Now, I wanted to sum it over k from -1 to 1. So, I 
wrote the following.
f1-function(theta,j){
aa-seq(-1,1,lenght=20001)
sum(dnorm(theta+2*pi*j,0,1)*(pnorm(((2*pi*(aa+1)-rho*
(theta+2*pi*j))
}

Next, I would like sum over j as
(This is a way I thouhgt about computing a double sum)
f2-function(theta){
aa-c(-1,0,1)
sum(f(theta,aa))
}
expecting f2 be a function of theta. 

Then, I wanted to plot f2 for theta from 0 to 2*pi. But, f2
(seq(0,2*pi,length=10)) is a scalar, not a vector with the 
dimension of 10x1. I would like to ask you how I can use 
rowSums with outer or some other method to correct my coding.

I would like to thank you in advance.
Sungsu.
UC riverside.

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


[R] weighted kernel density estimate

2006-04-09 Thread Adrian Baddeley

Weighted spatial kernel density estimation is available in 
the function 'density.ppp' in the package 'spatstat'.

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


[R] passing known medoids to clara() in the cluster package

2006-04-09 Thread Dylan Beaudette
Greetings,

I have had good success using the clara() function to perform a simple cluster 
analysis on a large dataset (1 million+ records with 9 variables). 

Since the clara function is a wrapper to pam(), which will accept known medoid 
data - I am wondering if this too is possible with clara() ... The 
documentation does not suggest that this is possible. 

Essentially I am trying to implement a supervised classification of numerous 
geographic data layers. The unsupervised approach using clara() works well, 
but I feel the output classes would be more meaningful if I were able to let 
clara() know about the classes that I have in mind.

Is this at all feasible, or am I trying to accomplish something that is not 
possible?

Cheers,


-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341

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


[R] [Help] a Correlation Problem

2006-04-09 Thread kenzy ken
  I encounter a statistic problem about correlation.
  I use R to test wether two variables are correlated or not.


  (pearson correlation)
  cor.test(x,y) give a p=5.87

  Because the x, y is not normal distributed (qqplot indicate that) I
also perform
  (spearman rank correlation)
  cor.test(x,y,method=spearman) give a very significant result p10e-4


  I don't know how to explain this. Will this result tell us that x, y
are correlated but not a linear one, and we can't
  use the coefficient estimated by spearman rank correlation because its
interpretation is not quite clear.

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


Re: [R] [Help] a Correlation Problem

2006-04-09 Thread Gabor Grothendieck
Try this where g is f summed over j and k for given scalars
theta and rho and gv is g vectorized over theta.  I have not
checked this carefully so be sure you do:

f - function(theta = 0, rho = 0, j = 0, k = 0)
dnorm(theta+2*pi*j,0,1)*pnorm(2*pi*(k+1)-rho*(theta+2*pi*j))
g - function(theta = 0, j = 0, k = 0)
sum(sapply(k, function(k) sum(f(theta, j = j, k = k
gv - function(theta = 0, ...) sapply(theta, g, ...)

x - seq(0, pi, length = 100)
plot(x, gv(x, j = -1:1, k = -1:1))

On 4/9/06, kenzy ken [EMAIL PROTECTED] wrote:
  I encounter a statistic problem about correlation.
  I use R to test wether two variables are correlated or not.


  (pearson correlation)
  cor.test(x,y) give a p=5.87

  Because the x, y is not normal distributed (qqplot indicate that) I
 also perform
  (spearman rank correlation)
  cor.test(x,y,method=spearman) give a very significant result p10e-4


  I don't know how to explain this. Will this result tell us that x, y
 are correlated but not a linear one, and we can't
  use the coefficient estimated by spearman rank correlation because its
 interpretation is not quite clear.

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


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


Re: [R] help on using sum in writng a function again

2006-04-09 Thread Gabor Grothendieck
Sorry, I replied to the wrong email.  Here it is again:

Try this where g is f summed over j and k for given scalars
theta and rho and gv is g vectorized over theta.  I have not
checked this carefully so be sure you do:

f - function(theta = 0, rho = 0, j = 0, k = 0)
   dnorm(theta+2*pi*j,0,1)*pnorm(2*pi*(k+1)-rho*(theta+2*pi*j))
g - function(theta = 0, j = 0, k = 0)
   sum(sapply(k, function(k) sum(f(theta, j = j, k = k
gv - function(theta = 0, ...) sapply(theta, g, ...)

x - seq(0, pi, length = 100)
plot(x, gv(x, j = -1:1, k = -1:1))

On 4/9/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi, thanks for your reply.
 Here I would like to ask you again more directly.
 The following is what I had for now.
 The function to begin with is
 dnorm(theta+2*pi*j,0,1)*(pnorm(((2*pi*(k+1)-rho*
 (theta+2*pi*j)).

 Now, I wanted to sum it over k from -1 to 1. So, I
 wrote the following.
 f1-function(theta,j){
 aa-seq(-1,1,lenght=20001)
 sum(dnorm(theta+2*pi*j,0,1)*(pnorm(((2*pi*(aa+1)-rho*
 (theta+2*pi*j))
 }

 Next, I would like sum over j as
 (This is a way I thouhgt about computing a double sum)
 f2-function(theta){
 aa-c(-1,0,1)
 sum(f(theta,aa))
 }
 expecting f2 be a function of theta.

 Then, I wanted to plot f2 for theta from 0 to 2*pi. But, f2
 (seq(0,2*pi,length=10)) is a scalar, not a vector with the
 dimension of 10x1. I would like to ask you how I can use
 rowSums with outer or some other method to correct my coding.

 I would like to thank you in advance.
 Sungsu.
 UC riverside.

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


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


[R] Generic code for simulating from a distribution.

2006-04-09 Thread matgopa1
Hello all,

I have the code below to simulate samples of certain size from a
particular distribution (here,beta distribution) and compute some
statistics for the samples.

betasim2-function(nsim,n,alpha,beta)
{
sim-matrix(rbeta(nsim*n,alpha,beta),ncol=n)
xmean-apply(sim,1,mean)
xvar-apply(sim,1,var)
xmedian-apply(sim,1,median)
simset-data.frame(sampleno=seq1:nsim),means=xmean,vars=xvar,medians=xmedian)
return(simset)
}

I can write a similar coding for any distribution individually.
Now, I would like to have a generic code, say if I specify the
distribution with the parameters and simulation and sample size I would
like to have the simulations done for the mentioned distribution and the
statistics performed.

I would appreciate any help in doing so?

Thanks for your time.
Mathangi


Mathangi Gopalakrishnan
Graduate student
Dept of Mathematics and Statistics
University of Maryland, Baltimore County
Baltimore, MD

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


[R] interlogistic regression-interactive parameters

2006-04-09 Thread orkun
hello

I wonder if anyone can tell me the logic of using of interactive 
parameters in
logistic regression ? (or direct me any link containing explaining it)

kind regards


Ahmet Temiz

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed 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