Re: [R] testing independence of categorical variables

2007-11-26 Thread Bernardo Rangel Tura

On Thu, 2007-11-22 at 16:16 +0500, Shoaaib Mehmood wrote:
 hi,
 
 is there a way of calculating of measuring dependence between two
 categorical variables. i tried using the chi square test to test for
 independence but i got error saying that the lengths of the two
 vectors don't match. Suppose X and Y are two factors. X has 5 levels
 and Y has 7 levels. This is what i tried doing
 
 temp-chisq.test(x,y)
 
 but got error the lengths of the two vectors don't match. any help
 will be appreciated


Hi Shoaaib,

Try using chisq.test(table(x,y)).

If you using chisq.test(x,y) R will testing goodness-of-fit.


-- 
Bernardo Rangel Tura, M.D,Ph.D
National Institute of Cardiology
Brazil

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


Re: [R] problem in closing R console

2007-11-26 Thread Uwe Ligges


amna khan wrote:
 Dear Sir
 
 When I close R console then following message apear when I want to save the
 workspace. If I close the R console without saving workspace then R console
 is closed otherwise not.
 
 Error in gzfile(file, wb) : unable to open connection
 In addition: Warning message:
 In gzfile(file, wb) : cannot open compressed file '.RDataTmp'
 Regards

You do not have write permissions in your working directory, I guess.

Uwe Ligges

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


Re: [R] about Runtime Error

2007-11-26 Thread Uwe Ligges


Xin Huang wrote:
 Hi,
 
 I wrote my own R program doing some MCMC simulation but I often got
 Runtime Error even the program only run for a couple of hundred
 times. The detail error message is as following:
 
 Runtime Error!
 Program: C:\Program Files\R\R-2.5.1\bin\Rgui.exe
 This application has requested the Runtime to terminate it in an
 unusual way. Please contact the application's support team for more
 information.
 
 When I turned off the program, there was another error message:
 
 RGui:Rgui.exe-Application Error
 The instruction at 0x5ad71531 referenced memory at 0x0014. The
 memory count not be read.
 
 Please let me know if there is anything I can do to solve the problem.

Do you have own C code to do the MCMC steps or do you use some existing 
R package?
In any case, solving the problem means fixing the code that causes the 
error, hence perhaps running it under some debugger.

Best,
Uwe Ligges


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

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


Re: [R] how to calculate the return?

2007-11-26 Thread Richard . Cotton
Denver,

   data is a matrix like this
  AMR  BS  GE  HR  MO  UK   SP500
 1974 -0.3505 -0.1154 -0.4246 -0.2107 -0.0758  0.2331 -0.2647
 1975  0.7083  0.2472  0.3719  0.2227  0.0213  0.3569  0.3720
 1976  0.7329  0.3665  0.2550  0.5815  0.1276  0.0781  0.2384
 1977 -0.2034 -0.4271 -0.0490 -0.0938  0.0712 -0.2721 -0.0718
 1978  0.1663 -0.0452 -0.0573  0.2751  0.1372 -0.1346  0.0656
 1979 -0.2659  0.0158  0.0898  0.0793  0.0215  0.2254  0.1844
 1980  0.0124  0.4751  0.3350 -0.1894  0.2002  0.3657  0.3242
 1981 -0.0264 -0.2042 -0.0275 -0.7427  0.0913  0.0479 -0.0491
 1982  1.0642 -0.1493  0.6968 -0.2615  0.2243  0.0456  0.2141
 1983  0.1942  0.3680  0.3110  1.8682  0.2066  0.2640  0.2251

It is perhaps more natural to specify this information as a data frame.

 I want  to calculate the return say AMR,so I use
 re=numeric(10)
 for (i in 2:nrow(data))
 re[1]=0
re[i]=log(data[i]/data[i-1])
 to my surprise, the result is
  re
  [1]  0.0  0.0  0.0  0.0  0.0  0.0  0.0 
0.0
  [9]  0.0 -1.70109

A couple of things:
1. You don't need re[1]=0 inside the loop (or at all, in fact, since 
numeric(10) will give a default value of 0).
2. It would be better to vectorise the code, to avoid the loop altogether.
3. You are looping over elements in the first column of data, which is why 
the log values are zero.

Some better code:
re = c(0, diff(log(data[,AMR])))

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

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

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


Re: [R] CPCA?

2007-11-26 Thread Jari Oksanen
Daniel Berner daniel.berner at mail.mcgill.ca writes:

 
 It would be great to know if and where an R code for Common Principal
Component Analysis is available.

The only code I know is in IMSL Fortran library, and that is proprietary, and
that is expensive. After a quick look, it really appears that IMSL C library
does not have the code, but you got to go to Fortran. Look for function DKPRIN
(KPRIN). That code cannot be ported to R, naturally.

Another issue is that the code obviously was written by Bernhard Flury, and he
also has FORTRAN listing in his book Commaon Principal Components and Related
Multivariate Models (J. Wiley  Sons, 1988). I don't know of the licensing
status of that code. I didn't find any explicit licensing information in the
book (but may have overlooked something), apart from the usual book copyright
that forbids everything. I assume it is the same code that is the base of DKPRIN
in the IMSL FORTRAN library. Would mean a lot of typing at minimum, and for any
sensible code, editing the code to use LAPACK where ever possible.

Further, Flury descirbes the algorithm in his book, and it could be implemented
independently in R. I think nobody has done that (yet).

cheers, jari oksanen

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


Re: [R] help pleaseeeeeeeee

2007-11-26 Thread Clara Cordeiro
Hi



Thank you very much for you interest and help in this mysterious problem.

I am going to investigate the random numbers issue. Concerning the
order.maxit helps but it is not what I have in mind. I think that in
case

  order.max - if (is.null(order.max)) floor(10 * log10(n.))

 else round(order.max)





I am going to explain better what my procedure is J



-  I have developed a new approach to obtain forecast intervals. In
this approach I select the order p of the autoregressive approximation by
AIC criterion.

-  Until now I only test it in few time series



-  Now, I am using M1- competition data ( package: Mcomp) and for
the *Yearly data* it is catastrophic L (error occurs)

 M1

M-Competition data: 1001 time series



   Type of data

 PeriodDEMOGR INDUST MACRO1 MACRO2 MICRO1 MICRO2 MICRO3 Total

  MONTHLY   75183 6492
10  89  104  617

  QUARTERLY 39   18 45   59   5
  2116   203

  *YEARLY*3035 30   29  16
 29   12   181



 I am going to investigate deeper the order.max and the randomness.

Thank you again for your time.

Best,

Clara







 sessionInfo()

R version 2.6.0 (2007-10-03)

i386-pc-mingw32



locale:

LC_COLLATE=Portuguese_Portugal.1252;LC_CTYPE=Portuguese_Portugal.1252;LC_MONETARY=Portuguese_Portugal.1252;LC_NUMERIC=C;LC_TIME=Portuguese_Portugal.1252



attached base packages:

[1] stats graphics  grDevices utils datasets  methods   base



other attached packages:

[1] Mcomp_1.07  forecast_1.07   tseries_0.10-12 zoo_1.4-0

[5] quadprog_1.4-11



loaded via a namespace (and not attached):

[1] grid_2.6.0 lattice_0.16-5 tools_2.6.0









2007/11/24, Steven McKinney [EMAIL PROTECTED]:


 Hi Clara,

 I suspect your error is happening because your input data
 is short (9 observations).  In the help for ar() for
 argument order.max it states

 order.maxMaximum order (or order) of model to fit. Defaults to
 10*log10(N) where N is the number of observations except for method=mle
 where it is the minimum of this quantity and 12.

 so perhaps the problem is 10*log10(9) is smaller than 1 and
 isn't being handled properly (this is just a guess).

 If I lengthen your data vector to be
 x-ts(c(-0.2052083,-0.3764986,-0.3762448,0.3740089 ,0.2737568,2.8235722,-
 1.7783313,0.2728676,-0.3273164,
 -0.2052083,-0.3764986,-0.3762448,0.3740089,0.2737568,2.8235722,-1.7783313,
 0.2728676,-0.3273164),start=c(1978,3),frequency=4,end=c(1982,3))

 I can not trip the error.

 I filed a bug report.

 You might try specifying order.max in your
 function call.  If I specify
 order.max = 1
 I can not trip the error.

  res.ar-ar(x,aic=TRUE,demean=F)
  res.ar-ar(x,aic=TRUE,demean=F)
 Error in if (order  0) coefs[order, 1:order] else numeric(0) :
 missing value where TRUE/FALSE needed
 In addition: Warning message:
 In if (order  0) coefs[order, 1:order] else numeric(0) :
 the condition has length  1 and only the first element will be used
  res.ar-ar(x,aic=TRUE,demean=F)
 Error in if (order  0) coefs[order, 1:order] else numeric(0) :
 missing value where TRUE/FALSE needed
 In addition: Warning message:
 In if (order  0) coefs[order, 1:order] else numeric(0) :
 the condition has length  1 and only the first element will be used
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar -ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar -ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar -ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar -ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  res.ar-ar(x,aic=TRUE,demean=F, order.max = 1)
  

[R] Unweighted meta-analysis

2007-11-26 Thread Roy Sanderson
Hello

I'm very much a beginner on meta-analysis, so apologies if this is a
trivial posting.  I've been sent a set data from separate experimental
studies, Treatment and Control, but no measure of the variance of effect
sizes, numbers of replicates etc.  Instead, for each study, all I have
is the mean value for the treatment and control (but not the SD).  As
far as I can tell, this forces me into an unweighted meta-analysis, with
all the caveats and dangers associated with it.  Two possible approaches
might be:

a) Take the ln(treatment/control) and perform a Fisher's randomisation
test (and also calculate +/- CI).
b) Regress the treatment vs control values, then randomise (with or
without replacement?) individual values, comparing the true regression
coefficient with the distribution of randomisation regression
coefficients.

Both approaches would appear to be fraught with risks; for example in
the regression approach, it is probable that the error distribution of
an individual randomised regression might not be normal - would this
then invalidate the whole set of regressions?

Many thanks for your advice.
Roy

-- 
Roy Sanderson
Institute for Research on Environment and Sustainability (IRES)
Devonshire Building
Newcastle University
Newcastle upon Tyne NE1 7RU
[EMAIL PROTECTED]
0191 246 4835

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


Re: [R] Dot plots in R

2007-11-26 Thread Adrian Dusa
On Saturday 24 November 2007, Paul Smith wrote:
 Dear All,
 Can R produce dot plots like the one of the following picture:
 http://en.wikipedia.org/wiki/Image:Dotplot_of_random_values.png
 ?
 I have tried dotchart, but no success.

I'm coming late to this thread, but I believe what Paul wants is better suited 
by the DOTplot() function from the UsingR package: it looks exactly the same 
as the web image and it has no axes, as Paul wants in a later message.

x - sample(1:10, 30, replace=T)
library(UsingR)
DOTplot(x)

Hth,
Adrian


-- 
Adrian Dusa
Romanian Social Data Archive
1, Schitu Magureanu Bd
050025 Bucharest sector 5
Romania
Tel./Fax: +40 21 3126618 \
  +40 21 3120210 / int.101

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


Re: [R] help pleaseeeeeeeee

2007-11-26 Thread Ben Bolker



CCordeiro wrote:
 
 Hi
 
 
 
 Thank you very much for you interest and help in this mysterious
 problem.
 
 I am going to investigate the random numbers issue. Concerning the
 order.maxit helps but it is not what I have in mind. I think that in
 case
 

Dear Clara,

  this did actually get investigated, but was continued in a thread
on the R development list:

http://www.nabble.com/Bug-in-package-stats-function-ar%28%29-%28PR-10459%29-tf4864536.html

  The problem is indeed with the order.max calculation, which should
not allow order.max to equal the length of the data series (but does
for very short time series).  There are no random numbers involved
in this calculation.

Something like

res.ar-ar(x,aic=TRUE,demean=F,order.max=length(x)-1) 

  should prevent this particular problem from happening ...

  Ben Bolker

 PS: it was very good of you to give a reproducible example,
and very helpful of you to point out this bug.  In the future,
the other helpful thing you could do is give your message
an informative subject line (e.g. problem with ar() rather
than help pleaseee) ...


-- 
View this message in context: 
http://www.nabble.com/help-please-tf4862400.html#a13948775
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] CPCA?

2007-11-26 Thread Ben Bolker



Jari Oksanen wrote:
 
 Daniel Berner daniel.berner at mail.mcgill.ca writes:
 
 
 It would be great to know if and where an R code for Common Principal
 Component Analysis is available.
 
 The only code I know is in IMSL Fortran library, and that is proprietary,
 and
 that is expensive. After a quick look, it really appears that IMSL C
 library
 does not have the code, but you got to go to Fortran. Look for function
 DKPRIN
 (KPRIN). That code cannot be ported to R, naturally.
 
 Another issue is that the code obviously was written by Bernhard Flury,
 and he
 also has FORTRAN listing in his book Commaon Principal Components and
 Related
 Multivariate Models (J. Wiley  Sons, 1988). I don't know of the
 licensing
 status of that code. I didn't find any explicit licensing information in
 the
 book (but may have overlooked something), apart from the usual book
 copyright
 that forbids everything. I assume it is the same code that is the base of
 DKPRIN
 in the IMSL FORTRAN library. Would mean a lot of typing at minimum, and
 for any
 sensible code, editing the code to use LAPACK where ever possible.
 
 Further, Flury descirbes the algorithm in his book, and it could be
 implemented
 independently in R. I think nobody has done that (yet).
 
 cheers, jari oksanen
 
 

I have a package that wraps some code Patrick Phillips wrote -- haven't put
it on CRAN (yet) because of issues with including executable files in
packages ...
e-mail me if you want further info.

  Ben Bolker

-- 
View this message in context: 
http://www.nabble.com/CPCA--tf4873113.html#a13948778
Sent from the R help mailing list archive at Nabble.com.

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


[R] pass lm( ) a char vector as the variables to be included

2007-11-26 Thread boshao zhang
Dear Everyone in list:
I am writing some codes to automate the process of
fitting linear models where the names of variables of
models are produced and stored in character vectors.
But I have problems to pass the vectors to the lm( )
because I don't know how to strip the quotation marks
automatically. 

Here are the codes of the example of lm( ):

## Annette Dobson (1990) An Introduction to
Generalized Linear Models.
## Page 9: Plant Weight Data.
ctl -
(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt -
(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
group - gl(2,10,20, labels=c(Ctl,Trt))
weight - c(ctl, trt)
anova(lm.D9 - lm(weight ~ group))
lm.D90 - lm(weight ~ group - 1) # omitting intercept

What I am doing is let the variable name group
stored in a vector, say, g - group. The question is
how to strip the quotation marks when we call lm( )
through g?

Thank you all.

Boshao



  

Never miss a thing.  Make Yahoo your home page.

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


Re: [R] pass lm( ) a char vector as the variables to be included

2007-11-26 Thread Richard . Cotton
 Here are the codes of the example of lm( ):
 
 ## Annette Dobson (1990) An Introduction to
 Generalized Linear Models.
 ## Page 9: Plant Weight Data.
 ctl -
 (4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
 trt -
 (4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
 group - gl(2,10,20, labels=c(Ctl,Trt))
 weight - c(ctl, trt)
 anova(lm.D9 - lm(weight ~ group))
 lm.D90 - lm(weight ~ group - 1) # omitting intercept
 
 What I am doing is let the variable name group
 stored in a vector, say, g - group. The question is
 how to strip the quotation marks when we call lm( )
 through g?

Try: 
w = weight
g = group
form = as.formula(paste(w,g,sep=~))
lm(form)

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

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

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


Re: [R] testing independence of categorical variables

2007-11-26 Thread John Kane
prettyR

--- Shoaaib Mehmood [EMAIL PROTECTED] wrote:

 i cant find help for xtab. Which package contains
 this function
 
 On Nov 24, 2007 12:16 PM, G Ilhamto
 [EMAIL PROTECTED] wrote:
  hi shohaib,
  have you tried xtab instead of chisq.test?
 
  Ilham
 
 
 
  On Nov 22, 2007 6:16 AM, Shoaaib Mehmood
 [EMAIL PROTECTED] wrote:
  
  
  
   hi,
  
   is there a way of calculating of measuring
 dependence between two
   categorical variables. i tried using the chi
 square test to test for
   independence but i got error saying that the
 lengths of the two
   vectors don't match. Suppose X and Y are two
 factors. X has 5 levels
   and Y has 7 levels. This is what i tried doing
  
   temp-chisq.test(x,y)
  
   but got error the lengths of the two vectors
 don't match. any help
   will be appreciated
   --
   Regards,
   Rana Shoaaib Mehmood
  
  
   __
   R-help@r-project.org mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
   and provide commented, minimal, self-contained,
 reproducible code.
  
 
 
 
 
 
 -- 
 Regards,
 Rana Shoaaib Mehmood
 (+92) 333 550 4531
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained,
 reproducible code.
 



  Instant Messaging, free SMS, sharing photos and more... Try the new 
Yahoo! Canada Messenger at http://ca.beta.messenger.yahoo.com/

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


[R] writing summary() to a text file

2007-11-26 Thread Federico Calboli
Hi All,

I would like to output the results of a function into a text file,  
legible as a such. The function produces a summary quite like:

summary(lm(x ~ y + w * z))

[for instance]

and I am not clear how to save this summary into a text file  
'automagically', because I need to be able to do it in a for() loop.

Cheers,

Federico

--
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

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


[R] help in md scaling

2007-11-26 Thread G Ilhamto
Dear list,

I am starting a new project in cmdscale, and I have a question regarding
distance matrix and covariance matrix.
Can I use covariance as my distance matrix?
Any good reference in this matter?

Thank you,
ilham

[[alternative HTML version deleted]]

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


Re: [R] writing summary() to a text file

2007-11-26 Thread John Kane
Would something like this do it?

sink(file=reg.txt)
summary(reg)
sink()

--- Federico Calboli [EMAIL PROTECTED] wrote:

 Hi All,
 
 I would like to output the results of a function
 into a text file,  
 legible as a such. The function produces a summary
 quite like:
 
 summary(lm(x ~ y + w * z))
 
 [for instance]
 
 and I am not clear how to save this summary into a
 text file  
 'automagically', because I need to be able to do it
 in a for() loop.
 
 Cheers,
 
 Federico
 
 --
 Federico C. F. Calboli
 Department of Epidemiology and Public Health
 Imperial College, St. Mary's Campus
 Norfolk Place, London W2 1PG
 
 Tel +44 (0)20 75941602   Fax +44 (0)20 75943193
 
 f.calboli [.a.t] imperial.ac.uk
 f.calboli [.a.t] gmail.com
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained,
 reproducible code.
 



  Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/

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


[R] R-2.6.1 is released

2007-11-26 Thread Peter Dalgaard
I've rolled up R-2.6.1.tar.gz a short while ago.

This is a maintenance release and fixes a number of mostly minor bugs
and platform issues, as well as a couple of major problems.

Probably, the most important issues were
- save-to-postscript on Windows
- tcltk event loop with X11
- build issue on recent MacOSX

See the full list of changes below.

You can get it (in a short while) from

http://cran.r-project.org/src/base/R-2/R-2.6.1.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you. Binaries
for various platforms will appear in due course.

For the R Core Team

Peter Dalgaard

These are the md5sums for the freshly created files, in case you wish
to check that they are uncorrupted:

070cca21d9f8a6af15f992edb47a24d5  AUTHORS
eb723b61539feef013de476e68b5c50a  COPYING
a6f89e2100d9b6cdffcea4f398e37343  COPYING.LIB
619aa712a6032fdbffd4f0c69d962859  FAQ
70447ae7f2c35233d3065b004aa4f331  INSTALL
b6ed12e20f627a466378fc28006dc9c9  NEWS
88bbd6781faedc788a1cbd434194480c  ONEWS
4f004de59e24a52d0f500063b4603bcb  OONEWS
19c35a69e1afa73f5f70f91ff9939233  R-2.6.1.tar.gz
19c35a69e1afa73f5f70f91ff9939233  R-latest.tar.gz
433182754c05c2cf7a04ad0da474a1d0  README
020479f381d5f9038dcb18708997f5da  RESOURCES
1ad28cbc84485ccdf4ce5721b34ed645  THANKS

Here is the relevant bit of the NEWS file:

CHANGES IN R VERSION 2.6.1

NEW FEATURES

o   The data.frame and factor methods for [[ now support
the 'exact' argument introduced in 2.6.0.

o   plot.lm() gains a new argument 'cex.caption' to allow the
size of the captions to be controlled.

o   A series of changes make the CHARSXP cache introduced in 2.6.0
faster (and in some cases many times faster) in sessions with
a large number (e.g. a million) of unique character strings,
and also if there are many empty strings.

o   embedFonts(), bitmap() and dev2bitmap() explicitly turn off
auto-rotation in Ghostscript when generating PDF.

o   The canonical architecture is no longer checked when loading
packages using a non-empty sub-architecture, since it is
possible to (e.g.) build packages for i386-pc-linux-gnu on both
that architecture and on x86_64-unknown-linux-gnu.

o   Deparsing will (if option warnIncomplete is set) warn on
strings longer than the parser limit (8192 bytes).

o   url() now uses the UserAgent header in http transactions in
the same way as download.file() (making use of option
HTTPUserAgent).

BUG FIXES

o   iconv() is again able to translate character strings with
embedded nuls (such as those in UCS-2).

o   new.packages() and update.packages() failed when called on an
empty library, since old.packages() threw an error.
old.packages() now returns NULL (as documented) in that case.

o   Builds on Mac OS X 10.4 or higher now allocate enough space
in the binary headers to relocate dependent libraries into the
framework.

o   R CMD build now computes the exclusion list on the copy it
makes: this avoids problems if the original sources contain
symbolic links (which are resolved in the copy).  Thanks to
Michael Lawrence for diagnosis and patch.

o   object.size() had slightly too low a size for objects of type S4.

o   symbol() in plotmath expressions was only accepting valid
character strings, which made it impossible to specify symbols
such as aleph (obtained by symbol(\300)) in a UTF-8 locale.

o   An event handling issue caused autorepeat functions to
misbehave with tcltk (notably scrollbars).

o   plot(sin, -5, 5) gives ylab 'sin(x)' again, where it resulted
in 'x(x)' in 2.6.0.  Further,  plot(sin)  again plots from
[0,1] also in cases where a previously used coordinate system
differs.

o   curve() with unspecified 'from', 'to' and 'xlim' now reuses the
previous x limits, and not slightly larger ones.

o   It was intended that R code filenames in packages should start
with an ASCII letter or digits (and R CMD INSTALL uses that),
but the test used in R CMD build ([A-Za-z0-9]) was
locale-specific (and excluded t to y in Estonian, for
example).  (PR#10351)

o   'R CMD build' could misbehave when faced with files with CRLF
line endings *and* no line ending on the final line of the
file, removing the last byte of the file.

o   DF[i, j] failed in 2.6.0 if j was a logical vector selecting a
single column.

o   Unix x11() would fail if a valid 'display' was specified but
DISPLAY was unset. (PR#10379)

o   postscript() was not always ignoring .Postscript.Options in
the workspace (where it should not have occurred).

o   help.search() would give an error if it found a badly
installed package, even if 'package' was not specified.

o   tclServiceMode() 

Re: [R] writing summary() to a text file

2007-11-26 Thread jim holtman
?capture.output

On Nov 26, 2007 9:31 AM, Federico Calboli [EMAIL PROTECTED] wrote:
 Hi All,

 I would like to output the results of a function into a text file,
 legible as a such. The function produces a summary quite like:

 summary(lm(x ~ y + w * z))

 [for instance]

 and I am not clear how to save this summary into a text file
 'automagically', because I need to be able to do it in a for() loop.

 Cheers,

 Federico

 --
 Federico C. F. Calboli
 Department of Epidemiology and Public Health
 Imperial College, St. Mary's Campus
 Norfolk Place, London W2 1PG

 Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

 f.calboli [.a.t] imperial.ac.uk
 f.calboli [.a.t] gmail.com

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




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

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


Re: [R] writing summary() to a text file

2007-11-26 Thread Richard . Cotton
 I would like to output the results of a function into a text file, 
 legible as a such. The function produces a summary quite like:
 
 summary(lm(x ~ y + w * z))

You can either redirect output to a file using cat or sink; generate a 
latex table using xtable (in the xtable package); or export the relevant 
bits (e.g. the coefficients matrix) using write.csv.

Based upon your message, sink is probably your best bet/

sink(file=foo.txt)
summary(lm(x ~ y + w * z))
sink(NULL)

Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

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

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


Re: [R] PCA with NA

2007-11-26 Thread Kevin Wright
The pcaMethods package offers a collection of different algorithms for
PCA, some of which (NIPALS and others) can be used on data that have
missing values.

Kevin Wright


On Nov 24, 2007 4:59 PM, Hartmut Oldenbürger [EMAIL PROTECTED] wrote:
 Hi Birgit, and All

 Possibly you should not consider the case completed ;-)
 There is an important alternative to imputing means, or estimates from
 first or second order
 regression (Frane, Psychometrica, BMDP):  partial-least-squares (Wold),
 which uses as much
 information from the data as possible to estimate the principal
 components, or the missing data.

 Stephane Dray, also from Lyon, provides 'nipals' here:
 http://biomserv.univ-lyon1.fr/~dray/software.php
 There is also an interesting paper.  - In case, you use PLS to estimate
 and impute, set the
 number of factors as high as reasonably possible, e.g. m-1, when m is
 the number of variables.
 best - Hartmut Oldenbürger
 ---
 [EMAIL PROTECTED]
 http://www.wipaed.wiso.uni-goettingen.de/~holdenb1


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


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


Re: [R] complex conjugates roots from polyroot?

2007-11-26 Thread Ravi Varadhan
Hi Spencer,

The default tolerance in your function might be a bit too conservative (i.e.
too small).  Here is an example:

 set.seed(123)
 z - polyroot(sample(1:5, size=40, rep=T)) # polynomial of degree 39
 zmat - which(outer(z, z, FUN=is.conj), arr.ind=T)
 zmat[zmat[,1]  zmat[,2], ]
  row col
 [1,]   3   5
 [2,]   2   7
 [3,]   6  10
 [4,]   9  11
 [5,]  13  15
 [6,]  16  18
 [7,]   1  22
 [8,]  21  24
 [9,]  17  25
[10,]  19  26
[11,]  23  29
[12,]  12  30
[13,]  20  32
[14,]  31  33
[15,]   8  34
[16,]   4  35
[17,]  28  36
[18,]  27  37
[19,]  38  39

 findConjugates(z)
 [1] -0.0168724+0.8593702i -0.4707594-0.7991353i -0.8955664-0.2000173i
 [4]  0.1495329-0.9612410i  0.3762447-0.8971735i  0.5654040-0.7332919i
 [7]  0.6648998-0.6811790i -0.9087387+0.3750093i -0.5663986-0.8890497i
[10]  0.7937910-0.6069981i  0.3565431-0.9877840i


You can see that your function finds only 11 conjugate pairs as opposed to
the correct 19 pairs (since there is only 1 real root, the rest must be
conjugate pairs).  Increasing the tolerance to 1.e-10, gives all the 19
pairs.  Therefore, I would suggest a default of 1.e-10 or even larger, say,
sqrt(.Machine$double.eps).

I wouldn't consider multiple real roots to be conjugates, since they are not
distinct points on the complex plane, as well as for the reason that you
have given.

Best,
Ravi.


---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 




-Original Message-
From: Spencer Graves [mailto:[EMAIL PROTECTED] 
Sent: Sunday, November 25, 2007 12:36 PM
To: Ravi Varadhan
Cc: r-help@r-project.org
Subject: Re: [R] complex conjugates roots from polyroot?

Hi, Ravi: 

  Question:  Are duplicate real numbers complex conjugates?  For 
some purposes, perhaps.  However, for identifying (damped) periodicity 
on a difference or differential equation, we must exclude repeated real 
roots. 

  In any event, your suggestion inspired me to create a function 
findConjugates (see below), which I've added to the FinTS package 
currently under development on R-Forge.  The source code is currently 
available via svn checkout 
svn://svn.r-forge.r-project.org/svnroot/fints.  In another day or so, 
it should be available (with documentation) via 
'install.packages(FinTS,repos=http://r-forge.r-project.org;)'.  In 
another couple of months, it should appear on CRAN. 

  Thanks again for your suggestion. 

  Best Wishes,
  Spencer
##
findConjugates - function(x, 
complex.eps=1000*.Machine[[double.neg.eps]]){
##
##  1.  compute normalization
##
  if(length(x)1)return(complex(0))
  ax - abs(x)
  m2 - outer(ax, ax, pmax)
##
##  2.  Compute complex differences
##
  c2 - (abs(outer(x, Conj(x), -) / m2)  complex.eps)
  c2[m2==0] - FALSE
  c2 - (c2  lower.tri(c2))
##
## 3.  Any differences exceed complex.eps? 
##
  if(any(c2)){
# check standard differences
d2 - (abs(outer(x, x, -) / m2)  complex.eps)
d2[m2==0] - FALSE
#
cd2 - (c2  d2)
if(any(cd2)){
  ic - sort(unique(row(cd2)[cd2]))
  return(x[ic])
}
  }
  complex(0)
}
##
Ravi Varadhan wrote:
 Hi Spencer,

 Here is a simple approach to detect conjugate pairs:

 is.conj - function(z1, z2, tol=1.e-10) {
 # determine if two complex numbers are conjugates
 cond1 - abs(Re(z1) - Re(z2))  tol
 cond2 - abs(Im(z1) + Im(z2))  tol
 cond1  cond2
 }

 set.seed(123)
 z - polyroot(sample(1:5, size=8, rep=T))
 zmat - which(outer(z, z, FUN=is.conj), arr.ind=T)
 zmat[zmat[,1]  zmat[,2], ]

 # result
  row col
 [1,]   1   3
 [2,]   5   6
 [3,]   4   7
   

 We see that (1,3), (4,7), and (5,6) are the conjugate pairs.

 This doesn't address the issue of numerical round-off (there is no
argument
 in polyroot that governs the accuracy of the roots).

 Best,
 Ravi.



 ---

 Ravi Varadhan, Ph.D.

 Assistant Professor, The Center on Aging and Health

 Division of Geriatric Medicine and Gerontology 

 Johns Hopkins University

 Ph: (410) 502-2619

 Fax: (410) 614-9625

 Email: [EMAIL PROTECTED]

 Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

  



 

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On
 Behalf Of Spencer Graves
 Sent: Friday, November 23, 2007 12:08 PM
 To: r-help@r-project.org
 Subject: [R] complex conjugates roots from polyroot?

 Hi, All: 

   Is there a simple way to detect complex conjugates 

Re: [R] writing summary() to a text file

2007-11-26 Thread Gabor Grothendieck
Also, this works:

s - summary(iris)
capture.output(s, file = myfile.txt)

and the Hmisc and xtable packages can output it in latex:

library(xtable)
print(xtable(s), file = myfile.tex)

library(Hmisc)
latex(s, file= myfile.tex)

On Nov 26, 2007 9:59 AM, John Kane [EMAIL PROTECTED] wrote:
 Would something like this do it?

 sink(file=reg.txt)
 summary(reg)
 sink()


 --- Federico Calboli [EMAIL PROTECTED] wrote:

  Hi All,
 
  I would like to output the results of a function
  into a text file,
  legible as a such. The function produces a summary
  quite like:
 
  summary(lm(x ~ y + w * z))
 
  [for instance]
 
  and I am not clear how to save this summary into a
  text file
  'automagically', because I need to be able to do it
  in a for() loop.
 
  Cheers,
 
  Federico
 
  --
  Federico C. F. Calboli
  Department of Epidemiology and Public Health
  Imperial College, St. Mary's Campus
  Norfolk Place, London W2 1PG
 
  Tel +44 (0)20 75941602   Fax +44 (0)20 75943193
 
  f.calboli [.a.t] imperial.ac.uk
  f.calboli [.a.t] gmail.com
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained,
  reproducible code.
 



  Looking for the perfect gift? Give the gift of Flickr!

 http://www.flickr.com/gift/


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


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


[R] Fwd: Empty list to use in a for cycle

2007-11-26 Thread Niccolò Bassani
Dear R-users,
I'm posting a problem I already asked help for some time ago, because I'm
facing that problem once again and even because now, reading that old
e-mail, and the answer recevied, I understand I've not made myself clear.

Here's the question: I need to create an empty list of a specific length to
fill it with a quite large amount of square matrices, which is 602. The
question is that these matrices are created inside a for cycle, and I do not
know how to recall all of them one by one, except by creating an empty list
before the cycle, than assigning for each value of the i index the amtrix
computed to the first element of the empty list.
The fact is that: i've trided to create an empty list with

vector(list,602)

and then putting it in a cycle, but it didn't work. This is the cycle I've
used. To prove it works (and then the cycle itself is not a problem) there's
also the output (i.e. the last square matrix computed).

for (i in unique(elio2$id)){
sub.mu - exp.mu[exp.mu$id==i,]
D - matrix(0,nrow( sub.mu),nrow(sub.mu))
diag(D) - sub.mu$deriv.link
A - mat.cov[1:nrow(D),1:nrow(D)]
R - corstr[1:nrow(D),1:nrow(D)]
W - solve(D)%*%solve(sqrt(A))%*%solve(R)%*%solve(sqrt(A))%*%solve(D)
}

 W
  [,1]  [,2]  [,3]  [,4]
[1,]  3.492489e+02 -7.9324883721  0.0006286788 -0.0031046240
[2,] -7.932488e+00 17.4974625191 -1.7575467817  0.0001403319
[3,]  6.286788e-04 -1.7575467817 17.3227959738 -1.7529916860
[4,] -3.104624e-03  0.0001403319 -1.7529916860 17.2279244622


Does anyone knows how to insert each and every matrix like the one above in
a omnicomprehensive list? That's because I've to use a function requiring
me to have the matrices I need inside a list.
Thanks in advance, hope it's not a too much stupid problem!
niccolò

[[alternative HTML version deleted]]

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


Re: [R] writing summary() to a text file

2007-11-26 Thread Mike Prager
Federico Calboli [EMAIL PROTECTED] wrote:

 
 I would like to output the results of a function into a text file,  
 legible as a such. The function produces a summary quite like:
 

Take a look at the sink() function.  Does that do what you need?

-- 
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.

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


Re: [R] Packages - a great resource, but hard to find the right one

2007-11-26 Thread Mike Prager
hadley wickham [EMAIL PROTECTED] wrote:

 Which moves somewhat back towards my original suggestion of review
 articles.  To me, an article which compared and contrasted four or
 five packages on a given topic would be much more useful than an
 article which reviewed only a single package.  I think basing reviews
 around a specific topic/methodology would be more useful than basing
 them around a single package.

I agree: Such articles would be welcome resources if published
either in JSS or in R-News.

-- 
Mike Prager, NOAA, Beaufort, NC
* Opinions expressed are personal and not represented otherwise.
* Any use of tradenames does not constitute a NOAA endorsement.

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


[R] limits on the length of the name of a script file in R 2.6.0.?

2007-11-26 Thread Dimitri Liakhovitski
Hello!
I posted earlier - about my problems with R 2.6 crashing (i.e.,
telling me it needs to shut down) every time I tried to open an R
script. First, it looked like it was unhappy with my working outside
of R folder (under Program Files). But not it looks like it was not
really the problem.
Now, it opens and works when I open scripts whose names are not very
long (e.g., Selecting cases I need.R). But it does crash (gives me a
message that R needs to shut down) when the script I am trying to open
has a slightly longer file name (e.g, in my case:
randforestImportanceExample with MR.r and longer).

Is anyone aware of the limits the latest version of R imposes on
script name length? I never experienced such a problem with R 2.5.0.

Thank you!
Dimitri Liakhovitski

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


Re: [R] pass lm( ) a char vector as the variables to be included

2007-11-26 Thread Gavin Simpson
On Mon, 2007-11-26 at 14:17 +, [EMAIL PROTECTED] wrote:
  Here are the codes of the example of lm( ):
  
  ## Annette Dobson (1990) An Introduction to
  Generalized Linear Models.
  ## Page 9: Plant Weight Data.
  ctl -
  (4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
  trt -
  (4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
  group - gl(2,10,20, labels=c(Ctl,Trt))
  weight - c(ctl, trt)
  anova(lm.D9 - lm(weight ~ group))
  lm.D90 - lm(weight ~ group - 1) # omitting intercept
  
  What I am doing is let the variable name group
  stored in a vector, say, g - group. The question is
  how to strip the quotation marks when we call lm( )
  through g?
 
 Try: 
 w = weight
 g = group
 form = as.formula(paste(w,g,sep=~))
 lm(form)
 
 Regards,
 Richie.

For more complicated automation, the ideas and examples from Bill
Venables Programmer Niche article in the R newsletter from a few years
ago might be of use:

[39] Bill Venables. Programmer's niche. R News, 2(2):24-26, June 2002.
[ bib | PDF | http ]

The PDF is available here:

http://cran.r-project.org/doc/Rnews/Rnews_2002-2.pdf

HTH

G

 
 Mathematical Sciences Unit
 HSL
 
 
 
 ATTENTION:
 
 This message contains privileged and confidential inform...{{dropped:20}}
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


Re: [R] limits on the length of the name of a script file in R 2.6.0.?

2007-11-26 Thread Duncan Murdoch
On 11/26/2007 11:03 AM, Dimitri Liakhovitski wrote:
 Hello!
 I posted earlier - about my problems with R 2.6 crashing (i.e.,
 telling me it needs to shut down) every time I tried to open an R
 script. First, it looked like it was unhappy with my working outside
 of R folder (under Program Files). But not it looks like it was not
 really the problem.
 Now, it opens and works when I open scripts whose names are not very
 long (e.g., Selecting cases I need.R). But it does crash (gives me a
 message that R needs to shut down) when the script I am trying to open
 has a slightly longer file name (e.g, in my case:
 randforestImportanceExample with MR.r and longer).
 
 Is anyone aware of the limits the latest version of R imposes on
 script name length? I never experienced such a problem with R 2.5.0.

The latest version of R is 2.6.1 (released today), but I doubt if you're 
using that yet.  It has the same limit as Windows on filename length.

2.6.0 had a bug which meant long filenames could cause a crash.  This 
was repaired a couple of weeks ago:

http://developer.r-project.org/blosxom.cgi/R-2-6-branch/2007/11/10#c2007-11-10

Duncan Murdoch

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


[R] Problem installing R on Solaris 9

2007-11-26 Thread aziza belmaati
I've downloaded R-2.6.0 I want  to install it on Solaris, so, I run the
configure command, it to be fine, but once I run
make it give me the following error:
*ld: fatal :  fichier Rmain.o : type de machine ELF erronV : EM_386
ld: fatal :  Erreurs dans le traitement des fichiers. Aucun rVsultat n'a VtV
Vcr
it dans R.bin
collect2: ld returned 1 exit status
*** Error code 1
make: Fatal error: Command failed for target `R.bin'
Current working directory /rgui-original/R-2.6.0/src/main
*** Error code 1
make: Fatal error: Command failed for target `R'
Current working directory /rgui-original/R-2.6.0/src/main
*** Error code 1
make: Fatal error: Command failed for target `R'
Current working directory /rgui-original/R-2.6.0/src
*** Error code 1
make: Fatal error: Command failed for target `R' *

Please have you any idea to solve this problem?

Sincerely yours*
*

[[alternative HTML version deleted]]

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


[R] All files inactive in installing R

2007-11-26 Thread amna khan
Dear Sir

I was facing various problems especially in making graphs. No graph file was
displayed. I reinstall the R 2.6.0. During installation all files icon is
inactive. It has not been marked. Which is creating many problems
particularly grDevices are not responding.

How to solve this problem

Regards

-- 
AMINA SHAHZADI
Department of Statistics
GC University Lahore, Pakistan.

[[alternative HTML version deleted]]

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


Re: [R] Problem installing R on Solaris 9

2007-11-26 Thread Prof Brian Ripley
On Mon, 26 Nov 2007, aziza belmaati wrote:

 I've downloaded R-2.6.0 I want  to install it on Solaris, so, I run the
 configure command, it to be fine, but once I run
 make it give me the following error:
 *ld: fatal :  fichier Rmain.o : type de machine ELF erronV : EM_386
 ld: fatal :  Erreurs dans le traitement des fichiers. Aucun rVsultat n'a VtV
 Vcr
 it dans R.bin
 collect2: ld returned 1 exit status
 *** Error code 1
 make: Fatal error: Command failed for target `R.bin'
 Current working directory /rgui-original/R-2.6.0/src/main
 *** Error code 1
 make: Fatal error: Command failed for target `R'
 Current working directory /rgui-original/R-2.6.0/src/main
 *** Error code 1
 make: Fatal error: Command failed for target `R'
 Current working directory /rgui-original/R-2.6.0/src
 *** Error code 1
 make: Fatal error: Command failed for target `R' *

 Please have you any idea to solve this problem?

Yes, your compiler and your hardware/OS version differ.  Since you haven't 
told us what either is, we can't even guess as to the difference.

Please ask your local OS expertise for help (you also omitted to tell us 
who you work for).


 Sincerely yours*
 *

   [[alternative HTML version deleted]]

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

PLEASE do.

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


[R] Communicating from one function to another

2007-11-26 Thread Thomas L Jones, PhD
My question is a seemingly simple one. I have a bunch of user-defined 
functions which compute such-and-such objects. I want to be able to define a 
variable in a particular function, then make use of it later, perhaps in a 
different function, without necessarily having to move it around in argument 
lists. In the C community, it would be called a global variable.

Question 1: Is this practical at all in the R language?

Suppose the variable is called x23. I want to assign a value to it, then use 
it later. Seemingly, there are two cases:

Case I is if the variable is given its value at the top level.

Case II is if it is given its value inside a user-defined function. That I 
do not know how to do.

Example:

func1 - function (){

x23 - 2.6

return ()

}

driver_func - function (){

func1 ()

print (x23)

return ()

}

However, when I call driver_func, it won't work. Beginning with the load 
operation, I get:



Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

 func1 - function (){
+
+ x23 - 2.6
+
+ return ()
+
+ }

 driver_func - function (){
+
+ func1 ()
+
+ print (x23)
+
+ return ()
+
+ }
 driver_func ()
Error in print(x23) : object x23 not found


---
From Tom:

Clearly, the two functions cannot communicate. I am aware of the existence 
of environments, but don't know much about them. Also, the attach function 
and the get and set functions. Also, .GlobalEnv It might or might not make 
sense to create a list of all of the variables, with two functions which 
get all of them and set all of them. The function calls may be thought of as 
an upside down tree. I want to be able to communicate from any node to any 
other node.

Your advice?

Tom
Thomas L. Jones, PhD, Computer Science

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


Re: [R] Problem installing R on Solaris 9

2007-11-26 Thread Peter Dalgaard
aziza belmaati wrote:
 I've downloaded R-2.6.0 I want  to install it on Solaris, so, I run the
 configure command, it to be fine, but once I run
 make it give me the following error:
 *ld: fatal :  fichier Rmain.o : type de machine ELF erronV : EM_386
 ld: fatal :  Erreurs dans le traitement des fichiers. Aucun rVsultat n'a VtV
 Vcr
 it dans R.bin
 collect2: ld returned 1 exit status
 *** Error code 1
 make: Fatal error: Command failed for target `R.bin'
 Current working directory /rgui-original/R-2.6.0/src/main
 *** Error code 1
 make: Fatal error: Command failed for target `R'
 Current working directory /rgui-original/R-2.6.0/src/main
 *** Error code 1
 make: Fatal error: Command failed for target `R'
 Current working directory /rgui-original/R-2.6.0/src
 *** Error code 1
 make: Fatal error: Command failed for target `R' *

 Please have you any idea to solve this problem?
   
As far I gather, this error can occur if you accidentally mix machine 
types. Any chance that you have something remaining from an earlier 
build for (say) Linux in the source directory?

 Sincerely yours*
 *

   [[alternative HTML version deleted]]

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


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

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


Re: [R] ftable as latex (with Hmisc?)

2007-11-26 Thread Frank E Harrell Jr
Dieter Menne wrote:
 Dear List, possibly called Frank,
 
 I tried to create an ftable lookalike of the following data set in 
 LaTeX/Sweave
 with summary(formula,..), but I could not get it to work for count tables; 
 numeric tables work fine. 
 
 summary(formula,...,fun=table) does not give the full cross breakdown.

See if fun=table (no quotes) or method='cross' work for you.
Frank

 
 Other suggestions welcome. Note that in the output there should be empty 
 fields
 on repeated column values like ftable produces.
 
 Dieter
 
 
 #---
 library(Hmisc)
 df = data.frame(drug=sample(c(P,V),100,TRUE),
 Hist1=sample(c(Pos,Neg),100,TRUE),
 Hist2=sample(c(Pos,Neg),100,TRUE))
 ftable(drug~Hist1+Hist2,data=df)
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 


-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University

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


Re: [R] Fwd: Empty list to use in a for cycle

2007-11-26 Thread Joerg van den Hoff
On Mon, Nov 26, 2007 at 04:35:53PM +0100, Niccolò Bassani wrote:
 Dear R-users,
 I'm posting a problem I already asked help for some time ago, because I'm
 facing that problem once again and even because now, reading that old
 e-mail, and the answer recevied, I understand I've not made myself clear.
 
 Here's the question: I need to create an empty list of a specific length to
 fill it with a quite large amount of square matrices, which is 602. The
 question is that these matrices are created inside a for cycle, and I do not
 know how to recall all of them one by one, except by creating an empty list
 before the cycle, than assigning for each value of the i index the amtrix
 computed to the first element of the empty list.
 The fact is that: i've trided to create an empty list with
 
 vector(list,602)
 
 and then putting it in a cycle, but it didn't work. This is the cycle I've
 used. To prove it works (and then the cycle itself is not a problem) there's
 also the output (i.e. the last square matrix computed).
 
 for (i in unique(elio2$id)){
 sub.mu - exp.mu[exp.mu$id==i,]
 D - matrix(0,nrow( sub.mu),nrow(sub.mu))
 diag(D) - sub.mu$deriv.link
 A - mat.cov[1:nrow(D),1:nrow(D)]
 R - corstr[1:nrow(D),1:nrow(D)]
 W - solve(D)%*%solve(sqrt(A))%*%solve(R)%*%solve(sqrt(A))%*%solve(D)
 }
 
  W
   [,1]  [,2]  [,3]  [,4]
 [1,]  3.492489e+02 -7.9324883721  0.0006286788 -0.0031046240
 [2,] -7.932488e+00 17.4974625191 -1.7575467817  0.0001403319
 [3,]  6.286788e-04 -1.7575467817 17.3227959738 -1.7529916860
 [4,] -3.104624e-03  0.0001403319 -1.7529916860 17.2279244622
 
 
 Does anyone knows how to insert each and every matrix like the one above in
 a omnicomprehensive list? That's because I've to use a function requiring
 me to have the matrices I need inside a list.
 Thanks in advance, hope it's not a too much stupid problem!
 niccol?
 

you  seem  to  have  all  the  ingredients,  so where is the
problem? it's probably not really faster to preallocate this
(moderately long) list.  so something like, e.g.

matlist - list()
for (i in 1:3) {
   matlist[[i]] = matrix(i, 2, 2)
}

should do what you want: create a list of matrices.


joerg

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


Re: [R] complex conjugates roots from polyroot?

2007-11-26 Thread Ravi Varadhan
Spencer,

I just observed that the polynomial root calculation in the package,
polynom, using the function solve() is more accurate than the polyroot()
function in the base package.  Here is an example:

set.seed(1234)
p - polynomial(sample(1:10, size=45, rep=T)) # degree 44
z - solve(p)
findConjugates(z, complex.eps=.Machine$double.eps)  # this identifies all 21
conjugate pairs

z1 - polyroot(p)
findConjugates(z1, complex.eps=.Machine$double.eps) # this only identifies
only 3 conjugate pairs 

As, I had mentioned earlier, I can't tell what tolerances are used by these
algorithms.  However, it appears that polynom is more accurate.  

Best,
Ravi.


---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 




-Original Message-
From: Spencer Graves [mailto:[EMAIL PROTECTED] 
Sent: Sunday, November 25, 2007 12:36 PM
To: Ravi Varadhan
Cc: r-help@r-project.org
Subject: Re: [R] complex conjugates roots from polyroot?

Hi, Ravi: 

  Question:  Are duplicate real numbers complex conjugates?  For 
some purposes, perhaps.  However, for identifying (damped) periodicity 
on a difference or differential equation, we must exclude repeated real 
roots. 

  In any event, your suggestion inspired me to create a function 
findConjugates (see below), which I've added to the FinTS package 
currently under development on R-Forge.  The source code is currently 
available via svn checkout 
svn://svn.r-forge.r-project.org/svnroot/fints.  In another day or so, 
it should be available (with documentation) via 
'install.packages(FinTS,repos=http://r-forge.r-project.org;)'.  In 
another couple of months, it should appear on CRAN. 

  Thanks again for your suggestion. 

  Best Wishes,
  Spencer
##
findConjugates - function(x, 
complex.eps=1000*.Machine[[double.neg.eps]]){
##
##  1.  compute normalization
##
  if(length(x)1)return(complex(0))
  ax - abs(x)
  m2 - outer(ax, ax, pmax)
##
##  2.  Compute complex differences
##
  c2 - (abs(outer(x, Conj(x), -) / m2)  complex.eps)
  c2[m2==0] - FALSE
  c2 - (c2  lower.tri(c2))
##
## 3.  Any differences exceed complex.eps? 
##
  if(any(c2)){
# check standard differences
d2 - (abs(outer(x, x, -) / m2)  complex.eps)
d2[m2==0] - FALSE
#
cd2 - (c2  d2)
if(any(cd2)){
  ic - sort(unique(row(cd2)[cd2]))
  return(x[ic])
}
  }
  complex(0)
}
##
Ravi Varadhan wrote:
 Hi Spencer,

 Here is a simple approach to detect conjugate pairs:

 is.conj - function(z1, z2, tol=1.e-10) {
 # determine if two complex numbers are conjugates
 cond1 - abs(Re(z1) - Re(z2))  tol
 cond2 - abs(Im(z1) + Im(z2))  tol
 cond1  cond2
 }

 set.seed(123)
 z - polyroot(sample(1:5, size=8, rep=T))
 zmat - which(outer(z, z, FUN=is.conj), arr.ind=T)
 zmat[zmat[,1]  zmat[,2], ]

 # result
  row col
 [1,]   1   3
 [2,]   5   6
 [3,]   4   7
   

 We see that (1,3), (4,7), and (5,6) are the conjugate pairs.

 This doesn't address the issue of numerical round-off (there is no
argument
 in polyroot that governs the accuracy of the roots).

 Best,
 Ravi.



 ---

 Ravi Varadhan, Ph.D.

 Assistant Professor, The Center on Aging and Health

 Division of Geriatric Medicine and Gerontology 

 Johns Hopkins University

 Ph: (410) 502-2619

 Fax: (410) 614-9625

 Email: [EMAIL PROTECTED]

 Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

  



 

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On
 Behalf Of Spencer Graves
 Sent: Friday, November 23, 2007 12:08 PM
 To: r-help@r-project.org
 Subject: [R] complex conjugates roots from polyroot?

 Hi, All: 

   Is there a simple way to detect complex conjugates in the roots 
 returned by 'polyroot'?  The obvious comparison of each root with the 
 complex conjugate of the next sometimes produces roundoff error, and I 
 don't know how to bound its magnitude: 

 (tst - polyroot(c(1, -.6, .4)))
 tst[-1]-Conj(tst[-2])
 [1] 3.108624e-15+2.22045e-16i
 abs(tst[-1]-Conj(tst[-2]))/abs(tst[-1])
 1.971076e-15
 .Machine$double.neg.eps
 1.110223e-16

   Testing (abs(tst[-1]-Conj(tst[-2]))/abs(tst[-1])  
 (20*.Machine$double.neg.eps)) would catch this example, but it might not 
 catch others. 

   The 'polyroot' help page says, See Also ... the 'zero' example in 
 the demos directory.  Unfortunately, I've so far been unable to find 
 that. 

 

[R] visualizing nucleotide sequence properties

2007-11-26 Thread Bernd Jagla
Hi there,

 

I am looking for R-packages that can help me visualize properties on
nucleotide sequences. I want to display sequences in the 1-100K base range
as lines and plot features above and below those lines. 

 

Any ideas would be welcome.

 

Thanks,

 

Bernd

 


[[alternative HTML version deleted]]

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


Re: [R] mvr error in PLS package

2007-11-26 Thread Gavin Simpson
On Mon, 2007-11-26 at 09:25 -0800, Bricklemyer, Ross S wrote:
 All,
 
 I have been using a data set to build pls models for three different
 soil properties.  Two of the three models run fine; however I receive
 the following error for the final model.  
 
  libs.IC.cal - mvr(libs.IC.fmla, data = libsdata.cond.cal,
 ncomp=20,validation = LOO, method = oscorespls) 
 
 Error in colMeans(x, n, prod(dn), na.rm) : 
 'x' must be numeric
 
 There are many 0 for this soil property.  Could this cause the
 error?

Without having the data (or a small example therefore) it is impossible
to tell.

To start, try str(libsdata.cond.cal) and check that the variables
referenced in your formula object (which is what I presume libs.IC.fmla
is?) are all numeric and haven't got coded as factors or characters or
something strange.

G

 
 Best,
 Ross
 
 ***
 Ross Bricklemyer
 Dept. of Crop and Soil Sciences
 Washington State University
 291D Johnson Hall
 PO Box 646420
 Pullman, WA 99164-6420
 Work: 509.335.3661
 Cell/Home: 406.570.8576
 Fax: 509.335.8674
 Email: [EMAIL PROTECTED]
 
  
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


Re: [R] Communicating from one function to another

2007-11-26 Thread Alberto Monteiro
Thomas L Jones wrote:

 My question is a seemingly simple one. I have a bunch of user-
 defined functions which compute such-and-such objects. I want to be 
 able to define a variable in a particular function, then make use of 
 it later, perhaps in a different function, without necessarily 
 having to move it around in argument lists. In the C community, it 
 would be called a global variable.
 
Global variables in R are used with - instead of -.

For example:

x - 1
y - 1

f - function() {
   x - 2
   y - 2
}

f()

will turn y to 2 but will not change x.

Alberto Monteiro

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


Re: [R] Communicating from one function to another

2007-11-26 Thread Duncan Murdoch
On 11/26/2007 1:25 PM, Alberto Monteiro wrote:
 Thomas L Jones wrote:

 My question is a seemingly simple one. I have a bunch of user-
 defined functions which compute such-and-such objects. I want to be 
 able to define a variable in a particular function, then make use of 
 it later, perhaps in a different function, without necessarily 
 having to move it around in argument lists. In the C community, it 
 would be called a global variable.
 
 Global variables in R are used with - instead of -.
 
 For example:
 
 x - 1
 y - 1
 
 f - function() {
x - 2
y - 2
 }
 
 f()
 
 will turn y to 2 but will not change x.
 

R doesn't really have global variables.  - goes looking in parent 
environments until it finds the target variable, and makes the 
assignment there.  If it never finds one, it makes the assignment in the 
global environment, but the name is misleading:  it should really be 
called the user workspace.

Duncan Murdoch

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


[R] looking for packages that visualize nucleotide sequence properties

2007-11-26 Thread Bernd Jagla
Hi there,

I am looking for R-packages that can help me visualize properties on
nucleotide sequences. I want to display sequences in the 1-100K base range
as lines and plot features above and below those lines. 

Any ideas would be welcome.

Thanks,

Bernd

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


Re: [R] ftable as latex (with Hmisc?)

2007-11-26 Thread Dieter Menne
 Dieter Menne wrote:
 I tried to create an ftable lookalike of the following data set in 
 LaTeX/Sweave
 with summary(formula,..), but I could not get it to work for count tables; 
 numeric tables work fine. 
 
  summary(formula,...,fun=table) does not give the full cross breakdown.
 

Frank E Harrell Jr f.harrell at vanderbilt.edu writes:

 See if fun=table (no quotes) or method='cross' work for you.
 Frank
 

No, it does not, that's why I asked. I had tried both, fun=table (with or
without ) give a individual breakdown by factor, and method=cross an 
error message (works find with numerical data).

Dieter

 df = data.frame(drug=sample(c(P,V),100,TRUE),
+ Hist1=sample(c(Pos,Neg),100,TRUE),
+ Hist2=sample(c(Pos,Neg),100,TRUE))
 ftable(drug~Hist1+Hist2,data=df)
drug  P  V
Hist1 Hist2   
Neg   Neg14  6
  Pos11 14
Pos   Neg13 15
  Pos14 13
 summary(drug~Hist1+Hist2,data=df,fun=table)
drugN=100

+---+---+---+--+--+
|   |   |N  |P |V |
+---+---+---+--+--+
|Hist1  |Neg| 45|25|20|
|   |Pos| 55|27|28|
+---+---+---+--+--+
|Hist2  |Neg| 48|27|21|
|   |Pos| 52|25|27|
+---+---+---+--+--+
|Overall|   |100|52|48|
+---+---+---+--+--+
 summary(drug~Hist2+Hist2,data=df,method=cross)
Error in Y %*% rep(1, ncol(Y)) : requires numeric matrix/vector arguments
In addition: Warning message:
In mean.default(newX[, i], ...) :
  argument is not numeric or logical: returning NA
 


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


Re: [R] Communicating from one function to another

2007-11-26 Thread Alberto Monteiro
Duncan Murdoch wrote:
 
 R doesn't really have global variables.  - goes looking in parent 
 environments until it finds the target variable, and makes the 
 assignment there.  If it never finds one, it makes the assignment in 
 the global environment, but the name is misleading:  it should 
 really be called the user workspace.
 
Got it.

So, in this case:

x - 1

f - function() {
  x - 2
  g - function() {
x - 3
  }
  g()
  x
}

f()

It's expected that f will return 3, but x would still be 1?

Alberto Monteiro

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


[R] Preserving output of MCMC iterations

2007-11-26 Thread Francesco Checchi
Dear colleagues,
 
I'm an epidemiologist with no background in programming and just
started using R a few weeks ago. I am working on the epidemiology of
African sleeping sickness, and am trying to use R to perform a Monte
Carlo Markov Chain analysis to estimate three unknown parameters within
a model of African sleeping sickness case detection that is mainly
informed by actual field programme data.
Basically, I have a set of four differential equations governing my
model, which I am implementing stochastically (small populations, low
transmission). I iterate the model a large number of times (10 000) for
each unique combination of plausible values of the three unknown
parameters a, b and c. After each iteration, I ask R to check whether
the output 'fits' the observed data: if it does, I ask R to add 1 to the
(i,j,k)th element of a 3-dimensional 'scores' array (3 unknown
parameters = 3 dimensions), where i,j, and k are the plausible values of
a,b and c that are currently being tested.
My intended output is in fact this 3-dimensional array, which is
essentially a likelihood surface wherein each (i,j,k)th element is the
likelihood of the corresponding combination of plausible parameter
values a, b and c.
 
The code I have written looks more or less like this:
 
FUN1(args) {
specify parameters based on arguments
 
replicate (10 000 times, {
  {implement differential equations once}
  if output fits data, scores[i,j,k]-scores[i,j,k]+1
  })
}
 
FUN2(args) {
create 3-dim 'scores' array
apply FUN1 to each combination of a,b and c values, i.e. to each row of
a dataframe containing each combination
return(scores)
}
 
I've tested the various sub-routines within the code repeatedly and
everything seems to work fine with the exception of one problem: the
scores array that R returns when I call FUN2 is unchanged from its
initial specification within FUN2 (e.g. if I tell R the initial value of
the array elements should be 0, R returns an array with all 0s). The
scores array IS being updated with +1 after each data-fitting iteration
of the model (I checked this), but somehow these changes are not being
preserved outside of the replicate {} environment.
 
I've tried to look at the help archives and other help sources but
haven't been able to find or perhaps interpret solutions to my problem.
I've also looked at the contributed MCMC packages already available, but
for a variety of reasons these do not seem suitable for my purposes, and
I would prefer writing the full code myself.
 
Apologies if the explanation is not very clear - I'm still in the very
steep learning curve! I will be happy to clarify further.
 
Thanks in advance for your consideration.
 
Francesco
 
 
 
 
 
 
Francesco Checchi
Honorary Lecturer, Part-time PhD Student
Disease Control and Vector Biology Unit
Department of Infectious and Tropical Diseases
London School of Hygiene and Tropical Medicine
Room 51G6, 49-51 Bedford Square
London WC1B 3DP, United Kingdom
office +44 (0)20 7927 2336
mobile +44 (0)79 0671 9637
fax +44 (0)20 7927 2918
e-mail  [EMAIL PROTECTED]

[[alternative HTML version deleted]]

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


[R] writing statistical function for boot

2007-11-26 Thread Monica Pisica

Hi everyone,
 
I need help in writing a statistical function for bootstrap. Suppose m is a 
matrix with n cols and p rows, my original data. What I want to do is a 
bootstrap (using boot from package boot) on eigenvectors from a PCA done on m 
with a statistic function calculating the eigenvector bootstrap error ratio. 
 
If R = number of bootstrap replicates, then my function should look something 
like this where m.i is the ith bootstrap sample matrix (of course this is 
wrong, but I wrote it to give an idea of what I am after)
 
pcasig - function(m) {
for (i in 1:R) {
pca.i - prcomp(m.i)
eigen.i - pca.i$rotation
estim - sum(eigen.1+….+eigen.R) / R
a - matrix(estim, p, n)
se - ((sum((eigen.i-estim)^2))/(R-1))^0.5
t.i - a / se }
}
 
Thanks for your consideration,
 
Monica
_
Your smile counts. The more smiles you share, the more we donate.  Join in.
www.windowslive.com/smile?ocid=TXT_TAGLM_Wave2_oprsmilewlhmtagline
[[alternative HTML version deleted]]

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


Re: [R] connection diagram

2007-11-26 Thread elw


On Wed, 14 Nov 2007, Manal Helal wrote:

 Dimn  Waves Tot.  Parts In Wave   Wave  NoSerial  Index   W Order 
 M
 Index DepTot. D1-Serial   D1-IndexD1-OrderD1-M
 Index D2-Serial   D2-IndexD2-OrderD2-M Index
 2 7   1   0   1   0   0   0, 0  2   2   
 18  0   4, 4  3   2   1   2, 0
 2 7   2   1   2   18  0   4, 4  2   4   
 20  0   2, 2  5   36  1   0, 4

 following the tutorial on SNA, I see that I need to convert that into 
 adjacency matrix to start plotting the graph, and I can not see how I 
 can do that,

Into one adjacency matrix -- you probably can't.  [And, I think, probably 
don't really want to do that...]

What you might be able to do is figure out what your actual actors are... 
the entities that are connected to each other... and use them (just 
them... or their relations...] to build your adjacency matrix.

With your matrix in hand, you will want to keep track of those other 
variables... there are a lotta ways you could go about this, and there are 
a lot of decisions to affect your implementation.

In the 'sna' package, look at the graph stack data structure.  [m x N x N 
dimension -- an array of adjacency matrices which could be attributed 
values rather than 0/1 boolean is-connected assertions.]

You might be best served by a series of plots, each taking into account a 
different combination of your available data variables.  It almost sounds 
fun, doesn't it?  :-)

Not really familiar enough with your data to make many more suggestions. 
It sounds like your data structure is pretty nontrivial... maybe there are 
ways you can break it down into pieces that you can manage more easily, 
for your own sake?

best,

--elijah

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


[R] Plotting with R: setting the y axis

2007-11-26 Thread Dave Jacoby
I have a series of numbers I'm wanting to plot. They come from a
nanodrop machine, which graphs with a specific x and y indices. X goes
from 220nm to 350nm, which I can set. But the y axis should go from -5
to 65, but I'm finding it impossible to hardcode that.

I've looked. I've typed ?plot at the R prompt. Google has not been my
friend. _R Graphics_, if it holds the key, has not presented it to me.
Can anyone help?

 x - (220:350)
 z - c(21.56 , 21.12 , 20.44 , 19.83 , 19.35 , 18.53 , 18.01 , 17.78 , 17.51 
 , 17.34 , 17.26 , 17.18 , 17.18 , 17.23 , 17.36 , 17.65 , 17.95 , 18.57 , 
 19.42 , 20.14 , 21.22 , 22.1 , 22.64 , 23.56 , 24.66 , 25.32 , 26.2 , 27.02 , 
 27.61 , 28.45 , 29.15 , 29.57 , 30.34 , 31.2 , 31.67 , 32.25 , 32.64 , 32.8 , 
 32.88 , 32.87 , 32.8 , 32.61 , 32.32 , 32.05 , 31.49 , 30.7 , 29.76 , 29.13 , 
 28.1 , 27.06 , 26.44 , 25.51 , 24.56 , 23.9 , 22.88 , 21.86 , 21.15 , 19.96 , 
 18.72 , 17.89 , 16.73 , 15.64 , 14.53 , 13.8 , 12.8 , 11.9 , 11.32 , 10.4 , 
 9.49 , 8.95 , 8.19 , 7.41 , 6.63 , 6.15 , 5.48 , 4.88 , 4.53 , 4.06 , 3.67 , 
 3.43 , 3.09 , 2.81 , 2.53 , 2.36 , 2.15 , 1.97 , 1.86 , 1.71 , 1.6 , 1.5 , 
 1.45 , 1.4 , 1.34 , 1.31 , 1.28 , 1.25 , 1.23 , 1.21 , 1.18 , 1.14 , 1.12 , 
 1.09 , 1.06 , 1.02 , 1.01 , 1 , 0.98 , 0.97 , 0.96 , 0.95 , 0.94 , 0.94 , 
 0.93 , 0.92 , 0.92 , 0.9 , 0.89 , 0.88 , 0.87 , 0.84 , 0.82 , 0.81 , 0.8 , 
 0.79 , 0.78 , 0.77 , 0.76 , 0.76 , 0.75 , 0.73 , 0.71 )
 jpeg(nano_WoloshukRIB401488.jpg)
 plot( x ,
   z ,
   type=l ,
   cols=red ,
   main=nanodrop - #012345 ,
   xlab=Wavelength(nm) ,
   ylab=10mm Absorbance )
 dev.off()



-- 
David Jacoby[EMAIL PROTECTED]
  Purdue Genomics Facility
  S049, WSLR building
  Phone: hah!

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


Re: [R] Filling in a Zero Matrix

2007-11-26 Thread Julian Burgos
Hi Amy,
Many (perhaps most) of the people on the list do not receive emails with 
html...so we can't see colored text.  Also it would be helpfully to have 
a bit of your data, so we can run your code (see the posting guide in 
this regard,http://www.R-project.org/posting-guide.html).

Please explain what are the 'xlabel' and the 'ylabel' that you 
mentioned.  I don't see those variables in your code.

Julian



Amit Patel wrote:
 Hi
 I am very new to R and statistical programming in general. I am trying to 
 reorder data from a .csv file. I have managed to import the data and create a 
 zero matrix. I am now trying to fill the matrix. There seems to be some 
 problem with this section of my code. I have highlighted the dodgy code in 
 red. Please help if possible.
 
 ##
 ###  Create matrix ###
 ##
 
 #Open the csv file
 OGSdata - read.table(MG3199.csv,sep=,,header=TRUE)
 
 #creates 3 separate vectors
 sample - OGSdata[,1]
 mci - OGSdata[,2]
 pct - OGSdata[,3]
 
 #change mci range 
 offset - min(mci)-1
 mci - (mci - offset)
 
 #matrix sizes
 mci_count - max(mci)
 sample_count - max(sample)
 
 #creates a zero matrix 
 OGS - mat.or.vec(mci_count,sample_count)
 
 #Create labels
 sample_lab - (A-9,B-9, C-9, D-9, E-9,A-12,B-12, C-12, 
 D-12, E-12)
 
 #add data
 for (i in 1:length(pct)) {
 OGS(mci(i),sample(i))- pct(i);
 }
 
 
 What I want is to have colum1 from original data to be the xlabel, column 2 
 to be the ylabel and the 3rd colum to be the values in the matrix
 Any help is appreciated.
 
 Kind Regards
 Amit Patel
 
 
 
 
   ___
 
 now.
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] question about extreme value distribution

2007-11-26 Thread Greg Snow
As an alternative you could try quantile regression (find a regression
line for the 95th percentile), if the relationship between max(y) and x
is only due to more points (and therefore more oportunities for large
values) then the estimated quantile lines should not differ
significantly from 0.

Try the following (where the truth is no relationship):

set.seed(2)

x - rep(1:10, 1:10)
y - rexp(55, 1)

plot(x,y)

cor.test( 1:10, tapply( y, x, max ) )

library(quantreg)
fit - rq( y ~ x, tau=c(0.5, 0.95) )
summary(fit)


Notice that the cor.test is significant, but that the confidence
intervals for the slopes both include 0.

Hope this helps,

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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Avril Coghlan
 Sent: Thursday, November 22, 2007 5:46 AM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: [R] question about extreme value distribution
 
 Hello,
 
 I have a question about using extreme
 value distribution in R. 
 
 I have two variables, X and Y, and have pairs of points 
 (X1,Y1),(X2,Y2), (X3,Y3) etc.
 When I plot X against Y, it looks
 like the maximum value of Y (for a particular X) is correlated with X.
 
 Indeed, when I bin the data by X-value into equally sized 
 bins, and test whether the maximum value of Y for a bin is 
 correlated with the mean X for the bin, there is a 
 significant correlation between max(Y) and X. However, I am 
 not very happy with this because there is not an equal number 
 of data points in each bin.
 
 I imagine that there is a better statistical test that I 
 could use, if I could fit an extreme value distribution to the Y data.
 However, I'm not sure how to do this. 
 I am wondering is there a way to use the extreme value 
 distribution functions in R to test the hypothesis that the 
 maximum of Y (for a particular X) is correlated with X?
 
 I would appreciate advice very much.
 
 regards
 Avril Coghlan
 
 
 
 
 
 
 
 --
  The Wellcome Trust Sanger Institute is operated by Genome 
 Research  Limited, a charity registered in England with 
 number 1021457 and a  company registered in England with 
 number 2742969, whose registered  office is 215 Euston Road, 
 London, NW1 2BE.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

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


Re: [R] Plotting with R: setting the y axis

2007-11-26 Thread Dylan Beaudette
On Monday 26 November 2007, Dave Jacoby wrote:
 I have a series of numbers I'm wanting to plot. They come from a
 nanodrop machine, which graphs with a specific x and y indices. X goes
 from 220nm to 350nm, which I can set. But the y axis should go from -5
 to 65, but I'm finding it impossible to hardcode that.

 I've looked. I've typed ?plot at the R prompt. Google has not been my
 friend. _R Graphics_, if it holds the key, has not presented it to me.
 Can anyone help?

  x - (220:350)
  z - c(21.56 , 21.12 , 20.44 , 19.83 , 19.35 , 18.53 , 18.01 , 17.78 ,
  17.51 , 17.34 , 17.26 , 17.18 , 17.18 , 17.23 , 17.36 , 17.65 , 17.95 ,
  18.57 , 19.42 , 20.14 , 21.22 , 22.1 , 22.64 , 23.56 , 24.66 , 25.32 ,
  26.2 , 27.02 , 27.61 , 28.45 , 29.15 , 29.57 , 30.34 , 31.2 , 31.67 ,
  32.25 , 32.64 , 32.8 , 32.88 , 32.87 , 32.8 , 32.61 , 32.32 , 32.05 ,
  31.49 , 30.7 , 29.76 , 29.13 , 28.1 , 27.06 , 26.44 , 25.51 , 24.56 ,
  23.9 , 22.88 , 21.86 , 21.15 , 19.96 , 18.72 , 17.89 , 16.73 , 15.64 ,
  14.53 , 13.8 , 12.8 , 11.9 , 11.32 , 10.4 , 9.49 , 8.95 , 8.19 , 7.41 ,
  6.63 , 6.15 , 5.48 , 4.88 , 4.53 , 4.06 , 3.67 , 3.43 , 3.09 , 2.81 ,
  2.53 , 2.36 , 2.15 , 1.97 , 1.86 , 1.71 , 1.6 , 1.5 , 1.45 , 1.4 , 1.34 ,
  1.31 , 1.28 , 1.25 , 1.23 , 1.21 , 1.18 , 1.14 , 1.12 , 1.09 , 1.06 ,
  1.02 , 1.01 , 1 , 0.98 , 0.97 , 0.96 , 0.95 , 0.94 , 0.94 , 0.93 , 0.92 ,
  0.92 , 0.9 , 0.89 , 0.88 , 0.87 , 0.84 , 0.82 , 0.81 , 0.8 , 0.79 , 0.78
  , 0.77 , 0.76 , 0.76 , 0.75 , 0.73 , 0.71 )
  jpeg(nano_WoloshukRIB401488.jpg)
  plot( x ,
z ,
type=l ,
cols=red ,
main=nanodrop - #012345 ,
xlab=Wavelength(nm) ,
ylab=10mm Absorbance )
  dev.off()

see the arguments xlim and ylim in plot.default



-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341

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


[R] Specification Tests for Tobit Models

2007-11-26 Thread Malte Brockmann

Dear R-List,

I am using Tobit regression models to estimate censored dependent
variables (using survreg in the survival package). I have 2 questions:

1) Is there any package providing specification tests for Tobit models
(Hausman test proposed by Newey (1987), Journal of Econometrics, White
Information Matrix test or any other test I do not know about so far)?

2) Are there any packages that implement SUR or simultaneous equations
for censored regression?

Thanks in advance,
Malte



Malte Brockmann
[EMAIL PROTECTED]

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


[R] Problem with avoiding rep

2007-11-26 Thread Paul Smith
Dear All,

Suppose that you have the following data:

X   Frequency
1   3
4   2
3   4

To get a vector with all observations, one could use

data - c(rep(1,3),rep(4,2),rep(3,4))

I am wondering whether there exists an easier way of doing this. Any ideas?

Thanks in advance,

Paul

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


[R] newbie polr() question

2007-11-26 Thread Max
Hi everyone, I'm trying to understand some R output here for ordinal 
regression. I have some integer data called A split up into 3 ordinal 
categories, top, middle and bottom, T, M and B respectively.

I have to explain this output to people who have a very poor idea about 
statistics and just need to make sure I know what I'm talking about 
first.

Here's the output:

Call:
polr(formula = Factor ~ A, data = a, Hess = TRUE, method = logistic)

Coefficients:
ValueStd. Error  t value
A -0.1259028 0.04758539  -2.645829

Intercepts:
Value Std. Error t value
B|M -2.5872 0.5596 -4.6232
M|T 0.3044 0.4864 0.6258

Residual Deviance: 204.8798
AIC: 210.8798

I really am not sure what the intercepts mean at all. However, my 
understanding of the coefficient of A is that as the category 
increases, A decreases? If I have an A value of 10, how to I figure out 
the estimated probability that this score is in one of the three 
categories?

thanks!

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


Re: [R] multiple comparisons/tukey kramer

2007-11-26 Thread Tyler Smith
On 2007-11-23, hadley wickham [EMAIL PROTECTED] wrote:

 What I need is a reference to the tests implemented in glht, so I can
 decide which one is appropriate for my data. Sequen, Changepoint et
 al. may be common terms in some fields, but not in the references I'm
 working from.

 Have you read the vignette:
 http://cran.r-project.org/doc/vignettes/multcomp/multcomp.pdf
 ?

Thanks,

I have, and I've now reread it, as well as looking at the examples in
contrMat. I now understand that Tukey, Dunnett, Sequen et al. are
'convenience' terms, specifying all pair-wise, treatments vs control
etc., contrasts. I worked through the numerical example in Dunnett's
original paper, and also found a worked example of Tukey-Kramer
contrasts, and reproduced the results using 

glht(LM, linfct = mcp(fac = 'Dunnett'))
glht(LM, linfct = mcp(fac = 'Tukey'))

I'm still finding the language very difficult. I was taught these
methods using SS/MS language. Linear models were mentioned in passing,
but the focus was on using (and hopefully understanding) the formulas
for filling in the cells in an anova table. Has the linear model focus
now replaced the 'traditional' approach I learned? 

It's been a very frustrating week or two as I try and come to terms
with material I thought I already knew, so what I'm wondering is if
I'm doomed to repeat this process with every variation on Anova
designs I want to analyze in R unless I take the time to study linear
models. Today's task, for example, is figuring out how to convert
Sokal and Rohlf's two-level nested model II anova into R code, and
it's not going well.

Thanks,

Tyler

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


Re: [R] Problem with avoiding rep

2007-11-26 Thread Gabor Csardi
 x - c(1,4,3)
 freq - c(3,2,4)
 rep(x, freq)
[1] 1 1 1 4 4 3 3 3 3

Gabor

On Mon, Nov 26, 2007 at 07:34:36PM +, Paul Smith wrote:
 Dear All,
 
 Suppose that you have the following data:
 
 X Frequency
 1 3
 4 2
 3 4
 
 To get a vector with all observations, one could use
 
 data - c(rep(1,3),rep(4,2),rep(3,4))
 
 I am wondering whether there exists an easier way of doing this. Any ideas?
 
 Thanks in advance,
 
 Paul
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Csardi Gabor [EMAIL PROTECTED]MTA RMKI, ELTE TTK

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


Re: [R] Problem with avoiding rep

2007-11-26 Thread Paul Smith
On Nov 26, 2007 7:45 PM, Gabor Csardi [EMAIL PROTECTED] wrote:
  x - c(1,4,3)
  freq - c(3,2,4)
  rep(x, freq)
 [1] 1 1 1 4 4 3 3 3 3

Thanks, Gabor. I had just tried

rep(1:10,10:20)

but should have tried

rep(1:10,11:20)

Paul



 On Mon, Nov 26, 2007 at 07:34:36PM +, Paul Smith wrote:
  Dear All,
 
  Suppose that you have the following data:
 
  X Frequency
  1 3
  4 2
  3 4
 
  To get a vector with all observations, one could use
 
  data - c(rep(1,3),rep(4,2),rep(3,4))
 
  I am wondering whether there exists an easier way of doing this. Any ideas?
 
  Thanks in advance,
 
  Paul
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.

 --
 Csardi Gabor [EMAIL PROTECTED]MTA RMKI, ELTE TTK


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


Re: [R] Filling in a Zero Matrix

2007-11-26 Thread Julian Burgos
My mistake, by xlabel and ylabel you are refering to the row and column 
names of your matrix, right?  To label a matrix you can simply use 
colnames() and rownames().

Still its not clear to me what you are trying to do with your code. 
Perhaps if you give us a sample of your data and explain clearly what 
you are trying to achieve, we can help you to simplify your code.

Julian

Julian Burgos wrote:
 Hi Amy,
 Many (perhaps most) of the people on the list do not receive emails with 
 html...so we can't see colored text.  Also it would be helpfully to have 
 a bit of your data, so we can run your code (see the posting guide in 
 this regard,http://www.R-project.org/posting-guide.html).
 
 Please explain what are the 'xlabel' and the 'ylabel' that you 
 mentioned.  I don't see those variables in your code.
 
 Julian
 
 
 
 Amit Patel wrote:
 Hi
 I am very new to R and statistical programming in general. I am trying to 
 reorder data from a .csv file. I have managed to import the data and create 
 a zero matrix. I am now trying to fill the matrix. There seems to be some 
 problem with this section of my code. I have highlighted the dodgy code in 
 red. Please help if possible.

 ##
 ###  Create matrix ###
 ##

 #Open the csv file
 OGSdata - read.table(MG3199.csv,sep=,,header=TRUE)

 #creates 3 separate vectors
 sample - OGSdata[,1]
 mci - OGSdata[,2]
 pct - OGSdata[,3]

 #change mci range 
 offset - min(mci)-1
 mci - (mci - offset)

 #matrix sizes
 mci_count - max(mci)
 sample_count - max(sample)

 #creates a zero matrix 
 OGS - mat.or.vec(mci_count,sample_count)

 #Create labels
 sample_lab - (A-9,B-9, C-9, D-9, E-9,A-12,B-12, C-12, 
 D-12, E-12)

 #add data
 for (i in 1:length(pct)) {
 OGS(mci(i),sample(i))- pct(i);
 }


 What I want is to have colum1 from original data to be the xlabel, column 2 
 to be the ylabel and the 3rd colum to be the values in the matrix
 Any help is appreciated.

 Kind Regards
 Amit Patel




   ___

 now.

  [[alternative HTML version deleted]]

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

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


Re: [R] Fwd: Empty list to use in a for cycle

2007-11-26 Thread ONKELINX, Thierry
You could try something like this (untested). 

lapply(unique(elio2$id), function(i){
  sub.mu - exp.mu[exp.mu$id==i, ]
  n - nrow(sub.mu)
  D - matrix(0, n, n)
  diag(D) - sub.mu$deriv.link
  A - mat.cov[seq_len(n), seq_len(n)]
  R - corstr[seq_len(n), seq_len(n)]
  SolveD - solve(D)
  SolveA - solve(sqrt(A))
  SolveD %*% SolveA %*% solve(R) %*% SolveA %*% SolveD
})

HTH,

Thierry


ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and 
Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology 
and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
[EMAIL PROTECTED] 
www.inbo.be 

Do not put your faith in what statistics say until you have carefully 
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of 
uncertainties, a surgery of suppositions. ~M.J.Moroney

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Niccolò Bassani
Verzonden: maandag 26 november 2007 16:36
Aan: [EMAIL PROTECTED]
Onderwerp: [R] Fwd: Empty list to use in a for cycle

Dear R-users,
I'm posting a problem I already asked help for some time ago, because I'm 
facing that problem once again and even because now, reading that old e-mail, 
and the answer recevied, I understand I've not made myself clear.

Here's the question: I need to create an empty list of a specific length to 
fill it with a quite large amount of square matrices, which is 602. The 
question is that these matrices are created inside a for cycle, and I do not 
know how to recall all of them one by one, except by creating an empty list 
before the cycle, than assigning for each value of the i index the amtrix 
computed to the first element of the empty list.
The fact is that: i've trided to create an empty list with

vector(list,602)

and then putting it in a cycle, but it didn't work. This is the cycle I've 
used. To prove it works (and then the cycle itself is not a problem) there's 
also the output (i.e. the last square matrix computed).

for (i in unique(elio2$id)){
sub.mu - exp.mu[exp.mu$id==i,]
D - matrix(0,nrow( sub.mu),nrow(sub.mu))
diag(D) - sub.mu$deriv.link
A - mat.cov[1:nrow(D),1:nrow(D)]
R - corstr[1:nrow(D),1:nrow(D)]
W - solve(D)%*%solve(sqrt(A))%*%solve(R)%*%solve(sqrt(A))%*%solve(D)
}

 W
  [,1]  [,2]  [,3]  [,4]
[1,]  3.492489e+02 -7.9324883721  0.0006286788 -0.0031046240 [2,] -7.932488e+00 
17.4974625191 -1.7575467817  0.0001403319 [3,]  6.286788e-04 -1.7575467817 
17.3227959738 -1.7529916860 [4,] -3.104624e-03  0.0001403319 -1.7529916860 
17.2279244622


Does anyone knows how to insert each and every matrix like the one above in a 
omnicomprehensive list? That's because I've to use a function requiring me to 
have the matrices I need inside a list.
Thanks in advance, hope it's not a too much stupid problem!
niccolò

[[alternative HTML version deleted]]

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


Re: [R] 'Split' character

2007-11-26 Thread Sébastien
One additionnal question about a problem that I just noticed in my script:
the list created by my split function is sorted in the increasing order 
and not in the current order of the elements of the do.call argument 
(see the results of the two last lines of the following script). I was 
unsuccesful in tweaking my split function to have a proper order...
If there is no way to do that, I guess it comes down to a very basic 
question: how can I reorder a list ?


how can I reorder the list 'mydata.split' according to

a-rep(1.5:10.5,each=2)
b-rep(21:30,each=2)
cd-101:120
mydata-data.frame(a,b,cd)

mydata.split - split(mydata,do.call(paste,c(mydata[,1:2],sep = 
:)),drop=TRUE)
names(mydata.split)
unique(do.call(paste,c(mydata[,1:2],sep = :)))



Sebastien

Gabor Grothendieck a écrit :
 Try this using the BOD data frame that comes with R or
 try using interaction in place of paste:

 split(BOD, do.call(paste, c(BOD, sep = :)), drop=TRUE)


 On Nov 25, 2007 10:23 AM,  [EMAIL PROTECTED] wrote:
   
 Thanks Jim and Herinque for you reply.

 The substitution you are both proposing works fine, except when a or b 
 contains
 decimal numbers (which is mostly my case in a real dataset). In this case, 
 there
 is no distinction between the decimal point and the one introduced by the 
 split
 function.
 If the split function cannot be customized, then I guess I have to first
 substitute the decimal point in my dataset by e.g. a * sign and change it 
 back
 to a . when the split is done...

 Sebastien

 jim holtman a écrit :

 
 Here is one way:

   
 a-1:10
 b-21:30
 mydata-data.frame(a,b)
 mydata.split-split(mydata,(mydata[,1:2]),drop=TRUE)
 x - mydata.split
 # customize the names
 names(x) - sapply(strsplit(names(x), \\.), paste, collapse=-my
 
 character-)
 
 x
 
 $`1-my character-21`
   a  b
 1 1 21

 $`2-my character-22`
   a  b
 2 2 22

 $`3-my character-23`
   a  b
 3 3 23
 ...

 On Nov 24, 2007 6:15 PM,  [EMAIL PROTECTED] wrote:
   
 Dear R-users,

 The following code splits a very simple dataframe into a list, each element
 
 of
 
 the list being one line of the dataframe. You will see that the split
 
 function
 
 names each element of the list by using uses the content of a and b and
 
 merging
 
 them with a . character. Is there a way to customize this character?

 a-1:10
 b-21:30
 mydata-data.frame(a,b)
 mydata.split-split(mydata,(mydata[,1:2]),drop=TRUE)
 mydata.split

 Thanks in advance for your help.

 Sebastien

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

 

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

 


   

[[alternative HTML version deleted]]

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


[R] spss, string factors, selecting

2007-11-26 Thread Katherine Jones
Hi,

I am having trouble with a large dataset I am importing from SPSS.  
The problem is I have to merge two datasets (which seems to be  
working OK) then select rows based on attributes. I have a column  
with either blank cells, B or E entered. I want to select all rows  
with E. I have other columns with numerical data which I will then do  
analyses on.
data[column== E] does not work. I use  E not E, because levels 
(column) returns  B  E.

Any help on what I am doing wrong is much appreciated. I'm getting  
quite stressed as I have 10 files with approx 100,000 records in each  
to analyse so manipulating data becomes a pain.

Here is the code below, not sure it makes much sense without seeing  
the dataset:-


chaff-read.spss(/Users/Kat/Desktop/papers in progress/btopaper/ 
edited BTO data/fatnewchaff.sav, to.data.frame=TRUE)
chafffat-read.spss(/Users/Kat/Desktop/papers in progress/btopaper/ 
edited BTO data/fatmethods.sav)
chaffmerge2-merge(chaff, chafffat, by.x=c(RINGNO, FAT,  
FATMTD), by.y=c(RINGNO, FAT, FATMTD), all=T)
attach(chaffmerge2)
chaffhabfactor-factor(chaffmerge2$HYBRID_A)
levels(chaffhabfactor)
Echaff-chaffmerge2[FATMTD== E,]
attach(Echaff)
names(Echaff)
plotmeans(Echaff$FAT~Echaff$HYBRID_A)
chaffFat-factor(Echaff$FAT)
levels(chaffFat)
chaffzeros-table(chaffFat, Echaff$HYBRID_A)
chaffzeros


chaffFat12345
   0   261  354  345 1003  235
   138   23   1762
   2190420
   3 70101
   4 20000
   5   145   34  123  100   60
   8 00000
   10  202  141  248  279  101
   15   73   12   79   519
   20   84   60   64  133   19
   25   146   20   223
   30   30   25   22   54   13
   3530744
   407   102   125
   4520310
   5010021
   6001011

The 1,2,3,4,5, values of chaffFat above correspond to B which  
should have been removed

[[alternative HTML version deleted]]

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


Re: [R] Unweighted meta-analysis

2007-11-26 Thread Emmanuel Charpentier
Roy Sanderson a écrit :
 Hello
 
 I'm very much a beginner on meta-analysis, so apologies if this is a
 trivial posting.  I've been sent a set data from separate experimental
 studies, Treatment and Control, but no measure of the variance of effect
 sizes, numbers of replicates etc.  Instead, for each study, all I have
 is the mean value for the treatment and control (but not the SD). 

With possibly three very special kind of exceptions, what you've been
sent is insufficient for any kind of analysis (meta- or otherwise) : no
way to assess variability, hence no way to assess relative importance of
noise to data or relative importance of different set of data.

One possible exception is when the very nature of the experiment imply
that your data come from a truly one-parameter distribution. I'm
thinking, for example, of count data of rare events, which might, under
not-so-unreasonable(-in-special-circumstances) conditions, come from a
Poisson distribution.

Another possible set of exception is that when the second (and
following) parameter(s) can be deduced from obvious general knowledge.
For example (set in a semi-imaginary setup), one may give you the number
of people using a given service at least once during a specified period,
*provided* that in order to use this service, people have to register
with the service provider first. The data might be a simple number (no
valid indication of variability, if service use is too ferquent to be
modeled by a Poisson distribution), but looking up the number of
registered users in some data bank might provide you with a valid
proportion and population size, which is enough to meta-analyze.

But the third possibility is of course that your means are indeed the
result of experimenting on *ONE* experimental unit of each group. This
is highly dependent of what is measured and how (an example of this
might be industrial production per unit time with two different set of
tools/machines in various industrial setups : here, the experimental
unit is the industrial setup, and your mean is *one* measure of
speed). Then, you have *individual* data, that you should analyze
accordingly (e. g. t-test or Wilcoxon test if there is no relationship
between treated and control experimental unit, paired t-test or
paired Wilcoxon test if you are told that the means may be related,
etc ...). This is not a meta-analysis, but an analysis.

Outside these possibilities, I see no point of meta-analysing anything
that isn't analysable by itself.

 As
 far as I can tell, this forces me into an unweighted meta-analysis, with
 all the caveats and dangers associated with it. 

As far as I can tell, you're forced to tell your sponsor/tutor/whatever
 either that he doesn't know what he asks for or that he's trying to
fool you (and you saw it !) ; which might lead you to ask him to rethink
his question, give you more informatin about the measumements and
experimental setup, to provide you (or help you find) the missing data,
to stop playing silly games or to go fly a kite...

  Two possible approaches
 might be:
 
 a) Take the ln(treatment/control) and perform a Fisher's randomisation
 test (and also calculate +/- CI).
 b) Regress the treatment vs control values, then randomise (with or
 without replacement?) individual values, comparing the true regression
 coefficient with the distribution of randomisation regression
 coefficients.

I haven't the foggiest idea of what you're trying to do here :
introducing artficial variability in order to separate it for variation
between groups ?

Unless you are in the case of one experiment = one experimental unit
per group (see above) with no information about variability, the only
information you can use is the *sign* of the difference
Experimental-Control : if all or almost all of them go in the
same direction, one might be tempted to conclude that this direction is
not random (that's the sign test) . But this is only valid if the
hypothesis Direction is 50/50 random under H0 has validity under the
experimental setup, which your story doesn't tell...

 Both approaches would appear to be fraught with risks; for example in
 the regression approach, it is probable that the error distribution of
 an individual randomised regression might not be normal - would this
 then invalidate the whole set of regressions?

Again, you'd work against an artificial variability that you'd have
introduced yourself : what is the point ?

HTH,

Emmanuel Charpentier

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


Re: [R] pass lm( ) a char vector as the variables to be included

2007-11-26 Thread Emmanuel Charpentier
Gavin Simpson a écrit :
 On Mon, 2007-11-26 at 14:17 +, [EMAIL PROTECTED] wrote:
 Here are the codes of the example of lm( ):

 ## Annette Dobson (1990) An Introduction to
 Generalized Linear Models.
 ## Page 9: Plant Weight Data.
 ctl -
 (4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
 trt -
 (4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
 group - gl(2,10,20, labels=c(Ctl,Trt))
 weight - c(ctl, trt)
 anova(lm.D9 - lm(weight ~ group))
 lm.D90 - lm(weight ~ group - 1) # omitting intercept

 What I am doing is let the variable name group
 stored in a vector, say, g - group. The question is
 how to strip the quotation marks when we call lm( )
 through g?
 Try: 
 w = weight
 g = group
 form = as.formula(paste(w,g,sep=~))
 lm(form)

 Regards,
 Richie.
 
 For more complicated automation, the ideas and examples from Bill
 Venables Programmer Niche article in the R newsletter from a few years
 ago might be of use:
 
 [39] Bill Venables. Programmer's niche. R News, 2(2):24-26, June 2002.
 [ bib | PDF | http ]
 
 The PDF is available here:
 
 http://cran.r-project.org/doc/Rnews/Rnews_2002-2.pdf

Another possibility is to create macro (library(gtools) ; ? defmacro).
See Thomas Lumley's paper in R News 2001-3 (Programmer’s Niche: Macros
in R\n Overcoming R’s virtues).

HTH,

Emmanuel Charpentier

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


Re: [R] Clean programming with R

2007-11-26 Thread Martin Waller
Hmm - I looked for the codetools package on the UK(London) cran site and 
couldn't find it - where can I find it please?

Martin

[EMAIL PROTECTED] wrote:
 library(codetools)
 findGlobals(power)
 
 Thanks for your answer.
 In addition, findGlobals(power,FALSE) gives the list of the globals 
 variables alone :
 
 findGlobals(power,F)
 $functions
 [1] ^  {  - return
 
 $variables
 [1] pp
 
 
 
 Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


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


[R] Odds Ratio calculation

2007-11-26 Thread sigalit mangut-leiba
Hello,
I want to calculate Odds Ratio.
I have a binary outcome and  two groups of exposure: '1' are exposed, and
'2' are not-exposed.
I want '2' to be the reference group.
By factor I get group '1' as a reference because it sorted in increasing
order.
How do I change it?
Thank you,
Sigalit.

[[alternative HTML version deleted]]

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


Re: [R] Clean programming with R

2007-11-26 Thread Gabor Csardi
Try some other mirror, or the main site:
http://cran.r-project.org/src/contrib/Descriptions/codetools.html

You can easily install it via

install.packages(codetools)

and then selecting an appropriate mirror.

Gabor

On Mon, Nov 26, 2007 at 08:19:39PM +, Martin Waller wrote:
 Hmm - I looked for the codetools package on the UK(London) cran site and 
 couldn't find it - where can I find it please?
 
 Martin
 
 [EMAIL PROTECTED] wrote:
  library(codetools)
  findGlobals(power)
  
  Thanks for your answer.
  In addition, findGlobals(power,FALSE) gives the list of the globals 
  variables alone :
  
  findGlobals(power,F)
  $functions
  [1] ^  {  - return
  
  $variables
  [1] pp
  
  
  
  Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre
  
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Csardi Gabor [EMAIL PROTECTED]MTA RMKI, ELTE TTK

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


Re: [R] 'Split' character

2007-11-26 Thread Dimitris Rizopoulos
one way is the following:

vals - do.call(paste, c(mydata[1:2], sep = :))
fc - factor(vals, levels = unique(vals))
mydata.split - split(mydata, fc, drop = TRUE)
names(mydata.split)


I hope it helps.

Best,
Dimitris


Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
  http://www.student.kuleuven.be/~m0390867/dimitris.htm


Quoting Sébastien [EMAIL PROTECTED]:

 One additionnal question about a problem that I just noticed in my script:
 the list created by my split function is sorted in the increasing order
 and not in the current order of the elements of the do.call argument
 (see the results of the two last lines of the following script). I was
 unsuccesful in tweaking my split function to have a proper order...
 If there is no way to do that, I guess it comes down to a very basic
 question: how can I reorder a list ?

 
 how can I reorder the list 'mydata.split' according to

 a-rep(1.5:10.5,each=2)
 b-rep(21:30,each=2)
 cd-101:120
 mydata-data.frame(a,b,cd)

 mydata.split - split(mydata,do.call(paste,c(mydata[,1:2],sep =
 :)),drop=TRUE)
 names(mydata.split)
 unique(do.call(paste,c(mydata[,1:2],sep = :)))

 

 Sebastien

 Gabor Grothendieck a écrit :
 Try this using the BOD data frame that comes with R or
 try using interaction in place of paste:

 split(BOD, do.call(paste, c(BOD, sep = :)), drop=TRUE)


 On Nov 25, 2007 10:23 AM,  [EMAIL PROTECTED] wrote:

 Thanks Jim and Herinque for you reply.

 The substitution you are both proposing works fine, except when a   
 or b contains
 decimal numbers (which is mostly my case in a real dataset). In   
 this case, there
 is no distinction between the decimal point and the one introduced  
  by the split
 function.
 If the split function cannot be customized, then I guess I have to first
 substitute the decimal point in my dataset by e.g. a * sign and   
 change it back
 to a . when the split is done...

 Sebastien

 jim holtman a écrit :


 Here is one way:


 a-1:10
 b-21:30
 mydata-data.frame(a,b)
 mydata.split-split(mydata,(mydata[,1:2]),drop=TRUE)
 x - mydata.split
 # customize the names
 names(x) - sapply(strsplit(names(x), \\.), paste, collapse=-my

 character-)

 x

 $`1-my character-21`
   a  b
 1 1 21

 $`2-my character-22`
   a  b
 2 2 22

 $`3-my character-23`
   a  b
 3 3 23
 ...

 On Nov 24, 2007 6:15 PM,  [EMAIL PROTECTED] wrote:

 Dear R-users,

 The following code splits a very simple dataframe into a list,   
 each element

 of

 the list being one line of the dataframe. You will see that the split

 function

 names each element of the list by using uses the content of a and b and

 merging

 them with a . character. Is there a way to customize this character?

 a-1:10
 b-21:30
 mydata-data.frame(a,b)
 mydata.split-split(mydata,(mydata[,1:2]),drop=TRUE)
 mydata.split

 Thanks in advance for your help.

 Sebastien

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




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






   [[alternative HTML version deleted]]





Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

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


Re: [R] newbie polr() question

2007-11-26 Thread Prof Brian Ripley
On Mon, 26 Nov 2007, Max wrote:

 Hi everyone, I'm trying to understand some R output here for ordinal
 regression. I have some integer data called A split up into 3 ordinal
 categories, top, middle and bottom, T, M and B respectively.

 I have to explain this output to people who have a very poor idea about
 statistics and just need to make sure I know what I'm talking about
 first.

 Here's the output:

 Call:
 polr(formula = Factor ~ A, data = a, Hess = TRUE, method = logistic)

 Coefficients:
 ValueStd. Error  t value
 A -0.1259028 0.04758539  -2.645829

 Intercepts:
 Value Std. Error t value
 B|M -2.5872 0.5596 -4.6232
 M|T 0.3044 0.4864 0.6258

 Residual Deviance: 204.8798
 AIC: 210.8798

 I really am not sure what the intercepts mean at all. However, my
 understanding of the coefficient of A is that as the category
 increases, A decreases? If I have an A value of 10, how to I figure out
 the estimated probability that this score is in one of the three
 categories?

Use predict(): see the book polr supports for examples (and the theory).

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


Re: [R] Clean programming with R

2007-11-26 Thread Prof Brian Ripley
It is part of recent versions of R (a recommended package), so if Mr 
Waller follows the advice of the posting guide, he will find it already 
installed.

On Mon, 26 Nov 2007, Gabor Csardi wrote:

 Try some other mirror, or the main site:
 http://cran.r-project.org/src/contrib/Descriptions/codetools.html

 You can easily install it via

 install.packages(codetools)

 and then selecting an appropriate mirror.

 Gabor

 On Mon, Nov 26, 2007 at 08:19:39PM +, Martin Waller wrote:
 Hmm - I looked for the codetools package on the UK(London) cran site and
 couldn't find it - where can I find it please?

 Martin

 [EMAIL PROTECTED] wrote:
 library(codetools)
 findGlobals(power)

 Thanks for your answer.
 In addition, findGlobals(power,FALSE) gives the list of the globals
 variables alone :

 findGlobals(power,F)
 $functions
 [1] ^  {  - return

 $variables
 [1] pp


 
 Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre

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


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



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


Re: [R] Filling in a Zero Matrix

2007-11-26 Thread jim holtman
You can use the reshape package:

 x - read.table(textConnection(Samp MCI   PCT
+ 11 2
+ 1   4 5
+ 1   7 8
+ 2   4 4
+ 2   7 5
+ 28 7), header=TRUE)
 require(reshape)
 x.m - melt(x, measure.var=PCT)
 cast(x.m, MCI ~ Samp)
  MCI  1  2
1   1  2 NA
2   4  5  4
3   7  8  5
4   8 NA  7



On Nov 26, 2007 11:50 AM, Amit Patel [EMAIL PROTECTED] wrote:

 Hi

 The data is in the format

 Samp MCI   PCT
 11 2
 1   4 5
 1   7 8
 2   4 4
 2   7 5
 28 7

 I have split the columns into individual vectors
 I would like the data in the format

 MCI  Samp1 Samp2
 1  2  NA
 4  5  4
  7  8  5
 8  NA   7

  Kind Regards
 Amit Patel


 - Original Message 
 From: jim holtman [EMAIL PROTECTED]
 To: Amit Patel [EMAIL PROTECTED]
 Sent: Monday, 26 November, 2007 3:12:19 PM
 Subject: Re: [R] Filling in a Zero Matrix

 Could you please provide commented, minimal, self-contained,
 reproducible code and an example of what you would like as output.  We
 don't have the test file that you are trying to read, nor really
 understand what you would like as output.

 On Nov 26, 2007 9:31 AM, Amit Patel [EMAIL PROTECTED] wrote:
  Hi
  I am very new to R and statistical programming in general. I am trying to
 reorder data from a .csv file. I have managed to import the data and create
 a zero matrix. I am now trying to fill the matrix. There seems to be some
 problem with this section of my code. I have highlighted the dodgy code in
 red. Please help if possible.
 
  ##
  ###  Create matrix ###
  ##
 
  #Open the csv file
  OGSdata - read.table(MG3199.csv,sep=,,header=TRUE)
 
  #creates 3 separate vectors
  sample - OGSdata[,1]
  mci - OGSdata[,2]
  pct - OGSdata[,3]
 
  #change mci range
  offset - min(mci)-1
  mci - (mci - offset)
 
  #matrix sizes
  mci_count - max(mci)
  sample_count - max(sample)
 
  #creates a zero matrix
  OGS - mat.or.vec(mci_count,sample_count)
 
  #Create labels
  sample_lab - (A-9,B-9, C-9, D-9, E-9,A-12,B-12, C-12,
 D-12, E-12)
 
  #add data
  for (i in 1:length(pct)) {
 OGS(mci(i),sample(i))- pct(i);
  }
 
 
  What I want is to have colum1 from original data to be the xlabel, column
 2 to be the ylabel and the 3rd colum to be the values in the matrix
  Any help is appreciated.
 
  Kind Regards
  Amit Patel
 
 
 
 
   ___
 
  now.
 
 [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 



 --
 Jim Holtman
 Cincinnati, OH
 +1 513 646 9390

 What is the problem you are trying to solve?


 
 Yahoo! Mail now has unlimited storage, which means you can have spam control
 and more space for those important e-mails.



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

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


Re: [R] Communicating from one function to another

2007-11-26 Thread Duncan Murdoch
On 11/26/2007 1:46 PM, Alberto Monteiro wrote:
 Duncan Murdoch wrote:
 
 R doesn't really have global variables.  - goes looking in parent 
 environments until it finds the target variable, and makes the 
 assignment there.  If it never finds one, it makes the assignment in 
 the global environment, but the name is misleading:  it should 
 really be called the user workspace.
 
 Got it.
 
 So, in this case:
 
 x - 1
 
 f - function() {
   x - 2
   g - function() {
 x - 3
   }
   g()
   x
 }
 
 f()
 
 It's expected that f will return 3, but x would still be 1?

Yes, the one in the user workspace be unaffected.

Duncan Murdoch

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


[R] Time Series Issues, Stationarity ..

2007-11-26 Thread Ozcan Asilkan
Hello,

I am very new to R and Time Series. I need some help including R codes
about the following issues. I' ll really appreciate any number  of
answers...

# I have a time series data composed of 24 values:
myinput = c(n1,n2...,n24);
# In order to make a forecasting a, I use the following codes
result1 = arima(ts(myinput),order = c(p,d,q),seasonal = list(order=c(P,D,Q)))
result2 = forecast(result1,12)
plot(result2)

Now, by using R code...

1) How can I determine if my data is statitonary or not ? (trend 
seasonal effects)
2) If not, how can I make it stationary ?
3) Is arima() function used only on STATIONARY data ? Or does it first
determine if the data is stationary or not and makes it stationary ?
(if it is non-stationary)
4) I tried different parameter values in arima() function, but every
parameter gave very different results :(( . I
even found  tried best.arima() function but it also gave
unsatisfactory result. So, how can I calculate the optimum arima()
parameters (p,d,q,P,D,Q) that fit my data best ?

Thanks in advance, best wishes..

Ozzy

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


Re: [R] Odds Ratio calculation

2007-11-26 Thread Uwe Ligges


sigalit mangut-leiba wrote:
 Hello,
 I want to calculate Odds Ratio.
 I have a binary outcome and  two groups of exposure: '1' are exposed, and
 '2' are not-exposed.
 I want '2' to be the reference group.
 By factor I get group '1' as a reference because it sorted in increasing
 order.
 How do I change it?


See ?factor and learn to use the levels argument of factor().

Uwe Ligges



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

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


Re: [R] ggplo2: fixed extent greater than data?

2007-11-26 Thread thegeologician


hadley wrote:
 
 On 11/23/07, thegeologician [EMAIL PROTECTED] wrote:
 
 I'd like to produce a series of maps with different data on, but exactly
 the
 same extent in each plot. Is there a way of switching the automatic
 extent
 (to the data of the last layer added) OFF? I'm trying something like:

 
 I think this is a bug in coord_map, as the limits set on the scales
 are basically  ignored.  However, I'm not completely sure how to fix
 this, as simply subsetting the data to be contained within those
 bounds may drop off points that are necessary to correctly draw
 boundaries.
 
 Essentially the problem is that the limits are specified on the
 unprojected data, and I don't know how to apply them to the projected
 data (and you might not want to do that anyway, given that it could
 produce non-linear boundaries).
 

Yes, that's true, due to the projection. The coordinate grid will bulge in
or out of the (projected) rectangular area defined by its corners. But in my
case it doesn't matter, as long as I can get all maps to show the same
extent... Anyway, it might be a nice touch, if at some point you could get
that to work too - but we're talking GIS here, might be a bit far out of
what R is basically designed for... Surely not a top issue for ggplot2.


hadley wrote:
 
 Additional question: is there a way of eliminating the extra spacing in a
 map projection? The expand=c(0,0) parameter seems not to work...
 
 This is a bug.  The fix will be included in the next version of
 ggplot, or you can fix the current version by running this code:
 
 ScaleContinuous$new - function(., name=NULL, limits=c(NA,NA),
 breaks=NULL, labels=NULL, variable, trans=identity, expand=c(0.05,
 0)) {
if (is.null(breaks)  !is.null(labels)) stop(Labels can only be
 specified in conjunction with breaks)
 
.$proto(name=name, .input=variable, .output=variable,
 limits=limits, .breaks = breaks, .labels = labels, .expand=expand)
  }
 

Thanks, that did fix THAT particular problem, indeed. But I encountered a
few new ones..:

At the moment, I'm doing something like:

getOverviewMap-function(xmin=4,xmax=18,ymin=43,ymax=50,proj=,par=NULL){
p2-ggplot()
p2-p2+geom_path(data=wa,mapping=aes(x=x,y=y))  # political boundaries
p2-p2+geom_point(data=spts,mapping=aes(x=Lon,y=Lat,colour=red))  
# sample
localities

# dummy points to fix extent:
xb-c(xmin,xmax,xmin,xmax)
yb-c(ymin,ymin,ymax,ymax)
bd-data.frame(xb,yb)
p2-p2+geom_point(data=bd,mapping=aes(x=xb,y=yb,plot=FALSE))

#axes:

p2-p2+scale_x_continuous(limits=c(xmin,xmax),expand=c(0,0),breaks=c(5,10,15,20))

p2-p2+scale_y_continuous(limits=c(ymin,ymax),expand=c(0,0),breaks=c(42,44,46,48,50))

p2$legend-FALSE
if(!(proj==none)) p2-p2+coord_map(project=proj,parameters=par)
return(p2)
}

I've fixed the extent-problem with some dummy points, outside of the area of
scope. The plot zooms to them, since I add them last.
wa is extracted from a call to map(), as shown on the ggplot2 site.
spts holds the sample localities.

Problem 1 (probably my stupidity): when I plot the sample localities without
colour=, they will be black and without Legend. When I give them colour,
as above, I can not get rid of the Legend! I tried to subset the plot and
gave the ..$legend-FALSE to different subsets and/or all layers, tried
the above statement at several places in the function... I didn't find the
trick. ;-(

Problem 2 (definitely my stupidity): I even couldn't find the right position
to place the plot=FALSE parameter, to suppress plotting of the dummy
points (corners). Or would ggplot2 notice and revert to the unwanted
smaller extent? Can I give them invisible colour?

Problem 3 (bug?): for testing, the function is designed to allow for the map
projection to be passed on. In cartesian coordinates (proj=none)
everything works fine. When I switch to - any, even rectangular - map
projection, I don't know how to override coord_map()s default behaviour to
omit the tick marks!?

Problem 4 (bug): As I said, cartesian coords are fine. In a map projection,
the country boundaries jump to the east by ~1 degree! It seems to me, wa -
but not the points? - might get projected twice, because of this strange
behaviour: when the function is run with proj=none it works fine
(default is cartesian). Any map projection set, the countries are offset.
BUT: When called with proj= after that, the map will also be fine (AND
projected)!! Since the parameter is passed through to mapproject, and there
it says an empty projection= defaults to the last projection used, I
assume no new calculation occurs in this case. The same happens even with
mercator projection (coord_map()s default) given as parameter.

Sorry for the lengthy post, but maybe my descriptions can help to track the
bugs... And of course I'd be thankful for any help! ;-)


-- 
View this message in context: 

Re: [R] how to compute highest density interval?

2007-11-26 Thread Greg Snow
The hpd function in the TeachingDemos package does this computation (for
unimodal densities).

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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of gallon li
 Sent: Saturday, November 24, 2007 5:44 AM
 To: r-help
 Subject: [R] how to compute highest density interval?
 
 Suppose i want to compute a 95% highest density for a beta 
 distribution
 beta(a,b)
 
 the two end points x1 and x2 shoudl satisfy the following two 
 equations:
 
 pbeta(x1,a,b)-pbeta(x2,a,b)=95%
 
 dbeta(x1,a,b)=dbeta(x2,a,b)
 
 Is there any fast way to compute x1 and x2 in R?
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

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


Re: [R] Time Series Issues, Stationarity ..

2007-11-26 Thread John C Frain
With 24 values you are asking the impossible from your data.   If you
use the standard Box Jenkins approach rather than an automatic ARIMA
and using any prior knowledge of the data you might manage some form
of forecast.  Look at graphs of the data and their first differences.
Look at graphs of the autocorrelation and partial autocorrelation
functions.  There are a range of text books that describe this kind of
manual Box-Jenkins approach.

There is an excellent account of stationarity and related matters in
Pfaff, B (2006), Analysis of Integrated and Cointegrated Time Series
with R, in the Springer USE R! series.  This also contains an account
of ARMA models.

Best regards

John

On 26/11/2007, Ozcan Asilkan [EMAIL PROTECTED] wrote:
 Hello,

 I am very new to R and Time Series. I need some help including R codes
 about the following issues. I' ll really appreciate any number  of
 answers...

 # I have a time series data composed of 24 values:
 myinput = c(n1,n2...,n24);
 # In order to make a forecasting a, I use the following codes
 result1 = arima(ts(myinput),order = c(p,d,q),seasonal = list(order=c(P,D,Q)))
 result2 = forecast(result1,12)
 plot(result2)

 Now, by using R code...

 1) How can I determine if my data is statitonary or not ? (trend 
 seasonal effects)
 2) If not, how can I make it stationary ?
 3) Is arima() function used only on STATIONARY data ? Or does it first
 determine if the data is stationary or not and makes it stationary ?
 (if it is non-stationary)
 4) I tried different parameter values in arima() function, but every
 parameter gave very different results :(( . I
 even found  tried best.arima() function but it also gave
 unsatisfactory result. So, how can I calculate the optimum arima()
 parameters (p,d,q,P,D,Q) that fit my data best ?

 Thanks in advance, best wishes..

 Ozzy

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



-- 
John C Frain
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]

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


Re: [R] Time Series Issues, Stationarity ..

2007-11-26 Thread Uwe Ligges


Ozcan Asilkan wrote:
 Hello,
 
 I am very new to R and Time Series. I need some help including R codes
 about the following issues. I' ll really appreciate any number  of
 answers...
 
 # I have a time series data composed of 24 values:
 myinput = c(n1,n2...,n24);
 # In order to make a forecasting a, I use the following codes
 result1 = arima(ts(myinput),order = c(p,d,q),seasonal = list(order=c(P,D,Q)))
 result2 = forecast(result1,12)
 plot(result2)
 
 Now, by using R code...
 
 1) How can I determine if my data is statitonary or not ? (trend 
 seasonal effects)

Look at the data and watch for different kinds of instationarity (or 
better, if the assumptions for stationarity are fulfilled).

 2) If not, how can I make it stationary ?

Depends on the kind of instationarity. Making it stationary might be 
impossible for the whole time series.

 3) Is arima() function used only on STATIONARY data ? Or does it first
 determine if the data is stationary or not and makes it stationary ?
 (if it is non-stationary)

No, R cannot think. It just does some calculations.


 4) I tried different parameter values in arima() function, but every
 parameter gave very different results :(( . I
 even found  tried best.arima() function but it also gave
 unsatisfactory result. So, how can I calculate the optimum arima()
 parameters (p,d,q,P,D,Q) that fit my data best ?

You got to the right question. Unfortunately, we are all interested in 
its answer. It depends on your definition on best and is not that easy.
You might want to start reading on the Box-Jenkins method to determine 
parameters and continue to read a good textbook on time series analysis. 
Or just ask the oracle.

Best,
Uwe Ligges



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

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


Re: [R] Install repeated library

2007-11-26 Thread Becky Parker
It worked.  The web page must have been down when I tried it the other day.
Thank you, Becky

On 11/26/07, Jonathan Baron [EMAIL PROTECTED] wrote:

 Try http://popgen.unimaas.nl/~jlindsey/rcode.html

 On 11/25/07 10:41, Becky Parker wrote:
  Hello -
 
  I cannot get to
  www.alpha.luc.ac.be/~jlindsey/rcode.html
 http://www.alpha.luc.ac.be/%7Ejlindsey/rcode
  .htmlto
  obtain and install the repeated library for use of glmm().  Is the web
  page not active?  Can you give me an alternative location to obtain the
  repeated library?
 
  Thank you,
  Becky Parker
 
[[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.

 --
 Jonathan Baron, Professor of Psychology, University of Pennsylvania
 Home page: http://www.sas.upenn.edu/~baron
 Editor: Judgment and Decision Making (http://journal.sjdm.org)


[[alternative HTML version deleted]]

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


Re: [R] spss, string factors, selecting

2007-11-26 Thread jim holtman
?subset

subset(data, column ==  E)

On Nov 26, 2007 3:07 PM, Katherine Jones [EMAIL PROTECTED] wrote:
 Hi,

 I am having trouble with a large dataset I am importing from SPSS.
 The problem is I have to merge two datasets (which seems to be
 working OK) then select rows based on attributes. I have a column
 with either blank cells, B or E entered. I want to select all rows
 with E. I have other columns with numerical data which I will then do
 analyses on.
 data[column== E] does not work. I use  E not E, because levels
 (column) returns  B  E.

 Any help on what I am doing wrong is much appreciated. I'm getting
 quite stressed as I have 10 files with approx 100,000 records in each
 to analyse so manipulating data becomes a pain.

 Here is the code below, not sure it makes much sense without seeing
 the dataset:-


 chaff-read.spss(/Users/Kat/Desktop/papers in progress/btopaper/
 edited BTO data/fatnewchaff.sav, to.data.frame=TRUE)
 chafffat-read.spss(/Users/Kat/Desktop/papers in progress/btopaper/
 edited BTO data/fatmethods.sav)
 chaffmerge2-merge(chaff, chafffat, by.x=c(RINGNO, FAT,
 FATMTD), by.y=c(RINGNO, FAT, FATMTD), all=T)
 attach(chaffmerge2)
 chaffhabfactor-factor(chaffmerge2$HYBRID_A)
 levels(chaffhabfactor)
 Echaff-chaffmerge2[FATMTD== E,]
 attach(Echaff)
 names(Echaff)
 plotmeans(Echaff$FAT~Echaff$HYBRID_A)
 chaffFat-factor(Echaff$FAT)
 levels(chaffFat)
 chaffzeros-table(chaffFat, Echaff$HYBRID_A)
 chaffzeros

 
 chaffFat12345
   0   261  354  345 1003  235
   138   23   1762
   2190420
   3 70101
   4 20000
   5   145   34  123  100   60
   8 00000
   10  202  141  248  279  101
   15   73   12   79   519
   20   84   60   64  133   19
   25   146   20   223
   30   30   25   22   54   13
   3530744
   407   102   125
   4520310
   5010021
   6001011
 
 The 1,2,3,4,5, values of chaffFat above correspond to B which
 should have been removed

[[alternative HTML version deleted]]

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




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

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


Re: [R] Install repeated library

2007-11-26 Thread Becky Parker
I was able to get the repeated library from
http://popgen.unimaas.nl/~jlindsey/rcode.htmlhttp://popgen.unimaas.nl/%7Ejlindsey/rcode.html

I still have not been able to find the repeated library on CRAN.  It is not
listed on http://cran.r-project.org/src/contrib/PACKAGES.html

I also tried clicking on Packages  Install packages in R 2.4.1.  I selected
a CRAN mirror [tried both USA (CA 1) and India] and 'repeated' is not in the
list of packages.

What am I doing wrong?

Becky Parker


On 11/25/07, Simon Blomberg [EMAIL PROTECTED] wrote:

 The repeated package is on CRAN. I installed it successfully from there.

 Simon.

 On Sun, 2007-11-25 at 10:41 -1200, Becky Parker wrote:
  Hello -
 
  I cannot get to
  www.alpha.luc.ac.be/~jlindsey/rcode.html
 http://www.alpha.luc.ac.be/%7Ejlindsey/rcode.htmlto
  obtain and install the repeated library for use of glmm().  Is the web
  page not active?  Can you give me an alternative location to obtain the
  repeated library?
 
  Thank you,
  Becky Parker
 
[[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 --
 Simon Blomberg, BSc (Hons), PhD, MAppStat.
 Lecturer and Consultant Statistician
 Faculty of Biological and Chemical Sciences
 The University of Queensland
 St. Lucia Queensland 4072
 Australia
 Room 320 Goddard Building (8)
 T: +61 7 3365 2506
 email: S.Blomberg1_at_uq.edu.au

 Policies:
 1.  I will NOT analyse your data for you.
 2.  Your deadline is your problem.

 The combination of some data and an aching desire for
 an answer does not ensure that a reasonable answer can
 be extracted from a given body of data. - John Tukey.



[[alternative HTML version deleted]]

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


Re: [R] spss, string factors, selecting

2007-11-26 Thread Katherine Jones
This sort of works. It does select the E data, but unfortunately it  
doesn't select the data from the other columns; I want to select data  
across about 5 columns by the factor  E in one of the columns. It  
should be easy, but for some reason it is not working. The spaces  
being added don't help.

It seems to work on my non-merged data files, although the merged  
file contains all the data I need.

Thanks for the subset command though. Hadn't thought of using that.


On 26-Nov-07, at 4:46 PM, jim holtman wrote:
?subset

 subset(data, column ==  E)


[[alternative HTML version deleted]]

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


Re: [R] Install repeated library

2007-11-26 Thread Prof Brian Ripley
On Mon, 26 Nov 2007, Becky Parker wrote:

 I was able to get the repeated library from
 http://popgen.unimaas.nl/~jlindsey/rcode.htmlhttp://popgen.unimaas.nl/%7Ejlindsey/rcode.html

 I still have not been able to find the repeated library on CRAN.  It is not
 listed on http://cran.r-project.org/src/contrib/PACKAGES.html

 I also tried clicking on Packages  Install packages in R 2.4.1.  I selected
 a CRAN mirror [tried both USA (CA 1) and India] and 'repeated' is not in the
 list of packages.

 What am I doing wrong?

Nothing.  AFAIK it has never been on CRAN.  BTW, the correct address _is_ 
in the R FAQ, section 5.1.5.

OTOH, expecting to use Windows binaries on such an old version of R will 
be a problem (many newer packages and many bug fixes are not available), 
as only 2.6.x is currently supported.  Please update to R 2.6.1.



 Becky Parker


 On 11/25/07, Simon Blomberg [EMAIL PROTECTED] wrote:

 The repeated package is on CRAN. I installed it successfully from there.

 Simon.

 On Sun, 2007-11-25 at 10:41 -1200, Becky Parker wrote:
 Hello -

 I cannot get to
 www.alpha.luc.ac.be/~jlindsey/rcode.html
 http://www.alpha.luc.ac.be/%7Ejlindsey/rcode.htmlto
 obtain and install the repeated library for use of glmm().  Is the web
 page not active?  Can you give me an alternative location to obtain the
 repeated library?

 Thank you,
 Becky Parker

   [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 --
 Simon Blomberg, BSc (Hons), PhD, MAppStat.
 Lecturer and Consultant Statistician
 Faculty of Biological and Chemical Sciences
 The University of Queensland
 St. Lucia Queensland 4072
 Australia
 Room 320 Goddard Building (8)
 T: +61 7 3365 2506
 email: S.Blomberg1_at_uq.edu.au

 Policies:
 1.  I will NOT analyse your data for you.
 2.  Your deadline is your problem.

 The combination of some data and an aching desire for
 an answer does not ensure that a reasonable answer can
 be extracted from a given body of data. - John Tukey.


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


Re: [R] spss, string factors, selecting

2007-11-26 Thread jim holtman
That should give you back a subset of 'data' (with all its columns),
for those with  E in 'column'.  Can you show an example of your data
and what the desired output would be.  The posting guide asks provide
commented, minimal, self-contained, reproducible code so we don't
have to speculate on what you want.

On Nov 26, 2007 5:04 PM, Katherine Jones [EMAIL PROTECTED] wrote:
 This sort of works. It does select the E data, but unfortunately it doesn't
 select the data from the other columns; I want to select data across about 5
 columns by the factor  E in one of the columns. It should be easy, but for
 some reason it is not working. The spaces being added don't help.

 It seems to work on my non-merged data files, although the merged file
 contains all the data I need.

 Thanks for the subset command though. Hadn't thought of using that.



 On 26-Nov-07, at 4:46 PM, jim holtman wrote:
 ?subset


 subset(data, column ==  E)




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

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


[R] 2d Joint Density Plot

2007-11-26 Thread Josef Fruehwald
Hi all,

I'm fairly new to R, so I'm still trying to feel out what is available to
me.  I would like to be able to plot joint density in a two dimensional plot
where density is indicated by color or darkness gradients, like a 2d color
coded topographic map.  Ideally, the output would be something I could then
plot other points or lines on.

Currently, I'm calculating joint density with the function kde2d(), and
plotted with persp().

Thanks a bunch.

-Joe

[[alternative HTML version deleted]]

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


Re: [R] newbie polr() question

2007-11-26 Thread Max
Prof Brian Ripley explained :
 On Mon, 26 Nov 2007, Max wrote:

 Hi everyone, I'm trying to understand some R output here for ordinal
 regression. I have some integer data called A split up into 3 ordinal
 categories, top, middle and bottom, T, M and B respectively.
 
 I have to explain this output to people who have a very poor idea about
 statistics and just need to make sure I know what I'm talking about
 first.
 
 Here's the output:
 
 Call:
 polr(formula = Factor ~ A, data = a, Hess = TRUE, method = logistic)
 
 Coefficients:
 ValueStd. Error  t value
 A -0.1259028 0.04758539  -2.645829
 
 Intercepts:
 Value Std. Error t value
 B|M -2.5872 0.5596 -4.6232
 M|T 0.3044 0.4864 0.6258
 
 Residual Deviance: 204.8798
 AIC: 210.8798
 
 I really am not sure what the intercepts mean at all. However, my
 understanding of the coefficient of A is that as the category
 increases, A decreases? If I have an A value of 10, how to I figure out
 the estimated probability that this score is in one of the three
 categories?

 Use predict(): see the book polr supports for examples (and the theory).

I appreciate the reply, but have difficulty understanding what you mean 
by the book polr supports? :-?

The manuals in R don't reference the polr() command, nor do they write 
about ordinal regression in R. (from what I can tell) The documentation 
of the polr() doesn't explain the output or the theory... I've done web 
searches on polr() and the MASS library and have found little of direct 
help to my question.

Thanks,

-Max

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


Re: [R] 2d Joint Density Plot

2007-11-26 Thread jim holtman
Look at levelplot in the lattice package.

On Nov 26, 2007 5:19 PM, Josef Fruehwald [EMAIL PROTECTED] wrote:
 Hi all,

 I'm fairly new to R, so I'm still trying to feel out what is available to
 me.  I would like to be able to plot joint density in a two dimensional plot
 where density is indicated by color or darkness gradients, like a 2d color
 coded topographic map.  Ideally, the output would be something I could then
 plot other points or lines on.

 Currently, I'm calculating joint density with the function kde2d(), and
 plotted with persp().

 Thanks a bunch.

 -Joe

[[alternative HTML version deleted]]

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




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

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


Re: [R] Communicating from one function to another

2007-11-26 Thread Greg Snow
Global variables are strongly discouraged in R, but there are sometimes
when they may be needed and so are possible.

One example where they are used is in random number generation, every
time a random number function is called (rnorm for example) the global
variable .Random.seed is updated so that new random values will be
generated next time.

If you absolutely need a global variable, then use assign (or possibly
-) to do the assignment.  Also choose a name such that your global
variable is unlikely to overwright or be overwritten (if you use x, then
both are likely to happen, preferable to use a name starting with '.').

A better approach is to use variables in a local environment such that
the 2 functions can both see the variable, but nothing outside of that
environment can.  Here is a simple example:

 tmp - local({
+ x23 - numeric(1)
+ func1 - function(){
+ x23 - 2.6
+ }
+ func2 - function(){
+ print(x23)
+ }
+ list(func1=func1,func2=func2)
+ })
 
 func1 - tmp$func1
 func2 - tmp$func2
 
 func2()
[1] 0
 func1()
 func2()
[1] 2.6
 tmp$func2()
[1] 2.6
 

The local function creates a new environment in which everything in the
{} is evaluated/created.  This new environment then gets a variable
(x23) which starts off to be 0.  The 2 functions defined in the same
environment can access x23.  The list statement just combines the 2
functions into a single object to be returned.  

So after running local, the variable tmp is a list with 2 elements each
being a function, we can run them as
tmp$func2() or copy them to easier to use functions.  We run func2 and
see that x23 is currently 0, then run func1 to change the value (don't
see anything yet) then run func2 again to see the new value of x23.

This is a cleaner solution in that if we already have a variable called
x23, it does not get overwritten by the global and it is very
difficult to accidentally overwrite the x23 shared by the 2 functions.

Hope this helps,

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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Thomas L Jones, PhD
 Sent: Monday, November 26, 2007 10:11 AM
 To: R-project help
 Subject: [R] Communicating from one function to another
 
 My question is a seemingly simple one. I have a bunch of 
 user-defined functions which compute such-and-such objects. I 
 want to be able to define a variable in a particular 
 function, then make use of it later, perhaps in a different 
 function, without necessarily having to move it around in 
 argument lists. In the C community, it would be called a 
 global variable.
 
 Question 1: Is this practical at all in the R language?
 
 Suppose the variable is called x23. I want to assign a value 
 to it, then use it later. Seemingly, there are two cases:
 
 Case I is if the variable is given its value at the top level.
 
 Case II is if it is given its value inside a user-defined 
 function. That I do not know how to do.
 
 Example:
 
 func1 - function (){
 
 x23 - 2.6
 
 return ()
 
 }
 
 driver_func - function (){
 
 func1 ()
 
 print (x23)
 
 return ()
 
 }
 
 However, when I call driver_func, it won't work. Beginning 
 with the load operation, I get:
 
 
 
 Type 'demo()' for some demos, 'help()' for on-line help, or 
 'help.start()' for an HTML browser interface to help.
 Type 'q()' to quit R.
 
  func1 - function (){
 +
 + x23 - 2.6
 +
 + return ()
 +
 + }
 
  driver_func - function (){
 +
 + func1 ()
 +
 + print (x23)
 +
 + return ()
 +
 + }
  driver_func ()
 Error in print(x23) : object x23 not found
 
 
 --
 -
 From Tom:
 
 Clearly, the two functions cannot communicate. I am aware of 
 the existence of environments, but don't know much about 
 them. Also, the attach function and the get and set 
 functions. Also, .GlobalEnv It might or might not make sense 
 to create a list of all of the variables, with two 
 functions which get all of them and set all of them. The 
 function calls may be thought of as an upside down tree. I 
 want to be able to communicate from any node to any other node.
 
 Your advice?
 
 Tom
 Thomas L. Jones, PhD, Computer Science
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

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


Re: [R] anyway to force rpart() to include a specific predictor

2007-11-26 Thread Weiwei Shi
just my2cent:

could you make a derived feature by including the desired predictor in
each of features you use to present to rpart?

(by the way, if I can understand your question right, I assume rpart
picks only one predictor each time at each node)

Best,

Weiwei

On 11/26/07, Wensui Liu [EMAIL PROTECTED] wrote:
 If I understand correctly, rpart() will pick predictor at each node
 automatically. I am wondering if there is a way to force rpart()
 including a specific predictor. The reason I am asking is that I'd
 like to use rpart() to detect interaction terms for some variables.

 Thanks.

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



-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

Did you always know?
No, I did not. But I believed...
---Matrix III

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


Re: [R] anova planned comparisons/contrasts

2007-11-26 Thread Greg Snow
Others have shown some approaches that work well for after you fit the
model.  Here is another approach starting with the model fit itself:

tmp - c(control, glucose, fructose, 
  gluc+fruct, sucrose)

treatment - factor(rep( tmp, each=10 ), levels=tmp)

length - c(75, 67, 70, 75, 65, 71, 67, 67, 76, 68,
57, 58, 60, 59, 62, 60, 60, 57, 59, 61,
58, 61, 56, 58, 57, 56, 61, 60, 57, 58,
58, 59, 58, 61, 57, 56, 58, 57, 57, 59,
62, 66, 65, 63, 64, 62, 65, 65, 62, 67)



cm1 - rbind( int=1/5, cntrl = c(4, -1,-1,-1,-1)/4,
plus=c( 0, -1, -1, 3, -1 )/3,
sug1=c( 0, -1, 1, 0, 0),
sug2=c( 0, -1, -1, 0, 2)/2 )

cm2 - zapsmall(solve(cm1))

contrasts(treatment) - cm2[,-1]

treatment

sugars - data.frame( length=length, treatment=treatment )

fit - aov( length ~ treatment, data=sugars )
summary.lm(fit)
summary(fit)
summary(fit, split=list(treatment=list(
  'Control vs. Sugars'=1, 'Gluc+Fruc vs. sugars'=2, 'Sugars'=3:4)))


Is this more what you were looking for?

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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Tyler Smith
 Sent: Thursday, November 22, 2007 12:38 PM
 To: [EMAIL PROTECTED]
 Subject: [R] anova planned comparisons/contrasts
 
 Hi,
 
 I'm trying to figure out how anova works in R by translating 
 the examples in Sokal And Rohlf's (1995 3rd edition) 
 Biometry. I've hit a snag with planned comparisons, their box 
 9.4 and section 9.6. It's a basic anova design:
 
 treatment - factor(rep(c(control, glucose, fructose, 
 gluc+fruct, sucrose), each = 10))
 
 length - c(75, 67, 70, 75, 65, 71, 67, 67, 76, 68,
 57, 58, 60, 59, 62, 60, 60, 57, 59, 61,
 58, 61, 56, 58, 57, 56, 61, 60, 57, 58,
 58, 59, 58, 61, 57, 56, 58, 57, 57, 59,
 62, 66, 65, 63, 64, 62, 65, 65, 62, 67)
 
 sugars - data.frame(treatment, length)
 
 The basic analysis is easy enough:
 
 anova(lm(length ~ treatment, sugars))
 
 SR proceed to calculate planned comparisons between control 
 and all other groups, between gluc+fruct and the remaining 
 sugars, and among the three pure sugars. I can get the first 
 two comparisons using the
 contrasts() function:
 
 contrasts(sugars$treatment) - matrix(c(-4, 1, 1,  1,  1,
 0, -1, 3, -1, -1), 5, 2) 
 
 summary(lm(length ~ treatment, sugars))
 
 The results appear to be the same, excepting that the book 
 calculates an F value, whereas R produces an equivalent t 
 value. However, I can't figure out how to calculate a 
 contrast among three groups. For those without access to 
 Sokal and Rohlf, I've written an R function that performs the 
 analysis they use, copied below. Is there a better way to do 
 this in R?
 
 Also, I don't know how to interpret the Estimate and Std. 
 Error columns from the summary of the lm with contrasts. It's 
 clear the intercept in this case is the grand mean, but what 
 are the other values? They appear to be the difference 
 between one of the contrast groups and the grand mean -- 
 wouldn't an estimate of the differences between the 
 contrasted groups be more appropriate, or am I (likely) 
 misinterpreting this?
 
 Thanks!
 
 Tyler
 
 MyContrast - function(Var, Group, G1, G2, G3=NULL) {
   ## Var == data vector, Group == factor
   ## G1, G2, G3 == character vectors of factor levels to contrast
   
   nG1 = sum(Group %in% G1)
   nG2 = sum(Group %in% G2)
   GrandMean = mean(Var[Group %in% c(G1, G2, G3)])
   G1Mean = mean(Var[Group %in% G1])
   G2Mean = mean(Var[Group %in% G2])
 
   if(is.null(G3))
 MScontr = nG1 * ((G1Mean - GrandMean)^2) + 
 nG2 * ((G2Mean - GrandMean)^2)
   else {
   nG3 = sum(Group %in% G3)
   G3Mean = mean(Var[Group %in% G3])
   MScontr = (nG1 * ((G1Mean - GrandMean)^2) + 
nG2 * ((G2Mean - GrandMean)^2) + 
nG3 * ((G3Mean - GrandMean)^2))/2
 }
   
   An - anova(lm(Var ~ Group))
   MSwithin = An[3]['Residuals',]
   DegF = An$Df[length(An$Df)]
   Fval = MScontr / MSwithin
   Pval = 1 - pf(Fval, 1, DegF)
   
   return (list(MS_contrasts = MScontr, MS_within = MSwithin, 
  F_value = Fval, P_value = Pval)) }
 
 ## The first two contrasts produce the same (+/- rounding 
 error) ## p-values as obtained using contrasts() 
 MyContrast(sugars$length, sugars$treatment, 'control', 
 c(fructose, gluc+fruct, glucose,
 sucrose))
 MyContrast(sugars$length, sugars$treatment, 'gluc+fruct',
 c(fructose, glucose, sucrose))
 
 ## How do you do this in standard R?
 MyContrast(sugars$length, sugars$treatment, fructose, glucose,
 sucrose)
 
 __
 R-help@r-project.org mailing list
 

Re: [R] newbie polr() question

2007-11-26 Thread Emmanuel Charpentier
Max a écrit :
 Prof Brian Ripley explained :
 On Mon, 26 Nov 2007, Max wrote:

 Hi everyone, I'm trying to understand some R output here for ordinal
 regression. I have some integer data called A split up into 3 ordinal
 categories, top, middle and bottom, T, M and B respectively.

 I have to explain this output to people who have a very poor idea about
 statistics and just need to make sure I know what I'm talking about
 first.

 Here's the output:

 Call:
 polr(formula = Factor ~ A, data = a, Hess = TRUE, method = logistic)

 Coefficients:
 ValueStd. Error  t value
 A -0.1259028 0.04758539  -2.645829

 Intercepts:
 Value Std. Error t value
 B|M -2.5872 0.5596 -4.6232
 M|T 0.3044 0.4864 0.6258

 Residual Deviance: 204.8798
 AIC: 210.8798

 I really am not sure what the intercepts mean at all. However, my
 understanding of the coefficient of A is that as the category
 increases, A decreases? If I have an A value of 10, how to I figure out
 the estimated probability that this score is in one of the three
 categories?
 Use predict(): see the book polr supports for examples (and the theory).
 
 I appreciate the reply, but have difficulty understanding what you mean 
 by the book polr supports? :-?
 
 The manuals in R don't reference the polr() command, nor do they write 
 about ordinal regression in R. (from what I can tell) The documentation 
 of the polr() doesn't explain the output or the theory... I've done web 
 searches on polr() and the MASS library and have found little of direct 
 help to my question.

Brian Ripley probably means Modern Applied Statistics with S, W
Venables and B. Ripley (4th edn), Springer, 2002. I'd also add
Categorical Data Analysis, Alan Agresti, Wiley (2000).

HTH

Emmanuel Charpentier

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


[R] generating .Rd files

2007-11-26 Thread Edna Bell
Hi R Gurus!

I have a package that I am putting together.

I waited until the end to do the documentation and would like to
generate a set of empty .Rd files.

Is there a quick way to do this, please?

Thanks,
Edna Bell
PS I can't seem to access the Writing R Extensions manual from 2.6.1
on Windows.

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


[R] Please ignore previous .Rd question

2007-11-26 Thread Edna Bell
If the function is f, you can use prompt(f)

Sorry

thanks,
Edna

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


Re: [R] generating .Rd files

2007-11-26 Thread Gabor Csardi
Edna,

maybe there is a way, but Rd files are not that difficult,
writing an empty one requires less time than writing this email.
Then just copy your empty file as many times as you want.

Gabor

ps. perhaps you didn't install the manuals. You can always read 
the up-to-date versions at the R homepage.

On Mon, Nov 26, 2007 at 05:59:55PM -0600, Edna Bell wrote:
 Hi R Gurus!
 
 I have a package that I am putting together.
 
 I waited until the end to do the documentation and would like to
 generate a set of empty .Rd files.
 
 Is there a quick way to do this, please?
 
 Thanks,
 Edna Bell
 PS I can't seem to access the Writing R Extensions manual from 2.6.1
 on Windows.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Csardi Gabor [EMAIL PROTECTED]MTA RMKI, ELTE TTK

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


Re: [R] Problem with avoiding rep

2007-11-26 Thread David Winsemius
Paul Smith [EMAIL PROTECTED] wrote in
news:[EMAIL PROTECTED]: 

 On Nov 26, 2007 7:45 PM, Gabor Csardi [EMAIL PROTECTED] wrote:
  x - c(1,4,3)
  freq - c(3,2,4)
  rep(x, freq)
 [1] 1 1 1 4 4 3 3 3 3
 
 Thanks, Gabor. I had just tried
 
 rep(1:10,10:20)
 
 but should have tried
 
 rep(1:10,11:20)
 

I am wondering it this worked example would be more scaleable?

Assuming someone (me) has just copied your table to the clipboard:
 dt-read.table(clipboard,header=TRUE)
 dt
  X Frequency
1 1 3
2 4 2
3 3 4
 dt.expand-rep(dt$X,dt$Frequency)
 dt.expand
[1] 1 1 1 4 4 3 3 3 3


David Winsemius
 

 On Mon, Nov 26, 2007 at 07:34:36PM +, Paul Smith wrote:
  Dear All,
 
  Suppose that you have the following data:
 
  X Frequency
  1 3
  4 2
  3 4
 
  To get a vector with all observations, one could use
 
  data - c(rep(1,3),rep(4,2),rep(3,4))
 
  I am wondering whether there exists an easier way of doing this.
  Any ideas? 
 



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


[R] calculate column means when missing data is present

2007-11-26 Thread Luke Neraas
# Hello,

# I have a matrix that contains some missing values denoted by NA.
# I would like to calculate the mean for each column and not have the
# NA values included.  here is a sample matrix  X below.


c1 - c(1,4,3,2,NA,2,5,6,4,2)
c2 - c(1,3,6,NA,NA,2,9,6,1,2)
c3 - c(2,4,2,NA,4,2,NA,6,3,5)
c4 - c(2,6,4,NA,4,2,NA,6,1,5)
c5 - c(2,3,2,NA,4,2,9,6,NA,5)

X-cbind(c1,c2,c3,c4,c5)

X

# I have tried a variety of methods to calculate the Column means but each time
# i do not get the result i am looking for

result-colMeans(X)  # only returns a mean of NA


X - X[!is.na(X)]# Effectively removes the NA values but now I
cannot calculate Column Means

#  Below is the result of the column means I am looking for

result
   c1   c2c3   c4c5
 [1,] 3.22 3.75  3.5  3.75 4.125


# any help or ideas would be greatly appreciated

# thanks in advance

Luke Neraas

[EMAIL PROTECTED]

University of Alaska Fairbanks
School of Fisheries and Ocean Sciences
11120 Glacier Highway
UAF Fisheries Division
Juneau, AK 99801

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


Re: [R] calculate column means when missing data is present

2007-11-26 Thread Denver XU
colMeans(X,na.rm=T)
?colMeans




2007/11/27, Luke Neraas [EMAIL PROTECTED]:
 # Hello,

 # I have a matrix that contains some missing values denoted by NA.
 # I would like to calculate the mean for each column and not have the
 # NA values included.  here is a sample matrix  X below.


 c1 - c(1,4,3,2,NA,2,5,6,4,2)
 c2 - c(1,3,6,NA,NA,2,9,6,1,2)
 c3 - c(2,4,2,NA,4,2,NA,6,3,5)
 c4 - c(2,6,4,NA,4,2,NA,6,1,5)
 c5 - c(2,3,2,NA,4,2,9,6,NA,5)

 X-cbind(c1,c2,c3,c4,c5)

 X

 # I have tried a variety of methods to calculate the Column means but each 
 time
 # i do not get the result i am looking for

 result-colMeans(X)  # only returns a mean of NA


 X - X[!is.na(X)]# Effectively removes the NA values but now I
 cannot calculate Column Means

 #  Below is the result of the column means I am looking for

 result
c1   c2c3   c4c5
  [1,] 3.22 3.75  3.5  3.75 4.125


 # any help or ideas would be greatly appreciated

 # thanks in advance

 Luke Neraas

 [EMAIL PROTECTED]

 University of Alaska Fairbanks
 School of Fisheries and Ocean Sciences
 11120 Glacier Highway
 UAF Fisheries Division
 Juneau, AK 99801

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


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


Re: [R] calculate column means when missing data is present

2007-11-26 Thread Peter Alspach
Luke

Check

?colMeans  or help(colMeans)

you will see there is an agrument, na.rm, which by default is FALSE -
you need to set it to TRUE.

Peter Alspach


 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Luke Neraas
 Sent: Tuesday, 27 November 2007 1:59 p.m.
 To: r-help
 Subject: [R] calculate column means when missing data is present
 
 # Hello,
 
 # I have a matrix that contains some missing values denoted by NA.
 # I would like to calculate the mean for each column and not 
 have the # NA values included.  here is a sample matrix  X below.
 
 
 c1 - c(1,4,3,2,NA,2,5,6,4,2)
 c2 - c(1,3,6,NA,NA,2,9,6,1,2)
 c3 - c(2,4,2,NA,4,2,NA,6,3,5)
 c4 - c(2,6,4,NA,4,2,NA,6,1,5)
 c5 - c(2,3,2,NA,4,2,9,6,NA,5)
 
 X-cbind(c1,c2,c3,c4,c5)
 
 X
 
 # I have tried a variety of methods to calculate the Column 
 means but each time # i do not get the result i am looking for
 
 result-colMeans(X)  # only returns a mean of NA
 
 
 X - X[!is.na(X)]# Effectively removes the NA values but now I
 cannot calculate Column Means
 
 #  Below is the result of the column means I am looking for
 
 result
c1   c2c3   c4c5
  [1,] 3.22 3.75  3.5  3.75 4.125
 
 
 # any help or ideas would be greatly appreciated
 
 # thanks in advance
 
 Luke Neraas
 
 [EMAIL PROTECTED]
 
 University of Alaska Fairbanks
 School of Fisheries and Ocean Sciences
 11120 Glacier Highway
 UAF Fisheries Division
 Juneau, AK 99801
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

The contents of this e-mail are privileged and/or confidential to the named
 recipient and are not to be used by any other person and/or organisation.
 If you have received this e-mail in error, please notify the sender and delete
 all material pertaining to this e-mail.

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


Re: [R] spss, string factors, selecting

2007-11-26 Thread Katherine Jones
Hi,

This is probably a case where someone has to see what is happening on  
my computer and it is complicated by my data being from SPSS (not my  
choice). It is quite hard to give my data, because it is such a large  
dataset. I have analysed 9 other datasets that work fine, but this  
particular dataset was inputted wrong so requires merging of two  
datasets. This may be the problem.

Example of data:-
File 1.
[1] Individual [2] Habitat type [3] Weight
File 2.
[1] Individual [2] Fat [3] Fat method.

I merge the two files to create:-
[1] Individual [2] Habitat type [3] Weight [4] Fat [5] Fat method

My merging appears to work in the sense that I can plot Weight versus  
Fat and I get data, but if I ask to see the data file I see a sea of  
NAs. So I'm not sure how there can be data there to plot, see  
levels for and create tables for but I can't see it as a dataframe. I  
do get the plot I want.

Fat method contains either blank cells,  B or  E.

I wish to select all the rows in columns 1-4 which contain an  E in  
Fat method.

e.g.
120, 3, 20.2, 4, E
121, 4, 20.0, 5, B
132, 3, 21.2, 4,

I want to select only the row containing  E, so I can plot Fat vs  
Habitat and Weight vs. Fat.

I have been doing this by using

selectE-Data[Fatmethod== E,].

However, this does not work. It removes all of my data in the other  
columns to NA and I am left only with fatmethod and fat scores.

It is odd it works with other datasets but not this one. Although  
with my other datasets when I ask to select  E, I can still see   
B using levels(Fat method) but there is no data there, so my plots  
are correct.

Sorry this is long. I'm having difficulty explaining it.

Katherine


On 26-Nov-07, at 5:09 PM, jim holtman wrote:

 That should give you back a subset of 'data' (with all its columns),
 for those with  E in 'column'.  Can you show an example of your data
 and what the desired output would be.  The posting guide asks provide
 commented, minimal, self-contained, reproducible code so we don't
 have to speculate on what you want.

 On Nov 26, 2007 5:04 PM, Katherine Jones  
 [EMAIL PROTECTED] wrote:
 This sort of works. It does select the E data, but unfortunately  
 it doesn't
 select the data from the other columns; I want to select data  
 across about 5
 columns by the factor  E in one of the columns. It should be  
 easy, but for
 some reason it is not working. The spaces being added don't help.

 It seems to work on my non-merged data files, although the merged  
 file
 contains all the data I need.

 Thanks for the subset command though. Hadn't thought of using that.



 On 26-Nov-07, at 4:46 PM, jim holtman wrote:
 ?subset


 subset(data, column ==  E)




 -- 
 Jim Holtman
 Cincinnati, OH
 +1 513 646 9390

 What is the problem you are trying to solve?

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


[R] lme object manipulation

2007-11-26 Thread SHIN LIN
Hello:

I have an lme object, say lme_res2,  which was generated using the varIdent.  
I'm trying to extract the double 1.532940 from the object, but I can't find it 
by attributes(lme_res2) or attributes(summary(lme_res2)).  How can I pull it 
out (so that I can save it to another variable)?  Thanks.
 
Shin
 
Linear mixed-effects model fit by REML
  Data: dat
  Log-restricted-likelihood: 22.3213
  Fixed: express1 ~ race * thaps + race * tuni
(Intercept)race   thapstuni  race:thaps   race:tuni
 7.00034057 -0.02675202 -0.05687972  0.01265845 -0.03859781 -0.11248439
Random effects:
 Formula: ~1 | fam
(Intercept)
StdDev:   0.1131353
 Formula: ~1 | twin %in% fam
(Intercept)
StdDev:   0.1740635
 Formula: ~1 | thaw %in% twin %in% fam
(Intercept)  Residual
StdDev:   0.1177579 0.1182267
Variance function:
 Structure: Different standard deviations per stratum
 Formula: ~1 | race
 Parameter estimates:
   01
1.00 1.532940
Number of Observations: 218
Number of Groups:
fam   twin %in% fam thaw %in% twin %in% fam
 33  66 102

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


Re: [R] spss, string factors, selecting

2007-11-26 Thread jim holtman
Can you provide a small subset of the data that shows the problem.  In
a sense, what you are doing with:

selectE-Data[Fatmethod== E,]

should pull your rows of interest.  What does 'str(Data)' show?  What
does 'str(selectE)' show?  If you can at least include 10-20 rows of
data that show what is happening, it would help.

Here is an example using the data you sent and it seems to work just fine:

 x
   V1 V2   V3 V4 V5
1 120  3 20.2  4  E
2 121  4 20.0  5  B
3 132  3 21.2  4
 str(x)
'data.frame':   3 obs. of  5 variables:
 $ V1: int  120 121 132
 $ V2: int  3 4 3
 $ V3: num  20.2 20 21.2
 $ V4: int  4 5 4
 $ V5: Factor w/ 3 levels , B, E: 3 2 1
 x[x$V5 ==  E,]
   V1 V2   V3 V4 V5
1 120  3 20.2  4  E


On Nov 26, 2007 8:31 PM, Katherine Jones [EMAIL PROTECTED] wrote:
 Hi,

 This is probably a case where someone has to see what is happening on
 my computer and it is complicated by my data being from SPSS (not my
 choice). It is quite hard to give my data, because it is such a large
 dataset. I have analysed 9 other datasets that work fine, but this
 particular dataset was inputted wrong so requires merging of two
 datasets. This may be the problem.

 Example of data:-
 File 1.
 [1] Individual [2] Habitat type [3] Weight
 File 2.
 [1] Individual [2] Fat [3] Fat method.

 I merge the two files to create:-
 [1] Individual [2] Habitat type [3] Weight [4] Fat [5] Fat method

 My merging appears to work in the sense that I can plot Weight versus
 Fat and I get data, but if I ask to see the data file I see a sea of
 NAs. So I'm not sure how there can be data there to plot, see
 levels for and create tables for but I can't see it as a dataframe. I
 do get the plot I want.

 Fat method contains either blank cells,  B or  E.

 I wish to select all the rows in columns 1-4 which contain an  E in
 Fat method.

 e.g.
 120, 3, 20.2, 4, E
 121, 4, 20.0, 5, B
 132, 3, 21.2, 4,

 I want to select only the row containing  E, so I can plot Fat vs
 Habitat and Weight vs. Fat.

 I have been doing this by using

 selectE-Data[Fatmethod== E,].

 However, this does not work. It removes all of my data in the other
 columns to NA and I am left only with fatmethod and fat scores.

 It is odd it works with other datasets but not this one. Although
 with my other datasets when I ask to select  E, I can still see 
 B using levels(Fat method) but there is no data there, so my plots
 are correct.

 Sorry this is long. I'm having difficulty explaining it.

 Katherine



 On 26-Nov-07, at 5:09 PM, jim holtman wrote:

  That should give you back a subset of 'data' (with all its columns),
  for those with  E in 'column'.  Can you show an example of your data
  and what the desired output would be.  The posting guide asks provide
  commented, minimal, self-contained, reproducible code so we don't
  have to speculate on what you want.
 
  On Nov 26, 2007 5:04 PM, Katherine Jones
  [EMAIL PROTECTED] wrote:
  This sort of works. It does select the E data, but unfortunately
  it doesn't
  select the data from the other columns; I want to select data
  across about 5
  columns by the factor  E in one of the columns. It should be
  easy, but for
  some reason it is not working. The spaces being added don't help.
 
  It seems to work on my non-merged data files, although the merged
  file
  contains all the data I need.
 
  Thanks for the subset command though. Hadn't thought of using that.
 
 
 
  On 26-Nov-07, at 4:46 PM, jim holtman wrote:
  ?subset
 
 
  subset(data, column ==  E)
 
 
 
 
  --
  Jim Holtman
  Cincinnati, OH
  +1 513 646 9390
 
  What is the problem you are trying to solve?





-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

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


Re: [R] Packages - a great resource, but hard to find the right one

2007-11-26 Thread Duncan Murdoch
Loren Engrav wrote:
 It is clear that R and Bio are amazing resources and that many people invest
 lots of time in making them work, thank you

 Having said that
 From the point of view of an R/Bio novice an improved method to find
 packages would be very helpful as suggested by John Sorkin

 Three other things would also be helpful

 1) a page titled for the newbie where the startup directions are clearly
 outlined, like print out the R Reference Index which can be found here
 and read it, etc
   

It would be really helpful if a newbie (you?) started this by writing 
down at least the questions.  The R Wiki might be a good place for this; 
check with the people who set it up.
 2) the vignette's are quite terse and many assume the reader already knows
 something which may not be true, it would helpful if at the top of each
 there be a short paragraph saying before you read this, you must read this
 and this
   

Documentation might be too terse; it happens.  You need to tell this to 
each author in each specific instance.  Authors of documentation don't 
always realize what's missing.  (But see below:  it might be that you 
aren't the intended audience for the documentation.)
 3) old timers stop saying please read the documentation as I read that
 insatiably and if it fixed the problem I would not ask the next question,
 would be more helpful to say in vignette xyz at the bottom you will find
 abc which will show you what to do and would also follow the example of
 Bolker which educates and encourages the newbies
   

Do remember that you aren't paying for the help you get.  If some of it 
isn't very helpful, then just move on.

Also remember that writing documentation for everyone is extremely 
difficult, so authors won't necessarily appreciate complaints that don't 
come with help for improvements.  Maybe old timers shouldn't say please 
read the documentation and nothing else, but newbies shouldn't say 
please write better documentation and nothing else.  Be specific and 
helpful about what is missing, and don't be upset when an author expects 
you to be experienced before using his package.   There are more than 
1000 packages on CRAN, but we don't need 1000 tutorials on R.

Duncan Murdoch
 Thank you

 Loren Engrav
 Univ Wash
 Seattle

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


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


  1   2   >