Re: [R] long captions -- new issue

2006-04-11 Thread Brian Quinif
I just found that out thanks to Frank Harrell.  Thanks, though.

2006/4/12, Prof Brian Ripley <[EMAIL PROTECTED]>:
> On Wed, 12 Apr 2006, Brian Quinif wrote:
>
> > I have found out that the way to have a break apart a long caption in
> > the way that one desires is to have a short caption for use in the
> > list of tables that is not broken with \\
> >
> > I can manually adjust the LaTeX output from the Hmisc function latex()
> > to get the tables how I want them.  However, I would like to automate
> > the creation of these tables.
> >
> > Inside the latex() function, I tried this:
> > caption='Estimated HOPE Effects on \\ Typical First-Year Students, 
> > 1990/1995 \\
> >   (Robust Std. Errors in Parentheses)',
> >  caption.lot='HOPE Effects on Typical First-Year Students'
> >
> > The resulting latex output however, turns the "\\" into "\", which
> > will not create the line breaks that I want.
> >
> > How can I remedy this?
>
> You inserted \ not \\ !  (Remember that R character strings use C-style
> escapes: see e.g. ?Quotes.)  Use "" to insert \\
>
> --
> 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] useR! 2006: April 15 regular registration deadline

2006-04-11 Thread Torsten Hothorn

Dear useRs,

we would like to inform you that we are approaching the regular
registration deadline (2006-04-15) of useR! 2006, the second R
user conference taking place in Vienna on June 15-17. So if you
plan to join the conference, this is the perfect time to register!

The pre-conference tutorials, on June 14, already attracted a lot
of interest, so make sure to book _now_ if you are planning to
attend one or two of the tutorials given by prominent members of
the R community.

The scientific program, including all abstracts, is available from the
conference Web page at
   http://www.R-project.org/useR-2006/

We are looking forward to meeting you in Vienna,
The useR! 2006 organizing team.

___
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-announce

__
R-help@stat.math.ethz.ch 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] Time Series information in formulae

2006-04-11 Thread Claus Dethlefsen
Dear List

The UKgas data is stored as an object of class 'ts'. I am trying to use "UKgas" 
in a formula as argument to a function. However, I do not know how to access 
the 'time series' information in the response (such as start() end() etc.).

Here is a boiled down example. 

ssm <-  function(formula, data = list(),subset=NULL) {
cl <- match.call()
  if (missing(data)) 
data <- environment(formula)
  mf <- match.call(expand.dots = FALSE)
  mf$drop.unused.levels <- TRUE
  mf[[1]] <- as.name("model.frame")
  mf <- eval(mf, .GlobalEnv)
  mt <- attr(mf, "terms")
  y <- model.response(mf, "numeric")
  print(class(y))
  }

R> class(UKgas)
[1] "ts"
R> ssm(UKgas~1)
[1] "numeric"
R> ssm(log10(UKgas)~1)
[1] "numeric"

I want the latter two to be "ts". I have tried putting "any" in place 
of "numeric" in the call to model.response, but it does not change anything for 
me.

How do I retrieve the response from a formula without loosing its "ts" status?

Best,
Claus

Claus Dethlefsen, MSc, PhD
Biostatistician at Center for Cardiovascular Research
Aalborg Hospital, Aarhus University Hospital, Denmark

__
R-help@stat.math.ethz.ch 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] long captions -- new issue

2006-04-11 Thread Prof Brian Ripley
On Wed, 12 Apr 2006, Brian Quinif wrote:

> I have found out that the way to have a break apart a long caption in
> the way that one desires is to have a short caption for use in the
> list of tables that is not broken with \\
>
> I can manually adjust the LaTeX output from the Hmisc function latex()
> to get the tables how I want them.  However, I would like to automate
> the creation of these tables.
>
> Inside the latex() function, I tried this:
> caption='Estimated HOPE Effects on \\ Typical First-Year Students, 1990/1995 
> \\
>   (Robust Std. Errors in Parentheses)',
>  caption.lot='HOPE Effects on Typical First-Year Students'
>
> The resulting latex output however, turns the "\\" into "\", which
> will not create the line breaks that I want.
>
> How can I remedy this?

You inserted \ not \\ !  (Remember that R character strings use C-style 
escapes: see e.g. ?Quotes.)  Use "" to insert \\

-- 
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] variable selection when categorical variables are available

2006-04-11 Thread Prof Brian Ripley
On Tue, 11 Apr 2006, Mike Wolfgang wrote:

> Probably it is not highly relevant question: Why do stepwise regression
> functions in R (step() or stepAIC()) add/delete categorical variables as a
> set?

Yes, those two do.  Others (e.g. in package leaps) may not.

> For example, I have a four-level factor variable d, so dummies are
> d1,d2,d3, as stepwise regression operates d, adding or removing, d1,d2,d3
> are simultaneously added/removed. What's the concern here if operating
> dummies individually? Model interpretability or anything else? (it seems
> shrinkage methods can operate them one by one)


-- 
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] [Fwd: Re: simple if statement]

2006-04-11 Thread [EMAIL PROTECTED]
Try this way

i <- 1
if (i==1) {years <- "Freshmen"}
if (i==1) {years <- "Sophomores"}

it should work!

Brian Quinif wrote:

> I am ashamed to be asking this question, but I couldn't find the
> solution anywhere.  Searching for "if" and "R" is not very
> productive...
> 
> I cannot get a simple if statement to work.
> 
> I have data on college students.  I want to make a string variable
> that has the names of the years.  That is, when the year variable i is
> equal to 1, I want to have a variable called years equal to
> "Freshmen".
> 
> I tried this
> years <- "Freshmen" if i==1
> years <- "Sophomores" if i==2
> 
> and so on, but I couldn't get it to work.  How can I get this variable to 
> work?
> 
> 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
> 
> 
-- 
~~~
~ Ennio D. Isaia
~ Dep. of Statistics & Applied Mathematics, University of Torino
~ Piazza Arbarello, 8 - 10122 Torino (Italy)
~ Phone: +39 011 670 57 29 ~~ Fax: +39 011 670 57 83
~~~

__
R-help@stat.math.ethz.ch 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] long captions -- new issue

2006-04-11 Thread Brian Quinif
I have found out that the way to have a break apart a long caption in
the way that one desires is to have a short caption for use in the
list of tables that is not broken with \\

I can manually adjust the LaTeX output from the Hmisc function latex()
to get the tables how I want them.  However, I would like to automate
the creation of these tables.

Inside the latex() function, I tried this:
caption='Estimated HOPE Effects on \\ Typical First-Year Students, 1990/1995 \\
(Robust Std. Errors in Parentheses)',
  caption.lot='HOPE Effects on Typical First-Year Students'

The resulting latex output however, turns the "\\" into "\", which
will not create the line breaks that I want.

How can I remedy this?

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] Group methods for basic classes

2006-04-11 Thread Parlamis Franklin
Trying to define group methods for the "expression" class, running  
into some problems.

 > setMethod("Arith", signature(e1 = "expression", e2 = "expression"),
+ function(e1, e2) 5)
[1] "Arith"
 > expression(2)+expression(5)
Error in expression(2) + expression(5) : non-numeric argument to  
binary operator

Is something sealed somewhere?  If so, what was the effect of my  
setMethod call, which gave no Error or Warning?

Here is what I am using as a workaround.

 > setClass("Expression", representation("expression"))
[1] "Expression"
 > setMethod("Arith", signature(e1 = "Expression", e2 = "Expression"),
+ function(e1, e2) 5)
[1] "Arith"
 > new("Expression", expression(2)) + new("Expression", expression(5))
[1] 5

Is this the preferred workaround, or is there something better?

Franklin

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

2006-04-11 Thread Spencer Graves
   RSiteSearch("multicomp") produced 42 hits for me just now, including 
mentions of a "multcomp" package (with no "i") and functions TukeyHSD, 
pairwise.t.test and pairwise.wilcox.test in ctest, including a comment 
from Ripley that, "If you look in the archives you will see this has 
cropped up repeatedly, and you will find the arguments why adjustment 
for multiple comparisons is given little importance." 
(http://finzi.psych.upenn.edu/R/Rhelp02a/archive/7570.html)

  hope this helps,
  spencer graves

Nair, Murlidharan T wrote:

> 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-help@stat.math.ethz.ch 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] Weights in glmmPQL

2006-04-11 Thread Spencer Graves
  Do some of your observations have weights=0?  If yes, that might be 
the problem.  I don't know the details, but some functions like glm have 
an argument 'subset' and might give inappropriate answers with weights = 
0.

  Beyond that, I just got 69 hits for RSiteSearch("glmmPQL weights"). 
Some of these might interest you.  In particular, you might also try 
fitting the same model using lmer associated with the lme4 package;  for 
that see the vignettes in the lme4 and MlmRev packages.

  If you would like further help from this listserve, please provide a 
simple, self-contained, reproducible example as suggested in the posting 
guide! "www.R-project.org/posting-guide.html".  Without it, I'm just 
guessing, and some who could help more than I can don't bother.

  hope this helps,
  spencer graves

Nelson, Kerrie wrote:

> 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-help@stat.math.ethz.ch 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] Change in lattice dotplot?

2006-04-11 Thread Deepayan Sarkar
On 4/11/06, Fredrik Karlsson <[EMAIL PROTECTED]> wrote:
> Dear list,
>
> I used to have this code in a Sweave document:
>
>
>
> sel <- placeDF$Place == "Velar" & placeDF$manner == "Plosive"
> table(placeDF$agem[sel], placeDF$place[sel]) -> pd
> print(
>   dotplot(
>prop.table(pd,margin=1),
>auto.key=list(
>  space="right"
>  ),
>xlab="Relative Frequency",
>ylab="Age (months)",
>stack=T,
>par.settings = list(superpose.fill = list(col =
> rev(gray.colors(40)[1:40 %% 4 == 1] )))
>)
>   )

Many of your arguments don't make sense for dotplot (they do for barchart).

> This used ot produce a dotplot with the proportion of each value in pd
> relative to the entire row. Each column constituted a separate group.
>
> Now, with an ugrade of all packages, I have lost the groups.
> Is there a way to get them back?

Hard to say without any version information. The following uses
grouping by default with R 2.2.1 and lattice 0.12-11 (both dotplot and
barchart):

pd = as.table(matrix(sample(c(rep(0, 10), 21:30), 20 * 6, TRUE), 20, 6))
dotplot(prop.table(pd, margin = 1), auto.key = list(space = "right"))
barchart(prop.table(pd, margin = 1), auto.key = list(space = "right"))

> (The pd table displayed below)

This is not a very useful form. What does str(pd) say?

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

2006-04-11 Thread David Duffy
Farrel Buchinsky <[EMAIL PROTECTED]> wrote:
>
> 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?
>
At some stage, you will need to have a "wide" format pedigree file, at least
as wide as the haplotypes you are interested in.

Using the idea of storage as strings (which would be especially good for
SNPs), you would just do something like:
  cbind(phenotypes, unlist(strplit(snp, " ")))
or
  ex <- function(x) matrix(unlist(strsplit(x," ")), nc=length(x))
  cbind(phenotypes, ex(snps[chosen.snps])

Here is a fragment using reshape from long to wide

extract.snp <- function(snplist, snpdata) {
# names of snps from one file
  snps <- read.delim(snplist, sep="\t", head=FALSE,
 colClasses=c("character", "numeric"))
  names(snps) <- c("Names", "Pos")
  snps <- snps[order(snps[,2]),]
# snp data in long format
  x <- read.delim(snpdata, sep="\t", colClasses="character", head=FALSE)
  names(x) <- c("id","marker", "genotype")
  ped<-reshape(x, v.names="genotype", timevar="marker",
 idvar="id",direction="wide")
  names(ped) <- gsub("genotype.","", names(ped))
  rpos <- match(snps$Name, names(ped))
  ped <- ped[,c(1, rpos[!is.na(rpos)])]
  ped
}

| David Duffy (MBBS PhD) ,-_|\
| email: [EMAIL PROTECTED]  ph: INT+61+7+3362-0217 fax: -0101  / *
| Epidemiology Unit, Queensland Institute of Medical Research   \_,-._/
| 300 Herston Rd, Brisbane, Queensland 4029, Australia  GPG 4D0B994A v

__
R-help@stat.math.ethz.ch 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-11 Thread Katherine A Grieve
Thanks for the numerous responses. I was asked to post the solution so that 
others could see it.

The solution is to use the estimable function from the gregmisc or gmodels 
package. First you create a matrix (the cm matrix) of the particular linear 
combinations of parameters you are concerned with. In my case with the 18 
groups I created an 18 row matrix corresponding to the linear combinations of 
coefficients which made up each of my treatment groups. (the columns correspond 
to each of the coefficients in the summary tTable).

cm<-rbind('Benicia Curved Base' = c(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
'PR39G83 Curved Base' =   c(1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
'Benicia Normal Base' =   c(1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
'Benicia Upright Base' =  c(1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
'Benicia Curved Mid'= c(1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),
'Benicia Curved Tip'= c(1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0),
'PR39G83 Normal Base'=c(1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0),
'PR39G83 Upright Base'=   c(1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0),
'PR39G83 Curved Mid'= c(1,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0),
'PR39G83 Curved Tip'= c(1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0),
'Benicia Normal Mid'= c(1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0),
'Benicia Upright Mid'=c(1,0,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0,0),
'Benicia Normal Tip'= c(1,0,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0),
'Benicia Upright Tip'=c(1,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0),
'PR39G83 Normal Mid'= c(1,1,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0),
'PR39G83 Upright Mid'=c(1,1,0,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0),
'PR39G83 Normal Tip'= c(1,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0),
'PR39G83 Upright Tip'=c(1,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1),
)

Then I called estimable(my.nlme, cm) which yielded the parameter estimates and 
the SE for each of the groups I was interested in.

__
R-help@stat.math.ethz.ch 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] Specifying an appropriate error term in a hierarchical regression

2006-04-11 Thread Chris Bergstresser
Hi all --

   So I'm working through my statistics homework again, and trying to
reproduce the examples in the book (Kirk's _Experimental Design_,
third edition) in R.  This is a completely randomized hierarchical
design (CRH-28(A)).  The B factor is completely nested within the A
factor.  Pages 480-482, for those playing along at home.

   I can use:

summary(aov(value ~ a + Error(b), data = ex));

   to get the correct F value for the main effect of A.  I can use

summary(aov(value ~ b, data = ex));

   to get the correct values for B(A) and the within cell SS.  But I
can't find any documentation about constructing the Error term to get
this output in a single analysis (except for
http://www.psych.upenn.edu/~baron/rpsych/rpsych.html, but Kirk doesn't
talk about these tests in terms of Error strata, so it's a little hard
to figure out the correspondence).
   Also, the documentation on the Error term in ?aov is rather
perfunctory.  There's no mention of the "/" operator, for example.

ex = scan()
 3  6  3  3
 1  2  2  2
 5  6  5  6
 2  3  4  3
 7  8  7  6
 4  5  4  3
 7  8  9  8
10 10  9 11

a = factor(rep(paste("a", 1:2, sep = ""), each = 16));
b = factor(rep(paste("b", 1:8, sep = ""), each = 4));

ex = data.frame(value = ex, a, b);

summary(aov(value ~ a + Error(b), data = ex));
summary(aov(value ~ b, data = ex));

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

2006-04-11 Thread Pradeep Gunda
I am using R for prediction. I want to use VARIMA. I could not not
find any package which would provide multivariate ARIMA that is
VARIMA. I looked at the list of CRAN packages and found  DSE package
and also fracdiff package but they do not contain VARIMA modeling
function.
DSE had only VAR models but not VARIMA. Could anybody inform me the
package and funcitons I need not use.

Thanks,
Pradeep

__
R-help@stat.math.ethz.ch 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] variable selection when categorical variables are available

2006-04-11 Thread Frank E Harrell Jr
Mike Wolfgang wrote:
> Dear All,
> 
> Probably it is not highly relevant question: Why do stepwise regression
> functions in R (step() or stepAIC()) add/delete categorical variables as a
> set? For example, I have a four-level factor variable d, so dummies are
> d1,d2,d3, as stepwise regression operates d, adding or removing, d1,d2,d3
> are simultaneously added/removed. What's the concern here if operating
> dummies individually? Model interpretability or anything else? (it seems
> shrinkage methods can operate them one by one)
> 
> Thanks
> mike

You would be on shaky ground statistically and interpretation wise to 
break up the variables.  Stepwise regression causes enough problems 
(invalidating most of the statististics from the final model) without 
doing that.

Shrinkage methods do not operate on them one by one; they shrink the 
estimates to the mean of all 4 groups (see for example the ols function 
in the Design package).

-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt 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] variable selection when categorical variables are available

2006-04-11 Thread Mike Wolfgang
Dear All,

Probably it is not highly relevant question: Why do stepwise regression
functions in R (step() or stepAIC()) add/delete categorical variables as a
set? For example, I have a four-level factor variable d, so dummies are
d1,d2,d3, as stepwise regression operates d, adding or removing, d1,d2,d3
are simultaneously added/removed. What's the concern here if operating
dummies individually? Model interpretability or anything else? (it seems
shrinkage methods can operate them one by one)

Thanks
mike

[[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] Change in lattice dotplot?

2006-04-11 Thread Fredrik Karlsson
Dear list,

I used to have this code in a Sweave document:



sel <- placeDF$Place == "Velar" & placeDF$manner == "Plosive"
table(placeDF$agem[sel], placeDF$place[sel]) -> pd
print(
  dotplot(
   prop.table(pd,margin=1),
   auto.key=list(
 space="right"
 ),
   xlab="Relative Frequency",
   ylab="Age (months)",
   stack=T,
   par.settings = list(superpose.fill = list(col =
rev(gray.colors(40)[1:40 %% 4 == 1] )))
   )
  )

This used ot produce a dotplot with the proportion of each value in pd
relative to the entire row. Each column constituted a separate group.

Now, with an ugrade of all packages, I have lost the groups.
Is there a way to get them back?

(The pd table displayed below)

/Fredrik




> pd

 Labial Dental Alveolar Postalveolar Retroflex Palatal Velar Uvular
  18  0  100 0   010  0
  19  1  100 0   0 9  0
  20  0  300 0   011  0
  21  1  300 0   017  0
  22  0  000 0   0 8  0
  23  0  900 0   032  0
  24  0  200 0   020  0
  25  1  100 0   028  0
  26  1  700 1   037  0
  27  2  700 1   035  0
  28  0  300 0   032  0
  29  0  400 3   029  0
  30  4 1000 1   030  0
  31  0  600 1   014  0
  32  2  200 0   018  0
  33  0 1300 2   026  0
  34  0  200 1   028  0
  35  2  100 0   025  0
  36  0  300 0   010  0
  37  0  100 1   014  0
  38  0  200 0   0 6  0
  39  0  200 0   0 7  0
  40  0  000 2   014  0
  41  1  200 1   010  0
  42  1  000 1   012  0
  43  0  100 1   013  0
  44  0  100 1   0 8  0
  45  0  000 1   011  0
  46  0  000 2   0 5  0
  47  0  200 4   0 9  0
  48  0  000 2   0 7  0
  49  0  000 2   0 5  0
  50  0  000 0   0 8  0
  51  0  000 1   0 7  0
>

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


Re: [R] Graphics device size

2006-04-11 Thread Christos Hatzis
Actually it does.
Thank you, Prof. Ripley. 

-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 11, 2006 1:26 PM
To: Christos Hatzis
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Graphics device size

On Tue, 11 Apr 2006, Prof Brian Ripley wrote:

> On Tue, 11 Apr 2006, Christos Hatzis wrote:
>
>> Dear All,
>>
>> When working with composite plots many times I have to manually 
>> adjust the graphics display window size to get the best results (in 
>> Windows XP).  I can then find the size of the adjusted window in inches
using par("din").
>>
>> Now I would like to export the adjusted graphs as png's and have them 
>> look as close to the original display as possible.  The problem is 
>> that the png device accepts size arguments in pixels so that I need 
>> to convert inches to pixels.  Is there a way to get the default 
>> pixels-per-inch that the windows device uses?  RSiteSearch("ppi") did not
return any helpful hints.
>
> Well, yes, but only by calling the Win API for your own C code.  It is 
> often not very accurate.  Interestingly, it is actually in pixels per cm.
>
> What is harder is to do is to find out how large you have resized the 
> graphics window to.  Since in fact that is stored in pixels, you don't 
> need the pixels-per-inch, but I can see no way to do this without C 
> code (the info is both in the private structure defined in 
> devWindows.h and in the device-driver structure via right - left, bottom -
top).

Doesn't savePlot(, type="png") do everything that you might want here?

-- 
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] [R-pkgs] Incompatible update to splancs

2006-04-11 Thread Roger Bivand
>From version 2.01-17, splancs, a package for spatial point pattern 
analysis, depends on package sp. 

Because both packages have defined a bounding box function bbox(), the
bbox() method in sp has been given priority, and the default object for
dispatch is an array with two or more columns (as in splancs until now).

However, the deprecated splancs function returned a non-closed rectangle
of coordinates, rather than the 2x2 matrix returned by sp bbox().

Consequently, any splancs bbox() uses in user code need to be replaced by
bboxx(bbox()), where bboxx() is a helper function unrolling the sp bbox()  
output into the form used until now by splancs.

With apologies for the bumpy ride,

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

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


Re: [R] problems with assign

2006-04-11 Thread Duncan Murdoch
On 4/11/2006 2:30 PM, Arnau Mir wrote:
> Hello.
> 
> I have n files in a directory: file1, ..., filen.
> 
> I read them with the following commands:
> 
> list=scan(file="list",what=list(nom=""))
> # in the file list, I have all the filenames.
> n=length(list[[1]])
> 
> for (i in 1:n){
> aux <- paste("p",i,sep="")
> assign(aux, as.matrix(read.table(list[[1]][i])))
> }
> 
> R creates the matrices p1,p2,...,pn.
> 
> I want to manipulate the matrices p1,...,pn and create new matrices
> pp1,...,ppn. The dimensions of matrices ppi must be 100x100.
> So, I do the following:
> 
> for (i in 1:n){
>  aux2 <- paste("pp",i,sep="")
>  assign(aux2, array(0,dim=c(100,100)))
> }
> 
> My question is the following:
> 
> I want to assign to the matrix ppi[1,1] the value of pi[1,1] for i=1,...,n.
> How can I do it?
> 
> 
> For i=1, I try:
> 
> assign("aux2[1,1]",as.matrix(read.table(list[[1]][1]))[1,1])
> 
> but it doesn't work because if I ask R:
> pp1[1,1]
> R responses 0 but the value of p1[1,1] is not 0.

Despite its appearance, the statement

pp2[1,1] <- p2[1,1]

doesn't do an assignment to pp2[1,1], it does an assignment to pp2 of 
the result of a call to the function "[<-".  See the R Language 
Definition, "Function Calls" section.

I really don't recommend working the way you want to.  You'd be much 
better off leaving everything in lists, say pp to hold your pp1 to ppn, 
and p to hold p1 to pn.  Then you could say

pp[[2]][1,1] <- p[[2]][1,1]

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] problems with assign

2006-04-11 Thread Arnau Mir
Hello.

I have n files in a directory: file1, ..., filen.

I read them with the following commands:

list=scan(file="list",what=list(nom=""))
# in the file list, I have all the filenames.
n=length(list[[1]])

for (i in 1:n){
aux <- paste("p",i,sep="")
assign(aux, as.matrix(read.table(list[[1]][i])))
}

R creates the matrices p1,p2,...,pn.

I want to manipulate the matrices p1,...,pn and create new matrices
pp1,...,ppn. The dimensions of matrices ppi must be 100x100.
So, I do the following:

for (i in 1:n){
 aux2 <- paste("pp",i,sep="")
 assign(aux2, array(0,dim=c(100,100)))
}

My question is the following:

I want to assign to the matrix ppi[1,1] the value of pi[1,1] for i=1,...,n.
How can I do it?


For i=1, I try:

assign("aux2[1,1]",as.matrix(read.table(list[[1]][1]))[1,1])

but it doesn't work because if I ask R:
pp1[1,1]
R responses 0 but the value of p1[1,1] is not 0.

Thanks,

Arnau.

__
R-help@stat.math.ethz.ch 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] cph() in Design package

2006-04-11 Thread array chip
sorry this problem only occurs in S-Plus, not in R.

--- array chip <[EMAIL PROTECTED]> wrote:

> Hi there, I encountered a weird problem using cph()
> with Design package:
> 
> I have 2 datasets, say "dat1" and "dat2", both data
> frames with 3 columns "time","status" and "scores",
> all numeric
> 
> If I run the following:
> dd<-datadist(dat1)
> options(datadist='dd')
> dd
> 
>  time status   scores 
>  Low:effect  37.0  0   -6.018
>   Adjust to  88.0  0   11.252
> High:effect 109.0  1   33.267
>  Low:prediction  11.0  0  -34.419
> High:prediction 147.5  1   88.218
> Low   5.0  0  -72.072
>High 171.0  1  154.678
> 
> fit <- cph(Surv(time,status) ~ scores,
> data=dat1,surv=T, x=T, y=T)
> fit
> 
> Cox Proportional Hazards Model
> 
> cph(formula = Surv(time, status) ~ scores, data =
> xx,
> x = T, y = T, surv = T)
> 
>  Obs Events Model L.R. d.f.  P Score Score P   
> R2
> 
>  171 64  10.651 0.0011 12.01  0.0005
> 0.062
> 
> so everything is ok.
> 
> However, if I run the following with the second
> dataset:
> 
> dd<-datadist(dat2)
> options(datadist='dd')
> dd
> 
>   time status   scores 
>  Low:effect  68.10  0  -16.036
>   Adjust to  91.75  09.068
> High:effect 119.03  1   42.447
>  Low:prediction  21.75  0  -48.103
> High:prediction 120.00  1   96.661
> Low   6.90  0  -75.392
>High 120.00  1  141.524
> 
> fit <- cph(Surv(time,status) ~ scores,
> data=dat2,surv=T, x=T, y=T)
> fit
> 
> Problem: Object "fit" not found, while calling
> subroutine S_agsurv2 
> Use traceback() to see the call stack
> 
> traceback()
> 4: eval(action, sys.parent())
> 3: doErrorAction("Problem: Object \"fit\" not found,
> while calling subroutine S_agsurv2", 1000)
> 2: eval(expression(fit))
> 1: 
> Message: Problem: Object "fit" not found, while
> calling subroutine S_agsurv2
> 
> so it didn't work with the second dataset. The 2
> dataset is very similar in terms of column data
> type. 
> 
> any suggestions?
> 
> Many thanks
> 
> 
> 
> 
> 
> 
> __
> Do You Yahoo!?

> protection around 
> http://mail.yahoo.com 
>

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


[R] cph() in Design package

2006-04-11 Thread array chip
Hi there, I encountered a weird problem using cph()
with Design package:

I have 2 datasets, say "dat1" and "dat2", both data
frames with 3 columns "time","status" and "scores",
all numeric

If I run the following:
dd<-datadist(dat1)
options(datadist='dd')
dd

 time status   scores 
 Low:effect  37.0  0   -6.018
  Adjust to  88.0  0   11.252
High:effect 109.0  1   33.267
 Low:prediction  11.0  0  -34.419
High:prediction 147.5  1   88.218
Low   5.0  0  -72.072
   High 171.0  1  154.678

fit <- cph(Surv(time,status) ~ scores,
data=dat1,surv=T, x=T, y=T)
fit

Cox Proportional Hazards Model

cph(formula = Surv(time, status) ~ scores, data = xx,
x = T, y = T, surv = T)

 Obs Events Model L.R. d.f.  P Score Score PR2

 171 64  10.651 0.0011 12.01  0.0005 0.062

so everything is ok.

However, if I run the following with the second
dataset:

dd<-datadist(dat2)
options(datadist='dd')
dd

  time status   scores 
 Low:effect  68.10  0  -16.036
  Adjust to  91.75  09.068
High:effect 119.03  1   42.447
 Low:prediction  21.75  0  -48.103
High:prediction 120.00  1   96.661
Low   6.90  0  -75.392
   High 120.00  1  141.524

fit <- cph(Surv(time,status) ~ scores,
data=dat2,surv=T, x=T, y=T)
fit

Problem: Object "fit" not found, while calling
subroutine S_agsurv2 
Use traceback() to see the call stack

traceback()
4: eval(action, sys.parent())
3: doErrorAction("Problem: Object \"fit\" not found,
while calling subroutine S_agsurv2", 1000)
2: eval(expression(fit))
1: 
Message: Problem: Object "fit" not found, while
calling subroutine S_agsurv2

so it didn't work with the second dataset. The 2
dataset is very similar in terms of column data type. 

any suggestions?

Many thanks

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

2006-04-11 Thread Gabor Grothendieck
One other thought.  If they are all of the same dimension you could
alternately consider putting them into a 3d array:

library(abind)
abind(lapply(foo, function(x) do.call(rbind, x)), along = 3)

which may or may not have some advantage to you.

On 4/11/06, Muhammad Subianto <[EMAIL PROTECTED]> wrote:
> Thank you very much for your useful suggestions.
> These are exactly what I was looking for.
>
> foo <- list(foo1, foo2, foo3)
> lapply(foo, function(x) matrix(unlist(x), nrow = length(x), byrow = TRUE))
> or
> lapply(foo, function(x) do.call('rbind', x))
>
> Best, Muhammad Subianto
>
> On 4/11/06, Muhammad Subianto <[EMAIL PROTECTED]> wrote:
> > Dear all,
> > I have a result my experiment like this below (here my toy example):
> >
> > foo1 <- list()
> > foo1[[1]] <- c(10, 20, 30)
> > foo1[[2]] <- c(11, 21, 31)
> >
> > foo2 <- list()
> > foo2[[1]] <- c(100, 200, 300)
> > foo2[[2]] <- c(110, 210, 310)
> >
> > foo3 <- list()
> > foo3[[1]] <- c(1000, 2000, 3000)
> > foo3[[2]] <- c(1100, 2100, 3100)
> >
> > list(foo1,foo2,foo3)
> >
> > The result:
> > > list(foo1,foo2,foo3)
> > [[1]]
> > [[1]][[1]]
> > [1] 10 20 30
> >
> > [[1]][[2]]
> > [1] 11 21 31
> >
> > [[2]]
> > [[2]][[1]]
> > [1] 100 200 300
> >
> > [[2]][[2]]
> > [1] 110 210 310
> >
> > [[3]]
> > [[3]][[1]]
> > [1] 1000 2000 3000
> >
> > [[3]][[2]]
> > [1] 1100 2100 3100
> >
> > >
> > I want to convert like this below (as list).
> >
> > [[1]]
> > [1] 10 20 30
> > [2] 11 21 31
> >
> > [[2]]
> > [1] 100 200 300
> > [2] 110 210 310
> >
> > [[3]]
> > [1] 1000 2000 3000
> > [2] 1100 2100 3100
> >
> > I saw on the R-help archives page similar like this but I can't find a
> > solution.
> > http://tolstoy.newcastle.edu.au/R/help/05/05/4678.html
> > Thanks very much for any suggestions.
> >
> > Sincerely, Muhammad Subianto
> >
>

__
R-help@stat.math.ethz.ch 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 II and III Sum square whit empty cells

2006-04-11 Thread John Fox
Dear Mario,

When there are empty cells, some of the usual contrasts defining
interactions (and possibly even main effects) can't be estimated, and one
should be especially careful about what hypotheses are being tested. There's
a good introduction to these problems (in my opinion) by Searle, Speed, and
Henderson in The American Statistician, Vol. 35, No. 1. (Feb., 1981), pp.
16-33. The issues are sufficiently complex that I thought it inadvisable to
provide an automatic solution.

For the data pattern that you give, you could test the hypothesis of no
interaction via anova(lm(y ~ a + b), lm(y ~ a*b)). If the interaction seems
negligible, you could test the main effects via Anova(lm(y ~ a + b),
error=lm(y ~ a*b)).

I hope this helps,
 John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Mario Morales
> Sent: Tuesday, April 11, 2006 12:05 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] type II and III Sum square whit empty cells
> 
> Dear all
> 
> I need to run an anova from a factorial model
> 
> y_{ijk}=\alpha_i+\beta_j+(\alpha\beta)_{ij}+e_{ijk}
> 
> and calculate type II and III sums of square, but I have an 
> empty cells, so anova function from package car fail. (I believe)
> 
> 
> y<-c(7,13,6,10,8,11,8,3,7,5,65)
> 
> a<-as.factor(c(1,1,2,2,3,3,3,1,1,1,2))
> 
> b<-as.factor( c(rep(1,7),rep(2,4)) )
> 
> table(b,a) # cell (2,3) is empty
> 
> mod<-lm(y~ a+b+a:b)
> 
> library(car)
> 
> Anova(mod,type="II")  # don't work
> 
> How can I calculate type II and III sum of square whit empty cell?
> 
> Thanks a lot
> 
> __
> R-help@stat.math.ethz.ch 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] Graphics device size

2006-04-11 Thread Prof Brian Ripley
On Tue, 11 Apr 2006, Prof Brian Ripley wrote:

> On Tue, 11 Apr 2006, Christos Hatzis wrote:
>
>> Dear All,
>>
>> When working with composite plots many times I have to manually adjust the
>> graphics display window size to get the best results (in Windows XP).  I can
>> then find the size of the adjusted window in inches using par("din").
>>
>> Now I would like to export the adjusted graphs as png's and have them look
>> as close to the original display as possible.  The problem is that the png
>> device accepts size arguments in pixels so that I need to convert inches to
>> pixels.  Is there a way to get the default pixels-per-inch that the windows
>> device uses?  RSiteSearch("ppi") did not return any helpful hints.
>
> Well, yes, but only by calling the Win API for your own C code.  It is
> often not very accurate.  Interestingly, it is actually in pixels per cm.
>
> What is harder is to do is to find out how large you have resized the
> graphics window to.  Since in fact that is stored in pixels, you don't
> need the pixels-per-inch, but I can see no way to do this without C code
> (the info is both in the private structure defined in devWindows.h and in
> the device-driver structure via right - left, bottom - top).

Doesn't savePlot(, type="png") do everything that you might want here?

-- 
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] type II and III Sum square whit empty cells

2006-04-11 Thread Mario Morales
Dear all

I need to run an anova from a factorial model

y_{ijk}=\alpha_i+\beta_j+(\alpha\beta)_{ij}+e_{ijk}

and calculate type II and III sums of square, but I have an empty
cells, so anova function from package car fail. (I believe)


y<-c(7,13,6,10,8,11,8,3,7,5,65)

a<-as.factor(c(1,1,2,2,3,3,3,1,1,1,2))

b<-as.factor( c(rep(1,7),rep(2,4)) )

table(b,a) # cell (2,3) is empty

mod<-lm(y~ a+b+a:b)

library(car)

Anova(mod,type="II")  # don't work

How can I calculate type II and III sum of square whit empty cell?

Thanks a lot

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

2006-04-11 Thread Prof Brian Ripley
On Tue, 11 Apr 2006, Christos Hatzis wrote:

> Dear All,
>
> When working with composite plots many times I have to manually adjust the
> graphics display window size to get the best results (in Windows XP).  I can
> then find the size of the adjusted window in inches using par("din").
>
> Now I would like to export the adjusted graphs as png's and have them look
> as close to the original display as possible.  The problem is that the png
> device accepts size arguments in pixels so that I need to convert inches to
> pixels.  Is there a way to get the default pixels-per-inch that the windows
> device uses?  RSiteSearch("ppi") did not return any helpful hints.

Well, yes, but only by calling the Win API for your own C code.  It is 
often not very accurate.  Interestingly, it is actually in pixels per cm.

What is harder is to do is to find out how large you have resized the 
graphics window to.  Since in fact that is stored in pixels, you don't 
need the pixels-per-inch, but I can see no way to do this without C code
(the info is both in the private structure defined in devWindows.h and in 
the device-driver structure via right - left, bottom - top).

-- 
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] About list to list - thanks

2006-04-11 Thread Muhammad Subianto
Thank you very much for your useful suggestions.
These are exactly what I was looking for.

foo <- list(foo1, foo2, foo3)
lapply(foo, function(x) matrix(unlist(x), nrow = length(x), byrow = TRUE))
or
lapply(foo, function(x) do.call('rbind', x))

Best, Muhammad Subianto

On 4/11/06, Muhammad Subianto <[EMAIL PROTECTED]> wrote:
> Dear all,
> I have a result my experiment like this below (here my toy example):
>
> foo1 <- list()
> foo1[[1]] <- c(10, 20, 30)
> foo1[[2]] <- c(11, 21, 31)
>
> foo2 <- list()
> foo2[[1]] <- c(100, 200, 300)
> foo2[[2]] <- c(110, 210, 310)
>
> foo3 <- list()
> foo3[[1]] <- c(1000, 2000, 3000)
> foo3[[2]] <- c(1100, 2100, 3100)
>
> list(foo1,foo2,foo3)
>
> The result:
> > list(foo1,foo2,foo3)
> [[1]]
> [[1]][[1]]
> [1] 10 20 30
>
> [[1]][[2]]
> [1] 11 21 31
>
> [[2]]
> [[2]][[1]]
> [1] 100 200 300
>
> [[2]][[2]]
> [1] 110 210 310
>
> [[3]]
> [[3]][[1]]
> [1] 1000 2000 3000
>
> [[3]][[2]]
> [1] 1100 2100 3100
>
> >
> I want to convert like this below (as list).
>
> [[1]]
> [1] 10 20 30
> [2] 11 21 31
>
> [[2]]
> [1] 100 200 300
> [2] 110 210 310
>
> [[3]]
> [1] 1000 2000 3000
> [2] 1100 2100 3100
>
> I saw on the R-help archives page similar like this but I can't find a
> solution.
> http://tolstoy.newcastle.edu.au/R/help/05/05/4678.html
> Thanks very much for any suggestions.
>
> Sincerely, Muhammad Subianto
>

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

2006-04-11 Thread Christos Hatzis
Dear All,

When working with composite plots many times I have to manually adjust the
graphics display window size to get the best results (in Windows XP).  I can
then find the size of the adjusted window in inches using par("din").

Now I would like to export the adjusted graphs as png's and have them look
as close to the original display as possible.  The problem is that the png
device accepts size arguments in pixels so that I need to convert inches to
pixels.  Is there a way to get the default pixels-per-inch that the windows
device uses?  RSiteSearch("ppi") did not return any helpful hints.

Thanks.
-Christos

__
R-help@stat.math.ethz.ch 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] Creating an new variable -or my failure to understand an IF() statement

2006-04-11 Thread Chuck Cleland
John Kane wrote:
> I am just starting with R and I am having a stupid 
> problem understanding  an if else statement because I
> am thinking in terms of something like SAS or Fortran.
>  
> 
> I am completely misunderstanding what I am reading in
> the Intro to R,  the R-Language Definitions and the
> Help Mailing List.  I have read references to if not a
> vector and ifelse vectored and am even more confused.
> 
> Problem :   I want to create some new variables to use
> in a data.frame.  The actual data is read into
> data.frame (mixed string and numeric data) using a
> read.csv() command.
> 
> Testdata is:
>  a <- c("A", "B","C","D","E")
>   Y1 <- c(2, 2 , 400, 500, 600)
>   Y2 <- c(2, 4, 4 , 600, 700)
>   Y3 <- c(5, 4, 1, 1, 200)
>   Y4 <- c(5, 5, 1, 3,  5)
> 
>   MyData <- data.frame(a,Y1,Y2,Y3, Y4)
> 
>  MyData
>  # Results are:
>   a  Y1  Y2  Y3 Y4
> 1 A   2   2   5  5
> 2 B   2   4   4  5
> 3 C 400   4   1  1
> 4 D 500 600   1  3
> 5 E 600 700 200  5
> 
> 
> What I want to do is to add a variable to the
> data.frame so that I have:
> 
>a  Y1  Y2   Y3 Y4   P1
> 1 A2   2   5   54
> 2 B2   4   4   58
> 3 C  400   4   1   12
> 4 D  500 600   1   34
> 5 E  600 700 200   5NA
> 
> However when I try this :
> 
>  if (a=="A") (P1 <- Y1+ Y2) else
>if (a=="B") (P1 <- Y2+Y3) else
>  if (a=="C" ) (P1 <- Y3+ Y4) else
>if (a=="D" (P1 <-  Y4) else
> if (a=="D") (P1<- NA)
> 
> Error: syntax error in:
> " if (a=="C" ) (P1 <- Y3+ Y4) else
>if (a=="D" (P1 <-  Y4) else"
>> if (a=="D") (P1<- NA)
> Warning message:
> the condition has length > 1 and only the first
> element will be used in: if (a == "D") (P1 <- NA) 
>  
> Can anyone help me a) get around it and b) understand
> what R is really doing.?

MyData$P1 <- ifelse(a=="A", Y1 + Y2,
   ifelse(a=="B", Y2 + Y3,
ifelse(a=="C", Y3 + Y4,
 ifelse(a=="D", Y4, NA

?ifelse

> Thanks
> 
> John Kane, Kingston ON  Canada
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

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

2006-04-11 Thread Christos Hatzis
Dear All,

When working with composite plots many times I have to manually adjust the
graphics display window size to get the best results (in Windows XP).  I can
then find the size of the adjusted window in inches using par("din").

Now I would like to export the adjusted graphs as png's and have them look
as close to the original display as possible.  The problem is that the png
device accepts size arguments in pixels so that I need to convert inches to
pixels.  Is there a way to get the default pixels-per-inch that the windows
device uses?  RSiteSearch("ppi") did not retrurn any helpful hints.

Thanks.
-Christos

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

2006-04-11 Thread Muhammad Subianto
Thank you very much for your useful suggestions.
These are exactly what I was looking for.

foo <- list(foo1, foo2, foo3)
lapply(foo, function(x) matrix(unlist(x), nrow = length(x), byrow = TRUE))
or
lapply(foo, function(x) do.call('rbind', x))

Best, Muhammad Subianto

On 4/11/06, Muhammad Subianto <[EMAIL PROTECTED]> wrote:
> Dear all,
> I have a result my experiment like this below (here my toy example):
>
> foo1 <- list()
> foo1[[1]] <- c(10, 20, 30)
> foo1[[2]] <- c(11, 21, 31)
>
> foo2 <- list()
> foo2[[1]] <- c(100, 200, 300)
> foo2[[2]] <- c(110, 210, 310)
>
> foo3 <- list()
> foo3[[1]] <- c(1000, 2000, 3000)
> foo3[[2]] <- c(1100, 2100, 3100)
>
> list(foo1,foo2,foo3)
>
> The result:
> > list(foo1,foo2,foo3)
> [[1]]
> [[1]][[1]]
> [1] 10 20 30
>
> [[1]][[2]]
> [1] 11 21 31
>
> [[2]]
> [[2]][[1]]
> [1] 100 200 300
>
> [[2]][[2]]
> [1] 110 210 310
>
> [[3]]
> [[3]][[1]]
> [1] 1000 2000 3000
>
> [[3]][[2]]
> [1] 1100 2100 3100
>
> >
> I want to convert like this below (as list).
>
> [[1]]
> [1] 10 20 30
> [2] 11 21 31
>
> [[2]]
> [1] 100 200 300
> [2] 110 210 310
>
> [[3]]
> [1] 1000 2000 3000
> [2] 1100 2100 3100
>
> I saw on the R-help archives page similar like this but I can't find a
> solution.
> http://tolstoy.newcastle.edu.au/R/help/05/05/4678.html
> Thanks very much for any suggestions.
>
> Sincerely, Muhammad Subianto
>

__
R-help@stat.math.ethz.ch 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] Creating an new variable -or my failure to understand an IF() statement

2006-04-11 Thread John Kane
I am just starting with R and I am having a stupid 
problem understanding  an if else statement because I
am thinking in terms of something like SAS or Fortran.
 

I am completely misunderstanding what I am reading in
the Intro to R,  the R-Language Definitions and the
Help Mailing List.  I have read references to if not a
vector and ifelse vectored and am even more confused.

Problem :   I want to create some new variables to use
in a data.frame.  The actual data is read into
data.frame (mixed string and numeric data) using a
read.csv() command.

Testdata is:
 a <- c("A", "B","C","D","E")
  Y1 <- c(2, 2 , 400, 500, 600)
  Y2 <- c(2, 4, 4 , 600, 700)
  Y3 <- c(5, 4, 1, 1, 200)
  Y4 <- c(5, 5, 1, 3,  5)

  MyData <- data.frame(a,Y1,Y2,Y3, Y4)

 MyData
 # Results are:
  a  Y1  Y2  Y3 Y4
1 A   2   2   5  5
2 B   2   4   4  5
3 C 400   4   1  1
4 D 500 600   1  3
5 E 600 700 200  5


What I want to do is to add a variable to the
data.frame so that I have:

   a  Y1  Y2   Y3 Y4   P1
1 A2   2   5   54
2 B2   4   4   58
3 C  400   4   1   12
4 D  500 600   1   34
5 E  600 700 200   5NA

However when I try this :

 if (a=="A") (P1 <- Y1+ Y2) else
   if (a=="B") (P1 <- Y2+Y3) else
 if (a=="C" ) (P1 <- Y3+ Y4) else
   if (a=="D" (P1 <-  Y4) else
if (a=="D") (P1<- NA)

Error: syntax error in:
" if (a=="C" ) (P1 <- Y3+ Y4) else
   if (a=="D" (P1 <-  Y4) else"
> if (a=="D") (P1<- NA)
Warning message:
the condition has length > 1 and only the first
element will be used in: if (a == "D") (P1 <- NA) 
 
Can anyone help me a) get around it and b) understand
what R is really doing.?

Thanks

John Kane, Kingston ON  Canada

__
R-help@stat.math.ethz.ch 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] p values for a GEE model

2006-04-11 Thread Thomas Lumley
On Tue, 11 Apr 2006, Prof Brian Ripley wrote:

> On Tue, 11 Apr 2006, Thomas Lumley wrote:
>> 
>> He has a linear model with the same number of observations for each person
>
> Not so: some have 3 and some have 2, and the two levels of T are not quite 
> balanced (29/28).
>
>> and no covariates that vary within a person. The independence and
>> exchangeable working correlations will give identical answers.
>
> They do not in this case (nor should they, I believe).
>

You are right, of course.  I believed the message rather than looking at 
the data.

-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
R-help@stat.math.ethz.ch 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] p values for a GEE model

2006-04-11 Thread Prof Brian Ripley
On Tue, 11 Apr 2006, Thomas Lumley wrote:

> On Tue, 11 Apr 2006, Renaud Lancelot wrote:
>
>> 2006/4/10, Tarca, Adi <[EMAIL PROTECTED]>:
>>> 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.
>>>
> <>
>>> 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))
>>
>> Beware: the default within-group correlation structure is independence
>> in the gee function (see argument corstr). I think you want an
>> exchangeable correlation structure, i.e. the same within-group
>> correlation for all the measurements:
>
>
> He has a linear model with the same number of observations for each person

Not so: some have 3 and some have 2, and the two levels of T are not quite 
balanced (29/28).

> and no covariates that vary within a person. The independence and
> exchangeable working correlations will give identical answers.

They do not in this case (nor should they, I believe).

-- 
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] Re : Bootstrap and Jackknife Bias using Survey Package

2006-04-11 Thread Thomas Lumley
On Tue, 11 Apr 2006, justin bem wrote:

> Hi
> you should use the package boot to compute bootsrap and jacknife
>

Not if he wants to get the right answers.  This was for a stratified 
multistage cluster-sampled survey.

-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
R-help@stat.math.ethz.ch 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] Bootstrap and Jackknife Bias using Survey Package

2006-04-11 Thread Thomas Lumley

On Tue, 11 Apr 2006, Carlos Creva Singano (M2004078) wrote:


Dear R users,

I´m student of Master in Statistic and Data analysis, in New University 
of Lisbon. And now i´m writting my dissertation in variance 
estimation.So i´m using Survey Package to compute the principal 
estimators and theirs variances.


My data is from Incoming and Expendire Survey. This is stratified 
Multi-stage Survey care out by National Statistic Institute of 
Mozambique. My domain of analysis is Maputo City, the Capital of 
Mozambique. I just compute the sampling errors using Survey Package, but 
i have some droubles:




1. How to compute Bootstrap and Jackknife Bias of estimates, like mean?


I don't know how to do this for survey estimates, but if you do, you can 
compute it from the replicates.



2. How to see each replicate estimate of the parameter?


All the survey functions for replicate designs will return the replicates 
with the return.replicates=TRUE option


R> a <- svymean(~api00,rclus1,return.replicates=TRUE)
R> summary(a$replicates)
   Min. 1st Qu.  MedianMean 3rd Qu.Max.
  636.1   640.4   642.9   644.3   645.7   667.7
R> str(a)
List of 2
 $ mean  : atomic [1:1] 644
  ..- attr(*, "var")= num 693
  ..- attr(*, "statistic")= chr "mean"
 $ replicates: num [1:15] 643 648 646 643 645 ...
 - attr(*, "class")= chr "svrepstat"


3. Is it possible to use the Sitter algoritm in Bootstrap for stratified 
and multi-stage sampling in Survey Package? Or is possible to use the 
pseudo-population (obtained by replication the sample) in estimation 
using Bootstrap?




as.svrepdesign( ,type="bootstrap")
does create a pseudo-population in designs with a finite population 
correction. This is as described in the reference by Davison and Canty 
given on the help page.


I don't know what you mean by the "Sitter algorithm".  Prof Sitter has 
written several papers on bootstrapping survey data -- can you give a more 
precise reference?


-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle__
R-help@stat.math.ethz.ch 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] About list to list

2006-04-11 Thread Patrick Burns
If I understand what you want correctly:

 > foo1 <- list(c(10,20,30), c(11,21,31))
 > foo2 <- list(c(100,200,300), c(110,210,310))
 > foo3 <- list(c(1000,2000,3000), c(1100,2100,3100))
 > fool <- list(foo1, foo2, foo3)
 > lapply(fool, function(x) do.call('rbind', x))
[[1]]
 [,1] [,2] [,3]
[1,]   10   20   30
[2,]   11   21   31

[[2]]
 [,1] [,2] [,3]
[1,]  100  200  300
[2,]  110  210  310

[[3]]
 [,1] [,2] [,3]
[1,] 1000 2000 3000
[2,] 1100 2100 3100

Patrick Burns
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

Muhammad Subianto wrote:

>Dear all,
>I have a result my experiment like this below (here my toy example):
>
>foo1 <- list()
>foo1[[1]] <- c(10, 20, 30)
>foo1[[2]] <- c(11, 21, 31)
>
>foo2 <- list()
>foo2[[1]] <- c(100, 200, 300)
>foo2[[2]] <- c(110, 210, 310)
>
>foo3 <- list()
>foo3[[1]] <- c(1000, 2000, 3000)
>foo3[[2]] <- c(1100, 2100, 3100)
>
>list(foo1,foo2,foo3)
>
>The result:
>  
>
>>list(foo1,foo2,foo3)
>>
>>
>[[1]]
>[[1]][[1]]
>[1] 10 20 30
>
>[[1]][[2]]
>[1] 11 21 31
>
>[[2]]
>[[2]][[1]]
>[1] 100 200 300
>
>[[2]][[2]]
>[1] 110 210 310
>
>[[3]]
>[[3]][[1]]
>[1] 1000 2000 3000
>
>[[3]][[2]]
>[1] 1100 2100 3100
>
>  
>
>I want to convert like this below (as list).
>
>[[1]]
>[1] 10 20 30
>[2] 11 21 31
>
>[[2]]
>[1] 100 200 300
>[2] 110 210 310
>
>[[3]]
>[1] 1000 2000 3000
>[2] 1100 2100 3100
>
>I saw on the R-help archives page similar like this but I can't find a
>solution.
>http://tolstoy.newcastle.edu.au/R/help/05/05/4678.html
>Thanks very much for any suggestions.
>
>Sincerely, Muhammad Subianto
>
>__
>R-help@stat.math.ethz.ch 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] p values for a GEE model

2006-04-11 Thread Thomas Lumley
On Tue, 11 Apr 2006, Renaud Lancelot wrote:

> 2006/4/10, Tarca, Adi <[EMAIL PROTECTED]>:
>> 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.
>>
<>
>> 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))
>
> Beware: the default within-group correlation structure is independence
> in the gee function (see argument corstr). I think you want an
> exchangeable correlation structure, i.e. the same within-group
> correlation for all the measurements:


He has a linear model with the same number of observations for each person 
and no covariates that vary within a person. The independence and 
exchangeable working correlations will give identical answers.


-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
R-help@stat.math.ethz.ch 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 : Bootstrap and Jackknife Bias using Survey Package

2006-04-11 Thread justin bem
Hi 
 you should use the package boot to compute bootsrap and jacknife 
 


[[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] compiling a package on a pc - process is stalling

2006-04-11 Thread john.gavin
Hi,

On a new pc, I am trying to 'CHECK' an R package
containing only R code but the process is hanging and I cant see why.

The 00check.log file shows
* using log directory 'c:/temp/opRisk.Rcheck'
* using R version 2.2.1, 2005-12-20 
* checking for file 'opRisk/DESCRIPTION' ... OK
* this is package 'opRisk' version '0.2'
* checking if this is a source package ... OK
* checking whether package 'opRisk' can be installed ...

The 00install.out file shows
'installing R.css in c:/temp/opRisk.Rcheck'

There is also an R.css file and a '00LOCK' folder with nothing in it.

There are no error messages or warnings.

I am using v5.8.8 of Perl and V2.2.1 of R on NT
and the latest version of Rtools.

I can 'BUILD' the package without any apparent problems.

> cd S:\QRMS\Stats\R\build
> Rcmd BUILD opRisk

S:\QRMS\Stats\R\build>Rcmd BUILD opRisk 
* checking for file 'opRisk/DESCRIPTION' ... OK
* preparing 'opRisk':
* checking DESCRIPTION meta-information ... OK
* removing junk files
* checking for LF line-endings in source files
* checking for empty directories
WARNING: directory opRisk/inst is empty
* building 'opRisk_0.2.tar.gz'

But 'Rcmd INSTALL opRisk' also stalls.

I have also tried to compile one of the packages from CRAN
with similar results (blighty).

Thanks for any pointers.

Regards,

John.

John Gavin <[EMAIL PROTECTED]>,
Commodities, FIRC,
UBS Investment Bank, 2nd floor, 
100 Liverpool St., London EC2M 2RH, UK.
Phone +44 (0) 207 567 4289

Visit our website at http://www.ubs.com

This message contains confidential information and is intend...{{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] summary(lm) * lack of a parameter estimate

2006-04-11 Thread Luis Ridao Cruz
R-help,

I'm using a lm  model for some data.
The code is below:

fitData <- lm(formula = log(f1) ~ year + mon + pair + rek, weights = w,
data = data)

I want to get the fitted values of log(f1) for every year so I do:

tapply(fitted(fitData), list(data96$year), mean)

but there is no parameter estimate for first year of data

A look in summary(fitData) confirms this lack (along with other
parameters).

Can anyone help?

Thank you in advance



I run on a Windows Xp machine

> version
 _  
platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor2.1
year 2005   
month12 
day  20 
svn rev  36812  
language R

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

2006-04-11 Thread Diethelm Wuertz
stat stat wrote:

>Dear R-users,
>   
>  I am wondering if anyone can tell me how Garch coefficients are calculated 
> in R. What is algorithm for that? If anyone give me a detail desceiption I 
> will be very grateful.
>   
>  Thanks and Regards,
>  stat74
>
>  
>
Goto www.rmetrics.org and download the white paper
GARCH Modelling in R .

regards Diethelm Wuertz



>thanks in advance
>   
>-
>
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>  
>

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

2006-04-11 Thread Gabor Grothendieck
I forgot the byrow = TRUE.  Try this instead:

lapply(foo, function(x) matrix(unlist(x), nrow = length(x), byrow = TRUE))


On 4/11/06, Gabor Grothendieck <[EMAIL PROTECTED]> wrote:
> Are you trying to turn each of the components of foo into a matrix?
> If that's it then:
>
> lapply(foo, function(x) matrix(unlist(x), nrow = length(x)))
>
>
> On 4/11/06, Muhammad Subianto <[EMAIL PROTECTED]> wrote:
> > Dear all,
> > I have a result my experiment like this below (here my toy example):
> >
> > foo1 <- list()
> > foo1[[1]] <- c(10, 20, 30)
> > foo1[[2]] <- c(11, 21, 31)
> >
> > foo2 <- list()
> > foo2[[1]] <- c(100, 200, 300)
> > foo2[[2]] <- c(110, 210, 310)
> >
> > foo3 <- list()
> > foo3[[1]] <- c(1000, 2000, 3000)
> > foo3[[2]] <- c(1100, 2100, 3100)
> >
> > list(foo1,foo2,foo3)
> >
> > The result:
> > > list(foo1,foo2,foo3)
> > [[1]]
> > [[1]][[1]]
> > [1] 10 20 30
> >
> > [[1]][[2]]
> > [1] 11 21 31
> >
> > [[2]]
> > [[2]][[1]]
> > [1] 100 200 300
> >
> > [[2]][[2]]
> > [1] 110 210 310
> >
> > [[3]]
> > [[3]][[1]]
> > [1] 1000 2000 3000
> >
> > [[3]][[2]]
> > [1] 1100 2100 3100
> >
> > >
> > I want to convert like this below (as list).
> >
> > [[1]]
> > [1] 10 20 30
> > [2] 11 21 31
> >
> > [[2]]
> > [1] 100 200 300
> > [2] 110 210 310
> >
> > [[3]]
> > [1] 1000 2000 3000
> > [2] 1100 2100 3100
> >
> > I saw on the R-help archives page similar like this but I can't find a
> > solution.
> > http://tolstoy.newcastle.edu.au/R/help/05/05/4678.html
> > Thanks very much for any suggestions.
> >
> > Sincerely, Muhammad Subianto
> >
> > __
> > R-help@stat.math.ethz.ch 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] problems with rounding in output

2006-04-11 Thread Dieter Menne
Brian Quinif  gmail.com> writes:

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

latex implicitely calls format.df, which has documented cdec, rdec... arguments.

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

Try numeric.dollar = TRUE (but you might run in other problems with that 
option, mainly in ctable).

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] About list to list

2006-04-11 Thread Gabor Grothendieck
Are you trying to turn each of the components of foo into a matrix?
If that's it then:

lapply(foo, function(x) matrix(unlist(x), nrow = length(x)))


On 4/11/06, Muhammad Subianto <[EMAIL PROTECTED]> wrote:
> Dear all,
> I have a result my experiment like this below (here my toy example):
>
> foo1 <- list()
> foo1[[1]] <- c(10, 20, 30)
> foo1[[2]] <- c(11, 21, 31)
>
> foo2 <- list()
> foo2[[1]] <- c(100, 200, 300)
> foo2[[2]] <- c(110, 210, 310)
>
> foo3 <- list()
> foo3[[1]] <- c(1000, 2000, 3000)
> foo3[[2]] <- c(1100, 2100, 3100)
>
> list(foo1,foo2,foo3)
>
> The result:
> > list(foo1,foo2,foo3)
> [[1]]
> [[1]][[1]]
> [1] 10 20 30
>
> [[1]][[2]]
> [1] 11 21 31
>
> [[2]]
> [[2]][[1]]
> [1] 100 200 300
>
> [[2]][[2]]
> [1] 110 210 310
>
> [[3]]
> [[3]][[1]]
> [1] 1000 2000 3000
>
> [[3]][[2]]
> [1] 1100 2100 3100
>
> >
> I want to convert like this below (as list).
>
> [[1]]
> [1] 10 20 30
> [2] 11 21 31
>
> [[2]]
> [1] 100 200 300
> [2] 110 210 310
>
> [[3]]
> [1] 1000 2000 3000
> [2] 1100 2100 3100
>
> I saw on the R-help archives page similar like this but I can't find a
> solution.
> http://tolstoy.newcastle.edu.au/R/help/05/05/4678.html
> Thanks very much for any suggestions.
>
> Sincerely, Muhammad Subianto
>
> __
> R-help@stat.math.ethz.ch 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] error message explanation for lmer

2006-04-11 Thread Andreas Svensson
I got strange error messages when I had other packages opened the same 
time as lme4 (e.g. as nlme).
Try to not have other libraries loaded.

/A

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

2006-04-11 Thread Muhammad Subianto
Dear all,
I have a result my experiment like this below (here my toy example):

foo1 <- list()
foo1[[1]] <- c(10, 20, 30)
foo1[[2]] <- c(11, 21, 31)

foo2 <- list()
foo2[[1]] <- c(100, 200, 300)
foo2[[2]] <- c(110, 210, 310)

foo3 <- list()
foo3[[1]] <- c(1000, 2000, 3000)
foo3[[2]] <- c(1100, 2100, 3100)

list(foo1,foo2,foo3)

The result:
> list(foo1,foo2,foo3)
[[1]]
[[1]][[1]]
[1] 10 20 30

[[1]][[2]]
[1] 11 21 31

[[2]]
[[2]][[1]]
[1] 100 200 300

[[2]][[2]]
[1] 110 210 310

[[3]]
[[3]][[1]]
[1] 1000 2000 3000

[[3]][[2]]
[1] 1100 2100 3100

>
I want to convert like this below (as list).

[[1]]
[1] 10 20 30
[2] 11 21 31

[[2]]
[1] 100 200 300
[2] 110 210 310

[[3]]
[1] 1000 2000 3000
[2] 1100 2100 3100

I saw on the R-help archives page similar like this but I can't find a
solution.
http://tolstoy.newcastle.edu.au/R/help/05/05/4678.html
Thanks very much for any suggestions.

Sincerely, Muhammad Subianto

__
R-help@stat.math.ethz.ch 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] long caption titles for tables

2006-04-11 Thread Marc Schwartz
On Tue, 2006-04-11 at 07:54 -0500, Frank E Harrell Jr wrote:
> Brian Quinif wrote:
> > I am using using the latex() function in the Hmisc package.  I want to
> > create some table captions that are relatively long and need to take
> > up more than one line.
> > 
> > When I do this, the LaTeX output has the majority of the text on one
> > line with the remainder spilling over into the second line as if it
> > were a normal sentence.
> 
> That is standard typography.
> 
> Frank
> 
> > 
> > How can I get a long caption such as "Estimated HOPE Effects on
> > Typical First-Year Students, 1990/1995 Robust Std. Errors in
> > Parentheses" to appear as
> > 
> > Estimated HOPE Effects on
> > Typical First-Year Students, 1990/1995
> > Robust Std. Errors in Parentheses
> > 
> > where that would be centered above the table?
> > 
> > Thanks,
> > 
> > BQ

Just a quick follow up to Frank's comment, which is that you might want
to consider using the 'caption' package, which provides for much greater
control over the formatting of captions, including centering, local
margins, indentation, etc.

More information is here:

  http://www.ctan.org/info?id=caption

HTH,

Marc Schwartz

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


Re: [R] long caption titles for tables

2006-04-11 Thread Frank E Harrell Jr
Brian Quinif wrote:
> I am using using the latex() function in the Hmisc package.  I want to
> create some table captions that are relatively long and need to take
> up more than one line.
> 
> When I do this, the LaTeX output has the majority of the text on one
> line with the remainder spilling over into the second line as if it
> were a normal sentence.

That is standard typography.

Frank

> 
> How can I get a long caption such as "Estimated HOPE Effects on
> Typical First-Year Students, 1990/1995 Robust Std. Errors in
> Parentheses" to appear as
> 
> Estimated HOPE Effects on
> Typical First-Year Students, 1990/1995
> Robust Std. Errors in Parentheses
> 
> where that would be centered above the table?
> 
> 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
> 


-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt 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


Re: [R] problem with RWinEdt

2006-04-11 Thread Uwe Ligges
Christian Gold wrote:

> Dear list members
> 
> I have been using RWinEdt for an extended time and on different machines
> (all under Windows XP). There is a strange problem that comes up
> sometimes on one of them, always on another and never on a third one.
> (However, I do think I have followed the same procedures on all machines
> when installing it.)
> 
> When I use one of the buttons (or key combinations) for pasting command
> lines from RWinEdt into R, instead of pasting the selected command
> line(s), it just pastes a "P", nothing else.
> 
> I have been working around this problem for a while, using ordinary
> copying and pasting. However, this is not really satisfying.
> Does anyone know a possible solution to this problem?


Is this the most recent version of package RWinEdt under R-2.2.1?
If "no": Please upgrade
If "yes": Please run RGui in sdi-mode and configure RWinEdt to support R 
in sdi mode.

Best,
Uwe Ligges



> Many thanks
> 
> Christian
> 
> 
> --
> 
> Dr. Christian Gold, PhD
> http://www.hisf.no/~chrisgol
> 
> __
> R-help@stat.math.ethz.ch 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] Text Problem

2006-04-11 Thread Gabor Grothendieck
Try:

junk <- capture.output(print("abc"))


On 4/11/06, Sumanta Basak <[EMAIL PROTECTED]> wrote:
> Hi All,
> I'm running garch models for different combinations, like (1,1),(1,2) etc.
> in a for loop. But, when i'm running it, R is showing a text "*
> ESTIMATION WITH ANALYTICAL GRADIENT * ". How can delete it? Any options
> for this?
>
> --
> SUMANTA BASAK.
>
>[[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] Help on GARCH calculation

2006-04-11 Thread stat stat
Dear R-users,
   
  I am wondering if anyone can tell me how Garch coefficients are calculated in 
R. What is algorithm for that? If anyone give me a detail desceiption I will be 
very grateful.
   
  Thanks and Regards,
  stat74


thanks in advance

-


[[alternative HTML version deleted]]

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


[R] problem with RWinEdt

2006-04-11 Thread Christian Gold
Dear list members

I have been using RWinEdt for an extended time and on different machines
(all under Windows XP). There is a strange problem that comes up
sometimes on one of them, always on another and never on a third one.
(However, I do think I have followed the same procedures on all machines
when installing it.)

When I use one of the buttons (or key combinations) for pasting command
lines from RWinEdt into R, instead of pasting the selected command
line(s), it just pastes a "P", nothing else.

I have been working around this problem for a while, using ordinary
copying and pasting. However, this is not really satisfying.
Does anyone know a possible solution to this problem?

Many thanks

Christian


--

Dr. Christian Gold, PhD
http://www.hisf.no/~chrisgol

__
R-help@stat.math.ethz.ch 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] variable-substitution / command-substitution

2006-04-11 Thread Gabor Grothendieck
Here are some different approaches:

x <- 1
y <- 2

paste("p", x, y, ".dat", sep = "") # p12.dat

sprintf("p%s%s.dat", x, y)

file.path("a", "b.dat")  # a/b.dat

library(gsubfn)
gsubfn(,,"p$x$y.dat") # p12.dat



On 4/11/06, Damaris Zurell <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have about 2000 data files which I want to analyse.
> The file names are all very similar =>
> p"variable1"_t"variable2"_c"variable3".txt
> There aren´t so much different variables (about 70) , just different
> combinations of them.
> To allow an easy way of handling those data files I was wondering
> whether R is able to do variable-substitution /command-substitution
> similar to shell-programming, so that I could imbed the read.table
> option (and further commands) in 3 loops (one for every variable in the
> filenames) .
>
> e.g.:
> for var1 in (varlist1)
>  for var2 in (varlist2)
>  for var3 in (varlist3)
>   read.table("/p$var1_t$var2_c$var3.txt")
>   statistics..
>  done
>  done
> done
>
>
> Cheers,
> Damaris
>
> __
> R-help@stat.math.ethz.ch 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] Text Problem

2006-04-11 Thread Sumanta Basak
Hi All,
I'm running garch models for different combinations, like (1,1),(1,2) etc.
in a for loop. But, when i'm running it, R is showing a text "*
ESTIMATION WITH ANALYTICAL GRADIENT * ". How can delete it? Any options
for this?

--
SUMANTA BASAK.

[[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] variable-substitution / command-substitution

2006-04-11 Thread Haroldo Stenger
I don't know wether R does variable substitution. In order to help
solve the problem, I suggest:
- you might use cat in order to concatenate the files (if this fits in
the problem)
- you might write a shell or perl script which would write an .R file
by doing the required looping, given the three variables are pretty
external to the statistical data. The shell or perl procedure would
generate something useful from R language, be it a list of filnames,
over which a R loop could iterate in turn, be it an extensive list of
'read.table("filename_xyz.data")' for every xyz tuple.

Hope this helps

Haroldo

2006/4/11, Damaris Zurell <[EMAIL PROTECTED]>:
> Hello,
>
> I have about 2000 data files which I want to analyse.
> The file names are all very similar =>
> p"variable1"_t"variable2"_c"variable3".txt
> There aren´t so much different variables (about 70) , just different
> combinations of them.
> To allow an easy way of handling those data files I was wondering
> whether R is able to do variable-substitution /command-substitution
> similar to shell-programming, so that I could imbed the read.table
> option (and further commands) in 3 loops (one for every variable in the
> filenames) .
>
> e.g.:
> for var1 in (varlist1)
>  for var2 in (varlist2)
>   for var3 in (varlist3)
>read.table("/p$var1_t$var2_c$var3.txt")
>statistics..
>   done
>  done
> done
>
>
> Cheers,
> Damaris
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>


--

b l o g  http://reenunciadosrenunciados.blogspot.com/  b l o g

__
R-help@stat.math.ethz.ch 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] error in which(): recursive default argument reference

2006-04-11 Thread Gabor Grothendieck
Or use letters. = letters and similarly for the other arguments of the
form x = x.

On 4/11/06, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:
> 'letters' is an argument to your function, with default 'letters', that it
> itself.  (Default arguments are evaluated in the evaluation frame of the
> function, not in the caller.)
>
> Try letters=base::letters in your argument list.
>
> On Tue, 11 Apr 2006, Matthieu Dubois wrote:
>
> > Dear useRs,
> >
> > I have written a very simple function to compute some probabilities
> > on words (function is below). The function includes a which()
> > statement applied to a vector of characters (word.split): sapply
> > (word.split, function(x) which(letters==x)). This statement  worked
> > as expected when used outside the global function :
> > > word <- "hello"
> > > (word.split <- unlist(strsplit(word, split=c(
> > [1] "h" "e" "l" "l" "o"
> > > (used.letters <- sapply(word.split, function(x) which(letters==x)))
> > h  e  l  l  o
> > 8  5 12 12 15
> >
> > However, when embedded in the fonction, the following error occurred :
> > >  compute.word("hello")
> > Error in which(letters == x) : recursive default argument reference
> >
> >
> > Any insights would be helpful ...
> >
> > Cheers,
> >
> > Matthieu
> >
> > Function :
> > #computes some probabilities based on (1) word frequency (word.freq),
> > letters visibility(letters.vis), letters frequency(letters.freq) and
> > viewing eccentricity (pos)
> > compute.word <- function(word, pos=X, word.freq=word.freq,
> > letters=letters, letters.vis=letters.vis, letters.freq=letters.freq)
> >   {
> >   word.split <- unlist(strsplit(word, split=c()))
> >
> >   #indexing vectors
> >   used.letters <- sapply(word.split, function(x) 
> > which(letters==x))
> >   pos <- c(1,rep(2,(length(word.split)-2)),3)
> >
> >   letters.freq.word <- unlist(letters.freq[cbind(used.letters, 
> > pos)])
> >   letters.vis.word <- letters.vis[paste("X", pos, sep=""),]
> >
> >   #computations
> >   Mean.Lvis <- mean(letters.vis.word)
> >   Prod.Lvis <- prod(letters.vis.word)
> >   PosRel <- 
> > sum((word.freq/letters.freq.word)*(letters.vis.word))
> >   output <- list(Mean.Lvis, Prod.Lvis, PosRel)
> >   names(output) <- c("Mean.Lvis", "Prod.Lvis", "PosRel")
> >   return(output)
> >   }
> >
> >
> >
> > Matthieu Dubois, PH.D. Student
> > Cognitive Neuroscience Unit
> > Université catholique de Louvain
> > 10, Place cardinal Mercier - 1348 Louvain-la-Neuve - BELGIUM
> >
> > [EMAIL PROTECTED]
> >
> >
> >
> >
> >   [[alternative HTML version deleted]]
> >
> >
>
> --
> 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-help@stat.math.ethz.ch 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] This company is giving out ipods

2006-04-11 Thread Tarun Kumar Singh
Hi there.

Have a look at this. Want an ipod nano?

http://mygift321.com/?r=MTGERHcEFhJJAWcKAy4M&i=gmail&z=1&[EMAIL PROTECTED]&tc=21



Cheers

__
R-help@stat.math.ethz.ch 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] Bootstrap and Jackknife Bias using Survey Package

2006-04-11 Thread Ramón Casero Cañas
Carlos Creva Singano (M2004078) wrote:
> 
> 1. How to compute Bootstrap and Jackknife Bias of estimates, like mean?

Have you had a look at packages "boot" and "bootstrap"? E.g. you can
compute the bias and s.e. of an estimate theta using bootstrap

library("boot")
a <- boot( data, theta, R=1000 )

where boot is a function of the boot package, and theta is a function
that you can define yourself. In your case, it is not necessary and you
can use mean instead of theta.

> 2. How to see each replicate estimate of the parameter?

In the example above, they can be found in the boot object "a" in:

a$t

-- 
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] error in which(): recursive default argument reference

2006-04-11 Thread Prof Brian Ripley
'letters' is an argument to your function, with default 'letters', that it 
itself.  (Default arguments are evaluated in the evaluation frame of the 
function, not in the caller.)


Try letters=base::letters in your argument list.

On Tue, 11 Apr 2006, Matthieu Dubois wrote:


Dear useRs,

I have written a very simple function to compute some probabilities
on words (function is below). The function includes a which()
statement applied to a vector of characters (word.split): sapply
(word.split, function(x) which(letters==x)). This statement  worked
as expected when used outside the global function :
> word <- "hello"
> (word.split <- unlist(strsplit(word, split=c(
[1] "h" "e" "l" "l" "o"
> (used.letters <- sapply(word.split, function(x) which(letters==x)))
h  e  l  l  o
8  5 12 12 15

However, when embedded in the fonction, the following error occurred :
>  compute.word("hello")
Error in which(letters == x) : recursive default argument reference


Any insights would be helpful ...

Cheers,

Matthieu

Function :
#computes some probabilities based on (1) word frequency (word.freq),
letters visibility(letters.vis), letters frequency(letters.freq) and
viewing eccentricity (pos)
compute.word <- function(word, pos=X, word.freq=word.freq,
letters=letters, letters.vis=letters.vis, letters.freq=letters.freq)
{
word.split <- unlist(strsplit(word, split=c()))

#indexing vectors
used.letters <- sapply(word.split, function(x) 
which(letters==x))
pos <- c(1,rep(2,(length(word.split)-2)),3)

letters.freq.word <- unlist(letters.freq[cbind(used.letters, 
pos)])
letters.vis.word <- letters.vis[paste("X", pos, sep=""),]

#computations
Mean.Lvis <- mean(letters.vis.word)
Prod.Lvis <- prod(letters.vis.word)
PosRel <- sum((word.freq/letters.freq.word)*(letters.vis.word))
output <- list(Mean.Lvis, Prod.Lvis, PosRel)
names(output) <- c("Mean.Lvis", "Prod.Lvis", "PosRel")
return(output)
}



Matthieu Dubois, PH.D. Student
Cognitive Neuroscience Unit
Université catholique de Louvain
10, Place cardinal Mercier - 1348 Louvain-la-Neuve - BELGIUM

[EMAIL PROTECTED]




[[alternative HTML version deleted]]




--
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] error in which(): recursive default argument reference

2006-04-11 Thread Matthieu Dubois
Dear useRs,

I have written a very simple function to compute some probabilities  
on words (function is below). The function includes a which()  
statement applied to a vector of characters (word.split): sapply 
(word.split, function(x) which(letters==x)). This statement  worked  
as expected when used outside the global function :
 > word <- "hello"
 > (word.split <- unlist(strsplit(word, split=c(
[1] "h" "e" "l" "l" "o"
 > (used.letters <- sapply(word.split, function(x) which(letters==x)))
h  e  l  l  o
8  5 12 12 15

However, when embedded in the fonction, the following error occurred :
 >  compute.word("hello")
Error in which(letters == x) : recursive default argument reference


Any insights would be helpful ...

Cheers,

Matthieu

Function :
#computes some probabilities based on (1) word frequency (word.freq),  
letters visibility(letters.vis), letters frequency(letters.freq) and  
viewing eccentricity (pos)
compute.word <- function(word, pos=X, word.freq=word.freq,  
letters=letters, letters.vis=letters.vis, letters.freq=letters.freq)
{
word.split <- unlist(strsplit(word, split=c()))

#indexing vectors
used.letters <- sapply(word.split, function(x) 
which(letters==x))
pos <- c(1,rep(2,(length(word.split)-2)),3)

letters.freq.word <- unlist(letters.freq[cbind(used.letters, 
pos)])
letters.vis.word <- letters.vis[paste("X", pos, sep=""),]

#computations
Mean.Lvis <- mean(letters.vis.word)
Prod.Lvis <- prod(letters.vis.word)
PosRel <- sum((word.freq/letters.freq.word)*(letters.vis.word)) 
output <- list(Mean.Lvis, Prod.Lvis, PosRel)
names(output) <- c("Mean.Lvis", "Prod.Lvis", "PosRel")
return(output)
}   



Matthieu Dubois, PH.D. Student
Cognitive Neuroscience Unit
Université catholique de Louvain
10, Place cardinal Mercier - 1348 Louvain-la-Neuve - BELGIUM

[EMAIL PROTECTED]




[[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] Bootstrap and Jackknife Bias using Survey Package

2006-04-11 Thread Carlos Creva Singano \(M2004078\)
Dear R users,

I´m student of Master in Statistic and Data analysis, in New University of 
Lisbon. And now i´m writting my dissertation in variance estimation.So i´m  
using Survey Package to compute the principal estimators and theirs variances.

My data is from Incoming and Expendire Survey. This is stratified Multi-stage 
Survey care out by National Statistic Institute of Mozambique. My domain of 
analysis is Maputo City, the Capital of Mozambique. I just compute the sampling 
errors using Survey Package, but i have some droubles:

1. How to compute Bootstrap and Jackknife Bias of estimates, like mean?

2. How to see each replicate estimate of the parameter?

3. Is it possible to use the Sitter algoritm in Bootstrap for stratified and 
multi-stage sampling in Survey Package? Or is possible to use the 
pseudo-population (obtained by replication the sample) in estimation using 
Bootstrap?

Thanks before hand to anyone how can help me!

__
R-help@stat.math.ethz.ch 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] png overwrites upper/lower case filenames

2006-04-11 Thread Timo Becker
Prof Brian Ripley schrieb:

> *on Windows*
>
> This is how the Windows file system works.  You cannot have a.png and 
> A.png in a directory on a Windows file system.  If you unlink() the file
> with the clashing name it will create it with the case you want (but 
> since asking Windows for "B.png" will give you "b.png", does it matter?).

Got it. I was just perplexed by the retained filenames with the new outputs.
Thanks for your help.
Cheers,
Timo

>
> On Tue, 11 Apr 2006, Timo Becker wrote:
>
>> Dear R users,
>>
>> when I create files with the png graphics device, it overwrites existing
>> files which differ concerning upper/lower case file names.
>> For example, I want to create four files named "a.png", "A.png", "b.png"
>> and "B.png" which contain the corresponding letters:
>>
>> png("a.png")
>> plot(1, type="n")
>> text(1, label="a")
>> dev.off()
>>
>> png("A.png")
>> plot(1, type="n")
>> text(1, label="A")
>> dev.off()
>>
>> png("B.png")
>> plot(1, type="n")
>> text(1, label="B")
>> dev.off()
>>
>> png("b.png")
>> plot(1, type="n")
>> text(1, label="b")
>> dev.off()
>>
>> These commands create a file named "a.png" which contains the letter "A"
>> and a file named "B.png" which contains the letter "b".
>> The old file name is retained, but overwritten with the output of the
>> new png device with the same case-insensitive file name.
>> I'm sure I missed something. Can anyone tell me how to create files
>> whith case-sensitive names with the same letters?
>>
>> R version 2.2.1, 2005-12-20, i386-pc-mingw32
>>
>> Regards,
>> Timo
>>
>>
>


-- 
Timo Becker
Phonetics
Austrian Academy of Sciences
Acoustics Research Institute

__
R-help@stat.math.ethz.ch 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] png overwrites upper/lower case filenames

2006-04-11 Thread Uwe Ligges
Timo Becker wrote:

> Dear R users,
> 
> when I create files with the png graphics device, it overwrites existing 
> files which differ concerning upper/lower case file names.
> For example, I want to create four files named "a.png", "A.png", "b.png" 
> and "B.png" which contain the corresponding letters:
> 
> png("a.png")
> plot(1, type="n")
> text(1, label="a")
> dev.off()
> 
> png("A.png")
> plot(1, type="n")
> text(1, label="A")
> dev.off()
> 
> png("B.png")
> plot(1, type="n")
> text(1, label="B")
> dev.off()
> 
> png("b.png")
> plot(1, type="n")
> text(1, label="b")
> dev.off()
> 
> These commands create a file named "a.png" which contains the letter "A" 
> and a file named "B.png" which contains the letter "b".
> The old file name is retained, but overwritten with the output of the 
> new png device with the same case-insensitive file name.
> I'm sure I missed something. Can anyone tell me how to create files 
> whith case-sensitive names with the same letters?


You cannot on Windows. This is an OS but not an R issue.

Uwe Ligges


> R version 2.2.1, 2005-12-20, i386-pc-mingw32
> 
> Regards,
> Timo
>

__
R-help@stat.math.ethz.ch 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] png overwrites upper/lower case filenames

2006-04-11 Thread Prof Brian Ripley
*on Windows*

This is how the Windows file system works.  You cannot have a.png and 
A.png in a directory on a Windows file system.  If you unlink() the file
with the clashing name it will create it with the case you want (but since 
asking Windows for "B.png" will give you "b.png", does it matter?).

On Tue, 11 Apr 2006, Timo Becker wrote:

> Dear R users,
>
> when I create files with the png graphics device, it overwrites existing
> files which differ concerning upper/lower case file names.
> For example, I want to create four files named "a.png", "A.png", "b.png"
> and "B.png" which contain the corresponding letters:
>
> png("a.png")
> plot(1, type="n")
> text(1, label="a")
> dev.off()
>
> png("A.png")
> plot(1, type="n")
> text(1, label="A")
> dev.off()
>
> png("B.png")
> plot(1, type="n")
> text(1, label="B")
> dev.off()
>
> png("b.png")
> plot(1, type="n")
> text(1, label="b")
> dev.off()
>
> These commands create a file named "a.png" which contains the letter "A"
> and a file named "B.png" which contains the letter "b".
> The old file name is retained, but overwritten with the output of the
> new png device with the same case-insensitive file name.
> I'm sure I missed something. Can anyone tell me how to create files
> whith case-sensitive names with the same letters?
>
> R version 2.2.1, 2005-12-20, i386-pc-mingw32
>
> Regards,
> Timo
>
>

-- 
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] png overwrites upper/lower case filenames

2006-04-11 Thread Timo Becker
Dear R users,

when I create files with the png graphics device, it overwrites existing 
files which differ concerning upper/lower case file names.
For example, I want to create four files named "a.png", "A.png", "b.png" 
and "B.png" which contain the corresponding letters:

png("a.png")
plot(1, type="n")
text(1, label="a")
dev.off()

png("A.png")
plot(1, type="n")
text(1, label="A")
dev.off()

png("B.png")
plot(1, type="n")
text(1, label="B")
dev.off()

png("b.png")
plot(1, type="n")
text(1, label="b")
dev.off()

These commands create a file named "a.png" which contains the letter "A" 
and a file named "B.png" which contains the letter "b".
The old file name is retained, but overwritten with the output of the 
new png device with the same case-insensitive file name.
I'm sure I missed something. Can anyone tell me how to create files 
whith case-sensitive names with the same letters?

R version 2.2.1, 2005-12-20, i386-pc-mingw32

Regards,
Timo

-- 
Timo Becker
Phonetics
Austrian Academy of Sciences
Acoustics Research Institute

__
R-help@stat.math.ethz.ch 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] long caption titles for tables

2006-04-11 Thread Brian Quinif
I am using using the latex() function in the Hmisc package.  I want to
create some table captions that are relatively long and need to take
up more than one line.

When I do this, the LaTeX output has the majority of the text on one
line with the remainder spilling over into the second line as if it
were a normal sentence.

How can I get a long caption such as "Estimated HOPE Effects on
Typical First-Year Students, 1990/1995 Robust Std. Errors in
Parentheses" to appear as

Estimated HOPE Effects on
Typical First-Year Students, 1990/1995
Robust Std. Errors in Parentheses

where that would be centered above the table?

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] variable-substitution / command-substitution

2006-04-11 Thread Damaris Zurell
Hello,

I have about 2000 data files which I want to analyse.
The file names are all very similar => 
p"variable1"_t"variable2"_c"variable3".txt
There aren´t so much different variables (about 70) , just different 
combinations of them.
To allow an easy way of handling those data files I was wondering 
whether R is able to do variable-substitution /command-substitution 
similar to shell-programming, so that I could imbed the read.table 
option (and further commands) in 3 loops (one for every variable in the 
filenames) .

e.g.:
for var1 in (varlist1)
 for var2 in (varlist2)
  for var3 in (varlist3)
   read.table("/p$var1_t$var2_c$var3.txt")
   statistics..
  done
 done
done


Cheers,
Damaris

__
R-help@stat.math.ethz.ch 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] Changing character limit in deparse, as.character and toString

2006-04-11 Thread Prof Brian Ripley
On Mon, 10 Apr 2006, Dave Armstrong wrote:

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

None of those functions convert 'characters' to a single string!
What actually are you trying to convert?

I guess the issue is the maximum line length in deparsing.  You can
almost always just paste multiple lines together, and this is done for 
formulae at several places in the R codebase.

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

Please show respect other people's copyright, and quote exactly with a 
reference or not at all.  (I was unable to find what you are non-quoting, 
and don't even know if it is still relevant.)


> Dave Armstrong
> University of Maryland
> Dept of Government and Politics

> 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