[R] displaying percentage in bar plot

2009-04-24 Thread Nattu
Hi,

I have a query regarding barplot

I have a following data

 AIS LEvel
 1  23
body regionA  10  15   20
 B  15  25  15

Now I want to plot a barplot and in each bar (corresponding a body region),
I need a percentage of AIS level 1 displayed in the plot. Is there an easy
way to do this ?

Thanks,
Nataraju
GM

-- 
No relationship is Static .. You either Step up or Step down

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] issue building my own package... moving from Apple OS to Windows

2009-04-24 Thread ronggui
Yeah, you have to build a binary package for windows, unless you just
want to simply source all the functions into R.

2009/4/24 Daryl Morris dar...@u.washington.edu:
 Hello,
 I have written my own very simple package.  On an Apple, I was able to run
 through the R CMD build and R CMD check successfully.  I have also
 installed the package, and successfully loaded the library on my Apple.

 This package is written entirely in R and requires no compilation.

 I am trying to move the package to a Windows machine.

 I (perhaps naively) thought, given that it contains no code requiring
 compilation, that I should just be able to take the .tar.gz file and
 directly install it in Windows.  This didn't work.  Nor did translating'
 the contents of the .tar.gz file into a .zip file.

 I was about to provide the errors, but more googling on this issue suggests
 that maybe what I'm trying to do is impossible.

 Do I really have to build on a Windows box ... even when the package
 requires no compilation?  Is there no simple translation tool available for
 this case?

 thank you, Daryl
 U. Washington Biostatistics

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
HUANG Ronggui, Wincent
PhD Candidate
Dept of Public and Social Administration
City University of Hong Kong
Home page: http://asrr.r-forge.r-project.org/rghuang.html

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] prediction intervals (alpha and beta) for model average estimates from binomial glm and model.avg (library=dRedging)

2009-04-24 Thread Michelle Ensbey
Hi all,

I was wondering if there is a function out there, or someone has written code 
for making confidence intervals around model averaged predictions (y~á+âx). The 
model average estimates are from the dRedging library?

It seems a common thing but I can't seem to find one via the search engines

Examples of the models are:

fit1 - glm(y~ dbh, family = binomial, data = data)

fit2 - glm(y~ dbh+vegperc, family = binomial, data = data)

fit3 - glm(y~ dbh, family = binomial, data = data)

and the model averaging

model.averaging -model.avg(fit1,fit2,fit3, method=0)

 and the output (from model.avg) has the following items: Coefficient, 
Variance, Standard error, adjusted standard error and lower and upper 
confidence interval for each parameter (and intercept).

What I would like to do is make prediction intervals. I know I need to 
include covariance and variance. Please let me know if anyone has a function or 
code to get these prediction intervals out of this output.

Thanks in advance for your help, and please advise me if you need more 
information

M
michelle.ens...@nt.gov.au

R version 2.8.1

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Terminology: Multiple Regression versus multivariate Regression

2009-04-24 Thread strinz
Hello R-Members,

can anyone explain the difference between
multiple and multivariate regression to me 
in terms of the terminology and eventually 
its respect to the mathematical foundation 
respectively ?

Is multiple regression perhaps more related to GLM
and multivariate Regression rather applied,
if there are no explizit numeric factor levels ?

Thanks for elucidations on that topic.

Many thanks and best regrads
Bjoern




Heute schon gefreeMailt?
Jetzt kostenlose E-Mail-Adresse sichern!
http://email.freenet.de/dienste/emailoffice/produktuebersicht/basic/mail/index.html?pid=6831


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] issue building my own package... moving from Apple OS to Windows

2009-04-24 Thread Uwe Ligges



Daryl Morris wrote:

Hello,
I have written my own very simple package.  On an Apple, I was able to 
run through the R CMD build and R CMD check successfully.  I have 
also installed the package, and successfully loaded the library on my 
Apple.


This package is written entirely in R and requires no compilation.

I am trying to move the package to a Windows machine.

I (perhaps naively) thought, given that it contains no code requiring 
compilation, that I should just be able to take the .tar.gz file and 
directly install it in Windows.  This didn't work.  Nor did 
translating' the contents of the .tar.gz file into a .zip file.


I was about to provide the errors, but more googling on this issue 
suggests that maybe what I'm trying to do is impossible.


Do I really have to build on a Windows box ... even when the package 
requires no compilation?  Is there no simple translation tool available 
for this case?


You need to INSTALL a source package (that has been build) as on any 
other platform. How to colect the tools in order to make R CMD INSTALL 
work under Windows (and other OSs) is described in the R Installation 
and Administration manual.


Best,
Uwe Ligges





thank you, Daryl
U. Washington Biostatistics

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

and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] power.t.test formula

2009-04-24 Thread Karl Ove Hufthammer
Peter Dalgaard:

 Does anyone of you knows a reference for the formula used in power.t.test
 function? And also why it uses the Student's distribution instead of
 Normal. (I know both of them can be used but don't see whether choose one
 or the other)
 
 It is  a straightforward first-principles calculation. The t
 distribution calculation is exact for normally distributed data with the
 same unknown variance in both groups.

I didn’t know about power.t.test. A very nice function, indeed. Is there a 
similar function that handles unequal number of observations for each 
group, and unequal variances?

The help file mislead me into thinking that power.t.test handles unequal 
number of observations, and for example  ‘power.t.test(c(10,3),1)’ *does* 
give some output (and not a warning or error), just not the output I was 
expecting.

(It gives two power values, one for sample of size 10 (for each group) and 
one for samples of size 3 (for each group), while I was expecting the power 
for a sample size 10 for one group and 3 for the other group).

-- 
Karl Ove Hufthammer

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Terminology: Multiple Regression versus multivariate Reg

2009-04-24 Thread Ted Harding
On 24-Apr-09 08:14:34, str...@freenet.de wrote:
 Hello R-Members,
 can anyone explain the difference between
 multiple and multivariate regression to me 
 in terms of the terminology and eventually 
 its respect to the mathematical foundation 
 respectively ?
 
 Is multiple regression perhaps more related to GLM
 and multivariate Regression rather applied,
 if there are no explizit numeric factor levels ?
 
 Thanks for elucidations on that topic.
 
 Many thanks and best regrads
 Bjoern

This is indeed a question of terminology and usage, and there
is a degree of variability in it.

As far as I am concerned (and others, though not all), multivariate
regression refers to regression where the dependent (outcome)
variable is mutltivariate:

  Y ~ X

where each instance of Y is a multivariate observation. For example,
suppose G (growth) consists of two pieces of data: height and weight,
and A is Age. Then a multivariate regression model would look like

  G ~ A  or  (Ht,Wt) ~ Age

(two variables on the left, one variable on the right). This allows
for correlation between Ht and Wt to be part of the model.

What is generally meant by multiple regression is regression
of a single variable (on the left) on more than one variable
(on the right), for example

  Wt ~ Ht + Age

If you must make a distinction, there is the term simple regression
(nowadays rarely used) for when there is only one variable on the right:

  Wt ~ Age

Whether this is a linear model (use lm()) or a generalised linear
model (use glm()) has nothing to do with the termonology.

There is an unfortunate (in my view) tendency for people to use
multivariate regression whden talking about what I call multiple
regression above (i.e. more than 1 independent variable). I think
this should be reserved for regression where the left-hand side is
multivariate.

But maybe I'm in a minority ...
Ted.


E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk
Fax-to-email: +44 (0)870 094 0861
Date: 24-Apr-09   Time: 10:00:23
-- XFMail --

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] displaying percentage in bar plot

2009-04-24 Thread Richard . Cotton
 I have a following data
 
  AIS LEvel
  1  23
 body regionA  10  15   20
  B  15  25  15
 
 Now I want to plot a barplot and in each bar (corresponding a body 
region),
 I need a percentage of AIS level 1 displayed in the plot. Is there an 
easy
 way to do this ?

Try this:
x - matrix(c(10,15,15,25,20,15), ncol=3)
pct - apply(x, 1, function(x) 100*x[1]/sum(x))
custompanelfn - function(...)
{
   panel.barchart(...)
   panel.text(x=c(5,5), y=c(1,2),paste(format(pct, digits=3),%, sep=))
}
library(lattice)
barchart(x, panel=custompanelfn)

Regards,
Richie.

Mathematical Sciences Unit
HSL




ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Terminology: Multiple Regression versus multivariate Reg

2009-04-24 Thread Peter Dalgaard
(Ted Harding) wrote:

 There is an unfortunate (in my view) tendency for people to use
 multivariate regression whden talking about what I call multiple
 regression above (i.e. more than 1 independent variable). I think
 this should be reserved for regression where the left-hand side is
 multivariate.
 
 But maybe I'm in a minority ...

If so, a minority of at least two...

Part of the problem is that people will often (for better or worse)
screen a set of predictors by univariate regression, which should
probably be the rather less catchy single-predictor regression. (As
far as I remember, SPSS, canonicalizes the term in its menu system.)




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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Can't install package glmnet

2009-04-24 Thread Uwe Ligges



Liang Zhang wrote:

Hi, I was trying to install package glmnet in R, but failed and it show such 
messages:

* Installing *source* package glmnet ...
 This package has only been tested with gfortran.
 So some checks are needed.
 R_HOME is /home/username/R/R-2.9.0
Attempting to determine R_ARCH...
R_ARCH is
Attempting to detect how R was configured for Fortran 90
Unsupported Fortran 90 compiler or Fortran 90
compilers unavailable! Stop!
ERROR: configuration failed for package glmnet
* Removing /home/username/R/R-2.9.0/library/glmnet

The downloaded packages are in
/tmp/RtmpwsLWSc/downloaded_packages
Updating HTML index of packages in '.Library'
Warning message:
In install.packages(glmnet) :
  installation of package 'glmnet' had non-zero exit status


It seems that it needs fortran 90 complier. What can I do to solve this 
problem? (I am not the administrator, only a user in the linux system).


Ask for a suitable compiler?

Uwe Ligges





Thank you very much!
Liang



  
	[[alternative HTML version deleted]]


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Box-counting dimension and package 'fdim'

2009-04-24 Thread Uwe Ligges



Remko Duursma wrote:

Dear R-helpers,


I am looking for an implementation of the box-counting algorithm to
estimate the box dimension of a cloud of points in 3D (aka fractal
dimension, or similarity dimension).

The package 'fdim' might be doing this, but the documentation is awful
and I don't understand what is what there.

Does anyone know of an implementation of this algorithm in R, or
elsewhere, or uses the fdim package successfully and can help me out?



Perhaps ask the author or package maintainer? And if so, you might want 
to volunteer to improve the help pages and add what you looked for, then 
 both of you can benefit.


Best,
Uwe Ligges




thanks,
Remko




-
Remko Duursma
Post-Doctoral Fellow

Centre for Plant and Food Science
University of Western Sydney
Hawkesbury Campus
Richmond NSW 2753

Dept of Biological Science
Macquarie University
North Ryde NSW 2109
Australia

Mobile: +61 (0)422 096908

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] suffix convention?

2009-04-24 Thread Uwe Ligges



Sebastian P. Luque wrote:

Hi,

Is there some convention for choosing 'RData' or 'rda' for binary files
written by save() or save.image()?  


I don't think so, I'd prefer RData myself.

 The docs treat these interchangeably.  Thanks.


Indeed.

Best,
Uwe Ligges




Cheers,



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to see the content of geepack package

2009-04-24 Thread Cetinyürek Aysun
Dear list members,
I need to see the content of the functions in package geepack. It uses
some C functions in the computation they are not available in the package
directory.
How can I see the content of C functions?

Kind Regards,

Thank you,

Aysun Cetinyurek

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Array

2009-04-24 Thread Bronagh Grimes
Hi there,

 

Just wondering if anyone has any tips for using arrays?

 

I am trying to convert the following SAS code to R:

 

 

data A2;  

 set A1;   

 by subject_id;

 retain   BX1-BX10i; 

 array b(1:10) BX1-BX10 ;

 

 if first.subject_id then do ;

  do j=1 to 10;

   b(j) = .;

  end;

  i=1;

 end;

 

b(i)  =  BX;

 i = i+1;

 

 if last.subject_id then output;

run ;

 

 

 

Many thanks in advance,

Bronagh

 


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Nonlinear regression help

2009-04-24 Thread Uwe Ligges



Taylor Hermes wrote:

I seek help with nonlinear regression for my data.  I've run intro
trouble fitting a model to my data as follows:

rate_parameter stable_population
75 1996.1277
100 1623.2979
125 1362.3475
150 1164.6738
175 1014.8227
200  892.0851
225  794.1844
250  710.1489
275  639.6738
300  578.0496
325  525.4965
350  479.4752
375  440.3050
400  402.4397

The rate_parameter here will be my independent variable which
affects the stable_population quantity in an agent-based simulation.

I can see that the plot of this data seems to fit an exponential
decay.  I would greatly appreciate if someone could help me out with
this task.  I've found the following info on this page helpful:
https://stat.ethz.ch/pipermail/r-help/2001-December/017330.html
yet, still unable to grasp what I need to do.



Is this homework?

Anyway, I'd go with a simple linear model given your data.frame is 
called dat:


lm(log(stable_population) ~ sqrt(rate_parameter), data = dat)

Not sure why you want to apply something nonlinear.

Uwe Ligges




Thanks!

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to see the content of geepack package

2009-04-24 Thread Dimitris Rizopoulos

you can download the source code of the package from:

http://cran.r-project.org/web/packages/geepack/index.html

and inspect it; you probably want to look at the 'src' directory.


I hope it helps.

Best,
Dimitris


Cetinyürek Aysun wrote:

Dear list members,
I need to see the content of the functions in package geepack. It uses
some C functions in the computation they are not available in the package
directory.
How can I see the content of C functions?

Kind Regards,

Thank you,

Aysun Cetinyurek

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to see the content of geepack package

2009-04-24 Thread Uwe Ligges

For example, read
Ligges, U. (2006): R Help Desk: Accessing the Sources. R News 6 (4), 
43-45. http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf


Best,
Uwe Ligges


Cetinyürek Aysun wrote:

Dear list members,
I need to see the content of the functions in package geepack. It uses
some C functions in the computation they are not available in the package
directory.
How can I see the content of C functions?

Kind Regards,

Thank you,

Aysun Cetinyurek

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Array

2009-04-24 Thread Peter Dalgaard
Bronagh Grimes wrote:

 Just wondering if anyone has any tips for using arrays?

You're presupposing that R works like SAS. It doesn't.

This looks like a job for reshape (either Hadley Wickham's package or
the built-in function).

 I am trying to convert the following SAS code to R: 

 data A2;  
  set A1;   
  by subject_id;
  retain   BX1-BX10i; 
  array b(1:10) BX1-BX10 ;
  if first.subject_id then do ;
   do j=1 to 10;
b(j) = .;
   end;
   i=1;
  end;
  b(i)  =  BX;
  i = i+1;
  if last.subject_id then output;
 run ;

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Array

2009-04-24 Thread Bronagh Grimes
Thanks for this, will have a look now.

Much appreciated,

-Original Message-
From: Peter Dalgaard [mailto:p.dalga...@biostat.ku.dk] 
Sent: 24 April 2009 11:40
To: Bronagh Grimes
Cc: r-help@r-project.org
Subject: Re: [R] Array

Bronagh Grimes wrote:

 Just wondering if anyone has any tips for using arrays?

You're presupposing that R works like SAS. It doesn't.

This looks like a job for reshape (either Hadley Wickham's package or
the built-in function).

 I am trying to convert the following SAS code to R: 

 data A2;  
  set A1;   
  by subject_id;
  retain   BX1-BX10i; 
  array b(1:10) BX1-BX10 ;
  if first.subject_id then do ;
   do j=1 to 10;
b(j) = .;
   end;
   i=1;
  end;
  b(i)  =  BX;
  i = i+1;
  if last.subject_id then output;
 run ;

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] stata == R - error messages

2009-04-24 Thread Rob Bakker
Dear Sirs,
I am just starting with R and I think it is a great system. Now, I want to
import Stata datasets (.dta) with read.dta, but receive errormessages like:

Error in grep(^(http|ftp|https)://, file) : object Rklein not found

Error in read.dta(Rklein) :
  unable to open file: 'No such file or directory'
this happens when I use 

What is the problem and how can I solve it?

Best regards,

Rob Bakker, Amsterdam

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Failing to print mer object in an RData image

2009-04-24 Thread Robert Zimbardo
 Have you load lme4 before you print the object?
Yes, I have.

 If yes, it may be caused by the change of representation of mer class.
That may be so (although the image was saved on 12/19/2008, i.e. AFTER
the release data of the lmer version I have now. But maybe I did that
on a different computer. Question though: does that mean that the mer
object is now inaccessible and the only way to get the data back is to
run the analyses again? The changes are not backward compatible??

Thx,
RZ




 2009/4/23 Robert Zimbardo robertzimba...@gmail.com:
 Hi all

 I have problems in accessing a mer object called model.01 from a
 workspace that was created with R 2.8.1 and saved with save into an
 .RData file (on Windows XP or Ubuntu 8.10, don't remember anymore).
 Now I want to open it in R 2.9.0 on Ubuntu 8.10. I use

 # load workspace
 load(name.RData)

 which seems to work:

 ls() # all objects in there
 [1] all          all.dd       model.01     model.sorter

 It also recognizes the class of model.01:

 class(model.01)
 [1] mer
 attr(,package)
 [1] lme4

 But when I want to print it or look at its structure:

 print(model.01)
 Error in slot(value, what) :
  no slot of name Xst for this object of class mer

 str(model.01)
 Error in FUN(c(env, nlmodel, frame, call, flist, X, Xst,  :
  no slot of name Xst for this object of class mer

 Any idea what to do?

 R.version
 platform       i486-pc-linux-gnu
 arch           i486
 os             linux-gnu
 system         i486, linux-gnu
 status
 major          2
 minor          9.0
 year           2009
 month          04
 day            17
 svn rev        48333
 language       R
 version.string R version 2.9.0 (2009-04-17)

 library(help=lme4)
 Package:       lme4
 Version:       0.999375-28
 Date:          2008-12-13

 Thanks,
 RZ

 --
 HUANG Ronggui, Wincent
 PhD Candidate
 Dept of Public and Social Administration
 City University of Hong Kong
 Home page: http://asrr.r-forge.r-project.org/rghuang.html

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Generalized 2D list/array/whatever?

2009-04-24 Thread Duncan Murdoch

Toby wrote:

I'm trying to figure out how I can get a generalized 2D
list/array/matrix/whatever
working.  Seems I can't figure out how to make the variables the right
type.  I
always seem to get some sort of error... out of bounds, wrong type, wrong
dim, etc.
Very confused... :)

x[[some label, some other index]] - 3
x[[some other label, something else]] - 4

I don't know the indexes/label ahead of time... they get generated...  Any
thoughts?
  


What you have there is not legal syntax, but this would be:

x[[c(some label, some other index)]] - 3

This assumes that x is a list, and one of its entries is a list named 
some label.  It will not create that entry, but it will create an 
entry named some other index, so you need


if (is.null(x[[some label]])) x[[some label]] - list()

first.  After executing this line and your first line above, you'll get

 x
$`some label`
$`some label`$`some other index`
[1] 3

Duncan Murdoch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Stuck using constrOptim

2009-04-24 Thread dre968

I'm very interested.  If you wouldn't mind I would love to see it.  

Thank you for the help.



dre968 wrote:
 
 Trying to use constrOptim to minimize the sum of squared deviations.  I
 put the objective function in as: sum((x %*% Y - Z)^2) so i'm trying to
 get values for x to minimize the sum of the squared deviations between the
 product of x and Y and Z.  
 
 Anyways i have no problem using this when x is a 3x1 test variable.  it
 works great with the constraints and everything.  when i actually use it
 on my data x is 3x900 or so and it wont optimize it just gives me back my
 initial guessthis is the output i'm getting:
 
 $value
 [1] 22.7438
 
 $counts
 function gradient 
  906   NA 
 
 $convergence
 [1] 1
 
 $message
 NULL
 
 $outer.iterations
 [1] 1
 
 $barrier.value
 [1] 1.381551e-06
 
 this is definitely not the right answer and it is just spitting back my
 initial guess back.  
 
 Any ideas?  are there limits as to how big the variables can be for this
 function?
 

-- 
View this message in context: 
http://www.nabble.com/Stuck-using-constrOptim-tp23197912p23214410.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] deleting rows provisionally

2009-04-24 Thread onyourmark

Hi. Thanks very much for the reply and the good suggestion. It works well.
But I don't get why the for loop is not deleting anything or making any
assignments? Or I should say, doesn't answer3[-i,] delete entries from
answer3 when the if condition is true?
Also, in your first solution 
answer2[-(answer2[,1]==answer2[,2]),]   

can I say that you are indexing answer2 by answer2[,] and all of the
deletion is coming in the first argument and specifically you are deleting
every entry in answer2 where the first elements of the first and second
columns are the same.
So for example, 
if I wanted instead to switch the elements of the first and second column
whenever they are different what would I do? confused.

Ben Bolker wrote:
 
 
 
 onyourmark wrote:
 
 I have an object. I think it is a matrix, called 'answer2'
  str(answer2)
  int [1:1537, 1:2] 1 399 653 2 3 600 4 5 271 870 ...
  - attr(*, dimnames)=List of 2
   ..$ : chr [1:1537] a4.1 hirschsprung.399 peritoneal.653
 abdomen.2 ...
   ..$ : chr [1:2] row col
 
 
 I want to delete rows that have the same entries.
 
 
 
 Your for loop didn't make any assignments.
 How about 
 
 answer3 - answer2[-(answer2[,1]==answer2[,2]),]  
 
 or
 
 answer3 - answer2[answer2[,1]!=answer2[,2],]  
 
 (which will be much faster than a loop anyway)
 
 ?
 

-- 
View this message in context: 
http://www.nabble.com/deleting-rows-provisionally-tp23209365p23214891.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] displaying percentage in bar plot

2009-04-24 Thread Nattu
Hi Jim,

Thank you for the help. Along with the bars I wanted to show the respective
percentage as well. Is that possible ?

Regards,
Nataraju
GM

On Fri, Apr 24, 2009 at 4:38 PM, Jim Lemon j...@bitwrit.com.au wrote:

 Nattu wrote:

 Hi,

 I have a query regarding barplot

 I have a following data

 AIS LEvel
 1  23
 body regionA  10  15   20
 B  15  25  15

 Now I want to plot a barplot and in each bar (corresponding a body
 region),
 I need a percentage of AIS level 1 displayed in the plot. Is there an easy
 way to do this ?

 Thanks,
 Nataraju
 GM



 Hi Nataraju,
 I might not understand exactly what you want, but try this:

 bardat-matrix(c(10,15,15,25,20,15),nrow=2)
 barpos-barplot(bardat,beside=TRUE)
 library(plotrix)
 boxed.labels(barpos,bardat/2,bardat/(sum(bardat[,1]/100)))

 Jim




-- 
No relationship is Static .. You either Step up or Step down

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [R-help]Remove error data and clustering analysis

2009-04-24 Thread guodong wang
Hi, all,
I’d like to do the clustering analysis in my dataset. The example data
are as follows:

Dataset 1:
500, 490, 486, 490, 491, 493, 480, 461, 504, 476, 434, 500, 470, 495,
3116, 3142, 12836, 3062, 3091, 3141, 3177, 3150, 3114, 3149;
Dataset 2:
506, 473, 495, 494, 434, 459, 445, 475, 476, 128367, 470, 513, 466,
476,482, 1201, 469, 502;

I had so many datasets like that. Basically, every dataset can
classify one or two clusters (no more than 2), meanwhile, there have
error data points, for example, 12836 is error data point in Dataset
1; and 128367, 1201 is error data points in dataset2.

The clustered data is following the normal distribution, the standard
deviation was known. That’s mean the one cluster is following the
normal distribution when the dataset classified one cluster like
dataset2; the two clusters are following the normal distribution
respectively when the dataset classified two clusters like dataset1.
Error data are far away of the mean.

I am wondering is there any mathematic pipeline/function can do
the analysis that removing error data, and clustering the dataset in 1
or 2 clusters?

Thank you for your reply.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] stata == R - error messages

2009-04-24 Thread Jim Lemon

Rob Bakker wrote:

Dear Sirs,
I am just starting with R and I think it is a great system. Now, I want to
import Stata datasets (.dta) with read.dta, but receive errormessages like:

Error in grep(^(http|ftp|https)://, file) : object Rklein not found

Error in read.dta(Rklein) :
  unable to open file: 'No such file or directory'
this happens when I use 

What is the problem and how can I solve it?
  

Hi Rob,
Looks like you're on Windows, and you have probably fallen victim to the 
Microsoft  (and Apple) hide-everything-you-can-from-them file manager 
defaults. Your file Rklein probably has an extension on it (maybe 
.dta?) and if you can find that by turning off extension hiding, you 
will probably see the solution immediately.


Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] stata == R - error messages

2009-04-24 Thread Duncan Murdoch

On 24/04/2009 7:42 AM, Peter Dalgaard wrote:

Jim Lemon wrote:

Rob Bakker wrote:

Dear Sirs,
I am just starting with R and I think it is a great system. Now, I
want to
import Stata datasets (.dta) with read.dta, but receive errormessages
like:

Error in grep(^(http|ftp|https)://, file) : object Rklein not found

Error in read.dta(Rklein) :
  unable to open file: 'No such file or directory'
this happens when I use 

What is the problem and how can I solve it?
  

Hi Rob,
Looks like you're on Windows, and you have probably fallen victim to the
Microsoft  (and Apple) hide-everything-you-can-from-them file manager
defaults. Your file Rklein probably has an extension on it (maybe
.dta?) and if you can find that by turning off extension hiding, you
will probably see the solution immediately.

Jim


Also, notice the function choose.file() which lets browse your way to


The function name is actually file.choose(), which exists on all (?) 
platforms.  There's also a function choose.files(), only on Windows, and 
mainly used for choosing multiple files (but it has a few other 
Windows-only differences from file.choose()).


Duncan Murdoch


the file in the usual Windows style. If used on its own, then it returns
the full path to the file, so that you know what to feed to read.dta().

You can short-circuit by using read.dta(choose.file()), but if you do it
in a script, then you need to do the browsing every time you run the
script.



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] iteration limit error in gamm and notExp2

2009-04-24 Thread Simon Wood
Isidora,

What is the actual model structure that you are trying to fit? 

It's not clear to me that modifying the nonExp2 defaults will help convergence 
here, but it may be that some slight modifications of the model itself will 
sort things out, which is why it would be good to know what the model is. One 
issue with `gamm' is that it is built on PQL estimation, so there is no 
guarantee that fitting will converge, although it usually does. 

best,
Simon

On Thursday 23 April 2009 19:40, isidora k wrote:
 hi,
 I am trying to run a mixed effect gam using gamm (mgcv)
 and I get the following error:
 Error in lme.formula(y ~ X - 1, random = rand, data = strip.offset(mf),  :
 nlminb problem, convergence error code = 1 message = iteration limit
 reached without convergence (9)

 I've read all about  'notExp2' but since I am not an expert I didn't
 understand that much. I was wondering if anyone has an example of the use
 of notExp2, or another suggestion on solving this problem.

 many thanks
 Isidora



   [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html and provide commented, minimal,
 self-contained, reproducible code.

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Almost ideal demand system with ADL

2009-04-24 Thread Marie Vandresse


As anyone knows how to estimate an almost ideal demand system with 
autoregressive distributed las?


Thanks!

Marie






-

Le Bureau federal du Plan fete ses 50 ans en 2009.

Het Federaal Planbureau viert zijn 50-ste verjaardag in 2009.

The Federal Planning Bureau celebrates its 50-th anniversary in 2009.

-

Disclaimer: please see www.plan.be/disclaimer.html

Please, think before you print...

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Terminology: Multiple Regression versus multivariate Reg

2009-04-24 Thread Dimitris Rizopoulos

Peter Dalgaard wrote:

(Ted Harding) wrote:


There is an unfortunate (in my view) tendency for people to use
multivariate regression whden talking about what I call multiple
regression above (i.e. more than 1 independent variable). I think
this should be reserved for regression where the left-hand side is
multivariate.

But maybe I'm in a minority ...


If so, a minority of at least two...

Part of the problem is that people will often (for better or worse)
screen a set of predictors by univariate regression, which should
probably be the rather less catchy single-predictor regression. (As
far as I remember, SPSS, canonicalizes the term in its menu system.)



Another approach (maybe more correct?) that I have seen in some papers, 
is to use multivariable regression for more than one predictors, and 
univariable regression for just a single one.



Best,
Dimitris






--
Dimitris Rizopoulos
Assistant Professor
Department of Biostatistics
Erasmus University Medical Center

Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
Tel: +31/(0)10/7043478
Fax: +31/(0)10/7043014

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to see the content of geepack package

2009-04-24 Thread Duncan Murdoch

Cetinyürek Aysun wrote:

Dear list members,
I need to see the content of the functions in package geepack. It uses
some C functions in the computation they are not available in the package
directory.
How can I see the content of C functions?


You need to download the source of the package from CRAN.  It's in 
http://cran.r-project.org/src/contrib/geepack_1.0-16.tar.gz.


Duncan Murdoch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] deleting rows provisionally

2009-04-24 Thread Hans Ekbrand
On Fri, Apr 24, 2009 at 04:50:48AM -0700, onyourmark wrote:
 
 Hi. Thanks very much for the reply and the good suggestion. It works well.
 But I don't get why the for loop is not deleting anything or making any
 assignments? Or I should say, doesn't answer3[-i,] delete entries from
 answer3 when the if condition is true?

Your for loop was:

for(i in 1:1537){if(answer2[i,1]==answer2[i,2]){answer3[-i,]}}

No, answer3[-i] does not remove item i from answer3, it returns an
anonymous temporary object which is identical to (answer3 without item
i). Since that object not saved, it is deleted when the loop enters
the next iteration. To actually *modify* answer3 you can use:

answer3 - answer3[-i]

-- 
Hans Ekbrand (http://sociologi.cjb.net) h...@sociologi.cjb.net
Q. What is that strange attachment in this mail?
A. My digital signature, see www.gnupg.org for info on how you could
   use it to ensure that this mail is from me and has not been
   altered on the way to you.


signature.asc
Description: Digital signature
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] stata == R - error messages

2009-04-24 Thread Peter Dalgaard
Jim Lemon wrote:
 Rob Bakker wrote:
 Dear Sirs,
 I am just starting with R and I think it is a great system. Now, I
 want to
 import Stata datasets (.dta) with read.dta, but receive errormessages
 like:

 Error in grep(^(http|ftp|https)://, file) : object Rklein not found

 Error in read.dta(Rklein) :
   unable to open file: 'No such file or directory'
 this happens when I use 

 What is the problem and how can I solve it?
   
 Hi Rob,
 Looks like you're on Windows, and you have probably fallen victim to the
 Microsoft  (and Apple) hide-everything-you-can-from-them file manager
 defaults. Your file Rklein probably has an extension on it (maybe
 .dta?) and if you can find that by turning off extension hiding, you
 will probably see the solution immediately.
 
 Jim

Also, notice the function choose.file() which lets browse your way to
the file in the usual Windows style. If used on its own, then it returns
the full path to the file, so that you know what to feed to read.dta().

You can short-circuit by using read.dta(choose.file()), but if you do it
in a script, then you need to do the browsing every time you run the
script.

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] stata == R - error messages

2009-04-24 Thread Peter Dalgaard
Rob Bakker wrote:
 Dear Peter,
 
 Also thank you for your quick reply. I did the following with no
 positive result:
 
 library(foreign)
  
 read.dta(choose.file(C:\Rklein))
 Error: unexpected input in read.dta(choose.file(C:\
 read.dta(choose.file(C:\Rklein))
 Error in grep(^(http|ftp|https)://, file) : 
   could not find function choose.file

As Duncan points out, it is file.choose(), sorry about that - I don't
use Windows regularly.

Notice also that you need to run it _without_ any argument.

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] displaying percentage in bar plot

2009-04-24 Thread Jim Lemon

Nattu wrote:

Hi,

I have a query regarding barplot

I have a following data

 AIS LEvel
 1  23
body regionA  10  15   20
 B  15  25  15

Now I want to plot a barplot and in each bar (corresponding a body region),
I need a percentage of AIS level 1 displayed in the plot. Is there an easy
way to do this ?

Thanks,
Nataraju
GM

  

Hi Nataraju,
I might not understand exactly what you want, but try this:

bardat-matrix(c(10,15,15,25,20,15),nrow=2)
barpos-barplot(bardat,beside=TRUE)
library(plotrix)
boxed.labels(barpos,bardat/2,bardat/(sum(bardat[,1]/100)))

Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] deleting rows provisionally

2009-04-24 Thread David Winsemius


On Apr 24, 2009, at 7:50 AM, onyourmark wrote:



Hi. Thanks very much for the reply and the good suggestion. It works  
well.
But I don't get why the for loop is not deleting anything or making  
any

assignments? Or I should say, doesn't answer3[-i,] delete entries from
answer3 when the if condition is true?


No, it doesn't. It returns a copy of answer3 without the ith row, but  
it does not touch answer3,  because as Ben said before you did no  
assignment.


Also, in your first solution
answer2[-(answer2[,1]==answer2[,2]),]

can I say that you are indexing answer2 by answer2[,] and all of the
deletion is coming in the first argument and specifically you are  
deleting
every entry in answer2 where the first elements of the first and  
second

columns are the same.
Actually you are still not deleting. But the rest of you  
characterization of the process looks correct.


So for example,
if I wanted instead to switch the elements of the first and second  
column

whenever they are different what would I do? confused.


The easiest approach would probably be to swap their names but if you  
want to swap the entries without touching the names then something like:


temp.ans - answer2[,2]
answer2[ , 2] - answer2[ , 1]
answer2[ , 2] - temp.ans

Or possibly answer2[ , c(2,1)] - answer2[ , c(1,2)] but I am not a  
sufficiently experienced R programmer to know the answer to that  
without testing.


--
David.



Ben Bolker wrote:


onyourmark wrote:


I have an object. I think it is a matrix, called 'answer2'
str(answer2)
int [1:1537, 1:2] 1 399 653 2 3 600 4 5 271 870 ...
- attr(*, dimnames)=List of 2
 ..$ : chr [1:1537] a4.1 hirschsprung.399 peritoneal.653
abdomen.2 ...
 ..$ : chr [1:2] row col


I want to delete rows that have the same entries.




Your for loop didn't make any assignments.
How about

answer3 - answer2[-(answer2[,1]==answer2[,2]),]

or

answer3 - answer2[answer2[,1]!=answer2[,2],]

(which will be much faster than a loop anyway)



David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Generalized 2D list/array/whatever?

2009-04-24 Thread hadley wickham
On Fri, Apr 24, 2009 at 5:50 AM, Duncan Murdoch murd...@stats.uwo.ca wrote:
 Toby wrote:

 I'm trying to figure out how I can get a generalized 2D
 list/array/matrix/whatever
 working.  Seems I can't figure out how to make the variables the right
 type.  I
 always seem to get some sort of error... out of bounds, wrong type, wrong
 dim, etc.
 Very confused... :)

 x[[some label, some other index]] - 3
 x[[some other label, something else]] - 4

 I don't know the indexes/label ahead of time... they get generated...  Any
 thoughts?


 What you have there is not legal syntax, but this would be:

It isn't?

a - as.list(1:4)
dim(a) - c(2, 2)
rownames(a) - c(a, b)
colnames(a) - c(c, d)

a[[a, d]]

Hadley


-- 
http://had.co.nz/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] prediction intervals (alpha and beta) for model average estimates from binomial glm and model.avg (library=dRedging)

2009-04-24 Thread David Winsemius
In R, the predict family of functions provides that facility. If you  
want the code it will be in the particular function associated with  
the model type.


?predict
?predict.glm
# the example illustrates creation of prediction curves on the  
response scale for  a specific range of data.
# create the desired CI's by appropriate use of the se.fit value  
returned from the predict call.
# This is the code inside predict.glm that does the work when se.fit  
is set as TRUE in the predict call:


se.fit - pred$se.fit
switch(type, response = {
se.fit - se.fit * abs(family(object)$mu.eta(fit))
fit - family(object)$linkinv(fit)
}, link = , terms = )

--
David Winsemius

On Apr 24, 2009, at 3:03 AM, Michelle Ensbey wrote:


Hi all,

I was wondering if there is a function out there, or someone has  
written code for making confidence intervals around model averaged  
predictions (y~á+âx). The model average estimates are from the  
dRedging library?


It seems a common thing but I can't seem to find one via the search  
engines


Examples of the models are:

fit1 - glm(y~ dbh, family = binomial, data = data)

fit2 - glm(y~ dbh+vegperc, family = binomial, data = data)

fit3 - glm(y~ dbh, family = binomial, data = data)

and the model averaging

model.averaging -model.avg(fit1,fit2,fit3, method=0)

and the output (from model.avg) has the following items:  
Coefficient, Variance, Standard error, adjusted standard error and  
lower and upper confidence interval for each parameter (and  
intercept).


What I would like to do is make prediction intervals. I know I  
need to include covariance and variance. Please let me know if  
anyone has a function or code to get these prediction intervals out  
of this output.


Thanks in advance for your help, and please advise me if you need  
more information


M
michelle.ens...@nt.gov.au

R version 2.8.1


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] power.t.test formula

2009-04-24 Thread Usuario R
Hello,
Thank you, but can you understand this result? first I calculate the sd for
n = 2 and then n with that sd. It should give me 2 right?

 FC = 1.5
 alfa = 0.01
 power = 0.85
 sd1 -   power.t.test( n = 2, delta = FC, sig.level = alfa,
+power = power, type = two.sample, sd = NULL)$sd

   n1 - round( power.t.test( n = NULL, delta = FC, sig.level = alfa,power
= power, type = two.sample, sd = sd1)$n)
Error in uniroot(function(n) eval(p.body) - power, c(2, 1e+07)) :
  f() values at end points not of opposite sign

2009/4/23 Peter Dalgaard p.dalga...@biostat.ku.dk

 Usuario R wrote:
  Hi,
 
  Does anyone of you knows a reference for the formula used in power.t.test
  function? And also why it uses the Student's distribution instead of
 Normal.
  (I know both of them can be used but don't see whether choose one or the
  other)

 It is  a straightforward first-principles calculation. The t
 distribution calculation is exact for normally distributed data with the
 same unknown variance in both groups. Formulas based on the normal
 distribution assumes the variance to be known, which overestimates small n.



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



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Array

2009-04-24 Thread Erik Iverson

Bronagh Grimes wrote:

Hi there,

 


Just wondering if anyone has any tips for using arrays?

 


I am trying to convert the following SAS code to R:



You're probably going to get more useful responses in general if, instead of 
posting code from SAS to be ported to R, you describe what the code is doing 
(e.g., give some sample input, and describe what you'd like the output to be).


That way, you do not limit those who will reply to the set of people who
know SAS.  Many times, the concepts will be different between the two approaches 
one would take when programming something in SAS and R.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Generalized 2D list/array/whatever?

2009-04-24 Thread Duncan Murdoch

On 24/04/2009 8:48 AM, hadley wickham wrote:

On Fri, Apr 24, 2009 at 5:50 AM, Duncan Murdoch murd...@stats.uwo.ca wrote:

Toby wrote:

I'm trying to figure out how I can get a generalized 2D
list/array/matrix/whatever
working.  Seems I can't figure out how to make the variables the right
type.  I
always seem to get some sort of error... out of bounds, wrong type, wrong
dim, etc.
Very confused... :)

x[[some label, some other index]] - 3
x[[some other label, something else]] - 4

I don't know the indexes/label ahead of time... they get generated...  Any
thoughts?


What you have there is not legal syntax, but this would be:


It isn't?


You're right, it is.  Sorry.

However, I think the solution I gave (not to make the list into an 
array, but rather to use a list of lists) is probably better in a lot of 
situations where the indices show up unpredictably.


Duncan Murdoch



a - as.list(1:4)
dim(a) - c(2, 2)
rownames(a) - c(a, b)
colnames(a) - c(c, d)

a[[a, d]]

Hadley




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] power.t.test formula

2009-04-24 Thread Peter Dalgaard
Usuario R wrote:
 Hello,
 Thank you, but can you understand this result? first I calculate the sd
 for n = 2 and then n with that sd. It should give me 2 right?
 
 FC = 1.5
 alfa = 0.01
 power = 0.85
 sd1 -   power.t.test( n = 2, delta = FC, sig.level = alfa,
 +power = power, type = two.sample, sd = NULL)$sd

   n1 - round( power.t.test( n = NULL, delta = FC, sig.level =
 alfa,power = power, type = two.sample, sd = sd1)$n)
 Error in uniroot(function(n) eval(p.body) - power, c(2, 1e+07)) :
   f() values at end points not of opposite sign

The error message pretty much says it: uniroot is looking for a root
between 2 and 1e7 and complains that the root is not properly bracketed.
 If the root is supposed to be AT 2, then this easily happens due to
rounding issues. (This could have better error trapping, but you're
really not expected to be planning studies with such low n.)

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] plot() - thicker points when pair exist more than 1 time?

2009-04-24 Thread Knut Krueger

Hi to all,
is it possible to show in anyway that point 1,1 is existing more than 
1one time?

f.e.:
f-  data.frame(x=c(1,3,5,6,1),y=c(1,2,3,4,1))
plot(f)

Regards Knut

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] plot() - thicker points when pair exist more than 1 time?

2009-04-24 Thread Marc Schwartz


On Apr 24, 2009, at 8:09 AM, Knut Krueger wrote:


Hi to all,
is it possible to show in anyway that point 1,1 is existing more  
than 1one time?

f.e.:
f-  data.frame(x=c(1,3,5,6,1),y=c(1,2,3,4,1))
plot(f)

Regards Knut


Several options:

  # See ?sunflowerplot
  sunflowerplot(f)


  # See ?xyTable referenced in the above
  coords - xyTable(f)
  plot(coords$x, coords$y, cex = coords$number)

  or

  coords - xyTable(f)
  plot(f, type = n)
  text(coords$x, coords$y, labels = coords$number)


  # See ?jitter
  plot(jitter(f$x), jitter(f$y))


HTH,

Marc Schwartz

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] plot() - thicker points when pair exist more than 1 time?

2009-04-24 Thread baptiste auguie

on suitable devices, you could consider transparency,

plot(f,col=alpha(grey,0.8),pch=19)



baptiste
On 24 Apr 2009, at 14:09, Knut Krueger wrote:


f-  data.frame(x=c(1,3,5,6,1),y=c(1,2,3,4,1))
plot(f)


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Interpreting the results of Friedman test

2009-04-24 Thread doerte . apelt
Hello,

Peter Dalgaard wrote:
 Not necessarily, but the first suspicion one gets is that what you're
 doing with Friedman is not equivalent to what you're doing with ANOVA,
 could you show us the code and data (or an outline of it)?

Please find attached the R script and the data input files.
The values in dataForFriedmanTest.dat represent the geometric mean of
the values of three repetitions for one observer and one condition.

Am I doing something wrong there?

Thanks in advance

Doerte

PS: I'm not sure if it is possible to send the dat-files by mail.
Therefore I renamed them to *.txt. Please rename back to *.dat.


 Original-Nachricht 
 Datum: Fri, 24 Apr 2009 14:52:44 +0200
 Von: Peter Dalgaard p.dalga...@biostat.ku.dk
 An: Doerte doerte.ap...@gmx.de
 Betreff: Re: [R] Interpreting the results of Friedman test

 Doerte wrote:
  Hello,
  
  I have problems interpreting the results of a Friedman test. It seems
  to me that the p-value resulting from a Friedman test and with it the
  significance has to be interpreted in another way than the p-value
  resulting from e.g. ANOVA?
  
  Let me describe the problem with some detail: I'm testing a lot of
  different hypotheses in my observer study and only for some the
  premises for performing an ANOVA are fulfilled (tested with Shapiro
  Wilk and Bartlett). For the others I perform a Friedman test.
  
  To my surprise, the p-value of the Friedman test is  0.05 for all my
  tested hypotheses. Thus, I tried to compare the results with the
  results of an ANOVA by performing both test methods (Friedman, ANOVA)
  to a given set of data.
  While ANOVA results in p = 0.34445 (-- no significant difference
  between the groups), the Friedman test results in p = 1.913e-06 (--
  significant difference between the groups?).
  
  How can this be?
  
  Or am I doing something wrong? I have three measured values for each
  condition. For ANOVA I use them all, for the Friedman test I
  calculated the geometric mean of the three values, since this test
  does not work with replicated values. Is this a crude mistake?
 
 Not necessarily, but the first suspicion one gets is that what you're
 doing with Friedman is not equivalent to what you're doing with ANOVA,
 could you show us the code and data (or an outline of it)?
 
 -- 
O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
 ~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

-- 

Observer | Condition | Repetition | AUC 
2 | 1 | 2 |  11.6698729267
2 | 1 | 3 |  11.3614841831
2 | 1 | 1 |  11.6320875675
3 | 1 | 3 |  11.3813182648
3 | 1 | 2 |  11.9791654383
3 | 1 | 1 |  11.3193295274
4 | 1 | 3 |  11.6271912743
4 | 1 | 1 |  11.7277539642
4 | 1 | 2 |  11.3073525275
6 | 1 | 2 |  11.5356087785
6 | 1 | 3 |  11.8625252416
6 | 1 | 1 |  11.1631417327
7 | 1 | 1 |  12.0811987417
7 | 1 | 2 |  11.4253889199
7 | 1 | 3 |  11.1438163937
8 | 1 | 2 |  12.3351513361
8 | 1 | 1 |  11.0075952969
8 | 1 | 3 |  11.2701354076
1 | 1 | 2 |  11.9582160341
1 | 1 | 3 |  11.3128071894
1 | 1 | 1 |  11.4041971251
2 | 2 | 2 |  11.1937509173
2 | 2 | 1 |  11.6252278612
2 | 2 | 3 |  11.7113976885
3 | 2 | 3 |  11.1192253767
3 | 2 | 1 |  11.3755159053
3 | 2 | 2 |  12.0029900345
4 | 2 | 3 |  11.6105418939
4 | 2 | 2 |  11.4205387926
4 | 2 | 1 |  11.5200504433
6 | 2 | 2 |  11.3150843227
6 | 2 | 3 |  11.087942451
6 | 2 | 1 |  12.0640315424
7 | 2 | 1 |  11.6605537521
7 | 2 | 3 |  11.6189671844
7 | 2 | 2 |  11.2636316548
8 | 2 | 3 |  11.3865060588
8 | 2 | 2 |  12.1672455368
8 | 2 | 1 |  10.9692943665
1 | 2 | 3 |  11.4617141335
1 | 2 | 1 |  11.5455368466
1 | 2 | 2 |  11.5463396473
2 | 3 | 2 |  11.3473263733
2 | 3 | 1 |  11.7839556008
2 | 3 | 3 |  11.1316960504
3 | 3 | 3 |  11.8686526315
3 | 3 | 2 |  11.0739149317
3 | 3 | 1 |  11.403959013
4 | 3 | 1 |  11.5870552325
4 | 3 | 2 |  11.3401354648
4 | 3 | 3 |  11.3424292954
6 | 3 | 3 |  11.3615420894
6 | 3 | 1 |  11.4887245966
6 | 3 | 2 |  11.3741010608
7 | 3 | 2 |  11.3180993919
7 | 3 | 1 |  11.4960941843
7 | 3 | 3 |  11.454173957
8 | 3 | 3 |  11.2121329748
8 | 3 | 1 |  11.5712149501
8 | 3 | 2 |  11.4525667984
1 | 3 | 3 |  11.1470495671
1 | 3 | 1 |  11.3843720685
1 | 3 | 2 |  11.7803942389
2 | 4 | 1 |  11.7049906947
2 | 4 | 2 |  11.3104231298
2 | 4 | 3 |  11.6789580111
3 | 4 | 2 |  11.9600062087
3 | 4 | 3 |  11.2497720322
3 | 4 | 1 |  11.5070118114
4 | 4 | 3 |  11.6880141384
4 | 4 | 2 |  11.6823046979
4 | 4 | 1 |  11.3789895286
6 | 4 | 1 |  11.2340767853
6 | 4 | 3 |  12.0463303433
6 | 4 | 2 |  11.4281136904
7 | 4 | 2 |  11.9397313286
7 | 4 | 1 |  11.5816813225
7 | 4 | 3 |  11.2157780218
8 | 4 | 3 |  11.3649382115
8 | 4 | 1 |  11.7537482956
8 | 4 | 2 |  11.6151737679
1 | 4 | 2 |  11.8833021895
1 | 4 | 1 |  11.6774568059
1 | 4 | 3 |  11.218661679
1 | 11.5549259143 | 11.5177949943 | 11.4343007933 | 11.5897878773
2 | 11.5536609678 | 

[R] Dealing with unix signal

2009-04-24 Thread Jong
Hi all,

I'm wondering if there is any module or function in R can deal with
unix signals such as SIGXCPU. In this way, when I get a signal from
OS, I like to do something (such as saving current variables or
terminating gracefully) by interrupting current execution of R.

Thank you for your help in advance.

Thanks,
Jong

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] My surprising experience in trying out REvolution's R

2009-04-24 Thread Jason Liao
David, thanks for following this through. 

I do not know how big a matrix needs to be before the multi-core
multi-threading will start save time. But it seems useful to build this
protection in your distribution so that it will not do multi-core when
multi-threading is more likely to do harm.

Jason
-Original Message-
From: David M Smith [mailto:da...@revolution-computing.com] 
Sent: Thursday, April 23, 2009 6:05 PM
To: Jason Liao
Cc: r-help@r-project.org
Subject: Re: [R] My surprising experience in trying out REvolution's R

We've taken a look at this in a bit more detail; it's a very
interesting example.  Although the code uses several functions that
exploit the parallel processing in REvolution R (notably %*% and
chol), this was one of those situations where the overheads of
threading pretty much balanced any performance gains: the individual
matrices for the operations were too small.

For some examples where the performance gains do show, see:
http://www.revolution-computing.com/products/r-performance.php

A more promising avenue for speeding up this code lies in
parallelizing the outer for(i in 1:200) loop...

# David Smith

On Tue, Apr 21, 2009 at 9:26 AM, Jason Liao jl...@hes.hmc.psu.edu
wrote:
 I care a lot about R's speed. So I decided to give REvolution's R
 (http://revolution-computing.com/) a try, which bills itself as an
 optimized R. Note that I used the free version.

 My machine is a Intel core 2 duo under Windows XP professional. The
code
 I run is in the end of this post.

 First, the regular R 1.9. It takes 2 minutes and 6 seconds, CPU usage
 50%

 Next, REvolution's R. It takes 2 minutes and 10 seconds, CPU usage
100%.


 In other words, REvolution's R consumes double the CPU with slightly
 less speed.

 The above has been replicated a few times (as a statistician of
course).


 Anyone has any insight on this? Anyway, my high hope was dashed.


-- 
David M Smith da...@revolution-computing.com
Director of Community, REvolution Computing www.revolution-computing.com
Tel: +1 (206) 577-4778 x3203 (San Francisco, USA)

Check out our upcoming events schedule at
www.revolution-computing.com/events

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] RES: How to force axis to have the same range

2009-04-24 Thread Sebastien Bihorel

Thanks to Greg and Deepayan for their answers.

*Sebastien Bihorel, PharmD, PhD*
PKPD Scientist
Cognigen Corp
Email: sebastien.biho...@cognigencorp.com 
mailto:sebastien.biho...@cognigencorp.com

Phone: (716) 633-3463 ext. 323


Greg Snow wrote:

For variables named my.x and my.y try:

  

plot( my.x, my.y, xlim=range(my.x,my.y), ylim=range(my.x,my.y) )



If all you want is to have the same range of values on both the x and y axes.




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] stata == R - error messages

2009-04-24 Thread Rob Bakker
Dear Duncan, Peter and Jim,
Thank you very much!! It worked!

Best regards,

Rob Bakker

2009/4/24 Duncan Murdoch murd...@stats.uwo.ca

 On 24/04/2009 7:42 AM, Peter Dalgaard wrote:

 Jim Lemon wrote:

 Rob Bakker wrote:

 Dear Sirs,
 I am just starting with R and I think it is a great system. Now, I
 want to
 import Stata datasets (.dta) with read.dta, but receive errormessages
 like:

 Error in grep(^(http|ftp|https)://, file) : object Rklein not found

 Error in read.dta(Rklein) :
  unable to open file: 'No such file or directory'
 this happens when I use 

 What is the problem and how can I solve it?


 Hi Rob,
 Looks like you're on Windows, and you have probably fallen victim to the
 Microsoft  (and Apple) hide-everything-you-can-from-them file manager
 defaults. Your file Rklein probably has an extension on it (maybe
 .dta?) and if you can find that by turning off extension hiding, you
 will probably see the solution immediately.

 Jim


 Also, notice the function choose.file() which lets browse your way to


 The function name is actually file.choose(), which exists on all (?)
 platforms.  There's also a function choose.files(), only on Windows, and
 mainly used for choosing multiple files (but it has a few other Windows-only
 differences from file.choose()).

 Duncan Murdoch


  the file in the usual Windows style. If used on its own, then it returns
 the full path to the file, so that you know what to feed to read.dta().

 You can short-circuit by using read.dta(choose.file()), but if you do it
 in a script, then you need to do the browsing every time you run the
 script.




[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] stata == R - error messages

2009-04-24 Thread Rob Bakker
Dear Peter,
Also thank you for your quick reply. I did the following with no positive
result:

library(foreign)

read.dta(choose.file(C:\Rklein))
Error: unexpected input in read.dta(choose.file(C:\
 read.dta(choose.file(C:\Rklein))
Error in grep(^(http|ftp|https)://, file) :
  could not find function choose.file
In addition: Warning messages:
1: '\R' is an unrecognized escape in a character string
2: unrecognized escape removed from C:\Rklein

The Rklein file is indeed .dta.
So what is the next step I can do?

Best regards, Rob Bakker


2009/4/24 Peter Dalgaard p.dalga...@biostat.ku.dk

 Jim Lemon wrote:
  Rob Bakker wrote:
  Dear Sirs,
  I am just starting with R and I think it is a great system. Now, I
  want to
  import Stata datasets (.dta) with read.dta, but receive errormessages
  like:
 
  Error in grep(^(http|ftp|https)://, file) : object Rklein not found
 
  Error in read.dta(Rklein) :
unable to open file: 'No such file or directory'
  this happens when I use 
 
  What is the problem and how can I solve it?
 
  Hi Rob,
  Looks like you're on Windows, and you have probably fallen victim to the
  Microsoft  (and Apple) hide-everything-you-can-from-them file manager
  defaults. Your file Rklein probably has an extension on it (maybe
  .dta?) and if you can find that by turning off extension hiding, you
  will probably see the solution immediately.
 
  Jim

 Also, notice the function choose.file() which lets browse your way to
 the file in the usual Windows style. If used on its own, then it returns
 the full path to the file, so that you know what to feed to read.dta().

 You can short-circuit by using read.dta(choose.file()), but if you do it
 in a script, then you need to do the browsing every time you run the
 script.

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



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Interpreting the results of Friedman test

2009-04-24 Thread Peter Dalgaard
doerte.ap...@gmx.de wrote:
 Hello,
 
 Peter Dalgaard wrote:
 Not necessarily, but the first suspicion one gets is that what you're
 doing with Friedman is not equivalent to what you're doing with ANOVA,
 could you show us the code and data (or an outline of it)?
 
 Please find attached the R script and the data input files.
 The values in dataForFriedmanTest.dat represent the geometric mean of
 the values of three repetitions for one observer and one condition.
 
 Am I doing something wrong there?

The .R file came as BIN file to me, so r-help may be missing it.

Anyways, Friedman's test is a replacement for a two-way ANOVA and you
are comparing it to a one-way analysis, and the latter is likely just wrong.

Try

anova(lm(AUC~as.factor(Condition)+as.factor(Observer),data=dataForANOVA))

or, maybe better

summary(aov(AUC ~ as.factor(Condition) + Error(as.factor(Observer) /
as.factor(Condition)),  data=dataForANOVA))

 Thanks in advance
 
 Doerte
 
 PS: I'm not sure if it is possible to send the dat-files by mail.
 Therefore I renamed them to *.txt. Please rename back to *.dat.

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] My surprising experience in trying out REvolution's R

2009-04-24 Thread David M Smith
You can always turn the multi-threading off with:

setMKLthreads(1)

We tested your code with this setting, and it ran in exactly the same
time as CRAN R.

# David Smith

On Fri, Apr 24, 2009 at 7:34 AM, Jason Liao jl...@hes.hmc.psu.edu wrote:
 David, thanks for following this through.

 I do not know how big a matrix needs to be before the multi-core
 multi-threading will start save time. But it seems useful to build this
 protection in your distribution so that it will not do multi-core when
 multi-threading is more likely to do harm.

 Jason
 -Original Message-
 From: David M Smith [mailto:da...@revolution-computing.com]
 Sent: Thursday, April 23, 2009 6:05 PM
 To: Jason Liao
 Cc: r-help@r-project.org
 Subject: Re: [R] My surprising experience in trying out REvolution's R

 We've taken a look at this in a bit more detail; it's a very
 interesting example.  Although the code uses several functions that
 exploit the parallel processing in REvolution R (notably %*% and
 chol), this was one of those situations where the overheads of
 threading pretty much balanced any performance gains: the individual
 matrices for the operations were too small.

 For some examples where the performance gains do show, see:
 http://www.revolution-computing.com/products/r-performance.php

 A more promising avenue for speeding up this code lies in
 parallelizing the outer for(i in 1:200) loop...

 # David Smith

 On Tue, Apr 21, 2009 at 9:26 AM, Jason Liao jl...@hes.hmc.psu.edu
 wrote:
 I care a lot about R's speed. So I decided to give REvolution's R
 (http://revolution-computing.com/) a try, which bills itself as an
 optimized R. Note that I used the free version.

 My machine is a Intel core 2 duo under Windows XP professional. The
 code
 I run is in the end of this post.

 First, the regular R 1.9. It takes 2 minutes and 6 seconds, CPU usage
 50%

 Next, REvolution's R. It takes 2 minutes and 10 seconds, CPU usage
 100%.


 In other words, REvolution's R consumes double the CPU with slightly
 less speed.

 The above has been replicated a few times (as a statistician of
 course).


 Anyone has any insight on this? Anyway, my high hope was dashed.


 --
 David M Smith da...@revolution-computing.com
 Director of Community, REvolution Computing www.revolution-computing.com
 Tel: +1 (206) 577-4778 x3203 (San Francisco, USA)

 Check out our upcoming events schedule at
 www.revolution-computing.com/events




-- 
David M Smith da...@revolution-computing.com
Director of Community, REvolution Computing www.revolution-computing.com
Tel: +1 (206) 577-4778 x3203 (San Francisco, USA)

Check out our upcoming events schedule at www.revolution-computing.com/events

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Interpreting the results of Friedman test

2009-04-24 Thread Doerte
Hello again,

it seems, the R script has been filtered from the previous posting.
Thus, I include is as text here:

dataForANOVA - read.csv(C:/R/dataForANOVA.dat,
 sep=|,
 as.is=T,
 na.strings=.,
 header=TRUE)
dataForFriedman - read.csv(C:/R/dataForFriedmanTest.dat,
sep=|,
as.is=T,
na.strings=.,
header=FALSE)

anova1 - lm(AUC~as.factor(Condition),data=dataForANOVA)
result_shapiro - shapiro.test(anova1$residuals)
result_bartlett - bartlett.test(anova1$residuals~as.factor
(Condition),data=dataForANOVA)
summaryANOVA1 - summary(anova1)

anova1Results - anova(lm(AUC~as.factor(Condition),data=dataForANOVA))
print(anova1Results)

friedman.test(as.matrix(dataForFriedman))

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Text Contrast in a Plot

2009-04-24 Thread Rodrigo Aluizio
Hi List,

I would appreciate any suggestion on how can I make a text I’ve inserted in
a plot show some contrast? With this I mean that I have a white text on a
plot and I would like to make a tiny border around it in black, so even
being small sized and the entire graphic being small in the text page I’ll
insert it. It will be visible.

 

Well I tried inserting a box() function inside the text() function, R
accepts the command but there is no effect. I even tried to plot a greater
black text and then a smaller white one at the same place, but it doesn’t
look good.

 

Any ideas!

 

Bellow is my plot code without the above mentioned attempts. I’d like to add
this effect at the second text() command.

 

png('BaseMap.png',width=5.2,height=3.6,pointsize=5,units='in',bg=NA,restoreC
onsole=T,res=1200)

par(mar=c(5,0,0,0))

map('worldHires','brazil',ylim=c(-5.15,-4.55),xlim=c(-37,-36.1),type='n')

rect(-37.1,-5.25,-36,-4.9,density=NULL,angle=45,col='#dbf4ff',border=F)

plot(Batimetria,ylab='',xlab='',border=F,col=Cor$Cor,add=T)

plot(Municipios,ylab='',xlab='',col=rgb(245,232,140,max=255,alpha=255),add=T
,lwd=0.2)

axis(1,xaxp=c(-37,-36.1,5),cex.axis=1.5)

axis(2,yaxp=c(-5.15,-4.55,5),cex.axis=1.5)

text(Prof$Long,Prof$Lat,rownames(Prof),col='black',cex=0.9,srt=-24,font=2)

text(c(-36.96,-36.96,-36.865,-36.54,-36.37,-36.2),c(-4.96,-5.05,-5.11,-5.14,
-5.14,-5.14),c('Areia

Branca','Serra

do Mel','Porto do
Mangue','Macau','Guamaré','Galinhos'),col='Black',cex=1.3,font=2)

rect(-36.20,-4.56,-36.155,-4.565,density=NULL,angle=45,col='black',border='b
lack',lwd=0.1)

rect(-36.155,-4.56,-36.111,-4.565,density=NULL,angle=45,col='white',border='
black',lwd=0.1)

text(c(-36.20,-36.155,-36.111,-36.215),c(-4.573,-4.573,-4.573,-4.562),c('0',
'5','10','km'),col='white',cex=1)

Norte(-36.155,-4.60,0.02)

box(which='plot',lty='solid')

dev.off()

 

Thanks in advance!

 

-

MSc.  mailto:r.alui...@gmail.com Rodrigo Aluizio

Centro de Estudos do Mar/UFPR
Laboratório de Micropaleontologia
Avenida Beira Mar s/n - CEP 83255-000
Pontal do Paraná - PR – Brasil


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] stata == R - error messages

2009-04-24 Thread Hans Ekbrand
On Fri, Apr 24, 2009 at 01:50:04PM +0200, Rob Bakker wrote:
 Dear Peter,
 Also thank you for your quick reply. I did the following with no positive
 result:
 
 library(foreign)
 
 read.dta(choose.file(C:\Rklein))

a) quote the filename
b) include the suffix

rklein - read.dta(C:\Rklein.dta)

-- 
Hans Ekbrand (http://sociologi.cjb.net) h...@sociologi.cjb.net
GPG Fingerprint: 1408 C8D5 1E7D 4C9C C27E 014F 7C2C 872A 7050 614E


signature.asc
Description: Digital signature
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] use of input in system()

2009-04-24 Thread Mike Miller

First, it looks like there is bug in the documentation...

According to the documentation for system():

http://stat.ethz.ch/R-manual/R-patched/library/base/html/system.html

  input  if a character vector is supplied, this is copied one string per
 line to a temporary file, and the standard input of command is
 redirected to the file

This seems to mean that the standard input of command is redirected *from* 
the file.  From the file, to the command.  Example:



i - 42
system( cat -, input=as.character(i) )

42

I guess the documentation needs to be clarified because I couldn't 
understand what it meant.


Second, I'm trying to use a system call to write files with names based on 
an integer value in an R variable (in this case the variable is called 
i).  As above, I can do this (on a GNU/Linux system):



system( cat -, input=sprintf(%04d, i) )

0005

I am running bash, but system calls go to sh.  I want to be able to put 
that input string (0005) into a variable and do something like this:


system( i=`cat /dev/stdin` ; run_script  file${i}.out , 
input=sprintf(%04d, i) )

I think my problem is more with sh than with R, but someone here must have 
tried this, so I'm hoping I can get an answer here.  Thanks in advance.


Best,
Mike

--
Michael B. Miller, Ph.D.
Minnesota Center for Twin and Family Research
Department of Psychology
University of Minnesota

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] stata == R - error messages

2009-04-24 Thread Duncan Murdoch

On 4/24/2009 10:18 AM, Hans Ekbrand wrote:

On Fri, Apr 24, 2009 at 01:50:04PM +0200, Rob Bakker wrote:

Dear Peter,
Also thank you for your quick reply. I did the following with no positive
result:

library(foreign)

read.dta(choose.file(C:\Rklein))


a) quote the filename
b) include the suffix

rklein - read.dta(C:\Rklein.dta)


c) use forward slashes, or double backslashes:

rklein - read.dta(C:/Rklein.dta)

Duncan Murdoch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] use of input in system()

2009-04-24 Thread Duncan Murdoch

On 4/24/2009 10:29 AM, Mike Miller wrote:

First, it looks like there is bug in the documentation...

According to the documentation for system():

http://stat.ethz.ch/R-manual/R-patched/library/base/html/system.html

   input  if a character vector is supplied, this is copied one string per
  line to a temporary file, and the standard input of command is
  redirected to the file

This seems to mean that the standard input of command is redirected *from* 
the file.  From the file, to the command.  Example:


The redirection is done *to* the file handle.  The fact that input is 
read from that handle is a different issue.


Duncan Murdoch




i - 42
system( cat -, input=as.character(i) )

42

I guess the documentation needs to be clarified because I couldn't 
understand what it meant.


Second, I'm trying to use a system call to write files with names based on 
an integer value in an R variable (in this case the variable is called 
i).  As above, I can do this (on a GNU/Linux system):



system( cat -, input=sprintf(%04d, i) )

0005

I am running bash, but system calls go to sh.  I want to be able to put 
that input string (0005) into a variable and do something like this:


system( i=`cat /dev/stdin` ; run_script  file${i}.out , 
input=sprintf(%04d, i) )

I think my problem is more with sh than with R, but someone here must have 
tried this, so I'm hoping I can get an answer here.  Thanks in advance.


Best,
Mike



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Interpreting the results of Friedman test

2009-04-24 Thread Doerte
 Anyways, Friedman's test is a replacement for a two-way ANOVA and you
 are comparing it to a one-way analysis, and the latter is likely just wrong.

Okay. Thanks for the hint.

 Try

 anova(lm(AUC~as.factor(Condition)+as.factor(Observer),data=dataForANOVA))

This results in p-value = 0.37969. This value is still quite different
from p-value = 1.913e-06, which is the result of friedman.test
(as.matrix(dataForFriedman)).

Is the method friedman.test (version R 2.9.0) working correctly for
certain types of data and hypotheses? Which limitations are known?

@ Jim: Thanks for the link.
Unfortunately, I'm a newbie in statistics, and I'm not sure, which
method can be used instead of the Friedman Test. Do you have an eye on
a certain R-program from this given website?

Doerte

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] the puzzle of eigenvector and eigenvalue

2009-04-24 Thread Abelian
Dear all
I am so glad the R can provide the efficient calculate about
eigenvector and eigenvalue.
However, i have some puzzle about the procedure of eigen.
Fristly, what kind of procedue does the R utilize such that the eigen
are obtained?
For example, A=matrix(c(1,2,4,3),2,2)
we can define the eigenvalue lamda, such as

   det | 1-lamda 4|  =0
 |23-lamda  |

then we can obtain the lamda=5 and -1
however, i am interesting in that how does the R to obatin lamda?
By the way, how does the R also obtain the eigenvector?

Basically, i must to know those definition in the R because i have to
utilize eigenvalue and eigenvector to develope SVD (single value
decomposition) by myself. Furthermore, i want to obtain the bi-plot
about my data.
Although someone suggest that i can obtain those result by R (base),
there are exist some tough problems which is difficult to solve it. My
data is too huge to do it. for example, the size of matrix is
40*800.
So, i think that i should follow whole steps by myself.

Finally, it is also my serious problem in the R, I have three
estimators which work for the same data.
Moreover, i utilize the biplot to realize those tendency. But i find
that the the tendency of third estimator mirror the other two, the
figures are linked below

http://hopjimmy123.pixnet.net/album/photo/108526615#pictop

i believe that the tendency should have the same way with the other
estimator and the major problem is about the eigenvalue, i hope that
someone can give me some idea or provide me some solution about this
problem.
Sincerely

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Using JRI and Java 1.6 on MAC OS X

2009-04-24 Thread Phil Robinson
if you wish to use jni with java 1.6 on a mac you have to compile the native 
code as a 64 bit application (-m64 on a gcc command line)

hope this helps

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] use of input in system()

2009-04-24 Thread Mike Miller

First, it looks like there is bug in the documentation...

According to the documentation for system():

http://stat.ethz.ch/R-manual/R-patched/library/base/html/system.html

  input  if a character vector is supplied, this is copied one string per
 line to a temporary file, and the standard input of command is
 redirected to the file

This seems to mean that the standard input of command is redirected *from* 
the file.  From the file, to the command.  Example:



i - 42
system( cat -, input=as.character(i) )

42

I guess the documentation needs to be clarified because I couldn't 
understand what it meant.


Second, I'm trying to use a system call to write files with names based on 
an integer value in an R variable (in this case the variable is called 
i).  As above, I can do this (on a GNU/Linux system):



system( cat -, input=sprintf(%04d, i) )

0005

I am running bash, but system calls go to sh.  I want to be able to put 
that input string (0005) into a variable and do something like this:


system( i=`cat /dev/stdin` ; run_script  file${i}.out , 
input=sprintf(%04d, i) )

I think my problem is more with sh than with R, but someone here must have 
tried this, so I'm hoping I can get an answer here.  Thanks in advance.


Best,
Mike

--
Michael B. Miller, Ph.D.
Minnesota Center for Twin and Family Research
Department of Psychology
University of Minnesota

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] use of input in system()

2009-04-24 Thread Mike Miller

On Fri, 24 Apr 2009, Mike Miller wrote:

I am running bash, but system calls go to sh.  I want to be able to put 
that input string (0005) into a variable and do something like this:


system( i=`cat /dev/stdin` ; run_script  file${i}.out , 
input=sprintf(%04d, i) )



In sh, both of these commands execute ls:

echo ls | `cat /dev/stdin`
echo ls | `cat -`

In R, both of these simply hang until I hit ctrl-c...


system( `cat /dev/stdin`, input=ls )
system( `cat -`, input=ls )


...but the stdin is getting to the command because both of these return 
ls to stdout:



system( cat -, input=ls )
system( cat /dev/stdin, input=ls )



So what am I missing?  I don't understand why the backtick method isn't 
working.  Is there another way to do this?


Mike

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Interpreting the results of Friedman test

2009-04-24 Thread Peter Dalgaard
Doerte wrote:
 Anyways, Friedman's test is a replacement for a two-way ANOVA and you
 are comparing it to a one-way analysis, and the latter is likely just wrong.
 
 Okay. Thanks for the hint.
 
 Try

 anova(lm(AUC~as.factor(Condition)+as.factor(Observer),data=dataForANOVA))
 
 This results in p-value = 0.37969. This value is still quite different
 from p-value = 1.913e-06, which is the result of friedman.test
 (as.matrix(dataForFriedman)).


If you had read ALL that I wrote, then you would have seen this:

 summary(aov(AUC ~ as.factor(Condition) + Error(as.factor(Observer) /
+ as.factor(Condition)),  data=dataForANOVA))

Error: as.factor(Observer)
  DfSum Sq   Mean Sq F value Pr(F)
Residuals  6 0.0066907 0.0011151

Error: as.factor(Observer):as.factor(Condition)
 Df   Sum Sq  Mean Sq F valuePr(F)
as.factor(Condition)  3 0.275825 0.091942  405.23  2.2e-16 ***
Residuals18 0.004084 0.000227
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Error: Within
  Df Sum Sq Mean Sq F value Pr(F)
Residuals 56 6.5337  0.1167


I.e. the thing that is going on is that the Observer:Condition
interaction is incredibly small (0.000227) compared to the replication
variation (0.1167), or put differently that you seem to have strong
negative correlation between replicates. This can happen if you have
things like plants growing in the same pot, but you need to consider
what could be happening in your case.

Looking at the table of means

 with(dataForANOVA,tapply(AUC,list(Observer,Condition),mean))
 1234
1 11.55841 11.51786 11.43727 11.59314
2 11.55448 11.51013 11.42099 11.56479
3 11.55994 11.49924 11.44884 11.57226
4 11.55410 11.51704 11.42321 11.58310
6 11.52043 11.48902 11.40812 11.56951
7 11.55013 11.51438 11.42279 11.57906
8 11.53763 11.50768 11.41197 11.57795

this is essentially the same as your dataForFriedman and it is pretty
clear that the 3rd column is substantially below the others, which is
what the Friedman test and also the F value of 405.23 above is picking
up on.


 
 Is the method friedman.test (version R 2.9.0) working correctly for
 certain types of data and hypotheses? Which limitations are known?
 
 @ Jim: Thanks for the link.
 Unfortunately, I'm a newbie in statistics, and I'm not sure, which
 method can be used instead of the Friedman Test. Do you have an eye on
 a certain R-program from this given website?
 
 Doerte
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] what is this experimental design (mixed-effects model)?

2009-04-24 Thread J S

Dear R community,
 
I am wondering what experimental design I am dealing with? I study the effect 
of daily air temperature on daily body temperature of the overwintering turtles 
(i.e. sleeping in soil). The model is a cosine wave with the air temperature as 
a covariate. 
 
Objects are 19 overwintering turtles. Data were combined over the three years. 
Each turtle was studied only once during these years, while 2 turtles were 
studied during two years (see table below). The study area was the same for 
these three studied years. Turtles were overwintering in different sites within 
this area. 
 
Is that correct to treat the study years as a random effect? I understand that 
I should incorporate autocorrelation model to account for daily variations in 
turtle’s body temperature. Is there a spatial correlation between the three 
study years, since the study was done within the same area?
 
 
 
 





Study year


turtle#


2005 year

 


 

1


 

2


 

3


 

4


 

5


 

6


 

7


2006 year

 


 

8


 

9


 

0


 

11


 

12


2006 year

 


 

13


 

14


 

15


 

4


 

16


 

17


 

18


 

12


 

19
 
Thanks for your help,

Julia






Internet Explorer 8 – Now Available. Faster, safer, easier. Download FREE now!

_
Rediscover Hotmail®: Now available on your iPhone or BlackBerry

Mobile2_042009
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] the puzzle of eigenvector and eigenvalue

2009-04-24 Thread Duncan Murdoch

On 4/24/2009 10:30 AM, Abelian wrote:

Dear all
I am so glad the R can provide the efficient calculate about
eigenvector and eigenvalue.
However, i have some puzzle about the procedure of eigen.
Fristly, what kind of procedue does the R utilize such that the eigen
are obtained?
For example, A=matrix(c(1,2,4,3),2,2)
we can define the eigenvalue lamda, such as

   det | 1-lamda 4|  =0
 |23-lamda  |

then we can obtain the lamda=5 and -1
however, i am interesting in that how does the R to obatin lamda?
By the way, how does the R also obtain the eigenvector?


The documentation for eigen says,

 By default 'eigen' uses the LAPACK routines DSYEVR, DGEEV, ZHEEV
 and ZGEEV whereas 'eigen(EISPACK=TRUE)' provides an interface to
 the EISPACK routines 'RS', 'RG', 'CH' and 'CG'.   

So you would need to consult the documentation for those functions 
(which is listed in the references) for details.


Duncan Murdoch



Basically, i must to know those definition in the R because i have to
utilize eigenvalue and eigenvector to develope SVD (single value
decomposition) by myself. Furthermore, i want to obtain the bi-plot
about my data.
Although someone suggest that i can obtain those result by R (base),
there are exist some tough problems which is difficult to solve it. My
data is too huge to do it. for example, the size of matrix is
40*800.
So, i think that i should follow whole steps by myself.

Finally, it is also my serious problem in the R, I have three
estimators which work for the same data.
Moreover, i utilize the biplot to realize those tendency. But i find
that the the tendency of third estimator mirror the other two, the
figures are linked below

http://hopjimmy123.pixnet.net/album/photo/108526615#pictop

i believe that the tendency should have the same way with the other
estimator and the major problem is about the eigenvalue, i hope that
someone can give me some idea or provide me some solution about this
problem.
Sincerely

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] lagged variable in a dataframe

2009-04-24 Thread Cecilia Carmo

Hi!
I have the following dataframe which represents a 
financial variable:

revenue

 firm year revenue id
10.1  500194670 2007  27725 10
10.2  500194670 2006   9717 10
10.3  500194670 2005 125621 10
10.4  500194670 2004  84837 10
12.1  500278725 2007 308532 12
12.2  500278725 2006 493755 12
12.3  500278725 2005 238195 12
12.4  500278725 2004  35472 12
13.1  502616695 2007725 13
13.2  502616695 2006  14392 13
13.3  502616695 2005  32502 13
13.4  502616695 2004  35271 13
…
And I want to compute the lagged version of it, like this:
  firm year revenue id
10.1  500194670 2007  9717 10
10.2  500194670 2006 125621 10
10.3  500194670 2005 84837 10
10.4  500194670 2004  NA 10
12.1  500278725 2007 493755 12
12.2  500278725 2006 238195 12
12.3  500278725 2005 35472 12
12.4  500278725 2004  NA 12
13.1  502616695 2007  14392 13
13.2  502616695 2006  32502 13
13.3  502616695 2005  35271 13
13.4  502616695 2004  NA 13

I’ve tried lag(revenue,k=1) but I failed. The error 
message was:

Error in attr(x, tsp) - c(1, NROW(x), 1) :
  invalid time series parameters specified

Thank you for your help,
Cecília Carmo (Portugal)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] function returns R object with name based on input

2009-04-24 Thread Jennifer Brea
I wanted to ask how I can make a for loop or a function return an R 
object with a unique name based on either some XX of the for loop or 
some input for the function.


For example

if I have a function:

fn-function(data,year){

which does does some stuff
}

How do I return an object from the function called X.year, such that if 
I run fn(data,1989), the output is an object called X.1989?


In a separate but related process, I'm also trying to subset data by 
year, where there are multiple observations by years, using the subset() 
function.  For example:


data.1946-subset(data, year==1946)
data.1947-subset(data, year==1947)
data.1948-subset(data, year==1948)
data.1949-subset(data, year==1949)
...

How should I set this up?  I was thinking of writing a for loop, but I 
have never written a for loop that creates objects based on the loop's 
index, for example a loop for(i in 1946:2000) that returns 55 objects 
with the object names based on the index.


Thanks for your help!

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] function returns R object with name based on input

2009-04-24 Thread David Winsemius


On Apr 24, 2009, at 11:56 AM, Jennifer Brea wrote:

I wanted to ask how I can make a for loop or a function return an R  
object with a unique name based on either some XX of the for loop or  
some input for the function.


For example

if I have a function:

fn-function(data,year){

which does does some stuff
}

How do I return an object from the function called X.year, such that  
if I run fn(data,1989), the output is an object called X.1989?


Read:
?assign
?paste
#and FAQ 7.21
http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-turn-a-string-into-a-variable_003f


In a separate but related process, I'm also trying to subset data by  
year, where there are multiple observations by years, using the  
subset() function.  For example:


data.1946-subset(data, year==1946)
data.1947-subset(data, year==1947)
data.1948-subset(data, year==1948)
data.1949-subset(data, year==1949)
...


list.of.subsets - sapply(1946:200, function(x) subset(data,  
year==x) ) # with no example ... untested


Using data as a dataframe names is poor R programming practice, since  
many functions use data a a parameter name and it is also a function  
name.





How should I set this up?  I was thinking of writing a for loop, but  
I have never written a for loop that creates objects based on the  
loop's index, for example a loop for(i in 1946:2000) that returns 55  
objects with the object names based on the index.




David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] argument 'exclude' in function xtabs

2009-04-24 Thread Matthieu Lesnoff
Dear all

I was willing to use argument 'exclude' in function xtabs to remove some
levels of factors (xtabs help page says 'exclude: a vector of values to be
excluded when forming the set of levels of the classifying factors).


I tried:

 mydata - data.frame(
 treatment = c(B, A, C, C, B, B, C, A, B, B, NA,
C),
 surv = c(YES, NO, YES, YES, NO, NO, NO, YES, YES,
NO, NO, NA)
)

 levels(mydata$treatment)
[1] A B C

 # try to remove level B in variable treatment
 xtabs(formula = ~ treatment + surv, data = mydata, exclude = B)
surv
treatment NO YES
   A  1   1
   B  3   2
   C  1   2



One alternative is to do:

 xtabs(formula = ~ treatment + surv, data = mydata[mydata$treatment != B,
], drop.unused.levels = TRUE)
surv
treatment NO YES
   A  1   1
   C  1   2



But I don't understand why I cannot remove B directly with argument
exclude.

Any help is welcome

Regards

Matthieu





My version on Windows XP

platform   i386-pc-mingw32
arch   i386
os mingw32
system i386, mingw32
status
major  2
minor  9.0
year   2009
month  04
day17
svn rev48333
language   R
version.string R version 2.9.0 (2009-04-17)





--
Matthieu Lesnoff
CIRAD
Bamako, Mali
E-mail: matthieu.lesn...@cirad.fr

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] argument 'exclude' in function xtabs

2009-04-24 Thread Erik Iverson

 I was willing to use argument 'exclude' in function xtabs to remove some
 levels of factors (xtabs help page says 'exclude: a vector of values to
 be excluded when forming the set of levels of the classifying factors).


I think I see what's happening, and it's a little confusing to me, too.  
If your classifying factor to xtabs is not
actually a factor, but say, a character vector, it will be converted to a
factor
while using the exclude argument.  However, if it already is a factor,
this does not happen.
So, for example, contrast:

trt.char - c(A,B,C,A,B,C)
xtabs(~trt.char, exclude = B)

with

trt.fac - factor(c(A,B,C,A,B,C))
xtabs(~trt.fac, exclude = B)

Hope that helps,
Erik Iverson

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to custom the tick and type in bwplot

2009-04-24 Thread Guanghong Zuo
Dear R users

I use bwplot to plot some figures.  There are two troubles:

1. How to change the dot of the mean to a line, like the style in boxplot
2. How to hide some tick marks.  For example, I have seven tick: A, B, C, D,
E, F, G,
but I want show four marks: A, C, E, G on the x-axis.

Thanks!

-- 
Kind Regards,
 Guanghong

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] By= levels with the Hmisc summarize function.

2009-04-24 Thread Lane, Jim
Hi, All

I have a data frame as follows:

 attach(mf)
 names(mf)
[1] centre   complex  appl pool monthalloc_gb

I want to summarize this as follows:

agg-summarize(alloc_gb,by=llist(centre,complex,appl,month),FUN=sum,
na.rm=TRUE)

That seems to run fine but there something odd about the output. The
first 3 by levels are as expected, for example

 levels(agg$centre)
[1] B G  O  Q 

However, month gets messed up somehow:

 levels(agg$month)
NULL

The original input data was in yearmon format:

 class(month)
[1] yearmon

I was expecting agg$month to have all the various values of mf$month.
What am I doing wrong here? Do I have to drop mf$pool somehow?

Jim Lane
Capacity Planner
RBC Financial Group
315 Front St W
6th Floor - H14
Toronto, Ontario CANADA
M5V 3A4
416-348-6024

Display of superior knowledge is as great a vulgarity
as display of superior wealth - greater indeed, inasmuch 
as knowledge should tend more definitely than wealth
towards discretion and good manners.

- H. W. Fowler, Modern English Usage


___

This e-mail may be privileged and/or confidential, and the sender does not 
waive any related rights and obligations.
Any distribution, use or copying of this e-mail or the information it contains 
by other than an intended recipient is unauthorized.
If you received this e-mail in error, please advise me (by return e-mail or 
otherwise) immediately.  

Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce 
pas aux droits et obligations qui s'y rapportent.
Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il 
contient par une personne autre que le (les) destinataire(s) désigné(s) est 
interdite.
Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser 
immédiatement, par retour de courrier électronique ou par un autre moyen.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] what is this experimental design (mixed-effects model)?

2009-04-24 Thread Dieter Menne



J S-19 wrote:
 
  
 I am wondering what experimental design I am dealing with? I study the
 effect of daily air temperature on daily body temperature of the
 overwintering turtles (i.e. sleeping in soil). The model is a cosine wave
 with the air temperature as a covariate. 
  
 

Not sure if I fully got it, but check the estus cycle example in
Pinheiro/Bates that looks 
similar, or the beaver example in 13.5 of MASS (probably less likely).

Dieter


-- 
View this message in context: 
http://www.nabble.com/what-is-this-experimental-design-%28mixed-effects-model%29--tp23218975p23219579.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Text Contrast in a Plot

2009-04-24 Thread Mark Difford

Hi Rodrigo,

 I would appreciate any suggestion on how can I make a text I’ve inserted
 in
 a plot show some contrast? 

There are quite a few approaches, but why not try legend?

Best, Mark.


Rodrigo Aluizio wrote:
 
 Hi List,
 
 I would appreciate any suggestion on how can I make a text I’ve inserted
 in
 a plot show some contrast? With this I mean that I have a white text on a
 plot and I would like to make a tiny border around it in black, so even
 being small sized and the entire graphic being small in the text page I’ll
 insert it. It will be visible.
 
  
 
 Well I tried inserting a box() function inside the text() function, R
 accepts the command but there is no effect. I even tried to plot a greater
 black text and then a smaller white one at the same place, but it doesn’t
 look good.
 
  
 
 Any ideas!
 
  
 
 Bellow is my plot code without the above mentioned attempts. I’d like to
 add
 this effect at the second text() command.
 
  
 
 png('BaseMap.png',width=5.2,height=3.6,pointsize=5,units='in',bg=NA,restoreC
 onsole=T,res=1200)
 
 par(mar=c(5,0,0,0))
 
 map('worldHires','brazil',ylim=c(-5.15,-4.55),xlim=c(-37,-36.1),type='n')
 
 rect(-37.1,-5.25,-36,-4.9,density=NULL,angle=45,col='#dbf4ff',border=F)
 
 plot(Batimetria,ylab='',xlab='',border=F,col=Cor$Cor,add=T)
 
 plot(Municipios,ylab='',xlab='',col=rgb(245,232,140,max=255,alpha=255),add=T
 ,lwd=0.2)
 
 axis(1,xaxp=c(-37,-36.1,5),cex.axis=1.5)
 
 axis(2,yaxp=c(-5.15,-4.55,5),cex.axis=1.5)
 
 text(Prof$Long,Prof$Lat,rownames(Prof),col='black',cex=0.9,srt=-24,font=2)
 
 text(c(-36.96,-36.96,-36.865,-36.54,-36.37,-36.2),c(-4.96,-5.05,-5.11,-5.14,
 -5.14,-5.14),c('Areia
 
 Branca','Serra
 
 do Mel','Porto do
 Mangue','Macau','Guamaré','Galinhos'),col='Black',cex=1.3,font=2)
 
 rect(-36.20,-4.56,-36.155,-4.565,density=NULL,angle=45,col='black',border='b
 lack',lwd=0.1)
 
 rect(-36.155,-4.56,-36.111,-4.565,density=NULL,angle=45,col='white',border='
 black',lwd=0.1)
 
 text(c(-36.20,-36.155,-36.111,-36.215),c(-4.573,-4.573,-4.573,-4.562),c('0',
 '5','10','km'),col='white',cex=1)
 
 Norte(-36.155,-4.60,0.02)
 
 box(which='plot',lty='solid')
 
 dev.off()
 
  
 
 Thanks in advance!
 
  
 
 -
 
 MSc.  mailto:r.alui...@gmail.com Rodrigo Aluizio
 
 Centro de Estudos do Mar/UFPR
 Laboratório de Micropaleontologia
 Avenida Beira Mar s/n - CEP 83255-000
 Pontal do Paraná - PR – Brasil
 
 
   [[alternative HTML version deleted]]
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/Text-Contrast-in-a-Plot-tp23217307p23221789.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] omit empty cells in crosstab?

2009-04-24 Thread sjaffe

Perhaps this is a common question but I haven't been able to find the answer.

I have data with many factors, each taking many values. However, only
relatively few combinations appear in the data, ie have nonzero counts, in
other words the resulting table is sparse. Say we have 10 factors each with
10 levels. The result of table() would exceed the memory space (on a 32bit
machine). Is there any way to produce a table with empty cells omitted?
(without first producing the whole table and then removing rows.)

Thanks,
Steve

-- 
View this message in context: 
http://www.nabble.com/omit-empty-cells-in-crosstab--tp2363p2363.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] omit empty cells in crosstab?

2009-04-24 Thread hadley wickham
Hi Steve,

The general answer is yes, but the specific will depend on your
problem.  Could you provide a small reproducible example to illustrate
your problem?

Hadley

On Fri, Apr 24, 2009 at 1:19 PM, sjaffe sja...@riskspan.com wrote:

 Perhaps this is a common question but I haven't been able to find the answer.

 I have data with many factors, each taking many values. However, only
 relatively few combinations appear in the data, ie have nonzero counts, in
 other words the resulting table is sparse. Say we have 10 factors each with
 10 levels. The result of table() would exceed the memory space (on a 32bit
 machine). Is there any way to produce a table with empty cells omitted?
 (without first producing the whole table and then removing rows.)

 Thanks,
 Steve

 --
 View this message in context: 
 http://www.nabble.com/omit-empty-cells-in-crosstab--tp2363p2363.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
http://had.co.nz/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] use of input in system()

2009-04-24 Thread Mike Miller

On Fri, 24 Apr 2009, Mike Miller wrote:


On Fri, 24 Apr 2009, Mike Miller wrote:

I am running bash, but system calls go to sh.  I want to be able to put 
that input string (0005) into a variable and do something like this:


system( i=`cat /dev/stdin` ; run_script  file${i}.out , 
input=sprintf(%04d, i) )



In sh, both of these commands execute ls:

echo ls | `cat /dev/stdin`
echo ls | `cat -`

In R, both of these simply hang until I hit ctrl-c...


system( `cat /dev/stdin`, input=ls )
system( `cat -`, input=ls )


...but the stdin is getting to the command because both of these return 
ls to stdout:



system( cat -, input=ls )
system( cat /dev/stdin, input=ls )



So what am I missing?  I don't understand why the backtick method isn't 
working.  Is there another way to do this?



I still can't figure that out, but it is OK because I found a better way. 
For some reason I was thinking of the system function like this...


system( command )

...when I could have been thinking of it like this:

foo - command

system( foo )

Maybe obvious in retrospect, but that makes it much easier to take values 
from R and insert them into system commands.  Here is a mini example:



i - 5
foo - ls
bar - paste(touch file, sprintf(%04d, i), .out, sep=)
bar

[1] touch file0005.out

Thus I have placed two system commands into variables foo and bar.  The 
system commands can be pasted together using  ;  as a separator...



barfoo - paste(bar, foo, sep= ; )
barfoo

[1] touch file0005.out ; ls


...then executed like so:


system( barfoo )



Mike

Michael B. Miller, Ph.D.
Minnesota Center for Twin and Family Research
Department of Psychology
University of Minnesota

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Problem with greek beta symbol in plot using CairoPDF (Windows)

2009-04-24 Thread Michal Figurski

Dear R-Helpers,

I have a problem with displaying the greek beta symbol in PDF files 
using Cairo library - it displays as an empty box. The same also happens 
for a dash symbol in subscript. Both symbols are displayed correctly if 
the plot is produced on screen (outside of CairoPDF).


The syntax that I use for it in plot command is: 
'xlab=expression(paste(A,beta,)[1-42])'.


When I try to select a different font family using 'family' option in 
the CairoPDF command - it has no effect. I tried 'CairoFonts', but it 
displays an error:


'Warning message:
In CairoFonts() :
  the R Cairo package was not installed with fontconfig. Please 
consider installing the cairo graphics engine (www.cairographics.org) 
with freetype and fontconfig support'


I have the most recent GTK+ installed. I don't know where to look for 
solution. Anyone able to help?


Here is my session info:

 sessionInfo()
R version 2.8.1 (2008-12-22)
i386-pc-mingw32

locale:
LC_COLLATE=Polish_Poland.1250;LC_CTYPE=Polish_Poland.1250;LC_MONETARY=Polish_Poland.1250;LC_NUMERIC=C;LC_TIME=Polish_Poland.1250

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] Cairo_1.4-5



--
Michal J. Figurski
HUP, Pathology  Laboratory Medicine
Biomarker Research Laboratory
Philadelphia, USA

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to custom the tick and type in bwplot

2009-04-24 Thread David Winsemius


On Apr 24, 2009, at 1:33 PM, Guanghong Zuo wrote:


Dear R users

I use bwplot to plot some figures.  There are two troubles:

1. How to change the dot of the mean to a line, like the style in  
boxplot


Sometimes you need to refer the the help page for panel.type of  
plot, in this case:

?panel.bwplot

... so the answer is now staring you in the face:
bwplot(decrease ~ treatment, OrchardSprays, groups = rowpos, pch=|)



2. How to hide some tick marks.  For example, I have seven tick: A,  
B, C, D,

E, F, G,
   but I want show four marks: A, C, E, G on the x-axis.


Using the example in bwplot again, and a fair amount of fruitless  
experimentation with the theory that one could do anything useful with  
scales=list(at= list(something)), I finally ended up trying ,  
labels=c( ) per Sarkar's Lattice book, producing this:


bwplot(decrease ~ treatment, OrchardSprays, groups = rowpos,  
scales=list(x=list( labels=c(A,,,D,,F,,) )))


--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] font size relative to graphic

2009-04-24 Thread Mike Miller
I am printing numbers onto horizontal bars in a bar plots, but I am 
finding it difficult to make the number always the right size.  If there 
are more bars, the bars get narrower and the font is too big.  I also find 
that if I change the size of the graph, the bars will get wider or 
narrower and the font stays about the same size.  The result depends on 
whether I view the graph in X11 or in postscript.


Is there a way to specify font size relative to bar width, or at least 
specify font size relative to graph coordinates?


Here's a bit of what I've been doing:

x.bar.plot - barplot(as.matrix(x), horiz=TRUE, beside=TRUE, xlim=c(0,100), 
xlab=Score, las=1)
text(as.matrix(x), x.bar.plot-.07, as.character(as.matrix(round(x))), pos=2, 
col=black)

The -.07 is something I added to make the numbers align well with the 
bars under one condition, but it doesn't always help.


Any tips would be greatly appreciated.  Thanks in advance.

Mike

--
Michael B. Miller, Ph.D.
Minnesota Center for Twin and Family Research
Department of Psychology
University of Minnesota

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Can't install package glmnet

2009-04-24 Thread Uwe Ligges



Liang Zhang wrote:

I am just wondering how to solve this installation problem.


As I said, ask your admin to install suitable compilers.

Uwe



Thanks,
Liang





From: Uwe Ligges lig...@statistik.tu-dortmund.de
To: Liang Zhang zhangl...@yahoo.com
Cc: r-help@r-project.org
Sent: Friday, April 24, 2009 2:50:00 AM
Subject: Re: [R] Can't install package glmnet



Liang Zhang wrote:

Hi, I was trying to install package glmnet in R, but failed and it show such 
messages:

* Installing *source* package glmnet ...
 This package has only been tested with gfortran.
 So some checks are needed.
 R_HOME is /home/username/R/R-2.9.0
Attempting to determine R_ARCH...
R_ARCH is
Attempting to detect how R was configured for Fortran 90
Unsupported Fortran 90 compiler or Fortran 90
compilers unavailable! Stop!
ERROR: configuration failed for package glmnet
* Removing /home/username/R/R-2.9.0/library/glmnet

The downloaded packages are in
/tmp/RtmpwsLWSc/downloaded_packages
Updating HTML index of packages in '.Library'
Warning message:
In install.packages(glmnet) :
  installation of package 'glmnet' had non-zero exit status


It seems that it needs fortran 90 complier. What can I do to solve this 
problem? (I am not the administrator, only a user in the linux system).


Ask for a suitable compiler?

Uwe Ligges





Thank you very much!
Liang



  [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.







__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] font size relative to graphic

2009-04-24 Thread David Winsemius


On Apr 24, 2009, at 3:14 PM, Mike Miller wrote:

I am printing numbers onto horizontal bars in a bar plots, but I am  
finding it difficult to make the number always the right size.  If  
there are more bars, the bars get narrower and the font is too big.   
I also find that if I change the size of the graph, the bars will  
get wider or narrower and the font stays about the same size.  The  
result depends on whether I view the graph in X11 or in postscript.


Is there a way to specify font size relative to bar width, or at  
least specify font size relative to graph coordinates?


Here's a bit of what I've been doing:

x.bar.plot - barplot(as.matrix(x), horiz=TRUE, beside=TRUE,  
xlim=c(0,100), xlab=Score, las=1)
text(as.matrix(x), x.bar.plot-.07,  
as.character(as.matrix(round(x))), pos=2, col=black)


The -.07 is something I added to make the numbers align well with  
the bars under one condition, but it doesn't always help.


Any tips would be greatly appreciated.  Thanks in advance.


The values returned from the barplot function are the locations of the  
bars. Why not call barplot, collect the values, and then use the  
length of the result to determine your sizes and widths?


hh - t(VADeaths)[, 5:1]
mybarcol - gray20
mp - barplot(hh, beside = TRUE,
col = c(lightblue, mistyrose,
lightcyan, lavender),
legend = colnames(VADeaths), ylim= c(0,100),
main = Death Rates in Virginia, font.main = 4,
sub = Faked upper 2*sigma error bars, col.sub = mybarcol,
cex.names = 1.5)

length(mp)  #  [1] 20

--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] omit empty cells in crosstab?

2009-04-24 Thread Dieter Menne
sjaffe sjaffe at riskspan.com writes:

 
 I have data with many factors, each taking many values. However, only
 relatively few combinations appear in the data, ie have nonzero counts, in
 other words the resulting table is sparse. Say we have 10 factors each with
 10 levels. The result of table() would exceed the memory space (on a 32bit
 machine). Is there any way to produce a table with empty cells omitted?
 (without first producing the whole table and then removing rows.)

It would be easier if you had a reproducible base example, but I 
suggest to create ONE new factor of the pasted levels using unique(), 
and  creating a table of these.

Dieter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Invert Deviance Residuals

2009-04-24 Thread BillJones

I have a vector of deviance residuals, r, a vector of fitted values, yhat and
I need to solve for a vector of actuals, y.  The deviance residual formula
is r={2(c ln c - c + 1)}^1/2.  c=y/yhat.

Since this can't be solved in closed form, I believe that I should be able
to solve this numerically using a function like optim but I can't get my
head around how to setup the problem and looking at the examples for optim
it hasn't clicked for me.  Any help would be appreciated.  

I am using this result as part of a funtion to do non-parametric
bootstrapping of a glm to build a range around my parameter errors.  

Thanks.

Bill
-- 
View this message in context: 
http://www.nabble.com/Invert-Deviance-Residuals-tp23223703p23223703.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] omit empty cells in crosstab?

2009-04-24 Thread Peter Dalgaard

Dieter Menne wrote:

sjaffe sjaffe at riskspan.com writes:


I have data with many factors, each taking many values. However, only
relatively few combinations appear in the data, ie have nonzero counts, in
other words the resulting table is sparse. Say we have 10 factors each with
10 levels. The result of table() would exceed the memory space (on a 32bit
machine). Is there any way to produce a table with empty cells omitted?
(without first producing the whole table and then removing rows.)


It would be easier if you had a reproducible base example, but I 
suggest to create ONE new factor of the pasted levels using unique(), 
and  creating a table of these.


interaction(..., drop=TRUE) may be a neater way.

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Can't install package glmnet

2009-04-24 Thread Liang Zhang
I am just wondering how to solve this installation problem.

Thanks,
Liang





From: Uwe Ligges lig...@statistik.tu-dortmund.de

Cc: r-help@r-project.org
Sent: Friday, April 24, 2009 2:50:00 AM
Subject: Re: [R] Can't install package glmnet



Liang Zhang wrote:
 Hi, I was trying to install package glmnet in R, but failed and it show such 
 messages:
 
 * Installing *source* package glmnet ...
  This package has only been tested with gfortran.
  So some checks are needed.
  R_HOME is /home/username/R/R-2.9.0
 Attempting to determine R_ARCH...
 R_ARCH is
 Attempting to detect how R was configured for Fortran 90
 Unsupported Fortran 90 compiler or Fortran 90
[[elided Yahoo spam]]
 ERROR: configuration failed for package glmnet
 * Removing /home/username/R/R-2.9.0/library/glmnet
 
 The downloaded packages are in
 /tmp/RtmpwsLWSc/downloaded_packages
 Updating HTML index of packages in '.Library'
 Warning message:
 In install.packages(glmnet) :
   installation of package 'glmnet' had non-zero exit status
 
 
 It seems that it needs fortran 90 complier. What can I do to solve this 
 problem? (I am not the administrator, only a user in the linux system).

Ask for a suitable compiler?

Uwe Ligges




[[elided Yahoo spam]]
 Liang
 
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] saved workspace

2009-04-24 Thread bogdanno
I saved the workspace once and now it automatically restore it
whenever I open R
How can I turn off this?
Thank you

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] saved workspace

2009-04-24 Thread Sarah Goslee
Assuming you are starting R from a terminal window, you can use
R --no-restore
or change to a different directory first.

If you are starting R in some other fashion, it will depend on what you
are doing, a piece of information you neglected to provide (along with
OS, which could be relevant, and is requested regardless).

Sarah

On Fri, Apr 24, 2009 at 1:49 PM, bogdanno bodins...@gmail.com wrote:
 I saved the workspace once and now it automatically restore it
 whenever I open R
 How can I turn off this?
 Thank you

-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] font size relative to graphic

2009-04-24 Thread Mike Miller

On Fri, 24 Apr 2009, David Winsemius wrote:


On Apr 24, 2009, at 3:14 PM, Mike Miller wrote:

I am printing numbers onto horizontal bars in a bar plots, but I am 
finding it difficult to make the number always the right size.  If 
there are more bars, the bars get narrower and the font is too big.  I 
also find that if I change the size of the graph, the bars will get 
wider or narrower and the font stays about the same size.  The result 
depends on whether I view the graph in X11 or in postscript.


Is there a way to specify font size relative to bar width, or at least 
specify font size relative to graph coordinates?


Here's a bit of what I've been doing:

x.bar.plot - barplot(as.matrix(x), horiz=TRUE, beside=TRUE, xlim=c(0,100), 
xlab=Score, las=1)
text(as.matrix(x), x.bar.plot-.07, as.character(as.matrix(round(x))), pos=2, 
col=black)

The -.07 is something I added to make the numbers align well with the 
bars under one condition, but it doesn't always help.


Any tips would be greatly appreciated.  Thanks in advance.


The values returned from the barplot function are the locations of the 
bars. Why not call barplot, collect the values, and then use the length 
of the result to determine your sizes and widths?


That is exactly the kind of thing I want to do, but I don't know how the 
font size can be specified so that it fits.  My bars are horizontal and 
yours (from code below) are vertical.  Your barplot output was called mp 
and mine was called x.bar.plot and here is what they looked like:



mp

 [,1] [,2] [,3] [,4] [,5]
[1,]  1.5  6.5 11.5 16.5 21.5
[2,]  2.5  7.5 12.5 17.5 22.5
[3,]  3.5  8.5 13.5 18.5 23.5
[4,]  4.5  9.5 14.5 19.5 24.5


x.bar.plot

 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
[1,]  1.5  4.5  7.5 10.5 13.5 16.5 19.5 22.5 25.5  28.5  31.5  34.5
[2,]  2.5  5.5  8.5 11.5 14.5 17.5 20.5 23.5 26.5  29.5  32.5  35.5

They are pretty similar numbers.  It seems that [1,1] element is always 
1.5 and consecutive elements in the same column differ by 1.0, but in the 
rows we see something different: mine are 3.0 apart and yours are 5.0 
apart.  So what does this tell me?  I think fonts are specified in points 
which correspond to 1/72 inches, while bars are specified in coordinates 
that are independent of inches.  So I need to know how coordinates 
correspond to inches before I can get this fixed.


Mike


hh - t(VADeaths)[, 5:1]
mybarcol - gray20
mp - barplot(hh, beside = TRUE,
  col = c(lightblue, mistyrose,
  lightcyan, lavender),
  legend = colnames(VADeaths), ylim= c(0,100),
  main = Death Rates in Virginia, font.main = 4,
  sub = Faked upper 2*sigma error bars, col.sub = mybarcol,
  cex.names = 1.5)

length(mp)  #  [1] 20


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] omit empty cells in crosstab?

2009-04-24 Thread sjaffe

small example:

a-c(1.1, 2.1, 9.1)
b-cut(a,0:10)
c-data.frame(b,b)
d-table(c)
dim(d) 
##result: c(10, 10)

But only 9 of the 100 cells are non-zero.
If there were 10 columns, the table have 10 dimensions each of length 10, so
have 10^10 elements, too much even to fit in memory


Dieter Menne wrote:
 
 sjaffe sjaffe at riskspan.com writes:
 
 
 I have data with many factors, each taking many values. However, only
 relatively few combinations appear in the data, ie have nonzero counts,
 in
 other words the resulting table is sparse. Say we have 10 factors each
 with
 10 levels. The result of table() would exceed the memory space (on a
 32bit
 machine). Is there any way to produce a table with empty cells omitted?
 (without first producing the whole table and then removing rows.)
 
 It would be easier if you had a reproducible base example, but I 
 suggest to create ONE new factor of the pasted levels using unique(), 
 and  creating a table of these.
 
 Dieter
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/omit-empty-cells-in-crosstab--tp2363p23224071.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] update.packages(checkBuilt=TRUE) returns Error: invalid version specification NA in 2.9.0

2009-04-24 Thread Uwe Ligges
Just a guess: We had an issues with malformed PACKAGES files in the 
Windows repositories.


Maybe you are affected here.
Can you please try in 24 hours from now to do that again using the 
mirror in Austria.


If the problem persists, please let me know.

Thank you,
Uwe Ligges


peter_kel...@fws.gov wrote:


I installed R-2.9.0 yesterday, and followed the instructions in the R for
Windows FAQ, 2.8 What's the best way to upgrade?  It reads run
update.packages(checkBuilt=TRUE, ask=FALSE) in the new R and then delete
anything left of the old installation.  I did this but it returned an
error.  It's the checkBuilt=TRUE which causes it, though I don't know why:
leaving it out or changing it to checkBuilt=FALSE do not return errors.


update.packages(checkBuilt=TRUE, ask=FALSE)

--- Please select a CRAN mirror for use in this session ---
Error: invalid version specification NA


update.packages(checkBuilt=TRUE)

Error: invalid version specification NA

Peter Keller
Wildlife Biologist
Tetlin National Wildlife Refuge
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] saved workspace

2009-04-24 Thread David Winsemius
One could also move the file out of the R search path, or rename it  
with an extension that prevents R from seeing it.( Some operating  
systems may not allow you to see it in their default mode, however.)


--
David
On Apr 24, 2009, at 4:07 PM, Sarah Goslee wrote:


Assuming you are starting R from a terminal window, you can use
R --no-restore
or change to a different directory first.

If you are starting R in some other fashion, it will depend on what  
you

are doing, a piece of information you neglected to provide (along with
OS, which could be relevant, and is requested regardless).

Sarah

On Fri, Apr 24, 2009 at 1:49 PM, bogdanno bodins...@gmail.com wrote:

I saved the workspace once and now it automatically restore it
whenever I open R
How can I turn off this?
Thank you


--
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] rounding problem + sprintf

2009-04-24 Thread Wacek Kusnierczyk
Prof Brian Ripley wrote:
 I think your subject line should read 'Excel bug'.  From the R help
 for round()

  Note that for rounding off a 5, the IEC 60559 standard is expected
  to be used, '_go to the even digit_'.

 In case you did not recognize it, IEC 60559 is an international
 standard: Excel is not.

 R is Open Source and so you can modify it to emulate the bugs in other
 software: that is not one of the aims of its developers so please
 don't expect us to do so for you.

 It is rare for round() to be called explicitly in R code: rounding is
 usually going on inside print routines.  

besides noting that r is as much an international standard as excel,
here's an example of how the otherwise buggy sprintf (less so now,
thanks to martin's recent fixes) and other print routines let excel bugs
sneak into r:

(x = c(0.15, 0.25, 0.35, 0.45, 0.55, 0.65))

round(x, 1)
print(x, 1)
sprintf('%.1f', x)

?print and ?sprintf do not say anything about how rounding is done, but
given the above strong statement about standards, one would expect that
the ties-to-even mode is used.  apparently, round (the function) and the
print routines (sprintf and print) either operate in different rounding
modes, or read the input (the internal representation of numbers)
differently. 

not so surprisingly, sprintf in r reproduces the behaviour of sprintf in
c.  but would it be a good idea to blame c for excel bugs in r?

vQ

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] font size relative to graphic

2009-04-24 Thread David Winsemius


On Apr 24, 2009, at 4:10 PM, Mike Miller wrote:


On Fri, 24 Apr 2009, David Winsemius wrote:


On Apr 24, 2009, at 3:14 PM, Mike Miller wrote:

I am printing numbers onto horizontal bars in a bar plots, but I  
am finding it difficult to make the number always the right size.   
If there are more bars, the bars get narrower and the font is too  
big.  I also find that if I change the size of the graph, the bars  
will get wider or narrower and the font stays about the same  
size.  The result depends on whether I view the graph in X11 or in  
postscript.
Is there a way to specify font size relative to bar width, or at  
least specify font size relative to graph coordinates?

Here's a bit of what I've been doing:
x.bar.plot - barplot(as.matrix(x), horiz=TRUE, beside=TRUE,  
xlim=c(0,100), xlab=Score, las=1)
text(as.matrix(x), x.bar.plot-.07,  
as.character(as.matrix(round(x))), pos=2, col=black)
The -.07 is something I added to make the numbers align well  
with the bars under one condition, but it doesn't always help.

Any tips would be greatly appreciated.  Thanks in advance.


The values returned from the barplot function are the locations of  
the bars. Why not call barplot, collect the values, and then use  
the length of the result to determine your sizes and widths?


That is exactly the kind of thing I want to do, but I don't know how  
the font size can be specified so that it fits.  My bars are  
horizontal and yours (from code below) are vertical.  Your barplot  
output was called mp and mine was called x.bar.plot and here is  
what they looked like:



mp

[,1] [,2] [,3] [,4] [,5]
[1,]  1.5  6.5 11.5 16.5 21.5
[2,]  2.5  7.5 12.5 17.5 22.5
[3,]  3.5  8.5 13.5 18.5 23.5
[4,]  4.5  9.5 14.5 19.5 24.5


x.bar.plot

[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
[1,]  1.5  4.5  7.5 10.5 13.5 16.5 19.5 22.5 25.5  28.5  31.5  34.5
[2,]  2.5  5.5  8.5 11.5 14.5 17.5 20.5 23.5 26.5  29.5  32.5  35.5

They are pretty similar numbers.  It seems that [1,1] element is  
always 1.5 and consecutive elements in the same column differ by  
1.0, but in the rows we see something different: mine are 3.0 apart  
and yours are 5.0 apart.  So what does this tell me?  I think fonts  
are specified in points which correspond to 1/72 inches, while bars  
are specified in coordinates that are independent of inches.  So I  
need to know how coordinates correspond to inches before I can get  
this fixed.


They do not correspond to inches, but the the numeric scale of the  
values. Here is your plot with the numbers moved so they are to the  
right of the bar ends:


txt - 1.5  4.5  7.5 10.5 13.5 16.5 19.5 22.5 25.5  28.5  31.5  34.5
 2.5  5.5  8.5 11.5 14.5 17.5 20.5 23.5 26.5  29.5  32.5  35.5
x - read.table(textConnection(txt), header=FALSE)

x.bar.plot - barplot(as.matrix(x), horiz=TRUE, beside=TRUE,  
xlim=c(0,100), xlab=Score, las=1)
text(as.matrix(x+6), x.bar.plot-.07,  
as.character(as.matrix(round(x))), pos=2, col=black)


# the rounding is what makes the dissimilar bars labeled with the same  
numbers, ... yecch.


Haven't figured out what the requirements on sizing really are;  but  
here is an example you might play with:


text(as.matrix(x+6), x.bar.plot-.07,  
as.character(as.matrix(round(x))), pos=2, col=black,

cex= 24/length(as.matrix(x)))


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to custom the tick and type in bwplot

2009-04-24 Thread Deepayan Sarkar
On 4/24/09, David Winsemius dwinsem...@comcast.net wrote:

  On Apr 24, 2009, at 1:33 PM, Guanghong Zuo wrote:


  Dear R users
 
  I use bwplot to plot some figures.  There are two troubles:
 
  1. How to change the dot of the mean to a line, like the style in boxplot
 

  Sometimes you need to refer the the help page for panel.type of plot, in
 this case:
  ?panel.bwplot

  ... so the answer is now staring you in the face:
  bwplot(decrease ~ treatment, OrchardSprays, groups = rowpos, pch=|)


 
  2. How to hide some tick marks.  For example, I have seven tick: A, B, C,
 D,
  E, F, G,
but I want show four marks: A, C, E, G on the x-axis.
 

  Using the example in bwplot again, and a fair amount of fruitless
 experimentation with the theory that one could do anything useful with
 scales=list(at= list(something)), I finally ended up trying , labels=c( )
 per Sarkar's Lattice book, producing this:

  bwplot(decrease ~ treatment, OrchardSprays, groups = rowpos,
 scales=list(x=list( labels=c(A,,,D,,F,,)
 )))

or

bwplot(decrease ~ treatment, OrchardSprays, groups = rowpos, pch=|,
   scales = list(x = list(at = c(1, 3, 5, 7), labels = c(A, C,
E, G

or

bwplot(decrease ~ treatment, OrchardSprays, groups = rowpos, pch=|,
   xlim = c(A, , C, , E, , G))

-Deepayan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] power.t.test formula

2009-04-24 Thread Greg Snow
Look at the pwr package, it has functions for 2 samples of different sizes.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Karl Ove Hufthammer
 Sent: Friday, April 24, 2009 2:41 AM
 To: r-h...@stat.math.ethz.ch
 Subject: Re: [R] power.t.test formula
 
 Peter Dalgaard:
 
  Does anyone of you knows a reference for the formula used in
 power.t.test
  function? And also why it uses the Student's distribution instead of
  Normal. (I know both of them can be used but don't see whether
 choose one
  or the other)
 
  It is  a straightforward first-principles calculation. The t
  distribution calculation is exact for normally distributed data with
 the
  same unknown variance in both groups.
 
 I didn’t know about power.t.test. A very nice function, indeed. Is
 there a
 similar function that handles unequal number of observations for each
 group, and unequal variances?
 
 The help file mislead me into thinking that power.t.test handles
 unequal
 number of observations, and for example  ‘power.t.test(c(10,3),1)’
 *does*
 give some output (and not a warning or error), just not the output I
 was
 expecting.
 
 (It gives two power values, one for sample of size 10 (for each group)
 and
 one for samples of size 3 (for each group), while I was expecting the
 power
 for a sample size 10 for one group and 3 for the other group).
 
 --
 Karl Ove Hufthammer
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] issue building my own package... moving from Apple OS to Windows

2009-04-24 Thread Daryl Morris

Thanks for the various responses.

It was easier than I thought to get all the tools together and setup 
Windows paths for the build process.  I've been successful now on Windows.


BUT... how do I make a package which DOES NOT require R CMD INSTALL to 
install?  Obviously, it should not be required for everyone to have Perl 
on their Windows box to install a package.


When I tried to install the .tar.gz file from the GUI, I got the same 
errors as I did when I used the version I had built on my Apple. 


Error in gzfile(file,r) : cannot open the connection
In addition: Warning messages:
1: In unzip(zipname, exdir=dest) :error 1 in extracting from zip file
2: In gzfile(file,r):
cannot open compressed file 
'multgeneriskpredperf_1.0.tar.gz/DESCRIPTION', probable reason 'No such 
file or directory'


Thanks, Daryl


Uwe Ligges wrote:


You need to INSTALL a source package (that has been build) as on any 
other platform. How to colect the tools in order to make R CMD INSTALL 
work under Windows (and other OSs) is described in the R Installation 
and Administration manual.


Best,
Uwe Ligges



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


  1   2   >