Re: [R] Generic code for simulating from a distribution.

2006-04-10 Thread Matthias Kohl
Hi,

have a look at the packages distr and distrSim which are on CRAN.

hth
Matthias

- original Nachricht 

Betreff: [R] Generic code for simulating from a distribution.
Gesendet: Mo, 10. Apr 2006
Von: [EMAIL PROTECTED]

 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
 

--- original Nachricht Ende 

__
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-10 Thread Prof Brian Ripley
You need ls(all=TRUE) as some (12) are 'dot-names'.  I just used

foo - ls(package:base, all =TRUE)
pr - foo[sapply(foo, function(x) is.primitive(get(x, package:base)))]

and got 152.

There is a description in the `Writing R Extensions' manual, but it is 
incomplete, and another classified list in tests/primitive-funs.R (also 
incomplete).

On Sun, 9 Apr 2006, Duncan Murdoch wrote:

 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

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


[R] using 'sum' function in writing a function

2006-04-10 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] passing known medoids to clara() in the cluster package

2006-04-10 Thread Martin Maechler
 DylanB == Dylan Beaudette [EMAIL PROTECTED]
 on Sun, 9 Apr 2006 19:28:44 -0700 writes:

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

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

indeed, it doesn't --  because it's not yet possible.
I (as maintainer of cluster) had added the ``known medoid''
option to pam() a while ago last June (for  cluster version 1.10.0),
and had left a note my TODO file to do the same for clara().

Unfortunately it's not true that clara() was a wrapper to pam()
as you state above.

Given your wish and clear use case situation, I'm more
motivated to approach this particular 'TODO' item!

Martin Maechler, ETH Zurich

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

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

__
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] The mysterious e1071

2006-04-10 Thread J Dougherty
On Saturday 08 April 2006 11:51, Chelsea Ellis wrote:
 Hi,

 I'm trying to use the svm function in R, but I can't find the e1071
 package. When I type library(e1071), I get the error message that the
 package doesn't exist.  I've searched all over the CRAN website, but I
 can't find anything.  Did it change names?

 Thanks for your help,

 Chelsea
You'll have to download it off CRAN.  It IS there.  Go to CRAN, choose your 
server, and then on the left pane, you will see a link named packages.  The 
link will be http://[your server name]/src/contrib/PACKAGES.html.  Chose 
that.  On the right pane, which is not visually well differentiated from the 
rest of the page, scroll down.  e1071 is there right at the beginning of the 
packages whose names begin with e.

Have fun,
JD

__
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] some output is missing -- not getting the full anova table

2006-04-10 Thread marilyn ford

I have just started using R and am stumped over something:

I am using the lme4 package, using lmer (and putting it in to fit0.lmer 
) and then I do an anova,
but I am not getting the full table.  This is what I get:

  fit0.lmer - lmer(subj.prob.rev ~ semantic.class + bipron.rec + 
item.order + (1|subject) + (1|verb), data=data)
  anova(fit0.lmer)
Analysis of Variance Table
   Df  Sum Sq Mean Sq
semantic.class  3  5401.7  1800.6
bipron.rec  1 22739.3 22739.3
item.order  1  7225.2  7225.2

Can anyone help?
Marilyn

__
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] installing problem

2006-04-10 Thread Fred J.
Dear R users
 
 a problem I encountered while installing fMultivar, I would appriciate any 
help with this.
 
 
  install.packages (fMultivar, dependencies=TRUE)
 Warning in install.packages(fMultivar, dependencies = TRUE) : 
  argument 'lib' is missing: using /usr/local/lib/R/site-library
 also installing the dependencies 'fBasics', 'fCalendar', 'fSeries'
 
 trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/fBasics_221.10065.tar.gz'
 Content type 'application/x-tar' length 3111632 bytes
 opened URL
 ==
 downloaded 3038Kb
 
 trying URL 
'http://cran.cnr.Berkeley.edu/src/contrib/fCalendar_221.10065.tar.gz'
 Content type 'application/x-tar' length 485586 bytes
 opened URL
 ==
 downloaded 474Kb
 
 trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/fSeries_221.10065.tar.gz'
 Content type 'application/x-tar' length 1594150 bytes
 opened URL
 ==
 downloaded 1556Kb
 
 trying URL 
'http://cran.cnr.Berkeley.edu/src/contrib/fMultivar_221.10065.tar.gz'
 Content type 'application/x-tar' length 1152747 bytes
 opened URL
 ==
 downloaded 1125Kb
 
 * Installing *source* package 'fBasics' ...
 ** libs
 /usr/lib/R/bin/SHLIB: line 102: make: command not found
 ERROR: compilation failed for package 'fBasics'
 ** Removing '/usr/local/lib/R/site-library/fBasics'
 * Installing *source* package 'fCalendar' ...
 ** libs
 /usr/lib/R/bin/SHLIB: line 102: make: command not found
 ERROR: compilation failed for package 'fCalendar'
 ** Removing '/usr/local/lib/R/site-library/fCalendar'
 * Installing *source* package 'fSeries' ...
 ** libs
 /usr/lib/R/bin/SHLIB: line 102: make: command not found
 ERROR: compilation failed for package 'fSeries'
 ** Removing '/usr/local/lib/R/site-library/fSeries'
 * Installing *source* package 'fMultivar' ...
 ** libs
 /usr/lib/R/bin/SHLIB: line 102: make: command not found
 ERROR: compilation failed for package 'fMultivar'
 ** Removing '/usr/local/lib/R/site-library/fMultivar'
 
 The downloaded packages are in
 /tmp/Rtmpr75wQe/downloaded_packages
 Warning messages:
 1: installation of package 'fBasics' had non-zero exit status in: 
install.packages(fMultivar, dependencies = TRUE) 
 2: installation of package 'fCalendar' had non-zero exit status in: 
install.packages(fMultivar, dependencies = TRUE) 
 3: installation of package 'fSeries' had non-zero exit status in: 
install.packages(fMultivar, dependencies = TRUE) 
 4: installation of package 'fMultivar' had non-zero exit status in: 
install.packages(fMultivar, dependencies = TRUE) 
  
 
 thank you

-

[[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] some output is missing -- not getting the full anova table

2006-04-10 Thread Dieter Menne
marilyn ford m.ford at griffith.edu.au writes:

 
 
 I have just started using R and am stumped over something:
 
 I am using the lme4 package, using lmer (and putting it in to fit0.lmer 
 ) and then I do an anova,
 but I am not getting the full table.  This is what I get:
 
   fit0.lmer - lmer(subj.prob.rev ~ semantic.class + bipron.rec + 
 item.order + (1|subject) + (1|verb), data=data)
   anova(fit0.lmer)
 Analysis of Variance Table
Df  Sum Sq Mean Sq
 semantic.class  3  5401.7  1800.6
 bipron.rec  1 22739.3 22739.3
 item.order  1  7225.2  7225.2

DF and p-values are currently not shown because of ongoing restauration work. 
Douglas Bates Deepayan believe in better nothing than possibly slightly off.
See for example

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

Shop will be re-opened as soon as smoke has settled.

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] SE estimates for treatment groups from nlme

2006-04-10 Thread Dieter Menne
Katherine A Grieve grieve at u.washington.edu writes:

 
 I am wondering how to obtain SE estimates for fixed effects from a nonlinear 
mixed effects model? 
 

It's a bit of fiddling, but there is an example coming close to what you want 
on page 373 of Pinheiro/Bates, and in file \library\nlme\scripts\ch08.R, 
section 8.2. And don't forget that you can use intervals on nlme-results.

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] Calculation of r.squared for linear model with offset

2006-04-10 Thread Prof Brian Ripley
On Sun, 9 Apr 2006, Ross Darnell wrote:

 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.

Not when there is no intercept or where there is an offset in 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)

Those are not the correct formulae in the presence of an offset.

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

Elsewhere.  The offset is subtracted from y.

-- 
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] using 'sum' function in writing a function

2006-04-10 Thread Dieter Menne
 skim033 at student.ucr.edu writes:

 
 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.

Looks like you are infected from other programming languages where in a 
function foo you must do a foo = ... to assign the return value. In R, this is 
a no-no, giving some mind-twisting recursion. And don't use c as a variable 
name. And parameters in sum() are comma separated, sum(c+x) is redundant. 

f-function(x){
  c1 - c(-1,0,1)
  sum(c1,c1)
}

f(12)

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


[R] Legend in the outer margin

2006-04-10 Thread Prasanna
Dear Rs

I have a 3x3 multiple plot. I would like to have a overall legend in
the outer right margin.
From the help archive, I found that it can be done by setting
par(xpd=NA). However, I couldn't find the correct values
for x and y co-ordinates for the legend. Please find the code snippet below:

par(mfrow=c(3,3), mar=c(4,4,0.9,0.5), oma=c(1,2,2,4),cex.main=1.1)

  *postscript(*file=epsfile,onefile=FALSE,horizontal=TRUE*)*

/* some plotting */

par(xpd=NA)

legend(legend=c(2h-opt Exact,1-shift Exact,2p-opt Exact),
lty=c(solid,dashed,dotdash),lwd=c(2,2,2),col=c(red,green,black),
bty=n,cex=0.8)

Thanks in advance
Prasanna

[[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] Handling of NA ´s in the matrix multiplicati on function

2006-04-10 Thread Fredrik Thuring


Hi!

Is there a way of handling NA´s in the matrix multiplication function
'%*%'? I cant find anything concerning this in the help files. I´m thinking
of some sort of setting such as na.rm=T.

Thanks before hand to anyone how can help me!

Fredrik Thuring, Junior Business Researcher
__
Codan Forsikring, Gammel Kongevej 60, DK-1790 Copenhagen V
tel: +45 33 55 26 63, fax: +45 33 55 21 22
e-mail: [EMAIL PROTECTED]
http://www.codan.dk

--
This e-mail and any attachment may be confidential and may a...{{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


[R] Weights in glmmPQL

2006-04-10 Thread Nelson, Kerrie
Hello,

I am using the R function glmmPQL to fit a logistic GLMM, with weights.
I am finding that I get fairly different parameter estimates in glmmPQL
from fitting the full dataset (with no weight statement) and an
equivalent, shorter dataset with the weights statement.  I am using the
weights statement in the 'glmmPQL' function exactly as in the 'glm'
function.  I also tested my dataset in the glm function and successfully
got the correct results using the full (with no weights) and the shorter
dataset (with weights).

Is the weight statement in glmmPQL intended to be applied in a different
way to a dataset than how it is used in the glm function?

Thank-you for your help and any suggestions,

Kerrie 

+
This mail has been sent through the MPI for Demographic Rese...{{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


[R] how to figure out skewness

2006-04-10 Thread Jian Zhang
I think it is simply, but I cannot find the method to figure out skewness.
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] how to figure out skewness

2006-04-10 Thread Gabor Grothendieck
RSiteSearch(skewness)

On 4/10/06, Jian Zhang [EMAIL PROTECTED] wrote:
 I think it is simply, but I cannot find the method to figure out skewness.
 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


Re: [R] how to figure out skewness

2006-04-10 Thread ronggui
you can transform the variable x down the ladder if it is positive
skew (x^0.5,x^ -1...)and  up the ladder if x is negative skew ( etc,
x^2 ,x^3...).

The book An R and S-PLUS Companion To Applied Regression has a
section to deal with the data transformation.Especiall P109 is about
transformation for normality and symmetry.

Hope this helps.

2006/4/10, Jian Zhang [EMAIL PROTECTED]:
 I think it is simply, but I cannot find the method to figure out skewness.
 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



--
黄荣贵
Deparment of Sociology
Fudan University

__
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] Upadating windows shortcuts after upgrade

2006-04-10 Thread Ales Ziberna
Dear R users,

I was just wondering, if anybody has a simple solution to the following 
problem:
I have just installed R 2.2.1 next to R 2.1.1 (in different folder, of 
course) (but the versions do not really matter) on WinXP.

I have different R projects in different folders and in each folder, I 
have (among all other things) .Rdata file, .Rhistory file and a an 
R 2.1.1 shortcut, which has the folder in which it is as a start 
(working) folder.
What I would like to to now (after installing a new version) is to copy 
each shortcut, rename the copy to R 2.2.1 and change the target 
program from R 2.1.1 to R 2.2.1. I would like to do this automtically 
for all R 2.1.1 shortcuts on my computer.

Thanks in advance for any ideas!

Best regards,
Ales Ziberna

__
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] Legend in the outer margin

2006-04-10 Thread Uwe Ligges
Prasanna wrote:

 Dear Rs
 
 I have a 3x3 multiple plot. I would like to have a overall legend in
 the outer right margin.
From the help archive, I found that it can be done by setting
 par(xpd=NA). However, I couldn't find the correct values
 for x and y co-ordinates for the legend. Please find the code snippet below:
 
 par(mfrow=c(3,3), mar=c(4,4,0.9,0.5), oma=c(1,2,2,4),cex.main=1.1)
 
   *postscript(*file=epsfile,onefile=FALSE,horizontal=TRUE*)*
 
 /* some plotting */
 
 par(xpd=NA)

You get the user coordinates of the plotting region by
   par(usr)
Now simply make the legend right of that plotting region, e.g. with
x corrdinates at
   par(usr)[2] + epsilon
and y coordinates at
   mean(par(usr)[3:4])

Uwe Ligges



 legend(legend=c(2h-opt Exact,1-shift Exact,2p-opt Exact),
 lty=c(solid,dashed,dotdash),lwd=c(2,2,2),col=c(red,green,black),
 bty=n,cex=0.8)
 
 Thanks in advance
 Prasanna
 
   [[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] Upadating windows shortcuts after upgrade

2006-04-10 Thread Gabor Grothendieck
If you are using XP then create a shortcut to Rgui.bat, which
can be found in:

http://cran.r-project.org/contrib/extra/batchfiles/

0.2-7 is the most recent.  When you install R it saves in the registry
the R version and Rgui.bat looks that up and runs that version thereby
giving you the last version you installed.

Rcmd.bat, also in batchfiles, does the same for running R from the
command line.

You can use Rversion.bat (or the gui version of that: Rversion.hta),
both from batchfiles as well, to change which version you want
it to use in the case that you have multiple versions of R on your
system.

There are also a number of other tools in the batchfiles collection
that can be of use in administering R on XP.  The README in
batchfiles has more info.


On 4/10/06, Ales Ziberna [EMAIL PROTECTED] wrote:
 Dear R users,

 I was just wondering, if anybody has a simple solution to the following
 problem:
 I have just installed R 2.2.1 next to R 2.1.1 (in different folder, of
 course) (but the versions do not really matter) on WinXP.

 I have different R projects in different folders and in each folder, I
 have (among all other things) .Rdata file, .Rhistory file and a an
 R 2.1.1 shortcut, which has the folder in which it is as a start
 (working) folder.
 What I would like to to now (after installing a new version) is to copy
 each shortcut, rename the copy to R 2.2.1 and change the target
 program from R 2.1.1 to R 2.2.1. I would like to do this automtically
 for all R 2.1.1 shortcuts on my computer.

 Thanks in advance for any ideas!

 Best regards,
 Ales Ziberna

 __
 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] Legend in the outer margin

2006-04-10 Thread Dieter Menne
Uwe Ligges ligges at statistik.uni-dortmund.de writes:

 You get the user coordinates of the plotting region by
par(usr)
 Now simply make the legend right of that plotting region, e.g. with
 x corrdinates at
par(usr)[2] + epsilon
 and y coordinates at
mean(par(usr)[3:4])

I always found it ugly that this depends on the last plotted figure in an 
array, but I wanted to position my legend independent of it at an absolute 
position in device space. What's the best way to achieve this?

par(mfrow=c(3,3), mar=c(4,4,0.9,0.5), 
   oma=c(5,2,5,10),cex.main=1.1)

n=7 # Legend should be positioned independent of n
for (i in 1:n){
  plot(rnorm(20),ylim=c(-3,3))
}

# ... just the idea
reset_to_01_coordinates()
par(xpd=NA)
leg = legend(0.9,0.5, #  Should be seen as absolute in 0/1 coords
c(2h-opt Exact,1-shift Exact,2p-opt Exact),
lty=c(solid,dashed,dotdash),lwd=c(2,2,2),
col=c(red,green,black),
bty=n,cex=0.8)


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


[R] fdim questions

2006-04-10 Thread James R. Milks
R-users:

My problem: the package fdim (which measures fractal dimensions of  
datasets) apparently prefers 3-D (XYZ) datasets.  I'm trying to  
measure the information dimension (a type of fractal dimension) of a  
2-D (XY) dataset.

Here's some examples of the preferred 3-D data (XYZ):

library(fdim)
XYZ - (makehplane(NumN=300, DimM=3, Longit=300))
fdim(XYZ,q=0.99,PlotF=TRUE)

Here's an example of the type of data I have:

library(fdim)
X- sample(1:1000,size=300,replace=TRUE)
Y- sample(1:500,size=300,replace=TRUE)
XY- matrix(c(X,Y),nrow=300)
fdim(XY,q=0.99,PlotF=TRUE)

My question is this: since fdim prefers XYZ data, is it invalid to  
use fdim to measure the fractal dimension of XY data?  What I have is  
XY position data of individual trees in a section of forest.  I'd  
like to measure the information dimension of the distribution of trees.

The reason I'm asking my question is that fdim returns consistently  
higher dimension numbers than do other fractal-measuring programs.   
However, those other programs measure the fractal dimension of  
bitmaps, not datasets, and have a problem with resolution--many of  
the points on the bitmap overlap, making it impossible to measure the  
dimension of those points.  Therefore, I'd like to measure the  
information dimension using a program that uses datasets, not bitmaps.

Thanks for your input.

Jim Milks
Graduate Student
Environmental Sciences Ph.D. Program
Wright State University
Dayton, OH 45435

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

2006-04-10 Thread Nair, Murlidharan T

Is there a multicomp() function in R as in S plus? 
Thanks ../Murli

__
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] TukeyHSDs function (pgirmess package)

2006-04-10 Thread Rune Vejen Petersen
Dear R-help,
 
I have been trying to use the TukeyHSDs function in the pgirmess
package to quickly extract all
significant pairwise comparisons in an aov object. However, it seems
that this function isn't working
as intended when only the two last populations means being tested are
significant.
 
An example of this can be seen below:
 
numbers-c(464,482,453,434,495,487) 
group-gl(3,2,label=c(A,B,C))
testobject-aov(numbers~group)
result-TukeyHSD(testobject,conf.level=0.95)
error-TukeyHSDs(result)
error$group[,1]
Error in error$group[, 1] : incorrect number of dimensions
 
To illustrate the normal function, the data set below can be used.
 
numbers-c(845,829,682, 689,581,495)
 
Is there something wrong with this function? Or is there a better way
to extract significant comparisons
from a tukey test?
 
Cheers,
Rune
---
Rune Vejen Petersen, M.Sc.Eng.
Statens Serum Institute
Dept. of Infectious Disease Immunology
Artillerivej 5, 81/344
DK-2300 Copenhagen

[[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] regression/step coefficients extraction

2006-04-10 Thread Hufkens Koen
Hi list,

I'm looking for a way to easily extract regression p-values and export
them to one file for further evaluation.

Here is the problem.

I use lm() and step() to get my regression parameters/coefficients.

after that I can extract them with summary(lm-results)$coefficients[,4]

so far so good

but it seems that if a value is not significant it is dropped from the
table/matrix so the previous command yields no consistent results with
respect to the order of appearance.

so I can get p-values for one regression being:

a   b   c   d
.01 .01 .01 .01

and the next

a   b   d
.01 .01 .01

so it's not easy to match them up correctly, because these shifts in
order or the lack of NA or empty spaces.

I would like an output to text file in this form

independent parameters: a   b   c
p-values:   .01 .02 .01
.01 NA  .01
...

etc

Any ideas to get a nice (and easy) output file where the dropped values
are filled in with NA and keeping the order and labels ok... ?


Best regards,
Koen

__
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] Fourier / Bandpass filter help?

2006-04-10 Thread Pete Cap
List,
 
 I am trying to apply some digital signal analysis methods to IPv4 networks.  
Specifically, I have had some success using the Fast Fourier Transform in R to 
find periodic events in IPv4 network traffic by producing periodograms.  I 
store network traffic in a mysql database so I have been using RMySQL to 
generate a data frame of [timestamp,events] (the FFT is run on the vector of 
events).
 
 Generating a periodogram in this case tells you that you have some periodic 
event occurring on your network (such as a keepalive signal from an instant 
messaging program) but it doesn't tell you anything more.  It would be useful 
to figure out which events in the network log being analyzed are responsible 
for the peak in the periodogram--e.g. which IPs are involved in some periodic 
activity.
 
 So, I think what I want to do is take a subset of the vector produced by the 
FFT and go from that back to the initial data frame of [timestamp,events], from 
which I can go back to the source data and pull out the IPs and so forth.  How 
can I do this?  My roommate (an aero engineer) has recommended that I look into 
implementing a bandpass filter but I'm finding the material to be way over my 
head.
 
 I'm at the limits of my expertise (I am not an engineer :) so if anyone just 
wants to point me at the topics I need to study, that would be fine--although 
pointing out some specific examples would be great as well.
 
 Thanks,
 
 Pete
 

-

[[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] Re : AUC under spline curve

2006-04-10 Thread Simon Wood
## simulated data...
x - runif(100)
y - rnorm(100)
## spline fit...
m - gam(y~s(x,k=6,fx=TRUE))
## trapezoidal integration ...
n - 1000 ## number of points in trap. approx
pd - data.frame(x=seq(0,1,length=n))
dx - pd$x[2]-pd$x[1]
f - predict.gam(m,pd)
w - rep(dx,n);w[1]-w[n] - w[2]/2 ## trapezoidal weights
sum(w*f) ## integral

## ... same again with standard error...

Xf - predict.gam(m,pd,type=lpmatrix)
t(w)%*%Xf%*%coef(m) ## integral
sqrt(t(w)%*%Xf%*%m$Vp%*%t(Xf)%*%w) ## its standard error

best,
Simon

- Simon Wood, Mathematical Sciences, University of Bath, Bath BA2 7AY
- +44 (0)1225 386603 www.maths.bath.ac.uk/~sw283/


On Mon, 10 Apr 2006 [EMAIL PROTECTED] wrote:


 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-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-10 Thread Greg Snow
A basic implementation of this is the dots function in the
TeachingDemos package.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Jinsong Zhao
 Sent: Sunday, April 09, 2006 12:07 AM
 To: R-help
 Subject: [R] dot diagram
 
 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] SE estimates for treatment groups from nlme

2006-04-10 Thread Katherine A Grieve
I have looked at that example on p. 373, however it still does not help me to
  get the stand errors i need. In my case, with the 18 different groups, I am 
combining more than just the (intercept) term with one other row in the Summary 
tTable. It is no problem to form linear combinations of the coefficients, but 
the SE in the tTable cannot just be combined. Similarly, intervals just gives me
  CI for each entry (row) in the tTable but these are not the group estimates 
that I am looking for.

An example to illustrate what i mean the rows of the tTable would be labeled 
something like this (A=2 levels, B=3 levels, C=3 levels):
Fixed Effects: (Asym~A*B*C)
   Value  SE
Asym.(intercept)x1
Asym.A1 x2
Asym.B1 x3
Asym.B2 x4
Asym.C1 x5
Asym.C2 x6
Asym.A1B1   x7
Asym.A1B2   x8
Asym.A1C1   x9
Asym.A1C2   x10
Asym.B1C1   x11
Asym.B2C1   x12
Asym.B1C2   x13
Asym.B2C2   x14
etc...

So, to get an estimate for the groups I form linear combinations e.g.:
Group A2,B1,C1 = x1 + x3 + x5 + x11

I am combining 4 coefficients to get the group mean -- is there a way to 
get the corresponding SE. It is definitely not a linear combination of the SE
listed in the tTable.
And, intervals just gives me a CI for each entry (row) in the table, not the 
linear combinations which form my groups.

Thanks again.
Katie
-
It's a bit of fiddling, but there is an example coming close to what you want 
on page 373 of Pinheiro/Bates, and in file \library\nlme\scripts\ch08.R, 
section 8.2. And don't forget that you can use intervals on nlme-results.

__
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] error message explanation for lmer

2006-04-10 Thread Bill Shipley
I am getting the following error message using the lmer function for mixed
models with method=Laplace:
 
nlminb returned message false convergence (8) in: LMEopt(x=mer,value=cv)
 
Could anyone explain what this means, and how I might overcome (or track
down) the problem?
 

Bill Shipley

 

 

[[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] Legend in the outer margin

2006-04-10 Thread Greg Snow
The cnvrt.coords function in the TeachingDemos package may be of help.
Here is an example of possible use (just change the .9 and .7 to where
ever on the page you want the legend):

par(mfrow=c(3,3), mar=c(4,4,0.9,0.5), oma=c(1,2,2,4),cex.main=1.1)

for (i in 1:9){
x - runif(25,1,10)
y - 3+ i*x + rnorm(25)
plot(x,y)
}

par(xpd=NA)

tmp - cnvrt.coords(.9,.7, 'tdev')$usr

legend(tmp,legend=c(2h-opt Exact,1-shift Exact,2p-opt Exact),
lty=c(solid,dashed,dotdash),lwd=c(2,2,2),col=c(red,green,blac
k),
bty=n,cex=0.8)

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Dieter Menne
 Sent: Monday, April 10, 2006 7:40 AM
 To: r-help@stat.math.ethz.ch
 Subject: Re: [R] Legend in the outer margin
 
 Uwe Ligges ligges at statistik.uni-dortmund.de writes:
 
  You get the user coordinates of the plotting region by
 par(usr)
  Now simply make the legend right of that plotting region, 
 e.g. with x 
  corrdinates at
 par(usr)[2] + epsilon
  and y coordinates at
 mean(par(usr)[3:4])
 
 I always found it ugly that this depends on the last plotted 
 figure in an array, but I wanted to position my legend 
 independent of it at an absolute position in device space. 
 What's the best way to achieve this?
 
 par(mfrow=c(3,3), mar=c(4,4,0.9,0.5), 
oma=c(5,2,5,10),cex.main=1.1)
 
 n=7 # Legend should be positioned independent of n for (i in 1:n){
   plot(rnorm(20),ylim=c(-3,3))
 }
 
 # ... just the idea
 reset_to_01_coordinates()
 par(xpd=NA)
 leg = legend(0.9,0.5, #  Should be seen as absolute in 0/1 
 coords c(2h-opt Exact,1-shift Exact,2p-opt Exact), 
 lty=c(solid,dashed,dotdash),lwd=c(2,2,2),
 col=c(red,green,black),
 bty=n,cex=0.8)
 
 
 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


__
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] SE estimates for treatment groups from nlme

2006-04-10 Thread Christian Ritz
Hi Katie,

maybe the easiest solution is to create a new factor that corresponds to
the combinations of the three factors A, B and C. A quick and dirty way
to create such a factor is:


ABC - factor(paste(A, x, B, x, C, sep = ))
ABC


and then fit the model using the variable ABC instead of A*B*C.

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


[R] seq

2006-04-10 Thread Omar Lakkis
Can someone, please, help explain to me why the following two calls
return the same set:

  seq(from=as.POSIXlt('2005-12-4'), to=as.POSIXlt('2006-4-2'), by='weeks')
 [1] 2005-12-04 EST 2005-12-11 EST 2005-12-18 EST 2005-12-25 EST
 [5] 2006-01-01 EST 2006-01-08 EST 2006-01-15 EST 2006-01-22 EST
 [9] 2006-01-29 EST 2006-02-05 EST 2006-02-12 EST 2006-02-19 EST
[13] 2006-02-26 EST 2006-03-05 EST 2006-03-12 EST 2006-03-19 EST
[17] 2006-03-26 EST 2006-04-02 EST

  seq(from=as.POSIXlt('2005-12-4'), to=as.POSIXlt('2006-4-9'), by='weeks')
 [1] 2005-12-04 EST 2005-12-11 EST 2005-12-18 EST 2005-12-25 EST
 [5] 2006-01-01 EST 2006-01-08 EST 2006-01-15 EST 2006-01-22 EST
 [9] 2006-01-29 EST 2006-02-05 EST 2006-02-12 EST 2006-02-19 EST
[13] 2006-02-26 EST 2006-03-05 EST 2006-03-12 EST 2006-03-19 EST
[17] 2006-03-26 EST 2006-04-02 EST


 seq
function (...)
UseMethod(seq)
environment: namespace:base

I am using R 2.2.1 on linux.
Why isn't 2006-04-09 in the response of the second call?

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

2006-04-10 Thread Gabor Grothendieck
Its undoubtedly a timezone or daylight savings time issue.  Use this
instead:

 seq(from=as.Date('2005-12-4'), to=as.Date('2006-4-9'), by='weeks')
 [1] 2005-12-04 2005-12-11 2005-12-18 2005-12-25 2006-01-01
 [6] 2006-01-08 2006-01-15 2006-01-22 2006-01-29 2006-02-05
[11] 2006-02-12 2006-02-19 2006-02-26 2006-03-05 2006-03-12
[16] 2006-03-19 2006-03-26 2006-04-02 2006-04-09

and read the R News 4/1 help desk article to learn more about this.

On 4/10/06, Omar Lakkis [EMAIL PROTECTED] wrote:
 Can someone, please, help explain to me why the following two calls
 return the same set:

   seq(from=as.POSIXlt('2005-12-4'), to=as.POSIXlt('2006-4-2'), by='weeks')
  [1] 2005-12-04 EST 2005-12-11 EST 2005-12-18 EST 2005-12-25 EST
  [5] 2006-01-01 EST 2006-01-08 EST 2006-01-15 EST 2006-01-22 EST
  [9] 2006-01-29 EST 2006-02-05 EST 2006-02-12 EST 2006-02-19 EST
 [13] 2006-02-26 EST 2006-03-05 EST 2006-03-12 EST 2006-03-19 EST
 [17] 2006-03-26 EST 2006-04-02 EST

   seq(from=as.POSIXlt('2005-12-4'), to=as.POSIXlt('2006-4-9'), by='weeks')
  [1] 2005-12-04 EST 2005-12-11 EST 2005-12-18 EST 2005-12-25 EST
  [5] 2006-01-01 EST 2006-01-08 EST 2006-01-15 EST 2006-01-22 EST
  [9] 2006-01-29 EST 2006-02-05 EST 2006-02-12 EST 2006-02-19 EST
 [13] 2006-02-26 EST 2006-03-05 EST 2006-03-12 EST 2006-03-19 EST
 [17] 2006-03-26 EST 2006-04-02 EST


  seq
 function (...)
 UseMethod(seq)
 environment: namespace:base

 I am using R 2.2.1 on linux.
 Why isn't 2006-04-09 in the response of the second call?

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

2006-04-10 Thread Thomas Lumley
On Mon, 10 Apr 2006, Omar Lakkis wrote:

 Can someone, please, help explain to me why the following two calls
 return the same set:

  seq(from=as.POSIXlt('2005-12-4'), to=as.POSIXlt('2006-4-2'), by='weeks')
 [1] 2005-12-04 EST 2005-12-11 EST 2005-12-18 EST 2005-12-25 EST
 [5] 2006-01-01 EST 2006-01-08 EST 2006-01-15 EST 2006-01-22 EST
 [9] 2006-01-29 EST 2006-02-05 EST 2006-02-12 EST 2006-02-19 EST
 [13] 2006-02-26 EST 2006-03-05 EST 2006-03-12 EST 2006-03-19 EST
 [17] 2006-03-26 EST 2006-04-02 EST

  seq(from=as.POSIXlt('2005-12-4'), to=as.POSIXlt('2006-4-9'), by='weeks')
 [1] 2005-12-04 EST 2005-12-11 EST 2005-12-18 EST 2005-12-25 EST
 [5] 2006-01-01 EST 2006-01-08 EST 2006-01-15 EST 2006-01-22 EST
 [9] 2006-01-29 EST 2006-02-05 EST 2006-02-12 EST 2006-02-19 EST
 [13] 2006-02-26 EST 2006-03-05 EST 2006-03-12 EST 2006-03-19 EST
 [17] 2006-03-26 EST 2006-04-02 EST


 seq
 function (...)
 UseMethod(seq)
 environment: namespace:base

 I am using R 2.2.1 on linux.
 Why isn't 2006-04-09 in the response of the second call?


It is because 2006-4-9 happened less than a week after 2006-4-2, because 
2006-4-2 was only 23 hours long in your time zone.  Use Date if you just 
want dates, not times.

-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


[R] Random specification in LMER

2006-04-10 Thread Arnaud Ghilain

Hello,

Can anybody help me understand the difference between the three different codes
in specifying the slope in the random part of a mixed model using LMER?

Here are the codes:

(age | id)
(1 + age | id)
(age - 1 | id)

Thank you in advance

Arnaud

__
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] TukeyHSDs function (pgirmess package)

2006-04-10 Thread Peter Ehlers
Rune Vejen Petersen wrote:

 Dear R-help,
  
 I have been trying to use the TukeyHSDs function in the pgirmess
 package to quickly extract all
 significant pairwise comparisons in an aov object. However, it seems
 that this function isn't working
 as intended when only the two last populations means being tested are
 significant.
  
 An example of this can be seen below:
  
 
numbers-c(464,482,453,434,495,487) 
group-gl(3,2,label=c(A,B,C))
testobject-aov(numbers~group)
result-TukeyHSD(testobject,conf.level=0.95)
error-TukeyHSDs(result)
error$group[,1]
 
 Error in error$group[, 1] : incorrect number of dimensions
  
 To illustrate the normal function, the data set below can be used.
  
 
numbers-c(845,829,682, 689,581,495)
 
  
 Is there something wrong with this function? Or is there a better way
 to extract significant comparisons
 from a tukey test?

It looks like the line

   res[[1]] - x[y, ]

in TukeyHSDs() should be replaced with

   res[[1]] - x[y, , drop = FALSE]


Peter Ehlers

  
 Cheers,
 Rune
 ---
 Rune Vejen Petersen, M.Sc.Eng.
 Statens Serum Institute
 Dept. of Infectious Disease Immunology
 Artillerivej 5, 81/344
 DK-2300 Copenhagen
 
   [[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] writing a data frame using xtable without row names

2006-04-10 Thread Monty B.
Dear all,

I am trying to write a data frame / table to a latex table using
xtable. The thing is that I do not want to write the row names as not
all rows will be named.

I have tried writing both a matrix (setting e.g. rownames(mat) -
c(a, , ))
and a dataframe (setting row.names to a similar setting) to disk, but
I still get rows named 1,2,3.

Have anyone solved a similar problem?

cheers,
Monty

__
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] p values for a GEE model

2006-04-10 Thread Tarca, Adi
Hi all,

I have a dataset in which the output Y is observed on two groups of
patients (treatment factor T with 2 levels).

Every subject in each group is observed three times (not time points but
just technical replication).

I am interested in estimating the treatment effect and take into account
the fact that I have repeated measurements for every subject.

If I do this with repeated measures ANOVA (in which the patient is
considered a random effect) I got the following results:

 

  library(nlme)

data-read.table(http://146.9.88.18/uploads/dataGEE.txt,header=TRUE)

   res-lme(Y~T,random=~1|P,data=data)

   summary(res)

 

So the p-value for significance of the treatment effect is 0.069.

I would like to use also as a variant analysis a Generalized Estimation
Equation Model, like 

library(gee)

summary(gee(Y~T,id=P,data=data))

 

Questions:

A) Is the gee approach suitable in this case with the model formulae I
use?

B) Can I obtain a p-value for the fixed effect T ?

 

Thanks,

 

Laurentiu Tarca

 

 


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

2006-04-10 Thread Omar Lakkis
I use POSIXct for datetimes. Is thee a timeAlign function that I can
use where :

align by year
  direction -1 == start of this year
  direction 1  == start of next year
align by week
  direction -1 == date on last sunday
  direction 1  == date on next sunday
align by day
  direction -1 == time at past midnight
  direction 1  == time at this comming midnight

__
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] passing known medoids to clara() in the cluster package

2006-04-10 Thread Dylan Beaudette
Thanks for the reply.

On Sunday 09 April 2006 11:46 pm, Martin Maechler wrote:
  DylanB == Dylan Beaudette [EMAIL PROTECTED]
  on Sun, 9 Apr 2006 19:28:44 -0700 writes:

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

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

 indeed, it doesn't --  because it's not yet possible.
 I (as maintainer of cluster) had added the ``known medoid''
 option to pam() a while ago last June (for  cluster version 1.10.0),
 and had left a note my TODO file to do the same for clara().

Ah. that would explain things ! :) . I will check back periodically to see 
when this feature is completed.

 Unfortunately it's not true that clara() was a wrapper to pam()
 as you state above.

I must have misread the manual pages...

 Given your wish and clear use case situation, I'm more
 motivated to approach this particular 'TODO' item!

 Martin Maechler, ETH Zurich

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

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

Thanks Martin! 

I will give pam() a try, and see if it can handle the large dataset that I am 
currently using clara() for -- usually only about 5 seconds are required for 
clara() to complete.

-- 
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] Changing character limit in deparse, as.character and toString

2006-04-10 Thread Dave Armstrong
Dear R-help Listers,

I am curious if there is some (hopefully easy) way to change the number of
characters that can be converted to a single string via any of deparse,
as.character or toString.   It seems that the limit is 500 for all of
these.  I saw a previous post where Prof. Ripley suggested that it was a
trivial change in the R internals to change as.character's limit from 60
to 500, but I was hoping for something that didn't involve me trying to
alter the R internals.

Thanks for your help,
Dave.

--
Dave Armstrong
University of Maryland
Dept of Government and Politics
3140 Tydings Hall
College Park, MD 20742
Office: 2103L Cole Field House
Phone: 301-405-9735
e-mail: [EMAIL PROTECTED]
web: www.davearmstrong-ps.com

[[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] Configure error

2006-04-10 Thread R. A. L. Carter
Hi Folks,

I sent this message before but I don't think it got through because I
wasn't registered.

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


Re: [R] Reshaping genetic data from long to wide

2006-04-10 Thread Farrel Buchinsky
1) I know how to post to the list. You simply send an e-mail to
[EMAIL PROTECTED] But how do you read the items and respond to them?
I usually read the items at
http://tolstoy.newcastle.edu.au/R/help/06/04/index.html#end and then have to
jump through some hoops to answer back.
 Is there any way to access this group through Google Groups or through
Outlook express' user group feature?

2)Storing all the SNP data as a string seems quite clever and a space-saving
way of doing it. However, if you were to analyze a whole chromosome at a
time you would still be creating one almighty big table albeit only
temporarily. Do you use R to run TDT analyses? If so, how are you setting up
your data frames and then what commands do you issue to analyze what is in
your dataframes?

I used David Clayton's Stata add on a few months ago and was able to get it
to run through the analysis. I ran just one locus. Technically, the analysis
seemed to run OK but I want to run all the loci one after the other. 

Currently I have my data such that I can access it from R through an ODBC
connection to Microsoft Access which in turn has an ODBC connection to the
Sybase database. Whether I go through strings or not, I still need to find a
way that I can assemble it so that a program can systematically run a TDT
analysis on all the loci. I can see how strings help me in my storing of the
data but that is already a fait acomplis. Can you explain to me how it would
help me with sequential analysis of each locus? Do you have any history
files so that I can see what you were doing?

Farrel Buchinsky, MD
Pediatric Otolaryngologist
Allegheny General Hospital
Pittsburgh, PA 


**
This email and any files transmitted with it are confidentia...{{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


Re: [R] timeAlign

2006-04-10 Thread Gabor Grothendieck
Try this.

dd - Sys.time()  # test data

lt - as.POSIXlt(dd)

ISOdate(1900+lt$year, 1, 1, 0, tz = )
ISOdate(1901+lt$year, 1, 1, 0, tz = )

seq(now, length = 2, by = paste(-, lt$wday,  day, sep =))[2]
seq(now, length = 2, by = paste(7-lt$wday, day))[2]

with(lt, ISOdate(1901+year, mon, mday, 0, tz = ))
with(lt, ISOdate(1901+year, mon, mday, 23, 59, 59, tz = ))+1



On 4/10/06, Omar Lakkis [EMAIL PROTECTED] wrote:
 I use POSIXct for datetimes. Is thee a timeAlign function that I can
 use where :

 align by year
  direction -1 == start of this year
  direction 1  == start of next year
 align by week
  direction -1 == date on last sunday
  direction 1  == date on next sunday
 align by day
  direction -1 == time at past midnight
  direction 1  == time at this comming midnight

 __
 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] Reshaping genetic data from long to wide

2006-04-10 Thread Gabor Grothendieck
On 4/10/06, Farrel Buchinsky [EMAIL PROTECTED] wrote:
 1) I know how to post to the list. You simply send an e-mail to
 [EMAIL PROTECTED] But how do you read the items and respond to them?
 I usually read the items at
 http://tolstoy.newcastle.edu.au/R/help/06/04/index.html#end and then have to
 jump through some hoops to answer back.
  Is there any way to access this group through Google Groups or through
 Outlook express' user group feature?

Try this:

http://news.gmane.org/gmane.comp.lang.r.general
or one of these:
http://dir.gmane.org/gmane.comp.lang.r.general

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

2006-04-10 Thread Gabor Grothendieck
On 4/10/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 Try this.

 dd - Sys.time()  # test data

 lt - as.POSIXlt(dd)

 ISOdate(1900+lt$year, 1, 1, 0, tz = )
 ISOdate(1901+lt$year, 1, 1, 0, tz = )

 seq(now, length = 2, by = paste(-, lt$wday,  day, sep =))[2]
 seq(now, length = 2, by = paste(7-lt$wday, day))[2]

The last two lines should be (same as above but the variable
name is called lt):

seq(lt, length = 2, by = paste(-, lt$wday,  day, sep =))[2]
seq(lt, length = 2, by = paste(7-lt$wday, day))[2]


 with(lt, ISOdate(1901+year, mon, mday, 0, tz = ))
 with(lt, ISOdate(1901+year, mon, mday, 23, 59, 59, tz = ))+1



 On 4/10/06, Omar Lakkis [EMAIL PROTECTED] wrote:
  I use POSIXct for datetimes. Is thee a timeAlign function that I can
  use where :
 
  align by year
   direction -1 == start of this year
   direction 1  == start of next year
  align by week
   direction -1 == date on last sunday
   direction 1  == date on next sunday
  align by day
   direction -1 == time at past midnight
   direction 1  == time at this comming midnight
 
  __
  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] problems with rounding in output

2006-04-10 Thread Brian Quinif
Perhaps someone will have a solution to my more general problem, but
here is the specific one:

I used the round() function to round some estimates to 3 decimal
places.  I then sent put the rounded estimates in a matrix and used
latex() to make a LaTeX table from them.  However, in my table, there
are estimtes which only have 2 decimal places. I assume that the third
decimal place in these numbers was equal to zero, so the round()
function simply cut off the superfluous zero.  However, I want all of
my estimates to have the same number of digits.  Is there a way to
force R to keep all three digits, even if the last one is zero?

Now, getting to the more general issue, to which a solution might
negate the need for a solution to the first part of this email.  I
want to create a table in which all of the standard errors are in
parentheses.  The solution I used was to input the std. errors into
the matrix to be used for making the table as follows

paste('(',satt.yr.hrs$se,')',sep='')

However, after doing so, my LaTeX output had all of the digits that R
output without rounding like it normally does.  So, I tried using the
round() command as described above.  Another problem with my solution
is that the negative signs in my LaTeX tables come out as hyphens, not
the usual negative signs from math mode.

Does anyone have a better solution for how to put my std. errors in parentheses?

Thanks,

BQ

__
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] problems with rounding in output

2006-04-10 Thread Gabor Grothendieck
Try:

 sprintf((%.2f), pi)
[1] (3.14)

On 4/11/06, Brian Quinif [EMAIL PROTECTED] wrote:
 Perhaps someone will have a solution to my more general problem, but
 here is the specific one:

 I used the round() function to round some estimates to 3 decimal
 places.  I then sent put the rounded estimates in a matrix and used
 latex() to make a LaTeX table from them.  However, in my table, there
 are estimtes which only have 2 decimal places. I assume that the third
 decimal place in these numbers was equal to zero, so the round()
 function simply cut off the superfluous zero.  However, I want all of
 my estimates to have the same number of digits.  Is there a way to
 force R to keep all three digits, even if the last one is zero?

 Now, getting to the more general issue, to which a solution might
 negate the need for a solution to the first part of this email.  I
 want to create a table in which all of the standard errors are in
 parentheses.  The solution I used was to input the std. errors into
 the matrix to be used for making the table as follows

 paste('(',satt.yr.hrs$se,')',sep='')

 However, after doing so, my LaTeX output had all of the digits that R
 output without rounding like it normally does.  So, I tried using the
 round() command as described above.  Another problem with my solution
 is that the negative signs in my LaTeX tables come out as hyphens, not
 the usual negative signs from math mode.

 Does anyone have a better solution for how to put my std. errors in 
 parentheses?

 Thanks,

 BQ

 __
 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