Re: [R] Normality tests

2007-08-04 Thread Tobias Verbeke
Hi Alexandre,

Alexandre Christie wrote:
 
 I am new to R, and I am writing to seek your advice on how best to use it to 
 run
 R's various normality tests in an automated way.
 
 In a nutshell, my situation is as follows. I work in an investment bank, and 
 my
 team and I are concerned that the assumption we make in our models that the
 returns of assets are normally distributed may not be justified for certain
 asset classes. We are keen to check this statistically.
 
 To this end, we have an Excel document which contains historical data on the
 returns of the asset classes we want to investigate, and we would like to run
 R's multiple normality tests on these data to check whether any asset classes
 are flagged up as being statistically non-normal.
 
 I see from the R documentation that there are several R commands to test for
 this, but is it possible to progamme a tool which can (i) convert the Excel 
 data
 into a format which R can read, then (ii) run all the relevant tests from R,
 then (iii) compare the results (such as the p-values) with a user-defined
 benchmark, and (iv) output a file which shows for each asset class, which 
 tests
 reveal that the null hypothesis of normality is rejected?

The short answer is `yes, this is perfectly possible' by putting all
the pieces in an R script file and sourcing it or processing it in
batch mode.

ad (i): there are several ways of accessing Excel files.
Using RODBC is one of them. Section 8 of the R
Data Import / Export gives an overview of all options.



ad (ii): this is a matter of conducting the tests and storing
the test results in appropriate data structure

ad (iii): straightforward

ad (iv): you did not specify

 
 My team and I would be very grateful for your advice on this.
 
 Yours sincerely,
 
 Alex.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 


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


Re: [R] Normality tests

2007-08-04 Thread Tobias Verbeke
I'm sorry, I pressed a wrong button and
sent an incomplete answer. Below follows
the completed e-mail.

 I am new to R, and I am writing to seek your advice on how best to use it to 
 run
 R's various normality tests in an automated way.
 
 In a nutshell, my situation is as follows. I work in an investment bank, and 
 my
 team and I are concerned that the assumption we make in our models that the
 returns of assets are normally distributed may not be justified for certain
 asset classes. We are keen to check this statistically.
 
 To this end, we have an Excel document which contains historical data on the
 returns of the asset classes we want to investigate, and we would like to run
 R's multiple normality tests on these data to check whether any asset classes
 are flagged up as being statistically non-normal.
 
 I see from the R documentation that there are several R commands to test for
 this, but is it possible to progamme a tool which can (i) convert the Excel 
 data
 into a format which R can read, then (ii) run all the relevant tests from R,
 then (iii) compare the results (such as the p-values) with a user-defined
 benchmark, and (iv) output a file which shows for each asset class, which 
 tests
 reveal that the null hypothesis of normality is rejected?

The short answer is `yes, this is perfectly possible' by putting all
the pieces in an R script file and sourcing it or processing it in
batch mode.

ad (i): there are several ways of accessing Excel files.
 Using RODBC is one of them. Section 8 of the R
 Data Import / Export gives an overview of all options.

http://cran.r-project.org/doc/manuals/R-data.html#Reading-Excel-spreadsheets

Here's a simple example for RODBC:

library(RODBC)
z - odbcConnectExcel(rexceltest.xls)
dd - sqlFetch(z, Sheet1)
close(z)


ad (ii): this is a matter of conducting the tests and storing
 (what you would like to keep from) the test results in an
 appropriate data structure.

ad (iii): should be straightforward as well.

ad (iv): you did not specify the output format, but R could
write to a.o. a text file, an HTML file, a LaTeX file
and if needed an Excel file. Relevant packages include
xtable, R2HTML and rcom.



HTH,
Tobias

P.S. It is always a good idea to define small functions for each step in
the process and then use these in the function definition of one big 
function that would be something like

checkAssetNormality(file = myassets.xls, otherarg1, otherarg2,
 outfile = res_myassets.html,
 outdir = .)

P.P.S. R has very neat and powerful graphical capabilities. It is
quite easy to rapidly produce large grids of QQ-plots for
all the assets concerned. This would give you additional
information about the nature of the deviation from normality.


 My team and I would be very grateful for your advice on this.
 
 Yours sincerely,
 
 Alex.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 


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


Re: [R] beta regressions in R

2007-07-30 Thread Tobias Verbeke
Walter R. Paczkowski wrote:

Good morning,
Does anyone know of a package or function to do a beta regression?

http://cran.r-project.org/src/contrib/Descriptions/betareg.html

HTH,
Tobias

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] R equivalent to Matlab's Bayes net toolbox

2007-07-17 Thread Tobias Verbeke
Søren Højsgaard wrote:
 Jose,
 I am not entirely sure what Matlabs Bayes net toolbox does, but I guess it 
 implements as propagation algorithm for Bayesian networks. There is no such 
 package on CRAN - yet - but there will be soon: I've created a package called 
 gRbayesnet which implements the Lauritzen-Spiegelhalter propagation 
 algorithm. I expect to upload it to CRAN within the next few days. 

An alternative could be to extend the current R-Weka interface
from Kurt Hornik et alii

http://cran.r-project.org/src/contrib/Descriptions/RWeka.html

to include as well an interface to the Weka Bayes net package
described at

http://downloads.sourceforge.net/weka/BayesianNetClassifiers-3.5.6.pdf

library(RWeka)
?list_Weka_interfaces

describes how to register new interfaces.

HTH,
Tobias

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] Complex surveys, properly computed SEs and non-parametric analyses

2007-07-15 Thread Tobias Verbeke
Dear John,

 Can someone direct me to an R function that properly computes standard errors 
 of data obtained from 
  a complex survery design i.e. perform alnalyses similiar to those 
that can be performed with SUDAAN,
  articularly for a non-parametric one-way ANOVA, e.g. signed rank test?

The survey package of Thomas Lumley has very broad functionality for the 
analysis of data from complex sampling designs. Please find below the 
homepage of the package (which is available on CRAN):

http://faculty.washington.edu/tlumley/survey/

I don't think non-parametric one-way ANOVA is implemented, but
quoting

http://faculty.washington.edu/tlumley/survey/survey-wss.pdf

slide 101:

Many features of the survey package result from requests from
unsatisfied users.

For new methods the most important information is a reference
that gives sufficient detail for implementation. A data set is nice
but not critical.

HTH,
Tobias

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] package with roc, sensitivity, specificity, kappa etc

2007-07-01 Thread Tobias Verbeke
Fredrik Lundgren wrote:
 Dear Guru's,
 
 Is there a package (R of course) with programs for diagnostics - roc, 
 sens , spec, kappa etc?

Your question is not very specific, but
you might have a look at the ROCR package
for visualizing classifier performance.

http://cran.r-project.org/src/contrib/Descriptions/ROCR.html

HTH,
Tobias

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] \include-mechanism in Sweave?

2007-06-29 Thread Tobias Verbeke
Dietrich Trenkler wrote:
 Dear HelpeRs,
 
 I'm very fond of Sweave and I use it as often as possible.  It'a a pity
 I can't use it for larger projects or can I?
 
 For instance suppose I have three files file1.rnw, file2.rnw and
 file3.rnw with Sweave code.  Working on file2.rnw I whould like to
 exclude file1.rnw and file3.rnw temporarily and joining all of them
 later.  This amounts to a mechanism similar to using LaTeX's \include
 command.  *Is* there a way to achieve that?


\SweaveInclude{} lets you do just that.

HTH,
Tobias

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] \include-mechanism in Sweave?

2007-06-29 Thread Tobias Verbeke
Tobias Verbeke wrote:
 Dietrich Trenkler wrote:
 Dear HelpeRs,

 I'm very fond of Sweave and I use it as often as possible.  It'a a pity
 I can't use it for larger projects or can I?

 For instance suppose I have three files file1.rnw, file2.rnw and
 file3.rnw with Sweave code.  Working on file2.rnw I whould like to
 exclude file1.rnw and file3.rnw temporarily and joining all of them
 later.  This amounts to a mechanism similar to using LaTeX's \include
 command.  *Is* there a way to achieve that?
 
 
 \SweaveInclude{} lets you do just that.

Oops. \SweaveInput{}

Sorry,
Tobias

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] cbind

2007-06-29 Thread Tobias Verbeke
livia wrote:

 Hi, I have a series of return data, a and b are factors. I would like to
 build a matrix which contains each vector of returns. I am thinking about
 something as following, but I guess there should be a sensible way of doing
 this. 
 
 returns - split(return, list(regimef, assetf))
 cbind(returns[[1]], returns[[2]],...,returns[[n]])

Does

do.call(cbind, returns)

do what you want ?

HTH,
Tobias

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] : regular expressions: escaping a dot

2007-06-28 Thread Tobias Verbeke
Wolfram Fischer wrote:

 What's really the problem with:
 
 regexpr( '\.odt$', Yodt, perl=TRUE )
   Warning: '\.' is an unrecognized escape in a character string
   Warning: unrecognized escape removed from \.odt$
   [1] 5
   attr(,match.length)
   [1] 4
 
 I know that I could use:
 regexpr( '[.]odt$', Yodt, perl=TRUE )
 
 But it seems to me that the first expression is also
 an accepted regular expression in accordance with perl.

In R you have to escape the \.

 From the help page of regexpr:

## Double all 'a' or 'b's;  \ must be escaped, i.e., 'doubled'
gsub(([ab]), \\1_\\1_, abc and ABC)

HTH,
Tobias

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] R logistic regression - comparison with SPSS

2007-06-10 Thread Tobias Verbeke
Alain Reymond wrote:

 Dear R-list members,
 
 I have been a user of SPSS for a few years and quite new to R. I read
 the documentation and tried samples but I have some problems to obtain
 results for a logistic regression under R.
 
 The following SPSS script
 
 LOGISTIC REGRESSION  vir
 /METHOD = FSTEP(LR) d007 d008 d009 d010 d011 d012 d013 d014 d015
 d016 d017 d018 d069 d072 d073
 /SAVE = PRED COOK SRESID
 /CLASSPLOT
 /PRINT = GOODFIT CI(95)
 /CRITERIA = PIN(.10) POUT(.10) ITERATE(40) CUT(.5) .
 
 predicts vir (value 0 or 1) according to my parameters d007 to d073. It
 gives me the parameters to retain in the logistic equation and the
 intercept.
 The calculation is made from a set of values of about 1.000 cases.
 
 I have been unable to translate it with success under R. I would like to
 check if I can obtain the same results than with SPSS. Can someone help
 me translate it under R ? I would be most grateful.

If all the variables you mention are available in a data frame, e.g. 
virdf, than you can fit a logistic regression model by

mymodel - glm(vir ~ d007 + d008 + d009 + d010 + d011 + d012 + d013 + 
d014 + d015 + d016 + d017 + d018 + d069 + d072 + d073, data = virdf, 
family = binomial)

or

mymodel - glm(vir ~ ., data = virdf, family = binomial)

if there are no variables other than those mentioned above in the
virdf data frame.

Contrary to SPSS you need not specify in advance what you would like
as output. Everything useful is stored in the model object (here: 
mymodel) which can then be used to further investigate the model in
many ways:

summary(mymodel)
anova(mymodel, test = Chisq)
plot(mymodel)

See ?summary.glm, ?anova.glm etc.

For stepwise variable selection (not necessarily corresponding to
STEP(LR)), see ?step or ?add1 to do it `by hand'.

HTH,
Tobias

P.S. You can find an introduction to R specifically targeted at (SAS 
and) SPSS users here:

http://oit.utk.edu/scc/RforSASSPSSusers.pdf

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] new data frame for loop

2007-06-07 Thread Tobias Verbeke
Hi Emily,

Emily Broccoli wrote:

 I have a data frame with three columns, one coded as a factor. I would like
 to separate my data out into separate data frames according to the factor
 level. Below is a simple example to illustrate. I can get R to return the
 data in the correct format but cannot work out how to get separate data
 frames. I am a newcommer to programming in R so am not sure what I am
 missing! Thanks, Emily
 
 a-seq(1,20, by=2)
 b-seq(1,30, by=3)
 ID-as.factor(c(1,1,1,2,2,2,3,3,3,3))
 df-data.frame(a,b,ID)

The function split will give you a list
of data frames split according to a factor:

  split(df, df$ID)
$`1`
   a b ID
1 1 1  1
2 3 4  1
3 5 7  1

$`2`
a  b ID
4  7 10  2
5  9 13  2
6 11 16  2

$`3`
 a  b ID
7  13 19  3
8  15 22  3
9  17 25  3
10 19 28  3

See ?split.

HTH,
Tobias

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] Subscript in axis label

2007-06-03 Thread Tobias Verbeke
[EMAIL PROTECTED] wrote:
 Dear R help list members,
 
 I am experiencing difficulty in trying to generate a subscript '2' in an 
 axis label. Although I can get the '2' into a subscript using expression(), 
 R then forces me to leave at least one space between the '2' and the 
 following character. My label is supposed to read 'N2O concentration 
 (ppm)', and the space between the '2' and the 'O' makes it look rather 
 inelegant! My code is the following (the comments in it are there to stop 
 me forgetting what I have done, I am new to R):
 
 postscript(file=/Users/patrickmartin/Documents/York Innova 
 Precision/N2Oinnova.eps, horizontal=FALSE, onefile=FALSE, height=4, 
 width=5, pointsize=10)
 plot(n2o, lty=0, las=1, xlab=Time, ylab=expression(N[2]~O 
 concentration (ppm))) points(n2o, pch=16) # suppresses line but adds 
 points dev.off() # turns postscript device off again

Is this better

plot(1:10, ylab = expression(paste(N[2],O concentration (ppm),
  sep = )))

?

HTH,
Tobias

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] specify font family for postscript device [was: Re: Subscript in axis label]

2007-06-03 Thread Tobias Verbeke
[EMAIL PROTECTED] wrote:

 Dear R help list members,

snip

 A related query is that the journal I want to publish this figure in 
 specifies that if EPS format is used, the font should be either Arial, 
 Courier, Helvetica, Times or Symbol. Is one of these the default font for 
 an EPS file in R, and if not, is there a possibility of changing it?

See ?postscript and in particular the family argument the details of
which are treated in the Families section.

HTH,
Tobias

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] Excel calling R functions

2007-06-01 Thread Tobias Verbeke
Marc Schwartz wrote:
 On Fri, 2007-06-01 at 08:50 -0700, Horace Tso wrote:
 Hi folks,

 Is it possible to have Excel call a R function. If not, how about
 making Excel send off a command to call a R script and then read the
 result back into Excel.

 I know, I know, this should belong to some Excel forum, but i just try
 my luck here.

 Thanks in advance.

 Horace W. Tso
 
 
 See the R-Excel add-in linked from here:
 
   http://www.sciviews.org/_rgui/projects/RDcom.html
 

Some of the files listed in the link on that page appear
to be quite outdated. The following link brings you to
the current portal of the R(D)COM server and the
rcom package.

http://sunsite.univie.ac.at/rcom/

See the Excel heading for your question. You might be
interested as well by the recent OpenOffice.org plugin
(heading OOo).

HTH,
Tobias

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] (no subject)

2007-05-19 Thread Tobias Verbeke
Hi,

Iasonas Lamprianou wrote:

 does anyone know how we can 'control' R from Visual Studio .NET? e.g. start 
 R, send a set of commands, save the results and open the results using Visual 
 Studio.


I'm not too familiar with Visual Studio .NET, but on Windows one can use
R as a (D)COM Server Application, the use of which could pretty much
correspond to the description you gave.

See

http://sunsite.univie.ac.at/rcom/

for one implementation. The binary you will need is at

http://sunsite.univie.ac.at/rcom/download/current/RSrv250_pl1.exe

There is a dedicated mailing list searchable from the given website.

HTH,
Tobias

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] rJava problem

2007-05-17 Thread Tobias Verbeke
mister_bluesman wrote:
 Could someone please tell me where I can find a simple example, which does
 not require linux!, on how I can see if this is working and get me started
 using rJava. I have read the document 'Getting Started with the
 R-Java/Omegahat Interface' and have tried to type in things such as
 .JavaConstructor(JButton, A button) in the R console after loading
 library(rJava). However i keep getting the error: 

 Error: could not find function .JavaConstructor
   
This function is not part of rJava; cf.

   library(help = rJava)

On the home page of rJava

   http://www.rforge.net/rJava/

there are very simple examples that can get you started.

HTH,
Tobias

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] Suggestions for statistical computing course

2007-04-20 Thread Tobias Verbeke
Giovanni Petris wrote:
 Dear R-helpers,

 I am planning a course on Statistical Computing and Computational
 Statistics for the Fall semester, aimed at first year Masters students
 in Statistics. Among the topics that I would like to cover are linear
 algebra related to least squares calculations, optimization and
 root-finding, numerical integration, Monte Carlo methods (possibly
 including MCMC), bootstrap, smoothing and nonparametric density
 estimation. Needless to say, the software I will be using is R.

 1. Does anybody have a suggestion about a book to follow that covers
(most of) the topics above at a reasonable revel for my audience? 
Are there any on-line publicly-available manuals, lecture notes,
instructional documents that may be useful?
   
The course notes for `Advanced Statistical Computing' by Robert Gray 
covers much of
the topics you mentioned and is interspersed with R (1.4.0) code.

http://www.stat.wisc.edu/~mchung/teaching/stat471/stat_computing.pdf

HTH,
Tobias

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] string edit distance

2007-04-07 Thread Tobias Verbeke
Thomas Hills wrote:
 I have a column of words, for example

 DOG
 DOOG
 GOD
 GOOD
 DOOR
 ...

 and I am interested in creating a matrix that contains the string  
 edit distances between each pair of words.  I am this close  - '  '   
 -   to writing the algorithm myself (which will allow for different  
 variations on the string edit rules, indels, plus or minus  
 transpositions, and possibly some variations on that), but I figured  
 I'd see if anyone on the list has any experience with this and might  
 already have some shoulders for me to stand on.
   
See

http://wiki.r-project.org/rwiki/doku.php?id=tips:data-strings:levenshtein
for some R code which might be useful.

HTH,
Tobias

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] package for Matlab

2007-04-05 Thread Tobias Verbeke
Schmitt, Corinna wrote:
 Hallo,

 does a package for Matlab exist in R?
   
To read and write MAT files, there is the R.matlab package:

http://cran.r-project.org/src/contrib/Descriptions/R.matlab.html

This package also enables bidirectional communication
between R and Matlab.

An alternative package with similar functionality (but not on CRAN
and according to its home page not yet functional on platforms other
than UNIX) is RMatlab

http://www.omegahat.org/RMatlab/

To ease translation of Matlab code, there is the matlab package:

http://cran.r-project.org/src/contrib/Descriptions/matlab.html

HTH,
Tobias
 If yes, where can I find it and how can I install it under R?

 Thanks, Corinna

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


   

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] Horvitz Thompson Variance

2007-03-03 Thread Tobias Verbeke
Gen wrote:
 I am performing linear regression R and would like to incorporate sampling
 weights.  
   

There is a survey package for the analysis of data from complex sample 
designs
of which svyglm might fit your purposes.

For the home page of the package (with lots of materials), see
http://faculty.washington.edu/tlumley/survey/

HTH,
Tobias

 Does any one know how to obtain Horvitz-Thompson variance estimates when
 performing linear regression?
 Thank you for your help.
   

-- 

Tobias Verbeke - Consultant
Business  Decision Benelux
Rue de la révolution 8
1000 Brussels - BELGIUM

+32 499 36 33 15
[EMAIL PROTECTED]

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


Re: [R] SNA Matrix

2007-01-02 Thread Tobias Verbeke
Salvaj, Erica wrote:
 Hello
  
 I export a one mode network from Pajek to R, and the former made an .r file  
 called PajekR.r, that is actually an script to be run in R
 The problem is that what the file actually does is to set a 0 martrix and 
 then assing to each pair of nodes the corresponding values. Since the matrix 
 is huge (10.000 nodes) a copy/paste procedure is very time consuming, and I 
 guess pretty inefficient. So the question is: are there any way to read 
 directly the .r file in R, without copy and paste the sentences of the script 
 in the R console?
   

The command you are looking for is source.

If PajekR.r resides in your working directory, it
is as easy as

source(PajekR.r)

Otherwise replace PajekR.r with the full path to this file.

An other option would be

source(choose.files())

which fires up a GUI that lets you browse for the file.

HTH,
Tobias
  
 Erica H. Salvaj
 PhD Candidate
 IESE Business School
 [EMAIL PROTECTED]
  


 This message has been scanned for viruses by TRENDMICRO,\ an...{{dropped}}

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




__
R-help@stat.math.ethz.ch 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] R2HTML: request for an extended example

2006-08-09 Thread Tobias Verbeke
Michael Kubovy wrote:
 Dear R-helpers,

 If you know of an extended example of the use of R2HTML, in which the  
 various constructs are present in one place, could you please point  
 me to it or send it to me?
   
There was an article in the R News of December 2003

http://cran.r-project.org/doc/Rnews/

HTH,
Tobias

 _
 Professor Michael Kubovy
 University of Virginia
 Department of Psychology
 USPS: P.O.Box 400400Charlottesville, VA 22904-4400
 Parcels:Room 102Gilmer Hall
  McCormick RoadCharlottesville, VA 22903
 Office:B011+1-434-982-4729
 Lab:B019+1-434-982-4751
 Fax:+1-434-982-4766
 WWW:http://www.people.virginia.edu/~mk9y/

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




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


Re: [R] R2HTML: request for an extended example

2006-08-09 Thread Tobias Verbeke
Michael Kubovy wrote:
 On Aug 9, 2006, at 9:23 AM, Tobias Verbeke wrote:
 Michael Kubovy wrote:
 Dear R-helpers,

 If you know of an extended example of the use of R2HTML, in which 
 the  various constructs are present in one place, could you please 
 point  me to it or send it to me?

 There was an article in the R News of December 2003

 http://cran.r-project.org/doc/Rnews/

 Thanks, Tobias. That's just what I needed.

 I ran into a small problem: when I run the following, the HTML is 
 missing some kind of icon at the top. Any ideas how to fix that?

  HTMLStart(outdir = file.path(/Users, mk, Documents, teach, 
 '2006.3.PSYC712'), echo = T, HTMLframe = F, Title = 'John Doe HW 1')

 *** Output redirected to directory:  
 /Users/mk/Documents/teach/2006.3.PSYC712
 *** Use HTMLStop() to end redirection.[1] TRUE
 HTML as.title(This is my first title)
 [1] This is my first title
 attr(,class)
 [1] title
 HTML x - 1
 HTML y- 2
 HTML x+y
 [1] 3
 HTML HTMLStop()
 [1] /Users/mk/Documents/teach/2006.3.PSYC712/index.html
I adapted your code to my situation (using R2HTML 1.57 on
R 2.3.1 under GNU/Linux and Firefox 1.5.0.4 to open the
resulting HTML file) and did not notice a missing icon.

What browser do you use ?

library(R2HTML)
HTMLStart(outdir = file.path(/home, tobias, R, packages, R2HTML),
   # mind the TRUE instead of T and the FALSE instead of F
   echo = TRUE, HTMLframe = FALSE, Title = John Doe HW 1)
as.title(This is my first title)
x - 1
y - 2
x + y
HTMLStop()

--Tobias

PS page source code obtained:

html xmlns:mml=http://www.w3.org/1998/Math/MathML;
head
title John Doe HW 1 /title
link rel=stylesheet href=R2HTML.css type=text/css
object id=mathplayer 
classid=clsid:32F66A20-7614-11D4-BD11-00104BD3F987/object
?import namespace=mml implementation=#mathplayer?
script type=text/javascript src=ASCIIMathML.js/script
link href=./runtime/styles/xp/grid.css rel=stylesheet type=text/css 
/link
link href=gridR2HTML.css rel=stylesheet type=text/css /link

script src=./runtime/lib/grid.js/script

script src=./gridR2HTML.js/script

script
   nequations=0;
/script
/head
body onload=translate() bgcolor= FF background= 
a name=Num2nbsp;/apxmp class=command as.title(This is my first 
title)/xmp/p
 h2  This is my first title/h2
a name=Num3nbsp;/apxmp class=command x - 1/xmp/p
a name=Num4nbsp;/apxmp class=command y - 2/xmp/p
a name=Num5nbsp;/apxmp class=command x + y/xmp/pp 
class='numeric'3/p

hr size=1
font size=-1
 Generated on: IWed Aug  9 21:29:45 2006/i - bR2HTML/b 
hr size=1
/body
/html

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


Re: [R] Non-metric Multidimensional Scaling in R

2006-07-27 Thread Tobias Verbeke
[EMAIL PROTECTED] wrote:
 Hi,

 I don't think my first email worked, so here it is again.

 I'd like to know if there is a nonmetric MDS function or package for R.  I've 
 beening trying to do a problem in Stata but I'm going crazy with it.  A 
 simple problem is becoming difficult so maybe R can help.  Any suggestions?
   
library(MASS)
?isoMDS

HTH,
Tobias
 Walt Paczkowski

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




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


Re: [R] Export to LaTeX

2006-07-14 Thread Tobias Verbeke
Mag. Ferri Leberl wrote:
 Dear Everybody!
 I want to export data to LaTeX. As I want to employ the data as freely as 
 possible I want to avoid the xtable-command and instead generate some List 
 like

 \MyOwnPrettyCommand{Adam}{Auer}{17}
 \MyOwnPrettyCommand{Bertram}{Bauer}{14}
 \MyOwnPrettyCommand{Christoph}{Huber}{75}
 \MyOwnPrettyCommand{Damian}{Dorfer}{69}
 \MyOwnPrettyCommand{Emanuel}{Eder}{43}

 with \MyOwnPrittyCommand defined elsewhere.
 As a pitty, if I make up about such a table in r, lets call it A, and use 
 the commands

 sink(tabelle.tex)
 A
 sink(anderedatei)

 tabelle.tex will look like this:

  [,1]  [,2][,3] [,4] [,5] [,6] [,7]
 [1,] MyOwnPrettyCommand{ Adam  }{ Auer   }{ 17 } 
 [2,] MyOwnPrettyCommand{ Bertram   }{ Bauer  }{ 14 } 
 [3,] MyOwnPrettyCommand{ Christoph }{ Huber  }{ 75 } 
 [4,] MyOwnPrettyCommand{ Damian}{ Dorfer }{ 69 } 
 [5,] MyOwnPrettyCommand{ Emanuel   }{ Eder   }{ 43 } 

 So my question is how to export the data properly, without line-indices, 
 without quotes but WITH backslashes.
   
mydf - as.data.frame(
  rbind(c(Adam,  Auer,   17),
  c(Bertram,   Bauer,  14),
  c(Christoph, Huber,  75),
  c(Damian,Dorfer, 69),
  c(Emanuel,   Eder,   43))
  )
cat(
paste(\\MyCommand{, mydf[,V1], }{, mydf[,V2], }{, 
mydf[,V3], },
  sep =, collapse = \n)
, file = tabelle.tex)

HTH,
Tobias
 Thank you in advance.
 Yours,
 Mag. Ferri Leberl

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




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


Re: [R] general linear model and generalized linear model

2006-07-01 Thread Tobias Verbeke
- Oorspronkelijk bericht -
Van: zhijie zhang [mailto:[EMAIL PROTECTED]
Verzonden: zaterdag, juli 1, 2006 08:50 AM
Aan: r-help@stat.math.ethz.ch
Onderwerp: [R] general linear model and generalized linear model

Dear friends,
  I searched the R site and found a lot of results on general linear model
and generalized linear model , and i was confused by them. Here, I only want
to get some concise answers on the following questions and i'll study it by
your hints:
 1. Which function(package) could be used to fit the general linear model ?

Function lm from the stats package (which comes with R).
See ?lm

2. Which function(package) could be used to fit the generalized linear model
?

Function glm from the stats package.
See ?glm

Chapter 11 of `An Introduction to R' (which comes with R and 
is available on CRAN) is devoted to statistical models in R
and has sections on linear models and generalized linear models.
Cf. http://cran.r-project.org/manuals.html

3. How to tell them which variables in my dataset are categorical variables
that will be used as dummy variables?

You should (only) make sure these variables are so-called factors 
(which is the way R represents categorical variables). 
Chapter 4 of `An Introduction to R' is entirely devoted to factors.

HTH,
Tobias

Thanks very much!


-- 
Kind Regards,
Zhi Jie,Zhang ,PHD
Department of Epidemiology
School of Public Health
Fudan University
Tel:86-21-54237149

   [[alternative HTML version deleted]]

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



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


Re: [R] Time delay function or plot animation

2005-12-12 Thread Tobias Verbeke
Ulrike Grömping wrote:

is it possible to specify a time delay for plotting the points in a curve? I 
would like to make the plotting process slow enough to show the development 
of the graph, and therefore I am looking either for the possibility within 
the plot function to specify a plotting speed or (if that doesn't exist) for 
a function like pause or wait that allows to specify a time delay until 
the next statement is executed. I have searched help and mailing list 
archives, but I don't seem to look for the right keywords. My current 
solution is very crude:

I add the following to an existing plot:

for (i in 1:steps) 
{ 
lines(x[i:(i+1)], y[i:(i+1)]) 
   #calculations with the sole purpose of generating a time delay 
   zoeger-1 
   for (j in 1:85000) 
   {zoeger-zoeger*j} 
}

Is there a better way to achieve this?
  

See ?Sys.sleep

HTH,
Tobias

Regards, Ulrike

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


  


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


Re: [R] Maintaining factors when copying from one data frame to another

2005-12-07 Thread Tobias Verbeke
Kurt Wollenberg wrote:

Greetings all:

OK, this is bugging the @[EMAIL PROTECTED] out of me. I know the answer is 
simple
and straightforward but for the life of me I cannot find it in the
documentation, in the archives, or in my notes (because I know I've
encountered this in the past). My problem is:

I have a data frame with columns A, B, C, D, and E. A, B, and E are
factors and C and D are numeric. I need a new data frame with just A,
C, and D. When I copy these columns to a new data frame

  

newDF - data.frame(cbind(oldDF$A, oldDF$C, oldDF$D))



all the factor data comes out as levels rather than the original
factors. How do I preserve the factors when I copy from one data frame
to another?

  

The following may be better:

newDF - subset(oldDF, select = c(A, C, D))

HTH,
Tobias

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


Re: [R] Element-by-element multiplication operator?

2005-11-09 Thread Tobias Verbeke
Gates, Michael BGI SF wrote:

Is there an element-by-element multiplication in R, like the .* operator in 
Matlab?

eg: A (2x3)
 B (2x3) 
C=A.*B
C (2x3)
C = [[a11*b11  a12*b12  a13*b13]; [a21*b21  a22*b22  a23*b23]]

I can't find one...
  

mym - matrix(1:4,2)
myt - matrix(5:8,2)

  mym
 [,1] [,2]
[1,]13
[2,]24
  myt
 [,1] [,2]
[1,]57
[2,]68
  mym * myt
 [,1] [,2]
[1,]5   21
[2,]   12   32

HTH,
Tobias

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


Re: [R] getting last 2 charcters of a string, other text functions?

2005-10-31 Thread Tobias Verbeke
t c wrote:

I wish to obtain the right-most n characters of a character string?  What is 
the appropriate function?
  

You could make one yourself:

rightmostn - function(x, n){
  res - substr(x, nchar(x)-n+1, nchar(x))
  return(res)
}
magic - hocuspocus
rightmostn(magic, 5)
[1] pocus

HTH,
Tobias


   
-

   [[alternative HTML version deleted]]

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


  


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


Re: [R] R and Data Storage

2005-10-01 Thread Tobias Verbeke
[EMAIL PROTECTED] wrote:

Where I work a lot of people end up using Excel spreadsheets for storing
data. This has limitations and maybe some less than obvious problems. I'd
like to recommend a uniform way for storing and archiving data collected
in the department. Most of the data could be stored in simple csv type
files but it would be nice to have something that stores more information
about the variables and units. netcdf seems like overkill (and not easy
for casual users). Same for postgres and mysql databases. Could someone
recommend some system for storing relatively small data sets (50-100
variables, 1000 records) that would be reliable, safe, and easy for
people to view and edit their data that works nicely with R and is open
source? Am I asking for the moon?
  

Would the StatDataML format meet your needs ?
It is open, XML-based, stores variable
types and works nicely with R (as R wizards designed
StatDataML and the corresponding R package).

See
http://cran.r-project.org/src/contrib/Descriptions/StatDataML.html
or
http://www.omegahat.org/StatDataML/

HTH,
Tobias

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


Re: [R] How to merge two strings

2005-08-16 Thread Tobias Verbeke
Claus Hindsgaul wrote:

Hi r-help,

A very simple question for which I have not been able to find an answer
in the docs:

   How can I merge two character strings?

I am searching for the equivalent of the (non-existing) stringmerge
function illustrated below:

  

s1 - R-
s2 - project
stringmerge(s1,s2)


[1] R-project
  


Claus

  

paste(s1, s2, sep = )

HTH,
Tobias

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


Re: [R] is there material about Longitudinal Data Analysis with R?

2005-05-31 Thread Tobias Verbeke
On Wed, 01 Jun 2005 00:04:22 +0800
ronggui [EMAIL PROTECTED] wrote:

 i am studying Longitudinal Data Analysis and want to carry it with R.anyone 
 knows  any materials about Longitudinal Data Analysis with R in the internet 
 which i can download?

You may have a look at

http://www.ats.ucla.edu/stat/examples/alda.htm

or

http://research.bus.wisc.edu/jfrees/Book/PDataBook.htm

HTH,
Tobias


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


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


Re: [R] Books on survival analysis and R/S

2005-03-24 Thread Tobias Verbeke

- Oorspronkelijk bericht -
Van
: Göran Broström [mailto:[EMAIL PROTECTED]
Verzonden
: donderdag
, maart
 24, 2005 10:40 AM
Aan
: r-help@stat.math.ethz.ch
Onderwerp
: [R] Books on survival analysis and R/S

I will be giving a course in survival analysis using R (of course!) for
people who know nothing about the subject (including R), but know basic
statistics. I'm looking for a suitable course book. Therneau  Grambsch
(2000) is an excellent book, but too much for this course. I need somthing
more elementary. 

I have a vague memory saying that such books exist, but I cannot find any
for the moment. Any suggestions are welcome.

Tableman, Kim  Portnoy,
Survival Analysis using S,
Chapman  Hall, 2003

Here's a review: 
http://www.jstatsoft.org/v11/b05/v11b05.pdf

HTH,
Tobias

Thanks,

Göran 
-- 
 Göran Broströmtel: +46 90 786 5223
 Department of Statistics  fax: +46 90 786 6614
 Umeå University   http://www.stat.umu.se/egna/gb/
 SE-90187 Umeå, Sweden e-mail: [EMAIL PROTECTED]

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



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


Re: [R] How to get standard deviation of rows in a matrix

2005-03-10 Thread Tobias Verbeke
On Wed, 9 Mar 2005 13:49:44 -0600
Jagarlamudi, Choudary [EMAIL PROTECTED] wrote:

 Hi all,
  
I am trying to find sd of my rows in a matrix and i get column sd inspite 
 of extracting rows.
 I tried to do the sqrt(var(x)) but that did'nt work as well,
  
 Here is my data
  
 genes
 15 24 63 40
 25 42 46 35
 23 53 37 45
 30 37 50 55
 40 51 30 48
  
 x-sd(genes[1:5,])
  
 y-sqrt(var(genes[1:5,]))
  
 I get 4 sds for the 4 columns instead of 5 sds for my 5 rows.
 Thanks you in advance.

 mymat - matrix(rnorm(20), 5)
 mymat
   [,1]   [,2]   [,3]   [,4]
[1,] -0.1418666 -0.6754704 -0.2525154 -1.4832003
[2,] -0.2254920  1.8705093 -0.9678318 -0.1108883
[3,]  2.2501392  0.1687349 -0.1279790  0.7055311
[4,]  0.9893453 -0.5924199  0.2410576  0.9001638
[5,] -0.4179559  0.9334556 -0.6501605  0.6148958
 apply(mymat, 1, sd)
[1] 0.6084171 1.2135998 1.0584750 0.7318231 0.7722641

See ?apply

HTH,
Tobias

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


Re: [R] GLM function with poisson distribution

2005-01-25 Thread Tobias Verbeke
On Tue, 25 Jan 2005 16:03:57 +0100
Göran Broström [EMAIL PROTECTED] wrote:

 On Tue, Jan 25, 2005 at 06:22:26AM -0800, Florian Menzel wrote:
  Hello all, 
  I found a weird result of the GLM function that seems
  to be a bug.
  The code:
a=c(rep(1,8),rep(2,8))
b=c(rep(0,8),rep(3,8))
cbind(a,b)
model=glm(b~a, family=poisson)
summary(model)
  generates a dataset with two groups. One group
  consists entirely of zeros, the other of 3?s (as
  happened in a dataset I?m analyzing right now). Since
  they are count data, one should apply a poisson
  distribution. A GLM with poisson distribution delivers
  a p value  0.99, thus, completely fails to detect the
  difference between the two groups. Why not and what
  should I do to avoid this error? A quasipoisson
  distribution detects the difference but I?m not sure
  whether it?s appropriate to use it.
  Thanks a lot to everybody who answers!
 
 
 This seems to be a good example of the Hauk-Donner effect; the likelihood
 ratio test gives a p-value of   8.017e-09, while the Wald p-value is 1 !

For the record: Hauck [sic], W.W. and A. Donner, Wald's test 
as applied to hypotheses in logit analysis,
JASA, 72(1977), p. 851-853.


Tobias
 -- 
  Göran Broströmtel: +46 90 786 5223
  Department of Statistics  fax: +46 90 786 6614
  Umeå University   http://www.stat.umu.se/egna/gb/
  SE-90187 Umeå, Sweden e-mail: [EMAIL PROTECTED]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] Newbie question regarding graphing of Princomp object

2005-01-15 Thread Tobias Verbeke
On Sat, 15 Jan 2005 05:39:00 +0100
List account [EMAIL PROTECTED] wrote:

 Greetings,
 
 I am working on a stylometric analysis of some latin texts; one of the  
 latest stylometric techniques involves using principal components  
 analysis.  Not being a statistician, I can't really fully rely on PCA  
 as my primary tool, since I don't really understand the statistics  
 behind the PCA technique.  Nevertheless, the ability to use PCA and  
 graph the results has been marvelously helpful as a preliminary  
 technique to determine what kinds of stylometric variables are worth  
 pursuing as indicators of authorship.
 
 For instance, I'm doing the following...  I have a set of data for  
 approximately 120 different latin works, about half of which are by St.  
 Thomas Aquinas, and the other half are by various other authors in the  
 Thomistic tradition, some known and some anonymous.  My data for  
 frequencies of prepositions looks like the following:
 
 A,AD,CIRCA,CUM,DE,  (total of 10 variables)
 1,0.00967667222531036,0.0208124884194923,0.00142671854734112,0.004863813 
 22957198,0.00758291643505651 ...
 2,0.00874917700292081,0.0217315416668508,0.00133005165549453,0.004379007 
 27772451,0.00537323193714733 
 3,0.0064258378627327,0.0280901956627422,0.00178739176045295,0.0043058230 
 9573329,0.00821688482105979 
 4,0.00706850368364528,0.027446604903448,0.000821141574836712,0.004617615 
 47172807,0.00812783899774761 
 5,0.010214039424891,0.015409971157808,0.000745993537614122,0.00584650749 
 246416,0.00475787738815518 
 6,0.00952534711010655,0.0180981595092025,0.00125928317726832,0.005150145 
 30190507,0.00447206974491443 ...
  (and so on for the rest of the 120 works)
 
 The works are numbered such that works 100 and below are by St. Thomas,  
 those from 101 to 117 are of dubious authenticity, and those from 118  
 to 179 are by other authors.
 
 When I perform a biplot, on the results of the princomp() function, I  
 get a nice graph that plots the 120 works on the two principal  
 component axes (I've figured out how to get rid of the red arrows  
 already).  Given that the data points tend to jumble together, I'd like  
 some way to color the different categories of works in the biplot, so  
 that data points for works 1-100 are red, those from 101-117 are blue,  
 and those from 118 to 179 are green (for instance).

You can use the `col' argument in the biplot call. In this case, I
would do something like 

biplot(mydata, col = c(rep(red, 100), rep(blue, 17), rep(green, 62)))

For a list of built-in color names, you can type colors() at the R prompt.
For more information on biplot, type ?biplot

VaRiis modis bene fit.

HTH,
Tobias

 I've included a sample of the output that I'm currently getting, in  
 case it's helpful to anybody.  BTW, I am running RAqua (for the Mac),  
 version 1.8.1.
 
 Thanks in advance for any help!
 
 -Erik Norvelle
 erik (at) norvelle (dot) org
 Facultad de Filosofía y Letras
 Universidad de Navarra
 Pamplona, Navarra, España
 


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


Re: [R] graphing of Princomp object

2005-01-15 Thread Tobias Verbeke
On Sat, 15 Jan 2005 15:53:18 +0100
List account [EMAIL PROTECTED] wrote:

 Thanks, Tobias for the response.
 
 I tried the suggestion you gave, and apparently (at least according to 
 the biplot manpage, only the first two members of the col vector are 
 used, the first to plot the first set of values, i.e. the scores, and 
 the second color is used for the loadings (I think I have that right).  
 At any rate, if I add the clause 'col = c(rep(red, 100), rep(blue, 
 17), rep(green, 62))' I just get a bunch of red points! :(

You're right. I'm sorry I did not read ?biplot, but only checked it had
a col argument (Semel in anno licet insanire..). 
Anyway, with PCA it is not a good idea to plot both variables and
cases on one single plot, because the temptation is too great to interpret
proximities between variables and cases. You'd better plot two different
graphs, one for the cases and one for the `circle of correlations'.

For plotting the cases, you could make up your own plot using
something similar to this:

library(MASS) # for eqscplot
F1 - yourpca$score[,1]
F2 - yourpca$score[,2]
eqscplot(F1, F2, pch = 20)
text(F1, F2, labels = names(F1), 
 col = c(rep(red, 100), 
 rep(blue, 17), 
 rep(green, 62)),
 pos = 3)


Tobias

 Si vales, valeo...
 
 -Erik

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


Re: [R] Breslow Day Test

2005-01-12 Thread Tobias Verbeke
On Tue, 11 Jan 2005 10:45:48 -0500
Palos, Judit [EMAIL PROTECTED] wrote:

 Breslow-Day test 
 A statistical test for the homogeneity of odds ratios.
  
[..some definitions..]

Your message was not particularly clear, but if
you were looking for R code to do a Breslow-Day test,
Google found this for you:

http://www.math.montana.edu/~jimrc/classes/stat524/Rcode/breslowday.test.r

HTH,
Tobias

 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] Re:Chi-square distance

2005-01-11 Thread Tobias Verbeke
- Oorspronkelijk bericht -
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Verzonden: dinsdag, januari 11, 2005 12:10 PM


 I'm Ph.D student and I need an R code to compute the chi square diistance 
 between n profile rows in a matrix.

There is a ready-made function dudi.dist in package ade4.
This function needs an object of class dudi, so (in your
case) you need to do a correspondence analysis on your matrix.
This will define the metrics on the row and column 
spaces the way you want. The function dudi.coa only accepts
data frames as its first argument.

install.packages(ade4)
library(ade4)
mydf - as.data.frame(mymat)
mydf.coa - dudi.coa(mydf, scannf = FALSE, nf = 2)
dudi.dist(mydf.coa, amongrow = TRUE)

should give you the chi square distances between
row profiles.

HTH,
Tobias

 
 could you help me please?
 Thanks
 
 Paola
 





Libero ADSL: 3 mesi gratis e navighi a 1.2 Mega. E poi hai l'Adsl senza limiti 
a meno di 1 euro al giorno. 
Abbonati subito senza costi di attivazione su http://www.libero.it

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



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


Re: [R] Asymmetry and kurtosis coefficients

2005-01-07 Thread Tobias Verbeke
On Fri, 07 Jan 2005 12:28:04 +
Talita Leite [EMAIL PROTECTED] wrote:

 Hello everybody,
 
 I'm studying descriptive statistics with R and I want to know how to 
 calculate the asymmetry and kurtosis coefficients of a sample using R. I'll 
 appreciate some help.

install.packages(e1071)
library(e1071)

?kurtosis
?skewness

HTH,
Tobias
 
 Thanx,
 
 
 Talita Perciano Costa Leite
 Graduanda em Ciência da Computação
 Universidade Federal de Alagoas - UFAL
 Departamento de Tecnologia da Informação - TCI
 Construção de Conhecimento por Agrupamento de Dados - CoCADa
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] list(0) to integer

2004-12-27 Thread Tobias Verbeke
On Mon, 27 Dec 2004 03:18:53 -0800 (PST)
Frederic renaud [EMAIL PROTECTED] wrote:

 Hello
 I've another question :-)
 I would like to transform a list to a integer.
 I must be sure that the number entered by the user is
 an integer! Thus, I've made :
 
 
 repeat{
   cat(Effectif des populations (integer):)
   n-scan(,n=1,what=list(0),quiet=TRUE)
 
   if (is.integer(n[[1]])==TRUE) break
   print(L'effectif des population doit etre un
 entier)
   }

if (!is.integer(unlist(n))) stop(L'effectif ...)

You don't need `== TRUE' (and I guess you meant `== FALSE')
An error action can be executed using stop(some error message).
`break' breaks out of the loop (ie goes to the first statement
after the loop), so the print statement cannot be executed.

Are you sure you need n to be a list ?

HTH,
Tobias

  That doesn't work of course but I've no idea to do
 this. How verify that n[[1]] is an integer an
 transform them as an integer (as.integer(n) doesn't
 work!) 

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


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


Re: [R] Un peu d'aide

2004-12-26 Thread Tobias Verbeke
On Sun, 26 Dec 2004 04:11:20 -0800 (PST)
Frederic renaud [EMAIL PROTECTED] wrote:

 Bonjour,
 Je voudrais faire un petit programme sous R dans
 lequel je ferais intervenir des parametres que
 j'initialiserais dans R directement ou dans un fichier
 txt(des naturels, reels et caracteres). N'auriez vous
 pas des programmes deja fait qui reprennent ces
 techniques? 

Salut, 

La liste R-help est anglophone. En bas de ce message 
figure l'URL du posting guide, qui pourrait te guider
vers la documentation (qui est fort riche).

Il n'y a aucun problème à lire des données depuis
un fichier. Voir la fonction read.table ou scan
Il y a un manuel spécifique pour l'importation
et l'exportation des données (qui se trouve très
probablement sur ton système, mais que tu peux
télécharger également depuis CRAN).

 De plus, je voudrais pouvoir travailler avec la
 distribution exp (rexp) de parametres: moyenne=1 et
 variance=1. J'ai un petit prob pour introduire la
 variance.

Je crois qu'il n'y qu'un seul paramètre pour
cette distribution (scale parameter b  0). 
La moyenne est b, la variance est b^2.

Le paramètre utilisé en R est le dit 'hazard rate'
lambda = 1/b. Pour une moyenne = 1 et variance = 1
il suffit d'introduire l'argument rate = 1.

HTH,
Tobias

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


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


Re: [R] Excel *.xls files, RODBC

2004-12-04 Thread Tobias Verbeke
On Sat, 4 Dec 2004 14:32:24 -0400 (AST)
Rolf Turner [EMAIL PROTECTED] wrote:

 Chuck Cleland wrote:
 
  The following works for me under WinXP Pro to create myframe as a 
  data frame:
  
  library(RODBC)
  z - odbcConnectExcel(c:/myfolder/mydata.xls)
  myframe - sqlFetch(z, Sheet1)
  close(z)
 
 I tried that and got the error message:
 
 Error: couldn't find function odbcConnectExcel
 
  Are you indicating the name of the worksheet you want within the
  *.xls file?  I suspect there could be additional issues on a
  non-Windows OS that I don't know about.
 
 On which Brian Ripley commented:
 
  Most notably the absence of an Excel ODBC driver.
 
 I guess that's the problem.  In my initial message I forgot to
 indicate that I am working on a Linux box.  Sorry; mea culpa.
 
 It would appear then, that there is NO WAY to read Excel files into R
 save by transporting them to a Windoze system, saving them as .csv
 files and then transporting these back reading them into R.  A bit
 unsatisfactory, but it ***is*** a workaround.

library(gdata)
?read.xls

HTH,
Tobias

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


Re: [R] Text Mining with R

2004-12-03 Thread Tobias Verbeke
On Thu, 2 Dec 2004 18:29:31 +0100
Daniele Medri [EMAIL PROTECTED] wrote:

 Dears,
 
 anyone has experiences with text mining and R?
 I'll be very greatfull for tutorial or examples.
 

You may have a look at:

http://wwwpeople.unil.ch/jean-pierre.mueller/

HTH,
Tobias


 -- 
 Daniele Medri - http://www.medri.org
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


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


Re: [R] debugging functions within Emacs/ESS/R

2004-09-24 Thread tobias . verbeke

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


Re: [R] debugging functions within Emacs/ESS/R

2004-09-24 Thread Tobias Verbeke

I'm sorry. My message just pointed to
the document by Roger Peng:

http://www.biostat.jhsph.edu/~rpeng/docs/R-debug-tools.pdf

HTH,
T.

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


Re: [R] (no subject)

2004-08-09 Thread Tobias Verbeke
On Mon, 09 Aug 2004 08:01:55 -0300
Paolo Tommasini [EMAIL PROTECTED] wrote:

 Hi ! mu name is Paolo and  I teach statistic in a small college in 
 Brazil and we use Linux. We started to use R as our statitical software. 
 I,ve been trying to use some commands I see in the documentation online 
 but i doesn not work. Commands like
 
 simple.hist.and.boxplot  and  others related with graphing. Do I need a special 
 ppackage ? how do I load it ?
 

This function is probably a function of the package Simple
that accompanies the user-contributed introduction to R simpleR

http://www.math.csi.cuny.edu/Statistics/R/simpleR/index.html

Download the tarball on this webpage 

http://www.math.csi.cuny.edu/Statistics/R/simpleR/Simple_0.4.tar.gz

and install it (as root) as follows:

# R CMD INSTALL Simple_0.4.tar.gz

Then (as a normal user) you can load the package (from within
R using the library() command)

 library(Simple)

to see an example of this simple.hist.and.boxplot() function
do

 example(simple.hist.and.boxplot)

to see the help for it, use

?simple.hist.and.boxplot

For graphics commands you do not need to use contributed
packages. On a standard R installation, a lot is already
available.

See ?hist, ?boxplot, ?plot etc. or the Graphics section
of the R manual An Introduction to R.

HTH,
Tobias

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


[OT] Re: [R] Transparent backgrounds in png files

2004-07-30 Thread tobias . verbeke






[EMAIL PROTECTED] wrote on 30/07/2004 05:34:32:

snip

 Are the Windows recipients of the R graphics involved in
 creating/editing the resultant documents, or do they simply require
 read only access of a final document?

 If the latter, then let me suggest that you generate EPS based graphics
 in R (for which you can specify height and width arguments in inches as
 required). Import those EPS graphics into OO.org's Impress (PP-alike) or
 Writer (Word-alike). Then print the file to a PS file and then use
 ps2pdf to create a PDF version of the document that the recipients can
 view in Acrobat Reader.

A more direct way than printing to .ps and converting with ps2pdf
could be to use the extendedPDF macros for OOo
(http://www.jdisoftware.co.uk/pages/epdf-home.php) which basically
does the same but can sit there as a button on your taskbar.
Moreover, extendedPDF allows to use `real' PDF hyperlinks and
PDF bookmarks. Unfortunately (as Marc Schwarz told me), extendedPDF
may not work on all Linux distro's (e.g. not on FC2 as FC people work
towards integrating OOo printing with CUPS and do not ship an OOo print
admin program anymore).

Best regards,
Tobias

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


Re: [R] Complex Surveys...Specifying Design

2004-07-23 Thread Tobias Verbeke
On Fri, 23 Jul 2004 12:23:35 -0400
Zodet, Marc [EMAIL PROTECTED] wrote:

 I need some guidance from someone who is familiar/has some experience with
 the survey package.
 
  
 
 The data that I am using is from the Medical Expenditure Panel Survey
 (www.meps.ahrq.gov http://www.meps.ahrq.gov/ ).  The STRATA and PSU
 variables are varstr01 and varpsu01 respectively.  When I try to specify
 them with the svydesign function I get an error message.  An excerpt of my
 session is as follows...
 
  
 
 library(foreign)
 
  h60 - read.xport(h:\\meps\\temptransports\\h60.tpt)
 
  names(h60) - casefold(names(h60))
 
  names(h60)
 
 [1] dupersid sex  inscov01 totexp01 perwt01f varstr01
 varpsu01
 
  library(survey)
 
  meps.design - svydesign(id=~varpsu01, strata=~varstr01, weight=~perwt01f,
 data=h60)
 
 Error in svydesign(id = ~varpsu01, strata = ~varstr01, weight = ~perwt01f,
 : 
 
 Clusters not nested in strata
 
 
 
  
 
 I'm not sure what is causing this error message or how to get around it
 (i.e., remedy the problem).  Any insight would be much appreciated.

Hi,

I guess the most common way of proceeding is to first stratify, 
and then to sample clusters independently within each stratum.
If this is the case, your data file can be put together like

stratum psu ...
1   1
1   2
1   3
2   1
2   2
2   3

or like

stratum psu ...
1   1
1   2
1   3
2   4
2   5
2   6

svydesign only likes the first data structure so
if this is not the case (clusters not 'nested' in
your strata) you should tell svydesign to nest 
(relabel) the clusters for you by passing the 
argument nest = TRUE to svydesign. In other words:

meps.design - svydesign(ids = ~varpsu01, strata = ~varstr01, 
weights = ~perwt01f, nest = TRUE, data = h60)

should work. See ?svydesign.

HTH,
Tobias

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


Re: [R] formatting

2004-06-30 Thread tobias . verbeke




[EMAIL PROTECTED] wrote on 30/06/2004 16:05:15:



 I could not figure this out from the documentation: is there a way to
send
 formatted non-graphical data to a fancy output device (eg, latex, pdf...)
 For example, if I want to include the summary of a linear model in a
 document, I might want to have it automatically texified.

Have a look at the latex() function in package Hmisc,
and/or at package xtable

If you want to use R code in a LaTeX document, you can
use Sweave; see

http://www.ci.tuwien.ac.at/~leisch/Sweave/

HTH,
Tobias

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


Re: [R] How to order a vector

2004-06-17 Thread tobias . verbeke




[EMAIL PROTECTED] wrote on 17/06/2004 13:10:35:

 Hi all

 I have a vector like this

 2003 2002 2001 2000 1999 1998 1997 1996
  106   105  106   106105   106   101   107

 How can I get it sorted right(19962003)?

 rev(1:4)
[1] 4 3 2 1

HTH,
Tobias

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


Re: [R] Sweave and multiple graphs

2004-06-11 Thread tobias . verbeke




[EMAIL PROTECTED] wrote on 11/06/2004 14:07:18:

 Dear list,

 I am using Sweave to build a small report. I want to produce a series of
 figures, each figure containing a number of plots and then have them
 included in the Sweave file.

 An example would be to :

 postscript(file = ANCbwplot%03d.eps, onefile = FALSE, other options...)
 oldpar - par(mfrow = c(2,2))
 
 do lots of plots to produce a number of eps files
 
 par(oldpar)
 dev.off()

 The example in the Sweave FAQ shows how to do something similar for
 cases where you know how many figures there are, but I do not know how
 many figures will be produced so want to produce a more generic solution.

 I thought of doing the above code in Sweave, and because I named the
 plots in a unique way, I now want to read all the files in the current
 directory that match ANCbwplot001.eps or ANCbwplot002.eps or
 ANCbwplot003.eps an so on. If I have this as a vector in R, then I can
 loop over this vector and do something like:

 results=tex,echo=FALSE=
 file.vec - all files in directory that match name
 for(i in seq(along=file.vec))
 {
cat(\\includegraphics{, file.vec[i], }\n\n, sep)
 }
 @

 in Sweave.

 I'm not sure about getting a list of file names from the current working
 directory that match a given string that I can then loop over and print
 out using cat as shown above. If anyone has any suggestions as to how to
 go about doing this that they are willing to share I would be most
grateful.

 Thanks in advance,
[EMAIL PROTECTED] wrote on 11/06/2004 14:07:18:

 Dear list,


[ generation of lots of graphics files to include in
  Sweave document]


 I'm not sure about getting a list of file names from the current working
 directory that match a given string that I can then loop over and print
 out using cat as shown above. If anyone has any suggestions as to how to
 go about doing this that they are willing to share I would be most
grateful.

 Thanks in advance,

Use list.files(). It has a path argument (to specify the directory)
and a pattern argument to put the regular expression.

mygraphs - list.files(path=./mygraphs, pattern=^ANCbwplot.*\\.eps)

See ?list.files and maybe ?regex

HTH,
Tobias

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


Re: [R] methods for complex sample surveys

2004-06-02 Thread tobias . verbeke




[EMAIL PROTECTED] wrote on 02/06/2004 15:21:14:

 I have learned a lot from this list. I would
 like to thank the developers and contributors who
 devote so much of their time to this project.

 Does anyone know if any methods have been
 developed for handling data from complex sample
 surveys that include sample weights, clusters,
 strata, and so on? I know that SUDAAN, Stata
 have some abilities. Does anything exist in R/S?

There is a survey package on CRAN, by Thomas Lumley.

HTH,

Tobias

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


Re: [R] read.spss

2004-06-01 Thread Tobias Verbeke
On Tue, 01 Jun 2004 18:37:53 +0200
samirkc [EMAIL PROTECTED] wrote:

 HI,
 I tried to read an spss file, i got this message, please help me out. I 
 am a very new user. Please suggest.
 Samir
 
 Error in read.spss(coughfever.sav) : Error reading system-file header.
 In addition: Warning message:
 coughfever.sav: File layout code has unexpected value 50331648.  Value 
 should be 2, in big-endian or little-endian

There has already been a thread regarding a similar
warning message.

See http://finzi.psych.upenn.edu/R/Rhelp02a/archive/21173.html
and the other messages in the thread.

HTH,
Tobias

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


Re: [R] S/R programming books

2004-06-01 Thread Tobias Verbeke
On Tue, 01 Jun 2004 14:13:23 +0100
Samuel Kemp (Comp) [EMAIL PROTECTED] wrote:

 Hi,
 
 I have been using R for a few months now and I am confident that the 
 language has everything I will need to complete my PhD. I can create 
 functions, script files and packages, but I would like to write my 
 programs more efficiently (maybe using OO). Can anyone recommend a good 
 book on the art of good R programming?
 

If you have patience (book announced for July 2004) 
and read German, Programmieren mit R by Uwe Ligges
(Springer Verlag, ISBN: 3-540-20727-9)
might be an other answer to your needs.

See:
http://www.springeronline.com/sgw/cda/frontpage/0,10735,5-40109-22-26682866-0,00.html

HTH,
Tobias

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


Re: [R] Date parsing question

2004-05-27 Thread tobias . verbeke




[EMAIL PROTECTED] wrote on 27/05/2004 11:29:11:

 How do I parse a date mmdd? I tried asking chron(s, ymd) but
 that didn't work. Would the date parsing routines of the Date class of
 1.9 grok this?

 a - 20030527
 as.Date(a, %Y%m%d)
[1] 2003-05-27

HTH,
Tobias


 --
 Ajay Shah   Consultant
 [EMAIL PROTECTED]  Department of Economic Affairs
 http://www.mayin.org/ajayshah   Ministry of Finance, New Delhi

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

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


Re: [R] searching a vector

2004-04-30 Thread tobias . verbeke




[EMAIL PROTECTED] wrote on 30/04/2004 15:33:48:

 Hi,

 I have a integer vector x that contains a unique set of numbers:

 x - c(1,2,4,6,8,10,12)

 Is there a simple test I can use to determine if an integer such as 6 is
 contained in x ?

 x - c(1,2,4,6,8,10,12)
 6 %in% x
[1] TRUE

See ?%in% and its 'See also:' section.


HTH,
Tobias

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


Re: [R] tutorial for lme

2004-04-23 Thread tobias . verbeke




[EMAIL PROTECTED] wrote on 23/04/2004 12:12:31:

 Hi all,

 I find an introduction for program lme()  for fitting mixed effects
models.
 I do not have the book wirtten by Pinheiro and Bates, and a tutorial
 would be very useful.
 In particular, I have some difficulties to understand how specifications
 for random effects and variance structures
 could be specified.

 somebody knows an introduction for that ?

http://socserv.mcmaster.ca/jfox/Books/Companion/appendix-mixed-models.pdf

This is part of the web appendix to
An R and S-PLUS Companion to Applied Regression
by John Fox, Sage Publications, 2002.


HTH,
Tobias

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


Re: [R] Failure to compile source packages in Debian

2004-03-31 Thread tobias . verbeke




F. Tusell [EMAIL PROTECTED] wrote on 31/03/2004 10:06:32:

[...]

 and yet libgc2-pic is not resolved. *HOWEVER* following your lead that
 whatever is needed must by in a library of name libg2c*, I did the
 following in /usr/lib:

ln -s libg2c0.so.0 libg2c-pic.so

 and everything works like a charm. Seems it si just a library that
 changed its name.

Hmm.. Doing a search on

http://www.debian.org/distrib/packages#search_contents

using options Keyword g2c-pic
packages that contain files or directories, whose
  names contain the keyword
testing
Intel x86

points to g77 packages.

Probably installing this one is a better solution ?

HTH,
Tobias

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


Re: [R] read.spss

2004-03-12 Thread tobias . verbeke




[EMAIL PROTECTED] wrote on 04/03/1997 03:21:00:

 Hi,
 I would like to read a spss file in R.
 When i type read.spss(...)
 Comes the error: couldn't find function read.spss
 What shall i do?


Hi Margarida,

Did you load the foreign package by typing
  library(foreign)
before using the
  read.spss()-command
and did you install the foreign package by typing e.g.
  install.packages(foreign)
before loading the foreign package ?

HTH,
Tobias

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


Betr.: [R] Levels number of a factor object

2004-01-23 Thread tobias . verbeke




[EMAIL PROTECTED] wrote on 23/01/2004 15:24:21:


 Hi all!

 How to retrieve the levels number of a factor object?
 See this code:
 groups-gl(4,10)
 I want to retrieve the number of levels (4) of my object groups
 I tried groups.levels but this don't work

Is

length(levels(groups))


what you were looking for ?


HTH,

Tobias

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


Betr.: [R] r: fortran help

2004-01-09 Thread tobias . verbeke





 I would like to know if anybody knows of either a good book or web site
 that explains one how to use Fortran. I would like to call some of the
 Fortran subroutines but before I can do that I first want to learn how
 to code in Fortran.

There is a wealth of resources in the fortran faq

http://www.faqs.org/faqs/fortran-faq/

(including two freely downloadable f77-books)


HTH,

Tobias

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


Re: [R] extensive grid docs?

2003-12-11 Thread tobias . verbeke




[EMAIL PROTECTED] wrote on 10/12/2003 22:23:43:

 I'm looking for extensive docs on using grid (for the somewhat newbie).
I'm
 attempting to create a set of graphics that look similar to the attached
 image (I hope this doesn't get bounced) and have only come across the R
 newsletters and it appears that grid was new as of 1.8.0? I think the
best
 way to proceed is to create the plot, clip it using a polygon, then
manually
 add the annotation. Is that correct?

 I couldn't find much on the FAQ regarding creating really goofy plots
with
 grid and any hints would be greatly appreciated.


Here's an R graphics tutorial by Paul Murrell

http://www.ci.tuwien.ac.at/Conferences/DSC-2003/tutorials.html



HTH,
Tobias

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] weighted correlations and NAs

2003-10-21 Thread tobias . verbeke




Dear list,

Is there a way to obtain a matrix of weighted
correlations in the presence of missing values ?
cor() can deal with NAs but cov.wt() apparently
can't. Is there any package that offers such a
function, e.g. one that uses all complete pairs
of observations ?

Thanks in advance,

Tobias

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Betr.: [R] Organized examples for newbyes

2003-10-14 Thread tobias . verbeke






[EMAIL PROTECTED] wrote on 14/10/2003 09:20:34:

 I'm learning R from scratch on my linux box, being deeply biased at
 work by those graphical programs, nice to look but often poor in
 content and almost generally limited, running under M$ Windows.

 I wonder if someone out there can suggest to an absolute beginner as
 I am where to find a collection of examples of R-code (or Splus, as
 I understand) to play with in order to learn R quicker.

 The collection should:
 1) be in English, or French, or, of course, Italian,
 2) be concentrated in one or at most a handful of sites,
 3) contain examples of gradually increasing complexity.

This site will not respond to all of the conditions,
but I learned a lot from it.

http://www.ku.edu/~pauljohn/R/Rtips.html

Do not forget to explore all of the contributed docs
you can find on CRAN (section Documentation, Contributed).

HTH,

Tobias

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Newbie

2003-08-14 Thread Tobias Verbeke
On Thu, 7 Aug 2003 14:41:51 +0100
Marcos Llobera [EMAIL PROTECTED] wrote:

 I just installed R's RPM on a Linux box using red hat 8.0. I would
 like to use some graphical interface (e.g. gnome) but I have not
 managed to do it. 

type R at the prompt in a gnome terminal and
you can use R.

 

There is the GUI Rcmdr (see message of Sir John
Fox preceding your message), a package you should
install. Install packages car and foreign first, 
because Rcmdr needs them.
(see the R documentation on CRAN on how to install 
a package)
 
If you installed the packages successfully,
type library(Rcmdr) at the R prompt and you
will have a GUI.

HTH,

Tobias

PS using the command line increases speed
and flexibility IMHO

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Changing default browser in options()

2003-08-14 Thread Tobias Verbeke
 so I have to type every single R session:

   options(browser='dillo')
 
 Is there anyway I can change this globally?

If you put the line
  
options(browser='dillo')

in the .Rprofile of your home directory, it
will fire up dillo the next time.




HTH,

Tobias

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] variable name of variable in dataframe

2003-07-25 Thread Tobias Verbeke
Dear list,

If I have this toy function:

toy - function(b=.95){
toyframe - data.frame(lion.95 = c(1, 2))
return(toyframe)
}

How can I obtain that for any value b, 
the name of the column becomes lionb, 
i.e. lion.95 if b = .95, lion.85 if b = .85 etc.
knowing that .95 (.85 etc.) may also be
given as 0.95 (0.85 etc.) but that the
result should be lion.95 (lion.85 etc.) 


Thanks in advance,

Tobias

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] variable name of variable in dataframe

2003-07-25 Thread Tobias Verbeke
Sir Hotz, 
Sir Bengtsson, 
Sir Ripley and
Sir Dalgaard,

Thank you __very__ much for
your help.

Tobias

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] I don't find fuzzy matching

2003-07-19 Thread Tobias Verbeke
I think the datasets you're talking
about can be downloaded at

http://wwwmaths.anu.edu.au/~johnm/r/dsets/

put these in your working directory
and type (in R), e.g.

 source(dolphins.R)

You can see you have the data now
by typing:

 dolphins
   wt heart logweight logheart species
1  35   245  3.555348 5.501258styx
2  42   255  3.737670 5.541264styx
3  71   525  4.262680 6.263398styx
4  65   425  4.174387 6.052089styx
5  63   425  4.143135 6.052089styx
6  64   440  4.158883 6.086775styx
7  45   350  3.806662 5.857933styx
8  54   300  3.988984 5.703782   delph
9  59   350  4.077537 5.857933   delph
10 50   320  3.912023 5.768321   delph
11 42   240  3.737670 5.480639   delph
12 55   305  4.007333 5.720312   delph
13 37   220  3.610918 5.393628   delph
14 47   310  3.850148 5.736572   delph
15 40   210  3.688879 5.347108   delph
16 52   350  3.951244 5.857933   delph


HTH,

Tobias

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] R, geochemistry, ternary diagrams

2003-07-15 Thread Tobias Verbeke

 Are there enough geochemists using R already that he'd find
 like-minded people to discuss technical issues with if he _did_
 switch to R? Is there a package somewhere already that does ternary
 and other geochemistry diagrams?

Another possibility for a ternary plot
was mentioned by Prof Ripley in

http://maths.newcastle.edu.au/~rking/R/help/02b/3637.html

 library(MASS)
 example(Skye)

gives code and an example


HTH,

Tobias

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] (no subject)

2003-07-15 Thread Tobias Verbeke
[read text file :]

 #data1
 1 2 3 4 
 5 6 7 8

Is this what you mean ?

 b - read.table(filewithyourdata, header=F, sep= )
 b
  V1 V2 V3 V4
1  1  2  3  4
2  5  6  7  8


HTH,

Tobias

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] (no subject)

2003-07-15 Thread Tobias Verbeke
Sorry Michael,
I should read more carefully.
You asked to create the file,
not to read it.

Tobias

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] for loop problem

2003-07-14 Thread Tobias Verbeke
Sir Dalgaard,

Thank you for your kind reply.
 
  In what way am I ill-treating R ?
 
 You're ill-treating the readers by not 
 giving a full example of a
 call to the function... 

ax.to.nax.for(qx, ax)

 However: in the for loop, i will be one of
 0,1,5,10 and n is the vector c(1,4,5,5) 
 so n[i+1] is indexing out of
 bounds and e.g. 
 
  n[6]
 [1] NA
 
 and the : operator subsequently objects. 
 Did you mean (i+1):(i+n[j]+1) or so? 

Yes! I meant (i+1):(i+n[j])


Thanks again,

Tobias

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] `acting' on variables

2003-07-09 Thread Tobias Verbeke
Dear list,

How can one from within a function act
on these variables (outside a function)
that were given as arguments.

If I have e.g. this beginning of a function:

foo - function(tiro){
app.tiro - 3 * tiro

[...]

}

How can I from within the curly brackets
e.g. concatenate the app.tiro to
the particular variable I passed as the
argument `tiro' ?

What is the technical name of this phenomenon ?

Thank you in advance,


Tobias

PS forgive my non-programmer lingo

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] `acting' on variables

2003-07-09 Thread Tobias Verbeke
Thanks to all of you for your answers,

The situation I was dangerously trying
to cope with was an incomplete life table,
with incomplete ages and incomplete survivors.
This is the table I want to complete using
a Gompertz function to estimate mortality
at high ages:

  agelx
1  75 53803
2  80 37441
3  85 21134

This is the function I wrote 
(I warn you, this is not meant 
for programmer's eyes):

gompertz.estimates - function(age, surv){
n - age[length(age)] - age[length(age) - 1]
ly2n - surv[length(surv)]
lyn - surv[length(surv) - 1]
ly - surv[length(surv) - 2]
y - age[length(age) - 2]
lastage - age[length(age)]
# list(n =n, ly2n = ly2n, lyn = lyn,
# ly = ly, y = y, lastage = lastage)   OK
b - (log(ly2n / lyn) / log(lyn / ly)) ** (1 / n)
a - exp(log(lyn / ly) / ((b ** y) * (b ** n - 1)))
C - ly * exp(-(b ** y) * log(a))
equation - function(d) C * (a ** (b ** d))
# return(equation(c(90,95,100,105,110))) OK
ageseq - seq(lastage + n, lastage + (20 * n), by=n)
l.est - equation(ageseq[1])
newl.est - 1
i - 1
while(newl.est = 0.5){
newl.est - equation(ageseq[i])
l.est - c(l.est, newl.est)
i - i + 1
}
app.age - ageseq[1:length(l.est)]
list(app.age = app.age, l.est = round(l.est, digits=0))
}


The components in the list are the things I
would like to add to the columns in my incomplete
life table.

If this is too dangerous (quaint etc.), 
I will not do it that way.

If you can recommend me more elegant ways
to do what I wanted, I will be grateful and
promise never ever to post this kind of
functions on this list ;-)


Regards,


Tobias

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] `acting' on variables

2003-07-09 Thread Tobias Verbeke
Favete linguis...

Thanks,
Tobias

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] dynamics of functions

2003-06-06 Thread Tobias Verbeke
Dear list,

I would like to study the dynamics of
functions using R (instead of mathematica e.g.),
i.e. the behavior of points under iteration
of a function.
So I tried (in vain) writing a function
myfunction - function(f,n,x){...}
in order to compute f^{n}(x), f^{n}(x) being
the function f composed with itself n-1 times.
n is a natural number, and the argument x is
the abscissa of the point I would like to
`follow'.

Can someone give me a boost?

I appreciate your help,

Tobias Verbeke

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] dynamics of functions

2003-06-06 Thread Tobias Verbeke
Dear list,

I would like to study the dynamics of
functions using R (instead of mathematica e.g.),
i.e. the behavior of points under iteration
of a function.
So I tried (in vain) writing a function
myfunction - function(f,n,x){...}
in order to compute f^{n}(x), f^{n}(x) being
the function f composed with itself n-1 times.
n is a natural number, and the argument x is
the abscissa of the point I would like to
`follow'.

Can someone give me a boost?

I appreciate your help,

Tobias Verbeke

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] dynamics of functions

2003-06-06 Thread Tobias Verbeke
Dear Thomas,  

 What about the following function?
 
 iterate-function(f,n,x){
   if(n==0) return(x)
   y-x
   for(i in 1:n)y-f(y)
   y
 }
 iterate(sqrt,3,256)

Thank you very much, this certainly helps.
I'm still curious, though, to know how to
write the expression of my function 
immediately as the argument f.
I can define it outside of the function
 aap - function(x) -x^3
and use it as argument
 iterate(aap,3,256),
but I seem not to be clever enough
to write a function that receives
the following as input

 iterate(-x^3,3,256)

Thanks again,

Tobias

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] dynamics of functions

2003-06-06 Thread Tobias Verbeke
Thanks to you all for the
clarifications.
I will work on my spacebar usage ;-)

Regards,

Tobias

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help