Re: [R] importing files, columns "invade next column"

2005-01-18 Thread Marc Schwartz
On Wed, 2005-01-19 at 04:25 +, Tiago R Magalhaes wrote:
> Dear R-listers:
> 
> I want to import a reasonably big file into a table. (15797 x 257 
> columns). The file is tab delimited with NA in every empty space. 

Tiago,

Have you tried to use read.table() explicitly defining the field
delimiting character as a tab to see if that changes anything?

Try the following:

AllFBImpFields <- read.table('AllFBAllFieldsNAShorter.txt',
  header = TRUE,
  row.names=paste('a',1:15797, sep=''),
  as.is = TRUE,
  sep = "\t")

I added the 'sep = "\t"' argument at the end.

Also, leave out the 'fill = TRUE', which can cause problems. You do not
need this unless your source file has a varying number of fields per
line.

Note that you do not need to specify the 'nrows' argument unless you
generally want something less than all of the rows. Using the
combination of 'skip' and 'nrows', you can read a subset of rows from
the middle of the input file.

See if that helps. Usually when there are column alignment problems, it
is because the rows are not being consistently parsed into fields, which
is frequently the result of not having the proper delimiting character
specified.

The last thought is to be sure that a '#' is not in your data file. This
is interpreted as a comment character by default, which means that
anything after it on a row will be ignored.

HTH,

Marc Schwartz

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


[R] recursive penalized regression

2005-01-18 Thread Vadim Ogranovich
Hi,
 
Few days ago I posted a question to r-sig-finance, which I thought would
be an easy one. To my surprise I have received no replies, which makes
me think that it is either harder than I thought, or that it makes no
sense. I am reposting the message (with some modifications) on the
R-help in a hope to get some leads, suggestions for alternatives, etc.
My apologies to those who had seen this on r-sig-finance.
 
 
I want to do a univariate no frills autoregression. The major
non-standard requirements are:
1. When estimating model parameters at time t the algorithm can only use
data up to time t.
2. The weights of the past observations should decay with time, e.g
exponentially
3. ability to apply some penalty, e.g. L2 (ridge), L1 (lasso), etc., to
model coefficients (or any other regularization technique)
 
Thanks in advance for your help,
Vadim

[[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] importing files, columns "invade next column"

2005-01-18 Thread Tiago R Magalhaes
Dear R-listers:
I want to import a reasonably big file into a table. (15797 x 257 
columns). The file is tab delimited with NA in every empty space. I 
have reproduced what I have used as my read.table instruction. I have 
read the R-dataImportExport FAQ and still couldn't solve my problem. 
(I might have missed it, of course). I'm using R.2.01 in a Mac G4, 
10.3.7.

I can import the file, but one of the columns "invades the other", 
meaning that the if there is an empty space marked as NA on the first 
column, it gets the value of the second column. I tried to import 
four different files (details below) and I think the problem is with 
the number of columns (with less columns it works)

workarounds:
a) I can separate my file into several files, import them and then 
make one file in R
b) try to learn basic commands in awk? perl?
any advice on this?

another question (much less important) I have a binnary file in Splus 
for this object. I exported the object in Splus as it says in the FAQ 
(dump.data). But data.restore doesn't exist as a function. Is it 
because I'm using a Mac?

details of what I did:
##
a) importing a shorter version of my file (58 columns); I get the 
"invading" behaviour and a column of row.names that I don't 
understand where it comes from. (UNIQID should be empty and 1006 
should be in All.FB.Id

 AllFBImpFields <- read.table('AllFBAllFieldsNAShorter.txt', fill=T, header=T,
+  row.names=paste('a',1:15797, sep=''),
+  as.is=T, nrows=15797)
 AllFBImpFields[1:2,1:5]
   row.names UNIQID All.FB.Id All.FB.5 All.FB.4
a110006
a210007
##
b) Importing only 5 cols of the previous file. It works. there is no 
"invasion" and the col row.names is not inserted

 AllFB5Cols <- read.table('AllFB5Cols.txt', fill=T, header=T,
+  row.names=paste('a',1:15797, sep=''),
+  as.is=T, nrows=15797)
 AllFB5Cols[1:2,1:5]
   UNIQID All.FB.Id Symbol   FB.gn CG.name
a110006p53 FBgn0039044 CG10873
a210007  Gr94a FBgn0041225 CG31280
##
c) importing file with 4 rows, 58 columns; invasion behaviour and a 
warning that I don't get in a) although the file is the same for the 
first 4 rows

 x4rowsAllCol <- read.table('AllFB4rowsAllCols.txt', fill=T, header=T,
+row.names=paste('a',1:4, sep=''),
+as.is=T, nrows=4)
Warning message:
incomplete final line found by readTableHeader on `AllFB4rowsAllCols.txt'
 x4rowsAllCol[1:2,1:5]
   row.names UNIQID All.FB.Id All.FB.5 All.FB.4
a1NA  10006NA   NA   NA
a2NA  10007NA   NA   NA
##
d) importing file with 4 rows and 4 cols, result is like b) but gives 
the same warning as c!)
 x4rows5cols <- read.table('AllFB4rows5cols.txt', fill=T, header=T,
+  row.names=paste('a',1:4, sep=''),
+  as.is=T, nrows=4)
Warning message:
incomplete final line found by readTableHeader on `AllFB4rows5cols.txt'
 x4rows5cols[1:2,1:5]
   UNIQID All.FB.Id All.FB.5 All.FB.4 All.FB.3
a1 NA 10006   NA   NA   NA
a2 NA 10007   NA   NA   NA
__
R-help@stat.math.ethz.ch 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 call R in delphi?

2005-01-18 Thread Mulholland, Tom
Try searching this list for delphi. This was the first post I found. You may 
find it helpful.

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

Tom

> -Original Message-
> From: YiYao_Jiang [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, 19 January 2005 10:12 AM
> To: r-help@stat.math.ethz.ch
> Cc: Jack_Kang; Ivy_Li
> Subject: [R] how to call R in delphi? 
> 
> 
> Dear All:
> 
> Now I am writing  program in delphi , found it is very 
> convenience to do anova, T-test, F-Test, etc in R , how to 
> call R in delphi? Thsnks.
> 
> 
> 
> 
> Best Regards
> 
> YiYao Jiang 
> 
> Product Division/ product Testing Department
> Semiconductor Manufacturing International Corporation
> ZhangJiang Road, PuDong New Area, Shanghai  ZIP: 201203
> Tel:86-21-5080-2000 Ext. 15173
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>

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


[R] how to call R in delphi?

2005-01-18 Thread YiYao_Jiang
Dear All:

Now I am writing  program in delphi , found it is very convenience to do anova, 
T-test, F-Test, etc in R , how to call R in delphi? Thsnks.




Best Regards

YiYao Jiang 

Product Division/ product Testing Department
Semiconductor Manufacturing International Corporation
ZhangJiang Road, PuDong New Area, Shanghai  ZIP: 201203
Tel:86-21-5080-2000 Ext. 15173

__
R-help@stat.math.ethz.ch 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] looking for a basic spatial diff function

2005-01-18 Thread McClatchie, Sam (PIRSA-SARDI)
Background:
OS: Linux Mandrake 10.1
release: R 2.0.0
editor: GNU Emacs 21.3.2
front-end: ESS 5.2.3
-

Colleagues

Is there a function to calculate distances between adjacent latitude/
longitude pairs in a matrix? It is basically a spatial diff() function that
I have in mind.

Data:

long1, lat1
long2, lat2
long3, lat3

looking for: diff(data$long, data$lat)

function Result

long1, lat1
long2, lat2, distance = long/lat2 - long/lat1
long3, lat3, distance = long/lat3 - long/lat2

I've probably missed it but a search of the maillist archives and quick scan
of the packages (map*) did not solve my query. For this simple task I don't
really want to get into GRASS.

Best fishes

Sam

Sam McClatchie,
Sub-program leader, Pelagic Fisheries
South Australian Aquatic Sciences Centre
PO Box 120, Henley Beach 5022
Adelaide, South Australia
email <[EMAIL PROTECTED]>
Telephone: (61-8) 8207 5448
FAX: (61-8) 8200 2481
Research home page 
  
   /\
  ...>> 
 
   <°)Xx><<
  /  \\
><(((°> 
  >><(((°>   ...>>O<°)Xx><<

__
R-help@stat.math.ethz.ch 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] signif() generic

2005-01-18 Thread McGehee, Robert
The method below looks for arguments of "sec" and "numeric". Sounds like
you want to pass in "sec" and "missing" (the class of missing data) and
get a default behavior. So in addition to the method you already wrote,
try this one as well:

setMethod("signif", signature(x = "sec", digits = "missing"),
function(x, digits) {
digits <- 2
## .. do something
print(digits)
}
)

Now we get the default behavior:
> signif(new("sec"))
[1] 2

Robert


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 18, 2005 7:50 PM
To: r-help@stat.math.ethz.ch
Subject: [R] signif() generic


Dear list, 

I'm trying to write a class for Gaussian error propagation of measured
values and their (estimated) errors,

> setClass("sec", representation(val="numeric", err="numeric"))

I've already successfully implemented basic arithmetics using mostly the
"Arith" group generics. But I'm running into trouble when trying to get
signif() to work for my purposes, i.e. with a default argument
(digits=2): When trying 

> seMethod("signif", signature(x="sec", digits="numeric")), 
function(x, digits=2){
# ...do something...
}
)

and 

> signif(sec1)

I get

> Error in signif(x, digits) : Non-numeric argument to mathematical
function

Putting a second argument (like digits=2) into the call makes it work,
but I want some default behavior specified for missing digits argument
so it works in an analogous fashion as signif for numeric values. 
I also tried inserting 

> setGeneric("signif", function(x, digits=6) standardGeneric("signif")) 

before the setMethod block, but that wouldn't help either. I'm pretty
clueless after having studied most of the material in the documentation
of the methods package and single functions concerning generic behavior
-- somehow I don't see what I'm doing wrong. 
Any help would be greatly appreciated,

Greetings, 
Ockham

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

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


[R] signif() generic

2005-01-18 Thread ockham
Dear list, 

I'm trying to write a class for Gaussian error propagation of measured
values and their (estimated) errors,

> setClass("sec", representation(val="numeric", err="numeric"))

I've already successfully implemented basic arithmetics using mostly the
"Arith" group generics. But I'm running into trouble when trying to get
signif() to work for my purposes, i.e. with a default argument
(digits=2): When trying 

> seMethod("signif", signature(x="sec", digits="numeric")), 
function(x, digits=2){
# ...do something...
}
)

and 

> signif(sec1)

I get

> Error in signif(x, digits) : Non-numeric argument to mathematical
function

Putting a second argument (like digits=2) into the call makes it work,
but I want some default behavior specified for missing digits argument
so it works in an analogous fashion as signif for numeric values. 
I also tried inserting 

> setGeneric("signif", function(x, digits=6) standardGeneric("signif")) 

before the setMethod block, but that wouldn't help either. I'm pretty
clueless after having studied most of the material in the documentation
of the methods package and single functions concerning generic behavior
-- somehow I don't see what I'm doing wrong. 
Any help would be greatly appreciated,

Greetings, 
Ockham

__
R-help@stat.math.ethz.ch 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] a question about linear mixed model in R

2005-01-18 Thread Peter Muhlberger
Hi Chung Cheng:  This seems related to a problem I'm having in some data of
mine as well.  I'm new to R (played w/ it some a year ago) & to lme
modeling, so take this w/ a grain of salt, but here are some thoughts:

In my problem, D would be an indicator of whether a subject was in the
control condition or not.  In the control condition, all people participated
individually, in the experimental condition there was small-group based
discussion.  r(ij) would be some variable that affects the outcome, but
whose effect may be moderated by the group the discussion was in.

The model assumes that the non-control condition values will have a
distribution of coefficients for r(ij).  The coefficient for r(ij) in the
controls need not have the same central value as for the non-controls
(though it would be nice to be able constrain it so it would be).  So, it
might make some sense to split the variable into two variables, one with
zeros for the controls & one w/ zeros for the experimental groups and
estimate the former w/ random effects & the other not.

I'm not 100% sure that's what you're asking, but it seems related.

Peter

>Dear all,
>
>I have a somewhat unusual linear mixed model that I can't seem
>to code in lme.  It's only unusual in that one random effect is
>applied only to some of the observations (I have an indicator
>variable
>that specifies which observations have this random effect).
>
>The model is:
>
>X_hijk = alpha_h + h * b_i + r_(ij) + e_hijk , where
>
>  h = 0 or 1 (indicator)
>  i = 1, ..., N
>  j = 1, ..., n_i
>  k = 1, ..., K
>alpha is fixed, and the rest are random.
>I'm willing to assume b, r, and e are mutually independent
>and normal with var(b) = sigma^2_b, var(r) = sigma^2_r, and
>var(e) = sigma^2.
>
>Any help in writing this model in lme() would be greatly
>appreciated.
>
>Thanks,
>
>Chung Cheng

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

2005-01-18 Thread Doran, Harold
Dear List:

A few weeks ago I posted some questions regarding data simulation and
received some very helpful comments, thank you. I have modified my code
accordingly and have made some progress. 

However, I now am facing a new challenge along similar lines. I am
attempting to simulate 250 datasets and then run the data through a
linear model. I use rm() and gc() as I move along to clean up the
workspace and preserve memory. However, my aim is to use sample sizes of
5,000 and 10,000. By any measure this is a huge task.

My machine has 2GB RAM and a Pentium 4 2.8 GHz machine with Windows XP.
I have the following in the "target" section of the Windows shortcut
--max-mem-size=1812M

With such large samples, R is unable to perform the analysis, at least
with the code I have developed. It halts when it runs out of memory. A
collegue subsequently constructed the simulation using another software
program with a similar computer and, while it took over night (and then
some), the program produced the results desired.

I am curious if it is the case that such large simulations are out of
the grasp of R or if my code is not adequately organized to perform the
simulation. 

I would appreciate any thoughts or advice.

Harold



library(MASS)
library(nlme)
mu<-c(100,150,200,250)
Sigma<-matrix(c(400,80,80,80,80,400,80,80,80,80,400,80,80,80,80,400),4,4
)
mu2<-c(0,0,0)
Sigma2<-diag(64,3)
sample.size<-5000
N<-250 #Number of datasets
#Take a single draw from VL distribution
vl.error<-mvrnorm(n=N, mu2, Sigma2)

#Step 1 Create Data
Data <- lapply(seq(N), function(x)
as.data.frame(cbind(1:10,mvrnorm(n=sample.size, mu, Sigma

#Step 2 Add Vertical Linking Error
for(i in seq(along=Data)){
Data[[i]]$V6 <- Data[[i]]$V2
Data[[i]]$V7 <- Data[[i]]$V3 + vl.error[i,1] 
Data[[i]]$V8 <- Data[[i]]$V4 + vl.error[i,2]
Data[[i]]$V9 <- Data[[i]]$V5 + vl.error[i,3] 
}

#Step 3 Restructure for Longitudinal Analysis
long <- lapply(Data, function(x) reshape(x, idvar="Data[[i]]$V1",
varying=list(c(names(Data[[i]])[2:5]),c(names(Data[[i]])[6:9])),
v.names=c("score.1","score.2"), direction="long"))

#
#Clean up Workspace
rm(Data,vl.error) 
gc()
#

# Step 4 Run GLS

glsrun1 <- lapply(long, function(x) gls(score.1~I(time-1), data=x, 
correlation=corAR1(form=~1|V1), method='ML'))

# Extract intercepts and slopes 
int1 <- sapply(glsrun1, function(x) x$coefficient[1])
slo1 <- sapply(glsrun1, function(x) x$coefficient[2])


#Clean up workspace
rm(glsrun1)
gc()

glsrun2 <- lapply(long, function(x) gls(score.2~I(time-1), data=x, 
correlation=corAR1(form=~1|V1), method='ML')) 

# Extract intercepts and slopes 
int2 <- sapply(glsrun2, function(x) x$coefficient[1])
slo2 <- sapply(glsrun2, function(x) x$coefficient[2])

 
#Clean up workspace
rm(glsrun2)
gc()



# Print Results

cat("Original Standard Errors","\n", "Intercept","\t",
sd(int1),"\n","Slope","\t","\t", sd(slo1),"\n")

cat("Modified Standard Errors","\n", "Intercept","\t",
sd(int2),"\n","Slope","\t","\t", sd(slo2),"\n")

rm(list=ls())
gc() 

[[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] R: error while loading shared libraries: libg2c.so.o

2005-01-18 Thread Jon Dressel
I have just installed the version of R for Linux Enterprise Server AS.  When R 
is launched, I receive the following error message:  
 
R: error while loading shared libraries: libg2c.so.o cannot open shared object 
file: no such file or directory
 
I have added the path to the library above to the /usr/etc/ld.so.conf file and 
then run ldconfig -v. The listing then shows that the libg2c.so.o is included 
in the path.  Please advise.
 
Jon Dressel

Applications Supervisor

SurroMed, Inc.


1430 O'Brien Drive


Menlo Park, CA 94025

Phone: 650.470.2322

Fax: 650.470.2400

email:   [EMAIL PROTECTED] 


[[alternative HTML version deleted]]

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


RE: [R] Randoms interactions in lme

2005-01-18 Thread Berton Gunter
Julien:

Big difference! You need to spend time with Bates and Pinheiro to understand
the concepts, but in brief:

~1|x/y  means that x and y are grouping variables with y nested within x and
a different random offset for each x and y within x.

~y|x means that x is a grouping variable and y is a linear covariate with a
different random (intercept and) slope for each x group.


-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box
 

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box
 
 

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Martin Julien
> Sent: Tuesday, January 18, 2005 12:42 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Randoms interactions in lme
> 
> In lme, what's the difference between "random = ~ 1 | x / y" 
> and "random = ~
> y | x" ?
> 
>  
> 
> Thanks
> 
> Julien
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>

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


[R] address statistics

2005-01-18 Thread [EMAIL PROTECTED]
Guten Tag

Im Rahmen einer Studienarbeit an der Hochschule fuer Technik in Rapperswil 
(HSR), zum Thema SPAM, haben wir 
Ihre E-Mail Adresse auf einer CD-ROM gefunden welche bei EBay gehandelt wird 
(Adresshandel).
Wir haben insbesondere alle E-Mail Adressen von Schweizer Unis und ETHs 
herausgesucht.

Nun ist es fuer unsere Statistik wichtig, dass wir wissen welche der gefundenen 
Adressen noch aktiv sind.
Aus diesem Grund senden wir Ihnen diese E-Mail.

Wichtig: Sie sollen darauf nicht Antworten, es geht nur darum herauszufinden ob 
die E-Mail Adresse noch existiert,
also diese E-Mail nicht rejected wird.


Fuer weitere Infos:
http://stud.ita.hsr.ch/sw04/sw0403/



Mit freundlichen Gruessen

Ch. Hoehn und A. Ruoss


<<-english--->>


Hello


Within the scope of a studying work at the "Hochschule fuer Technik in 
Rapperswil" (HSR), with the subject SPAM,
have we found your E-Mail Address on a CD-ROM which is sold at EBay.
We searched on this CD-ROM for E-Mail addresses from Universities and ETHs in 
switzerland.

It's important for our statistics, that we know which of the addresses we 
found, is still active.
This is the reason for this E-Mail.

Important: You shouldn't give an answer to this message. If this message isn't 
rejected, we will think it's an
active address.


For more infos:
http://stud.ita.hsr.ch/sw04/sw0403/


Sincerely yours

Ch. Hoehn and A. Ruoss

__
R-help@stat.math.ethz.ch 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] Randoms interactions in lme

2005-01-18 Thread Martin Julien
In lme, what's the difference between "random = ~ 1 | x / y" and "random = ~
y | x" ?

 

Thanks

Julien


[[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] Dropping a digit with scan() on a connection

2005-01-18 Thread Tim Howard
R gurus,

My use of scan() seems to be dropping the first digit of sequential
scans on a connection. It looks like it happens only within a line:

> cat("TITLE extra line", "235 335 535 735", "115 135 175",
file="ex.data", sep="\n")
> cn.x <- file("ex.data", open="r")
> a <- scan(cn.x, skip=1, n=2)
Read 2 items
> a
[1] 235 335
> b <- scan(cn.x, n=2)
Read 2 items
> b
[1]  35 735
> c <- scan(cn.x, n=2)
Read 2 items
> c
[1] 115 135
> d <- scan(cn.x, n=1)
Read 1 items
> d
[1] 75
> 

Note in b, I should get 535, not 35 as the first value. In d, I should
get 175.  Does anyone know how to get these digits?

The reason I'm not scanning the entire file at once is that my real
dataset is much larger than a Gig and I'll need to pull only portions of
the file in at once. I got readLines to work, but then I have to figure
out how to convert each entire line into a data.frame. Scan seems a lot
cleaner, with the exception of the funny character dropping issue.

Thanks so much!
Tim Howard

__
R-help@stat.math.ethz.ch 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] Function to modify existing data.frame

2005-01-18 Thread Jan T. Kim
On Tue, Jan 18, 2005 at 09:35:26AM -0800, Thomas Lumley wrote:
> On Tue, 18 Jan 2005, Peter Muhlberger wrote:
> 
> >I'm used to statistical languages, such as Stata, in which it's trivial to
> >pass a list of variables to a function & have that function modify those
> >variables in the existing dataset rather than create copies of the 
> >variables
> >or having to replace the entire dataset to change a few variables.  In R, I
> >suppose I could paste together the right instructions in a function and 
> >then
> >execute it, but is there any more straightforward way of doing this I'm
> >missing?

> There are two ways to get the effect you are looking for. I don't 
> recommend either, though.

This leaves me wondering which way you actually would recommend? After
all, one cannot entirely recommend against the concept of a function
(sensu lato, perhaps) which modifies a few members of a (possibly
very large) object in place, without copying the entire object in the
process.

> 1) Store your variables in an environment, rather than a data frame. 
> Environments are passed by reference.

This is the approach used in the OOP package -- so, while implementing
the data set as an object in this way is probably substantially "more"
than what Peter asked for, wouldn't this be an interesting option to
at least look into?

> 2) The right combinations of eval() and substitute() and lazy evaluation 
> make it possible to write macros in R.  There's an R Newsletter article 
> about this.

Ok, this refers to the "defmacro" technique, if I dereference this call
by reference correctly  ;-)

Best regards, Jan
-- 
 +- Jan T. Kim ---+
 |*NEW*email: [EMAIL PROTECTED]   |
 |*NEW*WWW:   http://www.cmp.uea.ac.uk/people/jtk |
 *-=<  hierarchical systems are for files, not for humans  >=-*

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


RE: [R] help wanted using R in a classroom

2005-01-18 Thread Liaw, Andy
> From: bogdan romocea
> 
> It appears you wouldn't get much improvement at all even if 
> the 2nd CPU
> were used at 100%. Five R sessions can easily overwhelm one CPU. I
> think you need (a lot) more CPUs than 2 to solve your problem.
> 
> Possible solutions:
> 1. Install R on each eMac. Since you have 40 of them, you 
> might want to
> put together a script to do this.
> 2. Get some boxes that can run Windows. On Windows, you can run R from
> a CD/zip drive/USB drive. (So you could burn 40 CDs and have everyone
> run their R session on their box.) As far as I know the same is not
> true for GNU/Linux and Mac OS.

If one can run Linux off a (live) CD, why wouldn't it be possible to do the
same for R?  (Burn a Quantian DVD and you can boot a x86 box from it to run
R.)

If I'm not mistaken, it shouldn't be a problem running R off a USB pen drive
or CD under Linux.  I can give it a shot tonight (if I can find the time).

Andy

 
> HTH,
> b.
> 
> 
> -Original Message-
> From: Sam Parvaneh
> Sent: Monday, January 17, 2005 6:11 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] help wanted using R in a classroom
> 
> 
> Hi everyone!
> 
> I'm using R 2.0.1 for Mac OS X in a classroom with 40 eMacs 
> running Mac
> OS 
> X version 10.3.6.
> These Macs are network based, meaning that the students log in to an 
> XServe G4 where their user accounts and home directories are stored.
> 
> The problem that I'm having each time a group of students 
> (usually 7 to
> 
> 10) use R is that the whole system get incredibly slow.
> The response time for opening an application  while the students are 
> running R is around 5 minutes.
> If a student wants to log into the system while others are running R,
> it 
> can take up to 10 minutes for the student to get logged in.
> Everything gets very slow that it's almost impossible to work.
> When I look at the server Graphs, the CPU usage of the first CPU is
> always 
> 100% when these students are using R. The second CPU is left at 15%. 
> 
> When these students quit R, then everything's is back to normal again.
> The 
> usage of both CPUs go back down to between 5-10%.
> Is there anyone out there using R in a university like this?
> Does anyone have an idea what this might depend one or maybe a
> solution?
> I can provide some more information if anyone wants, if you think you
> can 
> help me.
> 
> Thanks in advance
> /Sam
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
>

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


RE: [R] help wanted using R in a classroom

2005-01-18 Thread bogdan romocea
It appears you wouldn't get much improvement at all even if the 2nd CPU
were used at 100%. Five R sessions can easily overwhelm one CPU. I
think you need (a lot) more CPUs than 2 to solve your problem.

Possible solutions:
1. Install R on each eMac. Since you have 40 of them, you might want to
put together a script to do this.
2. Get some boxes that can run Windows. On Windows, you can run R from
a CD/zip drive/USB drive. (So you could burn 40 CDs and have everyone
run their R session on their box.) As far as I know the same is not
true for GNU/Linux and Mac OS.

HTH,
b.


-Original Message-
From: Sam Parvaneh
Sent: Monday, January 17, 2005 6:11 AM
To: r-help@stat.math.ethz.ch
Subject: [R] help wanted using R in a classroom


Hi everyone!

I'm using R 2.0.1 for Mac OS X in a classroom with 40 eMacs running Mac
OS 
X version 10.3.6.
These Macs are network based, meaning that the students log in to an 
XServe G4 where their user accounts and home directories are stored.

The problem that I'm having each time a group of students (usually 7 to

10) use R is that the whole system get incredibly slow.
The response time for opening an application  while the students are 
running R is around 5 minutes.
If a student wants to log into the system while others are running R,
it 
can take up to 10 minutes for the student to get logged in.
Everything gets very slow that it's almost impossible to work.
When I look at the server Graphs, the CPU usage of the first CPU is
always 
100% when these students are using R. The second CPU is left at 15%. 

When these students quit R, then everything's is back to normal again.
The 
usage of both CPUs go back down to between 5-10%.
Is there anyone out there using R in a university like this?
Does anyone have an idea what this might depend one or maybe a
solution?
I can provide some more information if anyone wants, if you think you
can 
help me.

Thanks in advance
/Sam


[[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] embedding fonts in eps files

2005-01-18 Thread Prof Brian Ripley
On Tue, 18 Jan 2005, Uwe Ligges wrote:
To clarify why people might want to embed fonts, I'd like to give an example:
After I submitted my book the first time, the printing house asked me 
explicitly to embed *all* fonts in graphics, or they would not be able to 
print from a pdf file (generated from PostScript by certain styles for Adobe 
Distiller). And sometimes discussions are simply hopeless.
Agreed.  So I got Distiller to embed them.  For that you need a valid 
licence for the font you use for the application you have (in Uwe's and my 
case, printing a book on someone else's printer).

Let me refer people again to the help file, which does contain all the 
information required, evne if it has not been read.

--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Time line plot in R? -- one more problem

2005-01-18 Thread Sander Oom
Jim,
Inspired by the question about font embedding, I plotted the time line 
script to a postscript file. To my disappointment, I can not make the 
time line appear properly on the postscript graph. It seems that the 
device does not know I have plotted something new below the original graph!?

Any suggesting how to resize the graph to plot the time line correctly 
in postscript?

Thanks,
Sander.
Jim Lemon wrote:
Sander Oom wrote:
Dear R users,
In order to illustrate the possible effects of events on variables
plotted against time, I would like plot a time line of events along side
the plot of the variables.
The x-axis should be some time unit; the y-axis should be the variable
of interest; the time line should be plotted below the graph along the
same x-axis scale.
As I have many variables and different events lists, I would like to
write a script to read the events from a file and plot them together
with the other plot.
The time line should look something like this:
http://www.oslis.k12.or.us/secondary/howto/organize/images/timeline.gif
Here's one way:
# some fake data please, maestro
fakedata<-sample(1:10,10)
# leave a bit of extra space beneath and to the left of the plot
par(mar=c(6,6,4,2))
# this function will probably end up in the "plotrix" package
time.line<-function(x,y,at=NULL,labels=TRUE,tlticks=NULL,...) {
 if(missing(x) && missing (y))
  stop("Usage: time.line(x,y,at=NULL,labels=TRUE)")
 plotrange<-par("usr")
 # get the graphical parameters
 oldpar<-par(no.readonly=TRUE)
 # turn off clipping
 par(xpd=TRUE)
 if(missing(x)) {
  # it's a horizontal line
  segments(plotrange[1],y,plotrange[2],y,...)
  ticklen<-(plotrange[4]-plotrange[3])*0.02
  if(!is.null(tlticks))
   segments(tlticks,y+ticklen,tlticks,y-ticklen,...)
  mwidth<-strwidth("M")
  # blank out the line where labels will appear
  rect(at-mwidth,y-ticklen,at+mwidth,y+ticklen,col="white",border=FALSE)
 # rotate the text
  par(srt=90)
  # draw the labels
  text(at,y,labels,...)
 }
 if(missing(y)) {
  # it's a vertical line
  # draw the line
  segments(x,plotrange[3],x,plotrange[4],...)
  ticklen<-(plotrange[2]-plotrange[1])*0.02
  if(!is.null(tlticks))
   segments(x+ticklen,tlticks,x-ticklen,tlticks,...)
  mheight<-strheight("M")
  # blank out the line where labels will appear
  rect(x-ticklen,at-mheight,x+ticklen,at+mheight,col="white",border=FALSE)
  # draw the labels
  text(x,at,labels,...)
 }
 # restore the parameters
 par(oldpar)
}
# create a file with the positions and labels you want like this:
# 2.5,first
# 4,second
# 7,third
# 8.5,fourth
# call it "labels.txt" and read it in
tl.labels<-read.table("labels.txt",sep=",")
plot(fakedata,xlab="")
# display a horizontal time line
time.line(x=-1,at=tl.labels[[1]],labels=tl.labels[[2]],col="black")
# now a vertical one
time.line(y=-1,at=tl.labels[[1]],labels=tl.labels[[2]],col="black")
__
R-help@stat.math.ethz.ch 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] embedding fonts in eps files

2005-01-18 Thread Sander Oom
Rudi,
If it turns out that fonts can not be embedded with R, then one option 
is to import/export the file through CorelDraw (or other vector drawing 
software equivalent). The 'export to eps' function in CorelDraw provides 
an option to embed all the fonts!

It requires manual labour, but it will work. You will be able to embed 
any font available in Corel Draw: fonts galore!!

Sander.
Rudi Alberts wrote:
Hi,
I have to make eps files with fonts embedded. 
I use the following postscript command:

postscript("fig3a.eps", width = 5.2756, height = 7.27, pointsize =
7,horizontal = FALSE, onefile = FALSE, paper = "special",family =
"Times")
plot(...)
dev.off()
Are fonts automatically embedded in this way?
How can I see that?
If not, how to do it?
regards, Rudi.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


[R] Off topic - Combine results of two testing procedures

2005-01-18 Thread Stephane Dray
Hello list,
I have a question not directly linked to R, I have googling during one day 
but did not find any satisfying answer. Perhaps some people of the list 
could give me some advices.

Here is my problem, I compute a statistic which measure the link between 
three tables X (n,p), Y(p,m) and Z(n,q). I would like to conduct a test the 
hypothesis  that X,Y and Z are linked.

I have implemented two testing procedures (by monte-carlo permutation) 
which test:

Ho: X,Y and Z are not linked vs. H1: at least X and Z are linked
Ho: X,Y and Z are not linked vs. H2: at least X and Y are linked
I would like to combine probabilites from these two tests in order to test
Ho: X,Y and Z are not linked vs. H3: X ,Y and Z are linked
I can not implement a direct permutation procedure to test Ho vs H3, and 
wonder if there is one way to deduce it from the two first testing procedures.

Help and reference are welcome,
Thanks in advance,
Sincerely.
Stéphane DRAY
-- 

Département des Sciences Biologiques
Université de Montréal, C.P. 6128, succursale centre-ville
Montréal, Québec H3C 3J7, Canada
Tel : (514) 343-6111 poste 1233 Fax : (514) 343-2293
E-mail : [EMAIL PROTECTED]
-- 

Web  http://www.steph280.freesurf.fr/
__
R-help@stat.math.ethz.ch 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] Function to modify existing data.frame

2005-01-18 Thread Thomas Lumley
On Tue, 18 Jan 2005, Peter Muhlberger wrote:
I'm used to statistical languages, such as Stata, in which it's trivial to
pass a list of variables to a function & have that function modify those
variables in the existing dataset rather than create copies of the variables
or having to replace the entire dataset to change a few variables.  In R, I
suppose I could paste together the right instructions in a function and then
execute it, but is there any more straightforward way of doing this I'm
missing?
Yes and no.
This isn't so much a question of pass-by-reference, as one reply 
suggested, but of macros vs functions.

Stata is (largely) a macro language: it does operations on command strings 
and then evaluates them.  It's not that Stata programs work with 
references, it's that all objects (except local macros) are global.

 R is based on functions: it evaluates arguments and then operates on 
them.  When you have functions, with local variables, it then becomes 
relevant to ask whether the arguments to the function are just copies or 
are references to the real thing. In R they are just copies (from a 
language point of view) but are often references from an efficiency point 
of view.

There are two ways to get the effect you are looking for. I don't 
recommend either, though.

1) Store your variables in an environment, rather than a data frame. 
Environments are passed by reference.

2) The right combinations of eval() and substitute() and lazy evaluation 
make it possible to write macros in R.  There's an R Newsletter article 
about this.

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


Re: [R] chi-square and error bars?

2005-01-18 Thread Achim Zeileis
On Tue, 18 Jan 2005 17:16:46 + (GMT) Dan Bolser wrote:

> 
> This may sound crazy but...
> 
> I have data like this...
> 
> > results.matrix
>  [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
> [1,]  949   932   11   26   2076   10 5 0 3
> [2,] 1233  124   24   35   58   57   17   21   31191121
> 
> 
> Which is the result of binning (summing) the response variables of an
> underlying (nearly) continious range of predictor variable into 12
> bins.
> 
> I can see that each row is not drawn from the same underlying
> population using chisq.test.
> 
> What I would like to do is plot each proportion from each row with a
> confidence interval which represents the results of the chisq.test,
> i.e. put confidence intervals on each proportion.
> 
> I thought about doing the arcsine transformation on the proportions
> and then I can use the binomial distribution to get the variance and
> hence 95% confidence interval (then back transformation).

You could also sample from the indepence table using r2dtable() and
derive simultanous confidence intervals from that.

Other visualizations of departures from indepence include mosaicplots
with shading or association plots. See mosaicplot() and assocplot() and
the package vcd.
Z
 
> Clearly confidence in latter points is weaker (fewer observations),
> but I can't seem to find a plot to capture this fact.
> 
> __
> R-help@stat.math.ethz.ch 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] "Attach" for S4 objects?

2005-01-18 Thread McGehee, Robert
Certainly this _is_ possible. However, there are no built-in functions to do 
just this (that I know of). Here's a function that attaches like you say (but 
still makes a local copy)

attachslot <- function(x) {
xname <- substitute(x)
sl <- names(getSlots(class(x)))
slotnames <- paste(sl, " <<- ", xname, "@", sl, sep = "")

for (i in slotnames) {
eval(parse(text = substitute(slotnames, list(slotnames = slotnames
}
}

If you wanted to do this without making a local copy, then the strategy might 
be either to make a promise object out of the "slotname" (which stores only the 
unevaluated expression until you need the data), see ?delay, or a bit more 
complicated, store the "name" of the object as a pointer to the underlying 
slot. Then, you would be referencing the pointer to the object rather than the 
copy. Don't want to spend the time to figure this out, but I'm pretty sure it 
_can_ be done.

All this said, there are good reasons not to attach like this as it is 
certainly a bad coding habit. If your code ever references two objects of the 
same class, there might be confusion as to which one is attached as slots are 
not unique. Also, this relies on the class design and not on the underlying 
data. I would certainly (and do!) want to switch around my slots or classes 
without substantively rewriting my code. And lastly, if you ever had an object 
named x and a slot of an attached object named x then either the former would 
be rewritten, or you'd have to spend a great deal of time figuring out ways to 
properly scope your attached slots.

In short, don't do it.

Best,
Robert


-Original Message-
From: F.Tusell [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 18, 2005 9:38 AM
To: R-help@stat.math.ethz.ch
Subject: [R] "Attach" for S4 objects?


When passing a list as an argument to a function, I find it convenient
to attach it in the first line of th function code, then refer to the
components as A, B, etc. rather than as list$A, list$B, etc.

If I pass a S4 class object, is there a way to "attach" it, or do I have
to refer to the slots as [EMAIL PROTECTED], [EMAIL PROTECTED], etc.? 

I could always make copies,  

 A <- [EMAIL PROTECTED] 
 B <- [EMAIL PROTECTED]
 ...

but "object" has many slots, some fairly large, so this seems wasteful.

Thank you.
-- 
Fernando TUSELLe-mail:
Departamento de Econometría y Estadística   [EMAIL PROTECTED] 
Facultad de CC.EE. y Empresariales Tel:   (+34)94.601.3733
Avenida Lendakari Aguirre, 83  Fax:   (+34)94.601.3754
E-48015 BILBAO  (Spain)Secr:  (+34)94.601.3740

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

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


[R] chi-square and error bars?

2005-01-18 Thread Dan Bolser

This may sound crazy but...

I have data like this...

> results.matrix
 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
[1,]  949   932   11   26   2076   10 5 0 3
[2,] 1233  124   24   35   58   57   17   21   31191121


Which is the result of binning (summing) the response variables of an
underlying (nearly) continious range of predictor variable into 12 bins.

I can see that each row is not drawn from the same underlying population
using chisq.test.

What I would like to do is plot each proportion from each row with a
confidence interval which represents the results of the chisq.test,
i.e. put confidence intervals on each proportion.

I thought about doing the arcsine transformation on the proportions and
then I can use the binomial distribution to get the variance and hence 95%
confidence interval (then back transformation).

Clearly confidence in latter points is weaker (fewer observations), but I
can't seem to find a plot to capture this fact.

__
R-help@stat.math.ethz.ch 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] Panel methods, implied var/cov structure

2005-01-18 Thread Tobias Muhlhofer
Hi!
I have a (fairly narrow and long) panel dataset of returns across three 
portfolios over 100-odd time-series observations. I have reason to 
believe that there is heteroskedasticity in the error terms, but that 
this heteroskedasticity is only through time, i.e. that the three 
portfolios have the same underlying covariance structure over time, 
which of course is unknown to me and about which I do not want to make 
assumptions as to functional form.

Greene says there are GLS methods to handle this type of situation. What 
R functions am I looking for?

Is there another way of estimating this? Perhaps SUR, or something like 
that?

Thanks,
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] Function to modify existing data.frame

2005-01-18 Thread Jan T. Kim
On Tue, Jan 18, 2005 at 09:31:33AM -0600, Marc Schwartz wrote:
> On Tue, 2005-01-18 at 10:18 -0500, Peter Muhlberger wrote:
> > I'm used to statistical languages, such as Stata, in which it's trivial to
> > pass a list of variables to a function & have that function modify those
> > variables in the existing dataset rather than create copies of the variables
> > or having to replace the entire dataset to change a few variables.  In R, I
> > suppose I could paste together the right instructions in a function and then
> > execute it, but is there any more straightforward way of doing this I'm
> > missing?

> What type of modifications?
> 
> Take a look at:
> 
> ?replace
> ?transform

I know neither the original poster nor Stata, but as I understand the
question, this answer may not be exactly what Peter has been looking
for. As the docs on replace state:

x is unchanged: remember to assign the result.

So, something like

x <- replace(x, 4:6, 3:5 * 3)

does not eliminate creation of a copy of x. A function that modifies
its argument would require a call by reference mechanism, which isn't
provided by R.

Some time ago, I looked quite extensively for a call by reference facility
in R, but found that there is none. In the archives of this mailing list
and elsewhere, various alternatives to call by reference approaches are
suggested. As far as I can see, the issues of performance hits incurred
by unnecessary copying of large objects, and of implementing true state
changes in object oriented programming cannot fully be resolved, however.

Best regards, Jan
-- 
 +- Jan T. Kim ---+
 |*NEW*email: [EMAIL PROTECTED]   |
 |*NEW*WWW:   http://www.cmp.uea.ac.uk/people/jtk |
 *-=<  hierarchical systems are for files, not for humans  >=-*

__
R-help@stat.math.ethz.ch 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] a question about linear mixed model in R

2005-01-18 Thread Chung Chang
Dear all,

I have a somewhat unusual linear mixed model that I can't seem
to code in lme.  It's only unusual in that one random effect is
applied only to some of the observations (I have an indicator
variable
that specifies which observations have this random effect).

The model is:

X_hijk = alpha_h + h * b_i + r_(ij) + e_hijk , where

  h = 0 or 1 (indicator)
  i = 1, ..., N
  j = 1, ..., n_i
  k = 1, ..., K
alpha is fixed, and the rest are random.
I'm willing to assume b, r, and e are mutually independent
and normal with var(b) = sigma^2_b, var(r) = sigma^2_r, and
var(e) = sigma^2.

Any help in writing this model in lme() would be greatly
appreciated.

Thanks,

Chung Cheng

__
R-help@stat.math.ethz.ch 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] background color for plotting symbols in 'matplot'

2005-01-18 Thread joerg van den hoff
something like
matplot2(matrix(1:6,3,2),matrix(7:12,3,2),pch=21,bg=c(2,3),type='b')
does not yield the expected (at least by me) result: only the points on 
the first line get (successively) background colors for the plotting 
symbols, the second line gets no background color at all for its 
plotting symbols.

I think the natural behaviour should be two curves which (for the 
example given above) symbol-background colors 2 and 3, respectively (as 
would be obtained by a suitable manual combination of 'plot' and 
'lines'). the modification of the matplot code to achieve this 
behaviour is obvious as far as I can see (adding 'bg' to the explicit 
arguments of matplot and handling similar to 'lty', 'cex' and the like 
inside the function including transfer to 'plot' and 'lines' argument list).

is the present behaviour a bug of 'matplot' or is it for some reason 
intended behaviour?

regards,
joerg
__
R-help@stat.math.ethz.ch 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] Function to modify existing data.frame

2005-01-18 Thread Marc Schwartz
On Tue, 2005-01-18 at 10:18 -0500, Peter Muhlberger wrote:
> I'm used to statistical languages, such as Stata, in which it's trivial to
> pass a list of variables to a function & have that function modify those
> variables in the existing dataset rather than create copies of the variables
> or having to replace the entire dataset to change a few variables.  In R, I
> suppose I could paste together the right instructions in a function and then
> execute it, but is there any more straightforward way of doing this I'm
> missing?
> 
> Thx,
> 
> Peter


What type of modifications?

Take a look at:

?replace
?transform

HTH,

Marc Schwartz

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


Re: [R] embedding fonts in eps files

2005-01-18 Thread Uwe Ligges
To clarify why people might want to embed fonts, I'd like to give an 
example:

After I submitted my book the first time, the printing house asked me 
explicitly to embed *all* fonts in graphics, or they would not be able 
to print from a pdf file (generated from PostScript by certain styles 
for Adobe Distiller). And sometimes discussions are simply hopeless.

Uwe Ligges

(Ted Harding) wrote:
On 18-Jan-05 Rudi Alberts wrote:
Hi,
I have to make eps files with fonts embedded. 
I use the following postscript command:

postscript("fig3a.eps", width = 5.2756, height = 7.27, pointsize =
7,horizontal = FALSE, onefile = FALSE, paper = "special",family =
"Times")
plot(...)
dev.off()
Are fonts automatically embedded in this way?
How can I see that?
If not, how to do it?

Well, it seems to have set Times as the working font family
when I used your postscript(...) command above; but see further
down. I viewed the resulting .eps file (using 'less' in Linux
but Windows users should also have some way of looking into a
text file).
The first few lines of the file are:
%!PS-Adobe-3.0 EPSF-3.0
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
%%+ font Times-BoldItalic
%%+ font Symbol
%%Title: R Graphics Output
...
These are so-called DSC ("Document Structuring Conventions")
comments and are not directly executed by whatever renders
the PostScript code. They do, however, provided useful
information for programs which have to handle the PS file.
From the above, it can be seen that R's postscript() function
has taken note of the 'family="Times"' option.
Further down the .eps file are the lines
%%IncludeResource: font Times-Roman
/Times-Roman findfont
dup length dict begin
  {1 index /FID ne {def} {pop pop} ifelse} forall
  /Encoding ISOLatin1Encoding def
  currentdict
  end
/Font1 exch definefont pop
%%IncludeResource: font Times-Bold
/Times-Bold findfont
dup length dict begin
  {1 index /FID ne {def} {pop pop} ifelse} forall
  /Encoding ISOLatin1Encoding def
  currentdict
  end
/Font2 exch definefont pop
%%IncludeResource: font Times-Italic
/Times-Italic findfont
dup length dict begin
  {1 index /FID ne {def} {pop pop} ifelse} forall
  /Encoding ISOLatin1Encoding def
  currentdict
  end
/Font3 exch definefont pop
%%IncludeResource: font Times-BoldItalic
/Times-BoldItalic findfont
dup length dict begin
  {1 index /FID ne {def} {pop pop} ifelse} forall
  /Encoding ISOLatin1Encoding def
  currentdict
  end
/Font4 exch definefont pop
%%IncludeResource: font Symbol
/Symbol findfont
dup length dict begin
  {1 index /FID ne {def} {pop pop} ifelse} forall
  currentdict
  end
/Font5 exch definefont pop
Apart from the "%%" DSC comments, this is executable PS
code which calls on the interpreter to set up the Times
fonts Times-Roman as Font1, Times-Bold as Font2,
Times-Italic as Font3, Times-BoldItalic as Font4,
and Symbol (not a Times font) as Font5.
If, instead of 'family="Times"', you had used the option
'family="Helvetica"', you would have got (try it and see)
exactly the same with "Helvetica" substituted for "Times"
throughout.
So far so good. Now comes the crunch.
The above (and this is the only part of the .eps file
which has anything to do with setting up fonts) assumes
that the PS interpreter (i.e. the program, including
printer firmware, which renders the PS visible) already
has access to the PostScript definitions of these fonts.
There is a default assumption (not just in R but in
practically any software which outputs PostScript) that
the rendering device will have built-in access to the
"Standard Adobe Font Set" -- a set of 13 fonts comprising
the Times, Helvetica and Courier families, and the Symbol
font, together with the encoding vectors StandardEncoding
and ISOLatin1Encoding; most software also assumes the
presence of further families (typically Bookman, Palatino,
AvantGarde, HelveticaNarrow, ZapfChanceryMediumItalic,
ZapfDingbats). None of these are strictly required by
the specification of the PostScript language, but they
have been a de facto standard for decades and it is most
unusual to find PostScript-generating software which does
not take them for granted (at least the 13 "Standard Adobe"
fonts).
Now "built-in access" means that the rendering device
is already equipped with the PostScript definitions of
how to draw ("render") the characters ("glyphs") in these
various fonts -- e.g. a PostScript printer will have the
definitions internally stored in a ROM chip. Therefore
when the PS definitions of "Font1" etc. as in the above
file are encountered, the device simply hooks its own PS
definitions into the working stack. It is not necessary
to include the definitions in the file which is being
interpreted.
However, to "embed" a font (which is what you refer to
in your query) means to include the PS font definition
in the file itself. This is certainly necessary if you
want to use a "non-standard" font, which might just be
an arty-farty font for English characters (e.g. a fancy

[R] Function to modify existing data.frame

2005-01-18 Thread Peter Muhlberger
I'm used to statistical languages, such as Stata, in which it's trivial to
pass a list of variables to a function & have that function modify those
variables in the existing dataset rather than create copies of the variables
or having to replace the entire dataset to change a few variables.  In R, I
suppose I could paste together the right instructions in a function and then
execute it, but is there any more straightforward way of doing this I'm
missing?

Thx,

Peter

__
R-help@stat.math.ethz.ch 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] "Attach" for S4 objects?

2005-01-18 Thread F.Tusell
When passing a list as an argument to a function, I find it convenient
to attach it in the first line of th function code, then refer to the
components as A, B, etc. rather than as list$A, list$B, etc.

If I pass a S4 class object, is there a way to "attach" it, or do I have
to refer to the slots as [EMAIL PROTECTED], [EMAIL PROTECTED], etc.? 

I could always make copies,  

 A <- [EMAIL PROTECTED] 
 B <- [EMAIL PROTECTED]
 ...

but "object" has many slots, some fairly large, so this seems wasteful.

Thank you.
-- 
Fernando TUSELLe-mail:
Departamento de Econometría y Estadística   [EMAIL PROTECTED] 
Facultad de CC.EE. y Empresariales Tel:   (+34)94.601.3733
Avenida Lendakari Aguirre, 83  Fax:   (+34)94.601.3754
E-48015 BILBAO  (Spain)Secr:  (+34)94.601.3740

__
R-help@stat.math.ethz.ch 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] Build problem with R-1.4.1 on AM64/Linux

2005-01-18 Thread Peter Dalgaard
"Liaw, Andy" <[EMAIL PROTECTED]> writes:

> When R-1.4.1 was released, AMD64 did not exist yet.  You are likely to do
> better by trying to update the package to the current version of R.  The
> first step of that is to change all the `_' for assignment to `<-' in the R
> code.  Some functions might be deprecated, and if so need to be replaced.
> It is possible that you may run into more problems, but those problems, I'd
> guess, are easier to solve than trying to get R-1.4.1 to compile correctly
> on a current AMD64 Linux installation.

My thoughts too. Also, there seems to be an issue with lazy loading,
which is a newer feature, but can be turned off with a line in the
DESCRIPTION file
 
> Just my 0.01532326 Euro (as of 2005-01-18)...

Wrong currency:

0.138560 SEK

or maybe (guessing from the name)

0.873306 INR

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

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

2005-01-18 Thread Douglas Bates
Ming Hsu wrote:
Hi, this is my first time using the nlme package, and I ran into the
following puzzling problem.
I estimated a mixed effects model using lme, once using groupedData, once
explicitly stating the equations.  I had the following outputs.  All the
coefficients were similar, but they're always slightly different, making me
think that it's not due to numerical error.
Also, what is the "Corr" field in the Random Effects output?  Is it the
correlation between the various regressors?
Here are the outputs.
1. Linear mixed-effects model fit by REML
 Data: groupedData(dPx ~ EMX + EMY | Session, data = X.cen)
   AIC BIClogLik
  834.1692 862.532 -407.0846
Random effects:
 Formula: ~EMX + EMY | Session
 Structure: General positive-definite
StdDevCorr
(Intercept) 1.0205525 (Intr) EMX
EMX 0.2708627  1
EMY 0.2795289 -1 -1
Residual5.5076376
Fixed effects: dPx ~ EMX + EMY
 Value Std.Error  DF   t-value p-value
(Intercept)  1.3011219 0.6807083 121  1.911423  0.0583
EMX  0.7878296 0.2539316 121  3.102526  0.0024
EMY -0.1566070 0.1534066 121 -1.020862  0.3094
 Correlation: 
(Intr) EMX   
EMX  0.151   
EMY -0.573 -0.092

Standardized Within-Group Residuals:
Min  Q1 Med  Q3 Max
-3.00618687 -0.23680151 -0.03431868  0.15386198  6.27114243
Number of Observations: 129
Number of Groups: 6
===
2. Linear mixed-effects model fit by REML
 Data: X.cen 
  AIC  BIClogLik
  834.457 862.8199 -407.2285

Random effects:
 Formula: ~EMX + EMY | Session
 Structure: General positive-definite, Log-Cholesky parametrization
StdDevCorr
(Intercept) 1.0101137 (Intr) EMX
EMX 0.2108649  0.857
EMY 0.2995491 -0.944 -0.882
Residual5.5104113
Fixed effects: dPx ~ EMX + EMY
 Value Std.Error  DF   t-value p-value
(Intercept)  1.3062194 0.6823464 121  1.914305  0.0579
EMX  0.7612238 0.2440504 121  3.119125  0.0023
EMY -0.1677985 0.1618076 121 -1.037025  0.3018
 Correlation: 
(Intr) EMX   
EMX  0.059   
EMY -0.552 -0.002

Standardized Within-Group Residuals:
Min  Q1 Med  Q3 Max
-3.00604994 -0.24210830 -0.01660797  0.14846499  6.27931955
Number of Observations: 129
Number of Groups: 6
Could you please include the calls to lme so we can see exactly what is 
being fit?

You asked about the Corr columns, those are the correlation form of the 
estimated variance-covariance matrix of the random effects.  Notice that 
you are trying to estmate 6 variance-covariance parameters (3 variances 
and 3 covariances) from information on 6 groups.  In the first output 
the estimated variance-covariance matrix is singlular (correlations of 
-1 and +1).  With so many parameters to estimate from so few groups it 
is not surprising that there is difficulty.

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

2005-01-18 Thread Uwe Ligges
Sander Oom wrote:
Jim,
Brilliant! Thought someone might have figured it out already. Now we 
just need a gallery to show off this graph!

One little thing: the par(mar=6,6,4,2) gives an error:

par(mar=c(6,6,4,2))
Uwe Ligges
'Error in par(args) : parameter "mar" has the wrong length'
Any suggestions?
Code below includes fake labels for testing.
Cheers,
Sander.
# some fake data please, maestro
fakedata<-sample(1:10,10)
# leave a bit of extra space beneath and to the left of the plot
par(mar=6,6,4,2)
# this function will probably end up in the "plotrix" package
time.line<-function(x,y,at=NULL,labels=TRUE,tlticks=NULL,...) {
 if(missing(x) && missing (y))
  stop("Usage: time.line(x,y,at=NULL,labels=TRUE)")
 plotrange<-par("usr")
 # get the graphical parameters
 oldpar<-par(no.readonly=TRUE)
 # turn off clipping
 par(xpd=TRUE)
 if(missing(x)) {
  # it's a horizontal line
  segments(plotrange[1],y,plotrange[2],y,...)
  ticklen<-(plotrange[4]-plotrange[3])*0.02
  if(!is.null(tlticks))
   segments(tlticks,y+ticklen,tlticks,y-ticklen,...)
  mwidth<-strwidth("M")
  # blank out the line where labels will appear
  rect(at-mwidth,y-ticklen,at+mwidth,y+ticklen,col="white",border=FALSE)
 # rotate the text
  par(srt=270)
  # draw the labels
  text(at,y,labels,...)
 }
 if(missing(y)) {
  # it's a vertical line
  # draw the line
  segments(x,plotrange[3],x,plotrange[4],...)
  ticklen<-(plotrange[2]-plotrange[1])*0.02
  if(!is.null(tlticks))
   segments(x+ticklen,tlticks,x-ticklen,tlticks,...)
  mheight<-strheight("M")
  # blank out the line where labels will appear
  rect(x-ticklen,at-mheight,x+ticklen,at+mheight,col="white",border=FALSE)
  # draw the labels
  text(x,at,labels,...)
 }
 # restore the parameters
 par(oldpar)
}
# some fake labels
eventT<-c(2.5, 4, 7, 8.5)
eventD<-c("first event","second event","third event","fourth event")
tl.labels<-data.frame(eventT,eventD)
plot(fakedata,xlab="")
# display a horizontal time line
time.line(x=-1,at=tl.labels[[1]],labels=tl.labels[[2]],col="black")
# now a vertical one
time.line(y=-1,at=tl.labels[[1]],labels=tl.labels[[2]],col="black")
 > version
 _
platform i386-pc-mingw32
arch i386
os   mingw32
system   i386, mingw32
status
major2
minor0.1
year 2004
month11
day  15
language R
 >
Jim Lemon wrote:
Sander Oom wrote:
Dear R users,
In order to illustrate the possible effects of events on variables
plotted against time, I would like plot a time line of events along side
the plot of the variables.
The x-axis should be some time unit; the y-axis should be the variable
of interest; the time line should be plotted below the graph along the
same x-axis scale.
As I have many variables and different events lists, I would like to
write a script to read the events from a file and plot them together
with the other plot.
The time line should look something like this:
http://www.oslis.k12.or.us/secondary/howto/organize/images/timeline.gif
Here's one way:
# some fake data please, maestro
fakedata<-sample(1:10,10)
# leave a bit of extra space beneath and to the left of the plot
par(mar=6,6,4,2)
# this function will probably end up in the "plotrix" package
time.line<-function(x,y,at=NULL,labels=TRUE,tlticks=NULL,...) {
 if(missing(x) && missing (y))
  stop("Usage: time.line(x,y,at=NULL,labels=TRUE)")
 plotrange<-par("usr")
 # get the graphical parameters
 oldpar<-par(no.readonly=TRUE)
 # turn off clipping
 par(xpd=TRUE)
 if(missing(x)) {
  # it's a horizontal line
  segments(plotrange[1],y,plotrange[2],y,...)
  ticklen<-(plotrange[4]-plotrange[3])*0.02
  if(!is.null(tlticks))
   segments(tlticks,y+ticklen,tlticks,y-ticklen,...)
  mwidth<-strwidth("M")
  # blank out the line where labels will appear
  rect(at-mwidth,y-ticklen,at+mwidth,y+ticklen,col="white",border=FALSE)
 # rotate the text
  par(srt=90)
  # draw the labels
  text(at,y,labels,...)
 }
 if(missing(y)) {
  # it's a vertical line
  # draw the line
  segments(x,plotrange[3],x,plotrange[4],...)
  ticklen<-(plotrange[2]-plotrange[1])*0.02
  if(!is.null(tlticks))
   segments(x+ticklen,tlticks,x-ticklen,tlticks,...)
  mheight<-strheight("M")
  # blank out the line where labels will appear
  
rect(x-ticklen,at-mheight,x+ticklen,at+mheight,col="white",border=FALSE)
  # draw the labels
  text(x,at,labels,...)
 }
 # restore the parameters
 par(oldpar)
}
# create a file with the positions and labels you want like this:
# 2.5,first
# 4,second
# 7,third
# 8.5,fourth
# call it "labels.txt" and read it in
tl.labels<-read.table("labels.txt",sep=",")
plot(fakedata,xlab="")
# display a horizontal time line
time.line(x=-1,at=tl.labels[[1]],labels=tl.labels[[2]],col="black")
# now a vertical one
time.line(y=-1,at=tl.labels[[1]],labels=tl.labels[[2]],col="black")

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


__
R

RE: [R] Build problem with R-1.4.1 on AM64/Linux

2005-01-18 Thread Liaw, Andy
When R-1.4.1 was released, AMD64 did not exist yet.  You are likely to do
better by trying to update the package to the current version of R.  The
first step of that is to change all the `_' for assignment to `<-' in the R
code.  Some functions might be deprecated, and if so need to be replaced.
It is possible that you may run into more problems, but those problems, I'd
guess, are easier to solve than trying to get R-1.4.1 to compile correctly
on a current AMD64 Linux installation.

Just my 0.01532326 Euro (as of 2005-01-18)...

Andy

> From: Sivakumar Ramagopal
> 
> Hi,
> 
> I get the following errors while building R-1.4.1 on AMD64/Linux (SuSE
> 9.1). R-2.0.1 compiles fine though. I'm building R-1.4.1 
> because I need to
> install SNet (available at
> http://cm.bell-labs.com/cm/ms/departments/sia/InternetTraffic/
> S-Net/SNet_1.0.zip).
> 
> The errors I get are:
> 
> In file included from dataentry.c:34:
> /usr/X11R6/include/X11/Xlib.h:1400: error: parse error before 
> "_Xconst"
> /usr/X11R6/include/X11/Xlib.h:1488: error: parse error before "char"
> 
> This happens a lot of times in various places in file dataentry.c
> 
> 
> dataentry.c: In function `GetKey':
> dataentry.c:1249: warning: passing arg 1 of `XLookupString' from
> incompatible pointer type
> dataentry.c:1249: warning: passing arg 4 of `XLookupString' from
> incompatible pointer type
> dataentry.c: In function `GetCharP':
> dataentry.c:1258: warning: passing arg 1 of `XLookupString' from
> incompatible pointer type
> dataentry.c:1258: warning: passing arg 4 of `XLookupString' from
> incompatible pointer type
> dataentry.c: In function `doControl':
> dataentry.c:1279: warning: passing arg 1 of `XLookupString' from
> incompatible pointer type
> dataentry.c:1279: warning: passing arg 4 of `XLookupString' from
> incompatible pointer type
> dataentry.c: In function `RefreshKeyboardMapping':
> dataentry.c:1308: warning: passing arg 1 of 
> `XRefreshKeyboardMapping' from
> incompatible pointer type
> make[4]: *** [dataentry.lo] Error 1
> 
> My guess is I'm missing a few packages but I don't know which 
> ones. How
> should I go about from here?
> 
> Thanks,
> Shiva
> 
> __
> R-help@stat.math.ethz.ch 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] problem installing RSPython

2005-01-18 Thread Robert Sams
Thank you Duncan. Still no luck, though.

> There are scripts in the installed version
> of RSPython 
> that sets the value of LD_LIBRARY_PATH,
> PYTHONPATH, etc.  appropriately.
> Your LD_LIBRARY_PATH seems to be incomplete for
> RSPython and you report three different settings
> for PYTHONPATH, but of course only one of them is
> the actual value that is set when python is run.
> 
> Use the appropriate script in
> 
>  RSPython/scripts/
> 
> by source'ing them into your shell,
> e.g. 
> 
>   . RSPython/scripts/RPython.bsh

I did...
$. /usr/lib/R/library/RSPython/scripts/RPython.bsh

now i have..
LD_LIBRARY_PATH=/usr/lib/R/lib
PYTHONPATH=/usr/lib/R/library/RSPython/libs:/usr/lib/R/library/RSPython/
Python
R_HOME=/usr/lib/R

but...
$python
import RS

returns the same error. 

And in R...
$R
library(RSPython)
Initialized R-Python interface package.
Warning message: 
the Python callback manager has been registered implicitly using the
defaults (referenceManager())! 

Any other hints? I'm having trouble problem solving this one.
Thanks.
Robert

> Robert Sams wrote:
> > Hi,
> > 
> > I'm trying to install RSPython v0.5-4 on a debian machine (woody,
> > testing) but am having the following problem.
> > 
> > $R CMD INSTALL -c --library=/usr/lib/R/library 
> RSPython_0.5-4.tar.gz 2>err
> > 
> > But then...
> > $python
> > >> import RS
> > Error in .PythonInit() : Error in Python call: values
> > Error in library("RSPython") : .First.lib failed for 'RSPython'
> > Traceback (most recent call last):
> >   File "", line 1, in ?
> >   File "/usr/lib/R/library/RSPython/Python/RS.py", line 69, in ?
> > library("RSPython")
> >   File "/usr/lib/R/library/RSPython/Python/RS.py", line 58, 
> in library
> > return(call("library", name));
> >   File "/usr/lib/R/library/RSPython/Python/RS.py", line 21, in call
> > return RSInternal.call(name, args, other, convert, ref)
> > RuntimeError: error in calling R: Error in 
> library("RSPython") : .First.lib failed for 'RSPython'
> > 
> > Hmm... But the installation is ok, except for these warnings:
> > $more err
> > PythonCall.c: In function `RPy_get':
> > PythonCall.c:305: warning: passing arg 1 of 
> `PyImport_ImportModule' discards qualifiers from pointer target type
> > RCall.c: In function `RPy_callPython':
> > RCall.c:62: warning: passing arg 1 of `PyType_GenericNew' 
> from incompatible pointer type
> > 
> > 
> > I'm running R v2.0.1, Python v2.3.4 and have the r-base-dev and
> > python2.3-dev packages installed. Relevant environment 
> variable settings:
> > PYTHONPATH=/usr/lib/python2.3:/usr/lib/python2.3/site-packages
> > R_HOME=/usr/lib/R
> > PYTHONPATH=${PYTHONPATH}:${R_HOME}/library/RSPython/Python
> > PYTHONPATH=${PYTHONPATH}:${R_HOME}/library/RSPython/libs
> > LD_LIBRARY_PATH=${R_HOME}/lib
> > 
> > Any suggestions? I'm probably overlooking something obvious. Thanks.
> > 
> > Robert
> > 
> > 
> > Robert Sams
> > 
> > SANCTUM FI LLP
> > Authorised and Regulated by the FSA. 
> > 
> > Sending encrypted mail:
> > 
> > See http://pgp.mit.edu (search string 'sanctumfi') for updates.
> > -BEGIN PGP PUBLIC KEY BLOCK-
> > Version: GnuPG v1.0.6 (GNU/Linux)
> > Comment: For info see http://www.gnupg.org
> > 
> > mQGiBEHVOaIRBAC3kUplVB1o00GQXU9TkKmMWz/LiknbhLgDPBZ+1nw1ffb2FpXW
> > mYet2yja8YIG3H2LnVla1WGVyfAyZ+QRmnUgm2hOnP7LNZIoHctnGqLmtQvOXvHz
> > xoDonFAl/ztBFE9aNPbiL4nlgdz9GS6LN6hbw9GTdYGip71QhaeVIRR3HwCgySSl
> > rUtSV8C7nbHR9C+zwku3EpMD/0yoq1R4lQgJGNbyjzzCRWRblK5cKLh1XUYG3JSc
> > ltLhoCZMvR+359FUSz+jEbbJaLRpquX48Wjv+7WW5KNVm2nPHSZrZ6tr+nm/ov1Y
> > DQxbIvBHxLXxltDWJlL/gg3bPaSIRlj/KVw0fB0NU1b25eGFRTtlHEvkAROj92sv
> > MiaSA/9jjEi2H0+yWujcBxJ6syUjWLlgRxvm85sJBihyan4ufAMFRria+QKx7ZMf
> > A7MNJ+r7ULdqCPsPdZP3kC7GNfLXBzizy3d2HSB/0oB7AjIoXrYyQvXQjFNQQX+u
> > XjeRGhALxou3H1NEPiCiHJiiaPU6Uh+KYhBCDOYZpc82FgKwWLQzUm9iZXJ0IFNh
> > bXMgKFNhbmN0dW0gRkkgTExQKSA8cm9iZXJ0QHNhbmN0dW1maS5jb20+iF0EExEC
> > AB0FAkHVOaIFCQHhM4AFCwcKAwQDFQMCAxYCAQIXgAAKCRB4Q4+orHX8Yk0hAJ9+
> > odzCRiih6wZz4NOOSVboJP+lngCeNvFGVxVQW35/qpTaF6wsym9jehi5AQ0EQdU5
> > oxAEALZEnBUQqKiF/gUqK7zyLJarsVxGsmuj0pkV5gFwCbChA4RA7QgHjknJT3Qd
> > jLUJOa+rW49WtbDCOBv+VOVp//gLROByZpizW4BYaOw01kI9emMuoc6el6nYXarJ
> > 6aZcA84IFBifdi2a8lB3ofhQuWc/YmxLjcOKbkaIC9lUYHrzAAMGA/0RRhkXCHCL
> > zRSQj+7nSBE4MTeMJycdytl1wnpWkRUa8MoUYBF6/3oiyCnO9bHbOAkQrULSWRLA
> > YsUJv0c1b6Dht5LVChGikJqKgCzWVEVUI7ob0F2LctvDxhZLlCctHapFGZn9+6pi
> > rZW+2XkBmbqhJ8ybKsRAIJNy7OV3sIHoVYhMBBgRAgAMBQJB1TmjBQkB4TOAAAoJ
> > EHhDj6isdfxizmIAn3I/mZyfAuBNZl0lG+9XpAhR80ThAKDAJEnXrH8dX30rRwDz
> > 1mgpwRYCiw==
> > =59j7
> > -END PGP PUBLIC KEY BLOCK-
> > 
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 
> -- 
> Duncan Temple Lang[EMAIL PROTECTED]
> Department of Statistics  work:  (530) 752-4782
> 371 Kerr Hall fax:   (530) 752-7099
>

[R] Build problem with R-1.4.1 on AM64/Linux

2005-01-18 Thread Sivakumar Ramagopal
Hi,

I get the following errors while building R-1.4.1 on AMD64/Linux (SuSE
9.1). R-2.0.1 compiles fine though. I'm building R-1.4.1 because I need to
install SNet (available at
http://cm.bell-labs.com/cm/ms/departments/sia/InternetTraffic/S-Net/SNet_1.0.zip).

The errors I get are:

In file included from dataentry.c:34:
/usr/X11R6/include/X11/Xlib.h:1400: error: parse error before "_Xconst"
/usr/X11R6/include/X11/Xlib.h:1488: error: parse error before "char"

This happens a lot of times in various places in file dataentry.c


dataentry.c: In function `GetKey':
dataentry.c:1249: warning: passing arg 1 of `XLookupString' from
incompatible pointer type
dataentry.c:1249: warning: passing arg 4 of `XLookupString' from
incompatible pointer type
dataentry.c: In function `GetCharP':
dataentry.c:1258: warning: passing arg 1 of `XLookupString' from
incompatible pointer type
dataentry.c:1258: warning: passing arg 4 of `XLookupString' from
incompatible pointer type
dataentry.c: In function `doControl':
dataentry.c:1279: warning: passing arg 1 of `XLookupString' from
incompatible pointer type
dataentry.c:1279: warning: passing arg 4 of `XLookupString' from
incompatible pointer type
dataentry.c: In function `RefreshKeyboardMapping':
dataentry.c:1308: warning: passing arg 1 of `XRefreshKeyboardMapping' from
incompatible pointer type
make[4]: *** [dataentry.lo] Error 1

My guess is I'm missing a few packages but I don't know which ones. How
should I go about from here?

Thanks,
Shiva

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

2005-01-18 Thread Sander Oom
Jim,
Brilliant! Thought someone might have figured it out already. Now we 
just need a gallery to show off this graph!

One little thing: the par(mar=6,6,4,2) gives an error:
'Error in par(args) : parameter "mar" has the wrong length'
Any suggestions?
Code below includes fake labels for testing.
Cheers,
Sander.
# some fake data please, maestro
fakedata<-sample(1:10,10)
# leave a bit of extra space beneath and to the left of the plot
par(mar=6,6,4,2)
# this function will probably end up in the "plotrix" package
time.line<-function(x,y,at=NULL,labels=TRUE,tlticks=NULL,...) {
 if(missing(x) && missing (y))
  stop("Usage: time.line(x,y,at=NULL,labels=TRUE)")
 plotrange<-par("usr")
 # get the graphical parameters
 oldpar<-par(no.readonly=TRUE)
 # turn off clipping
 par(xpd=TRUE)
 if(missing(x)) {
  # it's a horizontal line
  segments(plotrange[1],y,plotrange[2],y,...)
  ticklen<-(plotrange[4]-plotrange[3])*0.02
  if(!is.null(tlticks))
   segments(tlticks,y+ticklen,tlticks,y-ticklen,...)
  mwidth<-strwidth("M")
  # blank out the line where labels will appear
  rect(at-mwidth,y-ticklen,at+mwidth,y+ticklen,col="white",border=FALSE)
 # rotate the text
  par(srt=270)
  # draw the labels
  text(at,y,labels,...)
 }
 if(missing(y)) {
  # it's a vertical line
  # draw the line
  segments(x,plotrange[3],x,plotrange[4],...)
  ticklen<-(plotrange[2]-plotrange[1])*0.02
  if(!is.null(tlticks))
   segments(x+ticklen,tlticks,x-ticklen,tlticks,...)
  mheight<-strheight("M")
  # blank out the line where labels will appear
  rect(x-ticklen,at-mheight,x+ticklen,at+mheight,col="white",border=FALSE)
  # draw the labels
  text(x,at,labels,...)
 }
 # restore the parameters
 par(oldpar)
}
# some fake labels
eventT<-c(2.5, 4, 7, 8.5)
eventD<-c("first event","second event","third event","fourth event")
tl.labels<-data.frame(eventT,eventD)
plot(fakedata,xlab="")
# display a horizontal time line
time.line(x=-1,at=tl.labels[[1]],labels=tl.labels[[2]],col="black")
# now a vertical one
time.line(y=-1,at=tl.labels[[1]],labels=tl.labels[[2]],col="black")
> version
 _
platform i386-pc-mingw32
arch i386
os   mingw32
system   i386, mingw32
status
major2
minor0.1
year 2004
month11
day  15
language R
>
Jim Lemon wrote:
Sander Oom wrote:
Dear R users,
In order to illustrate the possible effects of events on variables
plotted against time, I would like plot a time line of events along side
the plot of the variables.
The x-axis should be some time unit; the y-axis should be the variable
of interest; the time line should be plotted below the graph along the
same x-axis scale.
As I have many variables and different events lists, I would like to
write a script to read the events from a file and plot them together
with the other plot.
The time line should look something like this:
http://www.oslis.k12.or.us/secondary/howto/organize/images/timeline.gif
Here's one way:
# some fake data please, maestro
fakedata<-sample(1:10,10)
# leave a bit of extra space beneath and to the left of the plot
par(mar=6,6,4,2)
# this function will probably end up in the "plotrix" package
time.line<-function(x,y,at=NULL,labels=TRUE,tlticks=NULL,...) {
 if(missing(x) && missing (y))
  stop("Usage: time.line(x,y,at=NULL,labels=TRUE)")
 plotrange<-par("usr")
 # get the graphical parameters
 oldpar<-par(no.readonly=TRUE)
 # turn off clipping
 par(xpd=TRUE)
 if(missing(x)) {
  # it's a horizontal line
  segments(plotrange[1],y,plotrange[2],y,...)
  ticklen<-(plotrange[4]-plotrange[3])*0.02
  if(!is.null(tlticks))
   segments(tlticks,y+ticklen,tlticks,y-ticklen,...)
  mwidth<-strwidth("M")
  # blank out the line where labels will appear
  rect(at-mwidth,y-ticklen,at+mwidth,y+ticklen,col="white",border=FALSE)
 # rotate the text
  par(srt=90)
  # draw the labels
  text(at,y,labels,...)
 }
 if(missing(y)) {
  # it's a vertical line
  # draw the line
  segments(x,plotrange[3],x,plotrange[4],...)
  ticklen<-(plotrange[2]-plotrange[1])*0.02
  if(!is.null(tlticks))
   segments(x+ticklen,tlticks,x-ticklen,tlticks,...)
  mheight<-strheight("M")
  # blank out the line where labels will appear
  rect(x-ticklen,at-mheight,x+ticklen,at+mheight,col="white",border=FALSE)
  # draw the labels
  text(x,at,labels,...)
 }
 # restore the parameters
 par(oldpar)
}
# create a file with the positions and labels you want like this:
# 2.5,first
# 4,second
# 7,third
# 8.5,fourth
# call it "labels.txt" and read it in
tl.labels<-read.table("labels.txt",sep=",")
plot(fakedata,xlab="")
# display a horizontal time line
time.line(x=-1,at=tl.labels[[1]],labels=tl.labels[[2]],col="black")
# now a vertical one
time.line(y=-1,at=tl.labels[[1]],labels=tl.labels[[2]],col="black")
__
R-help@stat.math.ethz.ch 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.c

RE: [R] Interpretation of randomForest results

2005-01-18 Thread Liaw, Andy
> From: luk
> 
> I got the following results when I run radomForest with below 
> commands:
>  
> qair <- read.table("train10.dat", header = T)
> oz.rf <- randomForest(LESION ~ ., data = qair, ntree = 220,  
> importance = TRUE)
> print(oz.rf)
> 
> Call:
>  randomForest.formula(x = LESION ~ ., data = qair, ntree = 
> 220,  importance = TRUE) 
>Type of random forest: classification
>  Number of trees: 220
> No. of variables tried at each split: 2
> OOB estimate of  error rate: 15.86%
  ^^^

Note what that says, which applies to the confusion matrix below as well.

> Confusion matrix:
>lesion noninf class.error
> lesion   3949525   0.1173447
> noninf894   3580   0.1998212
> 
> What did this mean? Is 11.7% the classification error for 
> 'lesion' class, and 19.98% the classification error for 
> 'noninf' class in the training set?

The results you showed above are out-of-bag (OOB) results.  If you don't
know what that means, you should read the documentation, and perhaps the
references.
 
> But when I run below command to test the performance of 
> classification in the same training set.
> 
> ntrain <- read.table("train10.dat", header = T)
> ntrain.pred <- predict(oz.rf, ntrain)
> table(observed = ntrain[, "LESION"], predicted = ntrain.pred)
> 
> I got the following results. It seemed that the 
> classification rates for 'lesion' and 'noninf' classes are 0. 
> Any suggestion will be very appreciated.

randomForest is rather good at overfitting _training_ data, but that's
(usually) not a problem in classification.  What one usually cares about is
the _test set_ performance.  There, randomForest performance does not
degrade as the number of trees increases, and that's what Breiman meant by
`random forests do not overfit'.

Andy

 
> 
> predicted
> observed lesion noninf
>   lesion 4474  0  
>   noninf0   4474  
> 
> 
>  
> 
> 
> 
>   
> -
> 
> 
>   [[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] embedding fonts in eps files

2005-01-18 Thread Simon Wood
Do you ultimately need the eps files themselves with embedded fonts, or 
is that you need to include them in a document that that has all fonts 
embedded? 

If it's the latter then you may find:

http://mpa.itc.it/markus/highres_pdf.html

useful. The trick seems to be to substitute the standard Fonts with their 
URW equivalents: the URW fonts are freely available and can therefor be 
embedded. It simplifies matters if you choose URW `families' when calling
`postscript()'.

> 
> I have to make eps files with fonts embedded. 
> I use the following postscript command:
> 
> 
> postscript("fig3a.eps", width = 5.2756, height = 7.27, pointsize =
> 7,horizontal = FALSE, onefile = FALSE, paper = "special",family =
> "Times")
> 
> plot(...)
> 
> dev.off()
> 
> 
> Are fonts automatically embedded in this way?
> How can I see that?
> If not, how to do it?
> 
> 
> regards, Rudi.
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


[R] Interpretation of randomForest results

2005-01-18 Thread luk
I got the following results when I run radomForest with below commands:
 
qair <- read.table("train10.dat", header = T)
oz.rf <- randomForest(LESION ~ ., data = qair, ntree = 220,  importance = TRUE)
print(oz.rf)

Call:
 randomForest.formula(x = LESION ~ ., data = qair, ntree = 220,  importance 
= TRUE) 
   Type of random forest: classification
 Number of trees: 220
No. of variables tried at each split: 2
OOB estimate of  error rate: 15.86%
Confusion matrix:
   lesion noninf class.error
lesion   3949525   0.1173447
noninf894   3580   0.1998212

What did this mean? Is 11.7% the classification error for 'lesion' class, and 
19.98% the classification error for 'noninf' class in the training set?

But when I run below command to test the performance of classification in the 
same training set.

ntrain <- read.table("train10.dat", header = T)
ntrain.pred <- predict(oz.rf, ntrain)
table(observed = ntrain[, "LESION"], predicted = ntrain.pred)

I got the following results. It seemed that the classification rates for 
'lesion' and 'noninf' classes are 0. Any suggestion will be very appreciated.


predicted
observed lesion noninf
  lesion 4474  0  
  noninf0   4474  


 




-


[[alternative HTML version deleted]]

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


Re: [R] Time line plot in R?

2005-01-18 Thread Jim Lemon
Sander Oom wrote:
> Dear R users,
>
> In order to illustrate the possible effects of events on variables
> plotted against time, I would like plot a time line of events along side
> the plot of the variables.
>
> The x-axis should be some time unit; the y-axis should be the variable
> of interest; the time line should be plotted below the graph along the
> same x-axis scale.
>
> As I have many variables and different events lists, I would like to
> write a script to read the events from a file and plot them together
> with the other plot.
>
> The time line should look something like this:
> http://www.oslis.k12.or.us/secondary/howto/organize/images/timeline.gif
>
Here's one way:

# some fake data please, maestro
fakedata<-sample(1:10,10)
# leave a bit of extra space beneath and to the left of the plot
par(mar=6,6,4,2)
# this function will probably end up in the "plotrix" package
time.line<-function(x,y,at=NULL,labels=TRUE,tlticks=NULL,...) {
 if(missing(x) && missing (y))
  stop("Usage: time.line(x,y,at=NULL,labels=TRUE)")
 plotrange<-par("usr")
 # get the graphical parameters
 oldpar<-par(no.readonly=TRUE)
 # turn off clipping
 par(xpd=TRUE)
 if(missing(x)) {
  # it's a horizontal line
  segments(plotrange[1],y,plotrange[2],y,...)
  ticklen<-(plotrange[4]-plotrange[3])*0.02
  if(!is.null(tlticks))
   segments(tlticks,y+ticklen,tlticks,y-ticklen,...)
  mwidth<-strwidth("M")
  # blank out the line where labels will appear
  rect(at-mwidth,y-ticklen,at+mwidth,y+ticklen,col="white",border=FALSE)
 # rotate the text
  par(srt=90)
  # draw the labels
  text(at,y,labels,...)
 }
 if(missing(y)) {
  # it's a vertical line
  # draw the line
  segments(x,plotrange[3],x,plotrange[4],...)
  ticklen<-(plotrange[2]-plotrange[1])*0.02
  if(!is.null(tlticks))
   segments(x+ticklen,tlticks,x-ticklen,tlticks,...)
  mheight<-strheight("M")
  # blank out the line where labels will appear
  rect(x-ticklen,at-mheight,x+ticklen,at+mheight,col="white",border=FALSE)
  # draw the labels
  text(x,at,labels,...)
 }
 # restore the parameters
 par(oldpar)
}
# create a file with the positions and labels you want like this:
# 2.5,first
# 4,second
# 7,third
# 8.5,fourth
# call it "labels.txt" and read it in
tl.labels<-read.table("labels.txt",sep=",")
plot(fakedata,xlab="")
# display a horizontal time line
time.line(x=-1,at=tl.labels[[1]],labels=tl.labels[[2]],col="black")
# now a vertical one
time.line(y=-1,at=tl.labels[[1]],labels=tl.labels[[2]],col="black")

__
R-help@stat.math.ethz.ch 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] embedding fonts in eps files

2005-01-18 Thread Ted Harding
On 18-Jan-05 Rudi Alberts wrote:
> Hi,
> 
> I have to make eps files with fonts embedded. 
> I use the following postscript command:
> 
> 
> postscript("fig3a.eps", width = 5.2756, height = 7.27, pointsize =
> 7,horizontal = FALSE, onefile = FALSE, paper = "special",family =
> "Times")
> 
> plot(...)
> 
> dev.off()
> 
> 
> Are fonts automatically embedded in this way?
> How can I see that?
> If not, how to do it?

Well, it seems to have set Times as the working font family
when I used your postscript(...) command above; but see further
down. I viewed the resulting .eps file (using 'less' in Linux
but Windows users should also have some way of looking into a
text file).

The first few lines of the file are:

%!PS-Adobe-3.0 EPSF-3.0
%%DocumentNeededResources: font Times-Roman
%%+ font Times-Bold
%%+ font Times-Italic
%%+ font Times-BoldItalic
%%+ font Symbol
%%Title: R Graphics Output
...

These are so-called DSC ("Document Structuring Conventions")
comments and are not directly executed by whatever renders
the PostScript code. They do, however, provided useful
information for programs which have to handle the PS file.

>From the above, it can be seen that R's postscript() function
has taken note of the 'family="Times"' option.

Further down the .eps file are the lines

%%IncludeResource: font Times-Roman
/Times-Roman findfont
dup length dict begin
  {1 index /FID ne {def} {pop pop} ifelse} forall
  /Encoding ISOLatin1Encoding def
  currentdict
  end
/Font1 exch definefont pop
%%IncludeResource: font Times-Bold
/Times-Bold findfont
dup length dict begin
  {1 index /FID ne {def} {pop pop} ifelse} forall
  /Encoding ISOLatin1Encoding def
  currentdict
  end
/Font2 exch definefont pop
%%IncludeResource: font Times-Italic
/Times-Italic findfont
dup length dict begin
  {1 index /FID ne {def} {pop pop} ifelse} forall
  /Encoding ISOLatin1Encoding def
  currentdict
  end
/Font3 exch definefont pop
%%IncludeResource: font Times-BoldItalic
/Times-BoldItalic findfont
dup length dict begin
  {1 index /FID ne {def} {pop pop} ifelse} forall
  /Encoding ISOLatin1Encoding def
  currentdict
  end
/Font4 exch definefont pop
%%IncludeResource: font Symbol
/Symbol findfont
dup length dict begin
  {1 index /FID ne {def} {pop pop} ifelse} forall
  currentdict
  end
/Font5 exch definefont pop

Apart from the "%%" DSC comments, this is executable PS
code which calls on the interpreter to set up the Times
fonts Times-Roman as Font1, Times-Bold as Font2,
Times-Italic as Font3, Times-BoldItalic as Font4,
and Symbol (not a Times font) as Font5.

If, instead of 'family="Times"', you had used the option
'family="Helvetica"', you would have got (try it and see)
exactly the same with "Helvetica" substituted for "Times"
throughout.

So far so good. Now comes the crunch.

The above (and this is the only part of the .eps file
which has anything to do with setting up fonts) assumes
that the PS interpreter (i.e. the program, including
printer firmware, which renders the PS visible) already
has access to the PostScript definitions of these fonts.

There is a default assumption (not just in R but in
practically any software which outputs PostScript) that
the rendering device will have built-in access to the
"Standard Adobe Font Set" -- a set of 13 fonts comprising
the Times, Helvetica and Courier families, and the Symbol
font, together with the encoding vectors StandardEncoding
and ISOLatin1Encoding; most software also assumes the
presence of further families (typically Bookman, Palatino,
AvantGarde, HelveticaNarrow, ZapfChanceryMediumItalic,
ZapfDingbats). None of these are strictly required by
the specification of the PostScript language, but they
have been a de facto standard for decades and it is most
unusual to find PostScript-generating software which does
not take them for granted (at least the 13 "Standard Adobe"
fonts).

Now "built-in access" means that the rendering device
is already equipped with the PostScript definitions of
how to draw ("render") the characters ("glyphs") in these
various fonts -- e.g. a PostScript printer will have the
definitions internally stored in a ROM chip. Therefore
when the PS definitions of "Font1" etc. as in the above
file are encountered, the device simply hooks its own PS
definitions into the working stack. It is not necessary
to include the definitions in the file which is being
interpreted.

However, to "embed" a font (which is what you refer to
in your query) means to include the PS font definition
in the file itself. This is certainly necessary if you
want to use a "non-standard" font, which might just be
an arty-farty font for English characters (e.g. a fancy
cursive script for greetings cards), or something more
exotic like Cyrillic characters or the International
Phonetic Alphabet. Since PS definitions of such fonts
cannot be expected to be present in a standard PS
rendering device, software which creates files to be
displayed with such fonts must itself have the necessary
resources.

You say you

[R] standardised residuals using standard deviation

2005-01-18 Thread Rado Bonk
Dear R-users,
I need to standardize residuals using standard deviation. Is the 
'stdres' the proper function? Beside other methods (for standardization 
and normalization), are there some approaches how to standardize using 
standard deviation?

Here is the sample of my residuals:
  Zres040Zres0820 Sres040Sres0820 PCres040
 -2.101740  -2.0682900   1.6328500   0.5046730 -0.005208170
  1.203350   1.2594100  -1.6836200  -1.1871700  0.001087080
 -0.724331  -0.8699000  -1.2246600  -0.2533400  0.002608070
 -0.333226  -0.2219900  -1.5083400  -1.6578600  0.001130550
 -1.850980  -1.8498800   6.7426900   7.6073600 -0.006078260
  2.676660   2.5251400   3.4960500   1.9224600  0.005720740
 -0.628793  -0.7680440  -0.7999610   0.7899290  0.007231940
Thanks in advance
Rado

--
Radoslav Bonk
European Commission - DG  Joint Research Centre (JRC)
Institute of Environment and Sustainability (IES)
LM Unit - Natural Hazards
Via E. Fermi, TP 261, 210 20 Ispra (VA), ITALY
tel: 0039 0332 78 6013
fax: 0039 0332 78 6653
http://natural-hazards.jrc.it/floods
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] How can i fit mixed effect model in a logistic regression?

2005-01-18 Thread Yisrael Parmet

__
R-help@stat.math.ethz.ch 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] embedding fonts in eps files

2005-01-18 Thread Prof Brian Ripley
On Tue, 18 Jan 2005, Rudi Alberts wrote:
I have to make eps files with fonts embedded.
I use the following postscript command:
postscript("fig3a.eps", width = 5.2756, height = 7.27, pointsize =
7,horizontal = FALSE, onefile = FALSE, paper = "special",family =
"Times")
plot(...)
dev.off()
Are fonts automatically embedded in this way?
How can I see that?
If not, how to do it?
Let me read to you the help page:
 The software including the PostScript plot file should either embed
 the font outlines (usually from '.pfb' or '.pfa' files) or use DSC
 comments to instruct the print spooler to do so.
In the case of the Times family, all PostScript interpreters should have 
access to the fonts, but the DSC comments will list them to ensure this.

--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Possible problem with pbirthday

2005-01-18 Thread A.G. Lynch
Dear all
I have come across the following problem with pbirthday:
(I have observed this in R 1.9.1 and R 2.0.1 on the Windows OS)
As I understand it, pbirthday(n,c,k) gives the approximate probability 
that we see a class with k coicident people in it when n people are sorted into 
c classes.

so the command
pbirthday(4,classes=3,coincident=4)
should give the approximate probability that when four people fall into 
three classes, all four end up in the same class. A probability 
that is clearly lower than the presently returned value of 1.

It seems to me that the line in the function
if (n > classes) return(1)
is only relevant to the default case of coincident = 2. (Naturally, if 
there are more people than classes, then at least one class must contain 
2 people).

Since the pbirthday function has been generalized to accept 
other values for coincidence

if (n > (classes * (coincident-1))) return(1)
would seem to me to be (one version of) the necessary line.
Alternatively I could be getting entirely the wrong end of the stick.
If you could either confirm or disabuse then I would be grateful
Yours
Andy Lynch
Centre for Applied Medical Statistics
Department of Public Health and Primary Care
University of Cambridge
Institute of Public Health
__
R-help@stat.math.ethz.ch 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] embedding fonts in eps files

2005-01-18 Thread Rudi Alberts
Hi,

I have to make eps files with fonts embedded. 
I use the following postscript command:


postscript("fig3a.eps", width = 5.2756, height = 7.27, pointsize =
7,horizontal = FALSE, onefile = FALSE, paper = "special",family =
"Times")

plot(...)

dev.off()


Are fonts automatically embedded in this way?
How can I see that?
If not, how to do it?


regards, Rudi.

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


[R] Re: Skewness test

2005-01-18 Thread Vito Ricci
Hi Christian,

see this links for skewness tests:

http://www.xycoon.com/skewness_test_1.htm
http://www.xycoon.com/skewness_test_2.htm

http://www.xycoon.com/skewness_small_sample_test_1.htm
http://www.xycoon.com/skewness_small_sample_test_2.htm

there you can find some help to solve your problem. I
believe it's simple to write R code!

Regards,
Vito


You wrote:

Hi,

is there a test for the H0 skewness=0 (or with
skewness as test
statistic and normality as H0) implemented in R?

Thank you,
Christian

=
Diventare costruttori di soluzioni
Became solutions' constructors

"The business of the statistician is to catalyze 
the scientific learning process."  
George E. P. Box

Top 10 reasons to become a Statistician

 1. Deviation is considered normal
 2. We feel complete and sufficient
 3. We are 'mean' lovers
 4. Statisticians do it discretely and continuously
 5. We are right 95% of the time
 6. We can legally comment on someone's posterior distribution
 7. We may not be normal, but we are transformable
 8. We never have to say we are certain
 9. We are honestly significantly different
10. No one wants our jobs


Visitate il portale http://www.modugno.it/
e in particolare la sezione su Palese  http://www.modugno.it/archivio/palese/

__
R-help@stat.math.ethz.ch 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 produce 2-d color plots in R

2005-01-18 Thread Martin Maechler
> "AndyL" == Liaw, Andy <[EMAIL PROTECTED]>
> on Fri, 14 Jan 2005 13:00:03 -0500 writes:

AndyL> Cut and paste the following function (to be in next
AndyL> release of R, I believe) 

that's correct; it's in current R-devel (for which snapshots
are available from CRAN).

AndyL> and type:

AndyL> RSiteSearch("election maps")

AndyL> This, of course, assumes that you have Internet
AndyL> connection.

AndyL> Andy

AndyL> RSiteSearch <- function(string,
AndyL>  restrict=c("Rhelp02a","Rhelp01","functions","docs"),
AndyL>  format="normal", sortby="score", matchesPerPage=20) {

AndyL> string <-
AndyL> paste("http://finzi.psych.upenn.edu/cgi-bin/namazu.cgi?query=";,
AndyL>..
AndyL>..

one of the differences of the R-devel version of RSiteSearch()
and yours is that we now have the nice `generic' URL
http://search.R-project.org/  {which resolves to Jonathan Baron's site}

Martin

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

2005-01-18 Thread Prof Brian Ripley
On Tue, 18 Jan 2005, Prof Brian Ripley wrote:
On Mon, 17 Jan 2005, Ming Hsu wrote:
I would like to run a weighted least squares with the the weighting matrix 
W.
This is generalized not weighted least squares if W really is a matrix and 
not a vector of case-by-case weights.

I ran the following two regressions,
(W^-1)Y = Xb + e
Y = WXb+ We
If W is a diagonal matrix, the weights for the second are W^(-2) and you used 
W below.

In both cases, E[bhat] = b.
I used the following commands in R
lm1 <- lm(Y/W ~ X)
lm2 <- lm(Y ~ W:X, weights = W)
where
Y <- rnorm(10,1)
X <- Y + rnorm(10,1)
W <- 1:10
That W is not a matrix!
In lm2, I believe W is applied to the error term, resulting in WLS. 
However
the estimated coefficients in lm1 and lm2 are really different.  I tried 
glm
as well, but the result was the same as lm.

Any advice would be appreciated,
Please do check that you supply an example that agrees with your words.
Another difference is that your equations have no intercept, but the lm 
calls do, so you need to add +0 to their rhs.

Use lm.gls in MASS or gls in nlme for generalized least squares, if that is 
what you meant.

--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] pairs: altering pch options on upper and lower panel of pairwise scatter plots

2005-01-18 Thread Uwe Ligges
Paul Hewson wrote:
Hello,
I can't figure out how to use the upper.panel and lower.panel options in
pairs to alter the label options for either panel independently of the
other.
I would like to be able to show the pairwise scatter plots for the data
as they are (a vanilla pairs plot?) but separately to be able to label
the points according to a factor level.   It is easy enough to do this
independently, but I can't figure out how to combine the two settings on
the same plot.   I have enclosed a toy example:   

Some made up data, e.g.
## make up some multivariate normal data using mvrnorm from MASS
##
require(MASS)
mu <- c(0,0,0)
digma <- matrix(c(0.9,0.5,0.5, 0.5,0.9,0.5, 0.5,0.5,0.9)
dummy.data <- mvrnorm(100,mu,sigma)
##
## add a factor
##
gender <- as.factor(c(rep("Male",50),rep("Female",50)))

I can create two separate pairs plots (upper and lower panel) as
follows:
## pairs plot just showing the data
pairs(dummy.data, lower.panel = NULL)
## pairs plot where the points are labelled according to a factor
pairs(dummy.data, pch = levels(gender), upper.panel = NULL)
But I would like to be able to combine the two panels on the same plot.
I would be grateful for any advice.   I've tried passing several
combinations of functions to upper.panel and lower.panel but either
they're the wrong function or I'm barking up the wrong tree entirely.

  pairs(dummy.data,
lower.panel = function(x, y) points(x, y, pch = levels(gender)))
Uwe Ligges

Thanks
Paul Hewson
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Lecturer in Statistics
University of Plymouth
Drake Circus 
Plymouth PL4 8AA

Tel ++ 44 1752 232778
Email [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] discretization

2005-01-18 Thread Uwe Ligges
Weiwei Shi wrote:
Hi, there:
I have a variable whose distribution is far from
normal and its qqnorm is S-shape, like a logisitic
plot. My purpose is to discretize it into 2 or 3
classes. (basically, a transformation from quantative
to discrete). I am wondering if there is a good way to
do that.
If this question is meant technical: ?cut
If you want to know how to choose the breaks, I'd suggest to think about 
the problem that you are going to analyze and to look at the data.

Uwe Ligges
thanks,
Ed
__
R-help@stat.math.ethz.ch 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] X11 installation problem Linux X86_64

2005-01-18 Thread Prof Brian Ripley
On Mon, 17 Jan 2005, Robert Nelson wrote:
Hello all,
This is my first time posting, so forgive my ignorance.  I've searched high 
and low but haven't come across the specific answer to my questions.
I don't think we have seen such a misconfigured system before.  What is 
`Linux' here?

configure runs fine,
I doubt it, unless erroneously is `fine'.
then make gives this error:
...
gcc -shared -L/usr/local/lib -o R_X11.so  dataentry.lo devX11.lo rotated.lo 
rbitmap.lo   -L/usr/X11R6/lib -lX11  -ljpeg -lpng -lz  -lreadline -ldl 
-lncurses -lm
/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libX11.so when searching 
for -lX11
/usr/bin/ld: skipping incompatible /usr/X11R6/lib/libX11.a when searching for 
-lX11
/usr/bin/ld: cannot find -lX11
collect2: ld returned 1 exit status
make[4]: *** [R_X11.so] Error 1
make[4]: Leaving directory `/root/R-2.0.1/src/modules/X11'
...

This is a 64-bit machine, so I'm wondering if the problem stems from make not 
looking in the /usr/X11R6/lib64 directory, as opposed to /usr/X11R6/lib64.
R works well on several Linux x86_64, e.g. FC3.  I get
gcc -shared -L/usr/local/lib -o R_X11.so  dataentry.lo devX11.lo 
rotated.lo rbitmap.lo  -lSM -lICE -L/usr/X11R6/lib64 -lX11  -ljpeg -lpng -lz

(on R-devel, where the unnecessary -lncurses -lm are skipped).
Both dirs are in /etc/ld.so.conf.  I also tried configure 
--x-libraries=/usr/X11R6/lib64, but that produced the same error.  I believe 
that I have all the requisite packages installed.  Could someone please point 
me in the right direction?  Thanks in advance
Where did /usr/X11R6/lib come from?   Probably by configure calling xmkmf, 
and likely that is broken on your `Linux'.   Please take a close look at 
the configure output.  I see in config.log:

configure:34402: checking for X
configure:34640: result: libraries /usr/X11R6/lib64, headers /usr/X11R6/include
Setting --x-libraries should work, but you do need to delete the cache 
first.

--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html