Re: [R] RMySQL on win32

2007-03-13 Thread Uwe Ligges
If you have gcc installed, yes, still a path issue:
You have tp put MinGW's ./bin directory into your PATH.

Best,
uwe


Pete Cap wrote:
 */Uwe Ligges [EMAIL PROTECTED]/* wrote:
 
 Please follow the Instructions to set up your build environment as
 mentioned in the R Installation and Administration manual. That
 includes
 installing the tools from Duncan Murdochs Webpage and putting it into
 your path. You either forgot to install those tools or you forgot to
 add
 it to your PATH environment variable.
 
 Uwe Ligges
 
 
 
   Apparently R is trying to call some shell script (from the
 windows prompt??) so I attempted this in cygwin. Results:
  
   Can't locate R/Dcf.pm in @INC (@INC contains: c
 \PROGRA~1\R\R-24~1.1\share\perl; /usr/lib/perl5/5.8/cygwin
 /usr/lib/perl5/5.8 /usr/lib/perl5/site_perl/5.8/cygwin
 /usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/site_perl/5.8/cygwin
 /usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/vendor_perl/5.8/cygwin
 /usr/lib/perl5/vendor_perl/5.8 /usr/lib/perl5/vendor_perl/5.8/cygwin
 /usr/lib/perl5/vendor_perl/5.8 .) at
 c:\PROGRA~1\R\R-24~1.1/bin/build line 29.
   BEGIN failed--compilation aborted at
 c:\PROGRA~1\R\R-24~1.1/bin/build line 29.
  
   Dcf.pm is actually located in C:\Program
 Files\R\R-2.4.1\share\perl\R. I wonder if the variable @INC is
 simply incorrect (it's looking under R-24~1.1, not sure if the
 truncated value is actually correct) but I have no idea in which
 file it may be located.
  
   Anyone have any ideas?
   I have installed mingw-utils while attempting to get this up and
 running, if it matters.
  
   If there is a simply better solution that I should try, I would
 appreciate hearing about it as well. All I really need to do at this
 point is send select and join queries to the local server--perhaps I
 should just install RSQLite from CRAN?
  
   Thanks in advance,
  
   Pete
  
  
   -
   Be a PS3 game guru.
  
   [[alternative HTML version deleted]]
  
   __
   R-help@stat.math.ethz.ch mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
   and provide commented, minimal, self-contained, reproducible code.
 
 
 Uwe,
 
 It seems you are correct!
 I neglected to alter my PATH statement.
 
 My only remaining issue, it seems, is what to add to %PATH%.
 
 The R documentation instructs the reader to download various tools in 
 the MinGW set (An alternative is to download the components 
 individually...and unpack these into the same directory),  All of the 
 recommended files were unzipped and untarred to C:\MinGW, which is in 
 the path, but obviously this is insufficient as there are binaries in 
 most of of the subdirectories.  The result is now:
 
 C:\Rcmd build --binary RMySQL
 * checking for file 'RMySQL/DESCRIPTION' ... OK
 * preparing 'RMySQL':
 * checking DESCRIPTION meta-information ... OK
 * cleaning src
 * checking whether 'INDEX' is up-to-date ... NO
 * use '--force' to overwrite the existing 'INDEX'
 * removing junk files
 * checking for LF line-endings in source files
 * checking for empty or unneeded directories
 * building binary distribution
  WARNING
 * some HTML links may not be found
 installing R.css in c:/TEMP/Rinst19605847
 
 Using auto-selected zip options ' RMySQL-HELP=ziponly'
 
 -- Making package RMySQL 
 ==
 RMySQL configure.win:
 * Using mysql libraries from c:/PROGRA~1/MySQL/MYSQLS~1.0/lib/opt
 * Using mysql dll from c:/PROGRA~1/MySQL/MYSQLS~1.0/bin
 * Copying runtime libMySQL.dll and libmysql.lib to inst/libs
 * Using an existing libmysql.a in c:/PROGRA~1/MySQL/MYSQLS~1.0/lib/opt
 ==
   adding build stamp to DESCRIPTION
   making DLL ...
 making RS-DBI.d from RS-DBI.c
 make[3]: gcc: Command not found
 make[3]: *** [RS-DBI.d] Error 127
 make[2]: *** [srcDynlib] Error 2
 make[1]: *** [all] Error 2
 make: *** [pkg-RMySQL] Error 2
 *** Installation of RMySQL failed ***
 
 Removing 'c:/TEMP/Rinst19605847/RMySQL'
  ERROR
 * installation failed
 
 Is this still a path issue?  Just wondering before I go messing with it 
 even more.
 
 Thanks,
 
 Pete
 
 
 Get your own web address. 
 http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL
 Have a HUGE year through Yahoo! Small Business.  
 http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domains/?p=BESTDEAL
  


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE 

Re: [R] An example of overloading [

2007-03-13 Thread Roger Bivand
On Mon, 12 Mar 2007, Sender wrote:

 Any insight as to why this is printing twice?

Try:

m - NA
class(m) - mydist
m[]
res - m[]
res

(hint - print.default() is returning what it was asked to print, which 
then gets printed again automatically)

 
 [.mydist - function(x,...){
 print(I called my function)
 }
 
 m - a_mydist_obj
 m[]
 
 I called my function
 I called my function
 
 
 
 
 On 3/12/07, Sender [EMAIL PROTECTED] wrote:
 
  Super. Thanks for the leads.
 
  On 3/12/07, Marc Schwartz [EMAIL PROTECTED] wrote:
  
   On Mon, 2007-03-12 at 21:28 -0700, Sender wrote:
Hello:
   
Could anyone point me to a nice example where someone has created
   methods
for [ on a user defined Class?
   
I looked at the package Matrix but that was a little daunting. I'm
   looking
for someone a little more introductory. I've tried to search the help
section and the web but its difficult since [ isn't searchable.
   
Thanks in advance!
   
Greg
  
   You might want to look at this thread from last year:
  
 http://finzi.psych.upenn.edu/R/Rhelp02a/archive/77057.html
  
  http://finzi.psych.upenn.edu/R/Rhelp02a/archive/77060.html
  
 http://finzi.psych.upenn.edu/R/Rhelp02a/archive/77059.html
  
  http://finzi.psych.upenn.edu/R/Rhelp02a/archive/77102.html
  
  
   You can also review the existing methods defined for '[' in your current
   installation by using:
  
 methods([)
  
   It may be easiest to then review the code for a given method by using
   something like the following as an example:
  
 getAnywhere([.data.frame)
  
  
   BTW, for searching the R help files, REGEX's are used, so for [, you
   would need:
  
 help.search (\\[)
  
   since '[' is a special character in regular expressions and you need to
   escape it to search on the literal character. In R, you need to double
   the '\' to be interpreted properly.
  
   HTH,
  
   Marc Schwartz
  
  
  
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

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

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


[R] distance metrics

2007-03-13 Thread Jari Oksanen
On Tue Mar 13 00:21:22 CET 2007 Gavin Simpson wrote:
 On Mon, 2007-03-12 at 16:02 -0700, Sender wrote:
  Thanks for the suggestion Christian. I'm trying to avoid expanding the dist
  object to a matrix, since i'm usually working with microarray data which
  produces a distance matrix of size 5000 x 5000.
  
  If i can keep it in its condensed form i think it will speed things up.
  
  Is my thinking correct?
 
 That will all depend on what you want to do with it...
 
 A dist object of that size is c. 100 MB in memory, and c. 200 MB in size
 as the full dissimilarity matrix - values from object.size(). Of course,
 you'll need a reasonable amount of free memory over and above this to do
 anything useful with the matrix as copies may be required during
 analysis/processing etc.
 
 Of course, a dist object is just a vector of observed distances with
 various attributes, so one can always use [ for vectors, but I imagine
 that anything other than trivial operations will become fiddly,
 complicated and time consuming - if you have the memory, give the
 as.matrix option a try and see how it works for your specific problems.
 
Such a fiddling could be a function that returns the index in the dist vector:
 
idx - function(i, j, Size) 
{ 
  a - min(i,j) 
  b - max(i,j) 
  Size*(a-1) - a*(a-1)/2 + b - a 
} 

where i and j are the desired matrix indices and Size is the number of
observations, or the attribute Size of a 'dist' object. (The function
will fail if i==j or any(c(i,j)  Size) and with some other potential
abuse.)

You can refer to your individual distances from 5000 observations as:

dis[idx(2417, 1105, 5000)]

This is slower, of course, but avoids expanding to a matrix. 

Perhaps a nicer and easier to use (but more opaque) way is to write the
function as:

getidx - function(dist, i, j) 
{
dist[idx(i, j, attr(dist, Size))]
}

which can be used with fewer bracket types: getidx(dist, 2417, 1105).

cheers, jari oksanen

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


[R] Rattle() GGobi()-Plots- How to save?

2007-03-13 Thread j.joshua thomas
I am using R2.4.1 and using Rattle()
Rattle() -- Explore-- GGobi

I need to save the Scatter plot matrix in any type of image format.

But it save as *.xml file how can i reterive the *.xml into *.bmp or *.png?

I have tried the Export button in Rattle() not much options.


Need the group help

JJ


-- 
Lecturer J. Joshua Thomas
KDU College Penang Campus
Research Student,
University Sains Malaysia

[[alternative HTML version deleted]]

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


Re: [R] turn regression coefficients into matrix or...

2007-03-13 Thread Norbert NEUWIRTH
jun,

im am also quite new to R. so i think, this is a question all we R-newbees  
ask  ;-). having had the same problem the other day, i solved it the  
following way:

  Multiple Regressions - Tables

data(anscombe)  # load anscombe  
dataset (implemented somwhere in R)
x5 - rnorm(11,14,1)# create an additional  
variable (at random)
anscombe.nn - cbind(anscombe,x5)   # attach the variable  
to the dataset
attach(anscombe.nn) # attach the dataset  
to the searchpath (just for convenience)
anscombe.nn # have a look on the  
data

ans.reg - vector(4, mode = list) # create empty list  
(just  for speeding up)

for(i in 1:4){  # now the 4  
regressions are stored to the list
 j - i+1
 x1 - get(paste(x, i, sep = ))  # exogenous var. #1
 x2 - get(paste(x, j, sep = ))  # exogenous var. #2
 y - get(paste(y, i, sep = ))   # endogenous
 ans.reg[[i]] - glm(y ~ x1+x2,family=gaussian)  # do the regression  
(out of 4)
 print(summary(ans.reg[[i]],cor=FALSE))
}

detach(anscombe)# detach dataset from  
search path
lapply(ans.reg, coef)   # see each regression  
in one line
sapply(ans.reg, coef)   # have the  
coefficients in a table
x-as.matrix(sapply(ans.reg, coef)) # convert table to  
matrix
x

this solution is quite comparable to Ligges(2007) [published in german and  
japanese, i think]

i have an additional question to list-members, that have left the  
newbee-status yet: how can i get R to hand over the standard errors,  
significance levels etc, so that i can create a table with  coeff and SE  
and sig.?

norbert


Am 13.03.2007, 02:58 Uhr, schrieb Jun Xu [EMAIL PROTECTED]:

 I don't have much experience with r. What I am trying to do is to turn
 regression coefficients (after I run a lm or glm model) into some matrix
 such that I can do some post-estimation calculation, for example  
 predicted
 probabilities in glm model, etc.. Or, is there any function in r that I  
 can
 use to do something along that line? thanks.

 Jun Xu, Ph.D.
 Department of Sociology
 Ball State University

 _
 Mortgage rates as low as 4.625% - Refinance $150,000 loan for $579 a  
 month.
 Intro*Terms
 https://www2.nextag.com/goto.jsp?product=10035url=%2fst.jsptm=ysearch=mortgage_text_links_88_h27f6disc=yvers=743s=4056p=5117

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




-- 
---
Mag. Norbert NEUWIRTH

Roubiczekgasse 2/23
A-1100  WIEN
mob: +43 699 1835 0704

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


[R] compatibility S-plus R: stepwise fonction

2007-03-13 Thread Solenne Carat
Hi,
I tried to use S-plus script with R. I thought it was easy because there 
aren't a lot differences between S-plus and R syntaxe. However, I didn't 
succeed to use stepwise function in R. I think the best equivalent in R 
is step, but this function seems not to use same parameters.
is there a better equivalent in R ? or package to make stepwise 
compatible with R ?

Thank you for answers
Regards,

solenne carat
student
Institut du thorax - Inserm U533
France

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


[R] gtk button: how to create signal handler?

2007-03-13 Thread d. sarthi maheshwari
Hi

Kindly correct me if I am posting a wrong query in the forum.

I am trying to handle my button:clicked event. But not able to proceed
further. Please help.
Following is my code:

library(RGtk2)


win - gtkWindowNew(type = NULL, show = TRUE)
butt - gtkButtonNewWithLabel(Submit, show = TRUE)
win$Add(butt)

Now I want to do something when my button is clicked. How can I grab the
clicked signal and define actions against it?

Thanks in advance.

--
Regards
Sarthi M.

[[alternative HTML version deleted]]

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


Re: [R] Highlight overlapping area between two curves

2007-03-13 Thread Bojanowski, M.J. \(Michal\)
If PDF is OK, you can use the 'alpha' argument in colors, i.e.:

pdf( file.pdf)
p - seq(0.2,1.4,0.01)
x1 - dnorm(p, 0.70, 0.12)
x2 - dnorm(p, 0.90, 0.12)
plot(range(p), range(x1,x2), type=n)
polygon(p, x1, col = rgb(1,0,0, .5),lwd=4, lty=2)
polygon(p, x2, col = rgb(0,0,1, .5),lwd=4)
dev.off()
 

hth,
Michal

*** Note that my e-mail address has changed to [EMAIL PROTECTED]
*** Please update your address books accordingly. Thank you!

_
Michal Bojanowski
ICS / Sociology
Utrecht University
Heidelberglaan 2; 3584 CS Utrecht
Room 1428
[EMAIL PROTECTED]
http://www.fss.uu.nl/soc/bojanowski
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Nguyen Dinh
Nguyen
Sent: Tuesday, March 13, 2007 5:20 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Highlight overlapping area between two curves

Dear R helpers,
I have a graph as following; I would like to highlight the overlapping
area between the two curves. Do you know how to do this?
Thank you in advance for your help.
Nguyen

###START
x1 - rnorm(1, 0.70,0.12)
x2 - rnorm(1, 0.90,0.12)

d1 - density(x1)
d2 - density(x2)

plot(range(d1$x,d2$x), range(d1$y, d2$y), type = n,
 xlab = X value, ylab = Probability Density )

lines(d1, col = red,lwd=4, lty=2)
lines(d2, col = blue,lwd=4)

##END CODE

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

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


[R] Solving PDEs

2007-03-13 Thread Amit Soni
Hi,

Is there any method in R by which I can solve PDEs?

Thank you,
Amit

[[alternative HTML version deleted]]

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


[R] multiplying matrix by vector of times

2007-03-13 Thread Laura Hill



On 8/3/07 22:12, Gad Abraham [EMAIL PROTECTED] wrote:

 Laura Hill wrote:
 
 
 On 7/3/07 00:15, Gad Abraham [EMAIL PROTECTED] wrote:
 

 On 6 Mar 2007, at 08:54, Laura Hill wrote:
 
 Hi,
 
 My name is Laura. I'm a PhD student at Queen's University Belfast
 and have
 just started learning R. I was wondering if somebody could help me
 to see
 where I am going wrong in my code for estimating the parameters
 [mu1, mu2,
 lambda1] of a 2-phase Coxian Distribution.
 
 cox2.lik-function(theta, y){
 mu1-theta[1]
 
 mu2-theta[2]
 
 lambda1-theta[3]
 
 p-Matrix(c(1, 0), nrow=1, ncol=2)
 
 Q-Matrix(c(-(lambda1 + mu1), 0, lambda1, -mu2), nrow=2, ncol=2)
 
 q-Matrix(c(mu1, mu2), nrow=2, ncol=1)
 
 for (i in 1:length(y)){
 loglik-log(p %*% expm(Q * y(i)) %*% q)
 return(loglik)}
 
 sumloglik-sum(loglik)
 
 return(-sumloglik)
 }

 
 
 
 Hi Gad,
 
 Yes that's exactly hat I am trying to do. If I gave you a simple example,
 could you perhaps tell me how I could create a vector of log likelihoods.
 
 
 
 Lets say I have 1x1 matrices:
 
 p=[1]
 Q=[0.05]  i.e. [mu1]
 q=[-0.05] i.e. [-mu1]
 
 Where mu1 is the parameter that I would like to estimate and I have chosen
 the initial value mu1=0.05
 
 
 Loglik-p %*% expm(Q*y) %*% q
 
 Where y=(5 10)
 
 I want to sum the log likelihoods that I get for y=5 and y=10 using
 
 Sumloglik-sum(allloglik)
 
 Where allloglik = vector of log likelihoods
 
 
 Any help would be greatly appreciated.
 
 Thanks in advance
 Laura
 
 
 Hi Laura,
 
 Make an empty vector of required length, then assign the loglik to each
 of its cells, and don't return() anything:
 
 loglik - rep(0, length(y))
 for(i in 1:length(y)){
 loglik[i] - log(p %*% expm(Q * y[i]) %*% q)
 }
 
 Then you can sum(loglik) like you did before.
 
 Cheers,
 Gad


Hi Gad,

Thanks for the tip about the empty vector, I ever knew you could do that. I
just have one problem,

Lets say Q is a 2x2 matrix
 p is a 1x2 matrix
 q is a 2x1 matrix
 y is vector of times, say y = c(5, 10)

How do I multiply Q by each time y[i]?

I would like to get the answer to the equation

loglik[i] - log(p %*% expm(Q * y[i]) %*% q)

Where first y=5 and then y=10 so that the answers to loglik for each i are
put into the empty vector.

I'm sure that I am missing something fairly obvious here but can't put my
finger on it.

Thanks in advance
Laura

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


[R] multiplying matrix by vector of times

2007-03-13 Thread Laura Hill



On 8/3/07 22:12, Gad Abraham [EMAIL PROTECTED] wrote:

 Laura Hill wrote:
 
 
 On 7/3/07 00:15, Gad Abraham [EMAIL PROTECTED] wrote:
 

 On 6 Mar 2007, at 08:54, Laura Hill wrote:
 
 Hi,
 
 My name is Laura. I'm a PhD student at Queen's University Belfast
 and have
 just started learning R. I was wondering if somebody could help me
 to see
 where I am going wrong in my code for estimating the parameters
 [mu1, mu2,
 lambda1] of a 2-phase Coxian Distribution.
 
 cox2.lik-function(theta, y){
 mu1-theta[1]
 
 mu2-theta[2]
 
 lambda1-theta[3]
 
 p-Matrix(c(1, 0), nrow=1, ncol=2)
 
 Q-Matrix(c(-(lambda1 + mu1), 0, lambda1, -mu2), nrow=2, ncol=2)
 
 q-Matrix(c(mu1, mu2), nrow=2, ncol=1)
 
 for (i in 1:length(y)){
 loglik-log(p %*% expm(Q * y(i)) %*% q)
 return(loglik)}
 
 sumloglik-sum(loglik)
 
 return(-sumloglik)
 }

 
 
 
 Hi Gad,
 
 Yes that's exactly hat I am trying to do. If I gave you a simple example,
 could you perhaps tell me how I could create a vector of log likelihoods.
 
 
 
 Lets say I have 1x1 matrices:
 
 p=[1]
 Q=[0.05]  i.e. [mu1]
 q=[-0.05] i.e. [-mu1]
 
 Where mu1 is the parameter that I would like to estimate and I have chosen
 the initial value mu1=0.05
 
 
 Loglik-p %*% expm(Q*y) %*% q
 
 Where y=(5 10)
 
 I want to sum the log likelihoods that I get for y=5 and y=10 using
 
 Sumloglik-sum(allloglik)
 
 Where allloglik = vector of log likelihoods
 
 
 Any help would be greatly appreciated.
 
 Thanks in advance
 Laura
 
 
 Hi Laura,
 
 Make an empty vector of required length, then assign the loglik to each
 of its cells, and don't return() anything:
 
 loglik - rep(0, length(y))
 for(i in 1:length(y)){
 loglik[i] - log(p %*% expm(Q * y[i]) %*% q)
 }
 
 Then you can sum(loglik) like you did before.
 
 Cheers,
 Gad


Hi Gad,

Thanks for the tip about the empty vector, I ever knew you could do that. I
just have one problem,

Lets say Q is a 2x2 matrix
 p is a 1x2 matrix
 q is a 2x1 matrix
 y is vector of times, say y = c(5, 10)

How do I multiply Q by each time y[i]?

I would like to get the answer to the equation

loglik[i] - log(p %*% expm(Q * y[i]) %*% q)

Where first y=5 and then y=10 so that the answers to loglik for each i are
put into the empty vector.

I'm sure that I am missing something fairly obvious here but can't put my
finger on it.

Thanks in advance
Laura

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


Re: [R] Solving PDEs

2007-03-13 Thread Thomas Adams
Amit,

A better tool for this purpose may be octave, which can be found at 
http://www.gnu.org/software/octave/

Regards,
Tom

Amit Soni wrote:
 Hi,

 Is there any method in R by which I can solve PDEs?

 Thank you,
 Amit

   [[alternative HTML version deleted]]

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


-- 
Thomas E Adams
National Weather Service
Ohio River Forecast Center
1901 South State Route 134
Wilmington, OH 45177

EMAIL:  [EMAIL PROTECTED]

VOICE:  937-383-0528
FAX:937-383-0033

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


Re: [R] reading BMP into R

2007-03-13 Thread Oleg Sklyar
Try EBImage from Bioconductor.org

Best,
Oleg

Milton Cezar Ribeiro wrote:
 Hi R-gurus
 
 How can I read my bmp files into R?
 
 Kind regards,
 
 
 miltinho
 Brazil
 
 __
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Dr Oleg Sklyar * EBI/EMBL, Cambridge CB10 1SD, England * +44-1223-494466

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


[R] Freeman-Tukey arcsine transformation

2007-03-13 Thread Inman, Brant A. M.D.
R-Experts:

Does anyone know if there are R functions to perform the Freeman-Tukey
double arcsine transformation and then backtransform it?

Thanks,

Brant Inman
Mayo Clinic

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


Re: [R] Rattle() GGobi()-Plots- How to save?

2007-03-13 Thread Henric Nilsson (Public)
Den Ti, 2007-03-13, 09:40 skrev j.joshua thomas:
 I am using R2.4.1 and using Rattle()
 Rattle() -- Explore-- GGobi

 I need to save the Scatter plot matrix in any type of image format.

Have you tried the `DescribeDisplay' package?

Take a look at http://www.ggobi.org/describe-display/ for a (very) short
howto, but note that the package is found at CRAN.


HTH,
Henric




 But it save as *.xml file how can i reterive the *.xml into *.bmp or
 *.png?

 I have tried the Export button in Rattle() not much options.


 Need the group help

 JJ


 --
 Lecturer J. Joshua Thomas
 KDU College Penang Campus
 Research Student,
 University Sains Malaysia

   [[alternative HTML version deleted]]

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



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


[R] 'substitute' question

2007-03-13 Thread remko duursma

# I use this code to label a graph with the R2:

# graph
x - rnorm(100)
y - x + rnorm(100)
lm1 - lm(y~x)
plot(x,y)

# label
R2text - substitute(paste(R^2, = ,r2),list(r2=r2))
text(1,-3,R2text, col=red)

# i have modified this a bit, so that i have a vector with other labels, 
each of which
# will be labelled on the graph. Example:
texts - c(And the R2 is, R2text)
x - c(-2,-2)
y - c(2,1)
for(i in 1:length(texts))text(x[i],y[i],texts[i],pos=4, col=blue)

# As you can see the label R2 = 48.7 remains at paste(R^2,  = , 48.7)
# What to do?



Thanks for your help,

Remko



..-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-
Remko Duursma
Post-doctoral researcher
Dept. Forest Ecology
University of Helsinki, Finland

_
With tax season right around the corner, make sure to follow these few 
simple tips.

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


Re: [R] 'substitute' question

2007-03-13 Thread Stephen Tucker
hi,

your first argument to substitute should be an expression, not a character
string (which the output of paste() will give you)

so...
# first assign to variable r2 (think you forgot to do that)
# in your example
r2 - summary(lm1)$r.squared

# then to your label
R2text - substitute(R^2==r2,list(r2=round(r2,2)))

# then you can annotate with text() as you did

alternatively, you can use 
R2text - bquote(R^2==.(round(r2,2)))


--- remko duursma [EMAIL PROTECTED] wrote:

 
 # I use this code to label a graph with the R2:
 
 # graph
 x - rnorm(100)
 y - x + rnorm(100)
 lm1 - lm(y~x)
 plot(x,y)
 
 # label
 R2text - substitute(paste(R^2, = ,r2),list(r2=r2))
 text(1,-3,R2text, col=red)
 
 # i have modified this a bit, so that i have a vector with other labels, 
 each of which
 # will be labelled on the graph. Example:
 texts - c(And the R2 is, R2text)
 x - c(-2,-2)
 y - c(2,1)
 for(i in 1:length(texts))text(x[i],y[i],texts[i],pos=4, col=blue)
 
 # As you can see the label R2 = 48.7 remains at paste(R^2,  = , 48.7)
 # What to do?
 
 
 
 Thanks for your help,
 
 Remko
 
 
 
 ..-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-
 Remko Duursma
 Post-doctoral researcher
 Dept. Forest Ecology
 University of Helsinki, Finland
 
 _
 With tax season right around the corner, make sure to follow these few 
 simple tips.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 



 

Finding fabulous fares is fun.

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


Re: [R] RMySQL on win32

2007-03-13 Thread Pete Cap
Uwe Ligges [EMAIL PROTECTED] wrote: If you have gcc installed, yes, still a 
path issue:
You have tp put MinGW's ./bin directory into your PATH.

Best,
uwe

Uwe,

Got it.  I had placed ..\mingw\mingw32\bin in the path instead.  I also had to 
place the directory for the HTML Help Workshop in the path because R could not 
find hhc.exe.  After that it appears to have compiled successfully.

Thank you everyone who helped.

Best regards,
Pete

 
-
No need to miss a message. Get email on-the-go 

[[alternative HTML version deleted]]

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


Re: [R] 'substitute' question

2007-03-13 Thread Mendiburu, Felipe \(CIP\)
Dear Renko

To modify the script

plot(x,y)
r2-summary(lm1)$r.squared*100
# label
R2text - substitute(paste(R^2, = ,r2),list(r2=r2))
text(-1,1,R2text, col=red) # To see of the coordinates of the graph.

Grettings

Felipe

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of remko duursma
Sent: Tuesday, March 13, 2007 8:02 AM
To: r-help@stat.math.ethz.ch
Subject: [R] 'substitute' question



# I use this code to label a graph with the R2:

# graph
x - rnorm(100)
y - x + rnorm(100)
lm1 - lm(y~x)
plot(x,y)

# label
R2text - substitute(paste(R^2, = ,r2),list(r2=r2))
text(1,-3,R2text, col=red)

# i have modified this a bit, so that i have a vector with other labels, 
each of which
# will be labelled on the graph. Example:
texts - c(And the R2 is, R2text)
x - c(-2,-2)
y - c(2,1)
for(i in 1:length(texts))text(x[i],y[i],texts[i],pos=4, col=blue)

# As you can see the label R2 = 48.7 remains at paste(R^2,  = , 48.7)
# What to do?



Thanks for your help,

Remko



..-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-
Remko Duursma
Post-doctoral researcher
Dept. Forest Ecology
University of Helsinki, Finland

_
With tax season right around the corner, make sure to follow these few 
simple tips.

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

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


Re: [R] An example of overloading [

2007-03-13 Thread Vincent Goulet
Le Mardi 13 Mars 2007 00:28, Sender a écrit :
 Hello:

 Could anyone point me to a nice example where someone has created methods
 for [ on a user defined Class?

 I looked at the package Matrix but that was a little daunting. I'm looking
 for someone a little more introductory. I've tried to search the help
 section and the web but its difficult since [ isn't searchable.

 Thanks in advance!

You might also have a look at the methods for [ and [- created 
for grouped data objects in the development version of package actuar.

Creation of the objects:
https://vgoulet.act.ulaval.ca/svn/R/actuar/trunk/actuar/R/grouped.data.R

Extraction methods:
https://vgoulet.act.ulaval.ca/svn/R/actuar/trunk/actuar/R/Extract.grouped.data.R

Doc:
https://vgoulet.act.ulaval.ca/svn/R/actuar/trunk/actuar/man/grouped.data.Rd
https://vgoulet.act.ulaval.ca/svn/R/actuar/trunk/actuar/man/Extract.grouped.data.Rd

Package:
http://vgoulet.act.ulaval.ca/actuar/

HTH

-- 
  Vincent Goulet, Associate Professor
  École d'actuariat
  Université Laval, Québec 
  [EMAIL PROTECTED]   http://vgoulet.act.ulaval.ca

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


Re: [R] 'substitute' question

2007-03-13 Thread Bojanowski, M.J. \(Michal\)
I do not understand why you play with 'substitute' instead of something
like this:

# CAUTION: this will work only for bivariate case

# plotmaking function
plotModel - function(m)
{
x - m$model$x
y - m$model$y
r2 - summary(m)$r.squared
plot(x,y)
abline(m)
text( min(x), max(y), paste(And the R^2 is, round(r2,3)),
pos=4)
invisible(NULL)
}

# your data
x - rnorm(100)
y - x + rnorm(100)
lm1 - lm(y~x)
# make the plot
plotModel(lm1)



*** Note that my e-mail address has changed to [EMAIL PROTECTED]
*** Please update your address books accordingly. Thank you!

_
Michal Bojanowski
ICS / Sociology
Utrecht University
Heidelberglaan 2; 3584 CS Utrecht
Room 1428
[EMAIL PROTECTED]
http://www.fss.uu.nl/soc/bojanowski
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of remko duursma
Sent: Tuesday, March 13, 2007 2:02 PM
To: r-help@stat.math.ethz.ch
Subject: [R] 'substitute' question


# I use this code to label a graph with the R2:

# graph
x - rnorm(100)
y - x + rnorm(100)
lm1 - lm(y~x)
plot(x,y)

# label
R2text - substitute(paste(R^2, = ,r2),list(r2=r2)) text(1,-3,R2text,
col=red)

# i have modified this a bit, so that i have a vector with other labels,
each of which # will be labelled on the graph. Example:
texts - c(And the R2 is, R2text)
x - c(-2,-2)
y - c(2,1)
for(i in 1:length(texts))text(x[i],y[i],texts[i],pos=4, col=blue)

# As you can see the label R2 = 48.7 remains at paste(R^2,  = ,
48.7)
# What to do?



Thanks for your help,

Remko



..-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-
Remko Duursma
Post-doctoral researcher
Dept. Forest Ecology
University of Helsinki, Finland

_
With tax season right around the corner, make sure to follow these few
simple tips.

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

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


[R] GLMM plots

2007-03-13 Thread Cristina Gomes
Hi R-users,
I would like to plot the effects of one of the predictor variables on 
the response variable in the GLMM I ran with the lme4 package. Usually 
when doing a multivariate analysis I would obtain the residuals of the 
model without the predictor variable of interest (x1) and then plot 
these residuals against X1. But in the lme4 package one can not obtain 
residuals. Is there any way of obtaining plots of this sort? or any 
other recommendation somebody could give me regarding this topic?
Thanks a lot in advance.
Cheers,
Cristina.

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


Re: [R] turn regression coefficients into matrix or...

2007-03-13 Thread Stephen Tucker
I believe the short answer to your question lies in 

 summary(ans.reg[[i]])$coefficients

which will give you a matrix with coefficients and standard errors (and
more). You can also find out what other information you can get from the
regressions if you type

 attributes(ans.reg[[i]])
 attributes(summary(ans.reg[[i]]))

and then see the names of the list elements (the regression functions and
summary() return objects of mode list) that might correspond to the
information you are looking for.

Good luck,

ST




--- Norbert NEUWIRTH [EMAIL PROTECTED] wrote:

 jun,
 
 im am also quite new to R. so i think, this is a question all we R-newbees 
 
 ask  ;-). having had the same problem the other day, i solved it the  
 following way:
 
   Multiple Regressions - Tables
 
 data(anscombe)  # load anscombe  
 dataset (implemented somwhere in R)
 x5 - rnorm(11,14,1)# create an additional 
 
 variable (at random)
 anscombe.nn - cbind(anscombe,x5)   # attach the variable  
 to the dataset
 attach(anscombe.nn) # attach the dataset  
 to the searchpath (just for convenience)
 anscombe.nn # have a look on the  
 data
 
 ans.reg - vector(4, mode = list) # create empty list  
 (just  for speeding up)
 
 for(i in 1:4){  # now the 4  
 regressions are stored to the list
  j - i+1
  x1 - get(paste(x, i, sep = ))  # exogenous var. #1
  x2 - get(paste(x, j, sep = ))  # exogenous var. #2
  y - get(paste(y, i, sep = ))   # endogenous
  ans.reg[[i]] - glm(y ~ x1+x2,family=gaussian)  # do the regression  
 (out of 4)
  print(summary(ans.reg[[i]],cor=FALSE))
 }
 
 detach(anscombe)# detach dataset from  
 search path
 lapply(ans.reg, coef)   # see each regression  
 in one line
 sapply(ans.reg, coef)   # have the  
 coefficients in a table
 x-as.matrix(sapply(ans.reg, coef)) # convert table to  
 matrix
 x
 
 this solution is quite comparable to Ligges(2007) [published in german and 
 
 japanese, i think]
 
 i have an additional question to list-members, that have left the  
 newbee-status yet: how can i get R to hand over the standard errors,  
 significance levels etc, so that i can create a table with  coeff and SE  
 and sig.?
 
 norbert
 
 
 Am 13.03.2007, 02:58 Uhr, schrieb Jun Xu [EMAIL PROTECTED]:
 
  I don't have much experience with r. What I am trying to do is to turn
  regression coefficients (after I run a lm or glm model) into some matrix
  such that I can do some post-estimation calculation, for example  
  predicted
  probabilities in glm model, etc.. Or, is there any function in r that I  
  can
  use to do something along that line? thanks.
 
  Jun Xu, Ph.D.
  Department of Sociology
  Ball State University
 
  _
  Mortgage rates as low as 4.625% - Refinance $150,000 loan for $579 a  
  month.
  Intro*Terms
 

https://www2.nextag.com/goto.jsp?product=10035url=%2fst.jsptm=ysearch=mortgage_text_links_88_h27f6disc=yvers=743s=4056p=5117
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide  
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 
 
 -- 
 ---
 Mag. Norbert NEUWIRTH
 
 Roubiczekgasse 2/23
 A-1100  WIEN
 mob: +43 699 1835 0704
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 



 

Food fight? Enjoy some healthy debate

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


[R] selecting rows with more than x occurrences in a given column (data type is names)

2007-03-13 Thread Mike Jasper
Despite a long search on the archives, I couldn't find how to do this.
Thanks in advance for what is likely a simple issue.

I have a data set where the first column is name (i.e., 'Joe Smith',
'Jane Doe', etc). The following columns are data associated with that
person. I have many people with multiple rows. What I want is to get a
new data frame out with only the people who have more than x
occurrences in the first column.

Here's what I've done, that's not working:

Let's call my old data.frame all.data

table(all.data$names)10

I get a list of names and TRUE/FALSE values. I then want to make a
list of the TRUEs and pass that to some subset type command like

dup.names=table(all.data$names)10

new.data=(all.data[all.data$names==dup.names,])

That's not working because the dimensions are wrong (I think). But
even when I tried to do part of it manually (to troubleshoot) like
this

dup.names=c('Joe Smith','Jane Doe','etc')

I got warnings and it didn't work correctly. There must be a simple
way to do this that I'm just not seeing. Thanks.

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


[R] hierarchical partitioning

2007-03-13 Thread vaniscotte
Dear all,

I am trying to model variation of distribution of species assemblages 
according to environmental variables. For that I use a log linear 
multinomial regression.
In order to select variables that mostly discriminate the assemblages, I 
tried to apply a hierarchical partitioning protocol to my data set.

For that I have adapted the all.regs() for multinomial model.
The problem is that I couldn't adapt partition() as I don't manage to 
access the C code (hierpart) which is called in this function. This is 
a black box for me.

When I run partition() with the Log Likelihood values obtained for the 
hierarchy of multinomial model, I obtain negative values for Independenr 
contribution.
This suggest that there is a bug somewhere in my protocole.
I suppose that I missused partition(). Maybe my log lokelihood 
(multinomial one) is not appropriate.

As someone had ever met this problem and could help me?

Many thanks

Amélie

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


[R] estimating an ARIMA model with constraints

2007-03-13 Thread Laurent Duvernet
Hi,

I am trying to estimate an ARIMA model in the case where I have some 
specific knowledge about the coefficients that should be included in the 
model. Take a classical ARIMA (or even ARMA) model:

P(B) X(t) = Q(B) epsilon(t),

where X(t) is the data, epsilon is a white noise, B is the backward operator 
and P and Q are some polynoms. Additionally, assume that you know in advance 
how P and Q look like. Typically, P could be something like this:

P(x) = (1 - a(1)*x - a(2)*x^2) * (1 - b(1)*x^23 - b(2)*x^24) * (1 - 
c(1)*x^168)

(That is in the case of hourly data, with lags 23 and 24 corresponding to 
the day, and lag 168 for the week.) How do you estimate this kind of model 
with R? The arima() and arima0() functions in the stats package do not allow 
this kind of constraints on the polynoms. I've searched in the packages 
dedicated to time series analysis, but I have not found a solution. Has 
anyone an idea?

Thanks in advance!

Laurent Duvernet
EDF RD

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


Re: [R] gtk button: how to create signal handler?

2007-03-13 Thread Michael Lawrence
Sarthi,

See help(gSignalConnect) for instructions on how to connect to GObject
signals.
For this particular case, try gSignalConnect(butt, clicked, function(wid)
print(clicked!)).
See the demos included in the RGtk2 paper for numerous examples of using
gSignalConnect().

Michael

On 3/13/07, hadley wickham [EMAIL PROTECTED] wrote:

 -- Forwarded message --
 From: d. sarthi maheshwari [EMAIL PROTECTED]
 Date: Mar 13, 2007 5:41 AM
 Subject: [R] gtk button: how to create signal handler?
 To: r-help@stat.math.ethz.ch


 Hi

 Kindly correct me if I am posting a wrong query in the forum.

 I am trying to handle my button:clicked event. But not able to proceed
 further. Please help.
 Following is my code:

 library(RGtk2)


 win - gtkWindowNew(type = NULL, show = TRUE)
 butt - gtkButtonNewWithLabel(Submit, show = TRUE)
 win$Add(butt)

 Now I want to do something when my button is clicked. How can I grab the
 clicked signal and define actions against it?

 Thanks in advance.

 --
 Regards
 Sarthi M.

 [[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

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


Re: [R] 'substitute' question

2007-03-13 Thread Bojanowski, M.J. \(Michal\)
I'm sorry for my first post as I did not properly understood your
problem.
The reason why you were getting paste(R^2,  = , 48.7) instead of the
properly formatted R^2=48.7
is that in creating 'texts' in your code you were mixing character
string with expressions resulting in 'texts' being a list not a vector.
The only modification to make is to index texts with double square
brackets as below

# the figure
x - rnorm(100)
y - x + rnorm(100)
lm1 - lm(y~x)
plot(x,y)
# label
R2text - substitute(paste(R^2, = ,r2),list(r2=r2)) text(1,-3,R2text,
col=red)

# i expanded your list of labels to four elements...
texts - c(And the R2 is, R2text, third label, fourth label)
# texts is a list not an atomic vector
class(texts)
str(texts)

# ... and added more coordinates accordingly
x - c(-2,-2, -1, -1)
y - c(2,1, 2, 1)
# here 'texts[[i]]' instead of 'texts[i]'
for(i in 1:length(texts))text(x[i],y[i], texts[[i]],pos=4, col=blue)

hth,
Michal


*** Note that my e-mail address has changed to [EMAIL PROTECTED]
*** Please update your address books accordingly. Thank you!

_
Michal Bojanowski
ICS / Sociology
Utrecht University
Heidelberglaan 2; 3584 CS Utrecht
Room 1428
[EMAIL PROTECTED]
http://www.fss.uu.nl/soc/bojanowski
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of remko duursma
Sent: Tuesday, March 13, 2007 2:02 PM
To: r-help@stat.math.ethz.ch
Subject: [R] 'substitute' question


# I use this code to label a graph with the R2:

# graph
x - rnorm(100)
y - x + rnorm(100)
lm1 - lm(y~x)
plot(x,y)

# label
R2text - substitute(paste(R^2, = ,r2),list(r2=r2)) text(1,-3,R2text,
col=red)

# i have modified this a bit, so that i have a vector with other labels,
each of which # will be labelled on the graph. Example:
texts - c(And the R2 is, R2text)
x - c(-2,-2)
y - c(2,1)
for(i in 1:length(texts))text(x[i],y[i],texts[i],pos=4, col=blue)

# As you can see the label R2 = 48.7 remains at paste(R^2,  = ,
48.7)
# What to do?



Thanks for your help,

Remko



..-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-.-~-
Remko Duursma
Post-doctoral researcher
Dept. Forest Ecology
University of Helsinki, Finland

_
With tax season right around the corner, make sure to follow these few
simple tips.

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

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


Re: [R] Solving PDEs

2007-03-13 Thread Peter Dalgaard
Thomas Adams wrote:
 Amit,

 A better tool for this purpose may be octave, which can be found at 
 http://www.gnu.org/software/octave/
   
Parabolic PDEs handled by the method of lines are effectively systems of
ODEs and can be solved by (tada!) ODEsolve.

 -p
 Regards,
 Tom

 Amit Soni wrote:
   
 Hi,

 Is there any method in R by which I can solve PDEs?

 Thank you,
 Amit

  [[alternative HTML version deleted]]

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


Re: [R] estimating an ARIMA model with constraints

2007-03-13 Thread Leeds, Mark \(IED\)

are the carats in your notation meant to be time subscripts ?

also, I think I know what a and b are meant to be ( the coefficients of
the polynomaisl corresponding
To the ar part of the model but correct me if I'm wrong ) but is there
an ma piece to it also ?
And I don't see an error term ?


I think you need to be clearer on your notation and write out the full
model in terms of X(t) = whatever because then more people will reply.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Laurent Duvernet
Sent: Tuesday, March 13, 2007 10:36 AM
To: r-help@stat.math.ethz.ch
Subject: [R] estimating an ARIMA model with constraints

Hi,

I am trying to estimate an ARIMA model in the case where I have some
specific knowledge about the coefficients that should be included in the
model. Take a classical ARIMA (or even ARMA) model:

P(B) X(t) = Q(B) epsilon(t),

where X(t) is the data, epsilon is a white noise, B is the backward
operator and P and Q are some polynoms. Additionally, assume that you
know in advance how P and Q look like. Typically, P could be something
like this:

P(x) = (1 - a(1)*x - a(2)*x^2) * (1 - b(1)*x^23 - b(2)*x^24) * (1 -
c(1)*x^168)

(That is in the case of hourly data, with lags 23 and 24 corresponding
to the day, and lag 168 for the week.) How do you estimate this kind of
model with R? The arima() and arima0() functions in the stats package do
not allow this kind of constraints on the polynoms. I've searched in the
packages dedicated to time series analysis, but I have not found a
solution. Has anyone an idea?

Thanks in advance!

Laurent Duvernet
EDF RD

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

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


Re: [R] Rattle() GGobi()-Plots- How to save?

2007-03-13 Thread j.joshua thomas
i tried with package DescribeDisplay

dd_load(DescribeDisplay)
Load describe display

i couldnt find any documentation. could you give me a sample

help



On 3/13/07, Henric Nilsson (Public) [EMAIL PROTECTED] wrote:

 Den Ti, 2007-03-13, 09:40 skrev j.joshua thomas:
  I am using R2.4.1 and using Rattle()
  Rattle() -- Explore-- GGobi
 
  I need to save the Scatter plot matrix in any type of image format.

 Have you tried the `DescribeDisplay' package?

 Take a look at http://www.ggobi.org/describe-display/ for a (very) short
 howto, but note that the package is found at CRAN.


 HTH,
 Henric



 
  But it save as *.xml file how can i reterive the *.xml into *.bmp or
  *.png?
 
  I have tried the Export button in Rattle() not much options.
 
 
  Need the group help
 
  JJ
 
 
  --
  Lecturer J. Joshua Thomas
  KDU College Penang Campus
  Research Student,
  University Sains Malaysia
 
[[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 




-- 
Lecturer J. Joshua Thomas
KDU College Penang Campus
Research Student,
University Sains Malaysia

[[alternative HTML version deleted]]

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


Re: [R] Freeman-Tukey arcsine transformation

2007-03-13 Thread Peter Dalgaard
Inman, Brant A. M.D. wrote:
 R-Experts:

 Does anyone know if there are R functions to perform the Freeman-Tukey
 double arcsine transformation and then backtransform it?

   

Well, if not, both are given by explicit formulas, so it shouldn't take
long to implement, cf.:

The Teacher's Corner


*The Inverse of the Freeman-Tukey Double Arcsine Transformation

http://www.jstor.org/view/00031305/di020556/02p0095b/0?frame=noframedpi=3[EMAIL
 
PROTECTED]/01cce4405c00501bb027fbackcontext=pagebackurl=/cgi-bin/jstor/viewitem/00031305/di020556/02p0095b/[EMAIL
 PROTECTED]/01cce4405c00501bb027f%26config%3d%26PAGE%3d0config=jstorPAGE=0*



John J. Miller 


/The American Statistician/, Vol. 32, No. 4. (Nov., 1978),
p. 138. 


Stable URL:

http://links.jstor.org/sici?sici=0003-1305%28197811%2932%3A4%3C138%3ATIOTFD%3E2.0.CO%3B2-Z



  Abstract

A formula for the inverse of the Freeman-Tukey double arcsine
transformation is derived. This formula is useful when
expressing means of double arcsines as retransformed
proportions. When the mean is taken from original proportions
involving different n's, it is suggested that the harmonic mean
of the n's be used in the inversion formula.



 Thanks,

 Brant Inman
 Mayo Clinic

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


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


Re: [R] selecting rows with more than x occurrences in a given column (data type is names)

2007-03-13 Thread Stephen Tucker
This isn't pretty, but should work:

x - 10 # number of occurrences
y - split(all.data,f=all.data$names)
z - y[unlist(lapply(y,nrow))x]
newdata - vector()
for( k in z ) {
  newdata - rbind(newdata,k)
}

Basically I split your data frame into groups by name (into a list), then
selected elements in the list for which the number of rows (number of
occurrences) was  x, then concatenated rows from the selected elements to an
initially empty vector. Probably there is a more elegant way to do this but I
can't think of it at the moment...

You are correct in that the conditional statement using '==' cannot test
vectors of mismatched dimensions.





--- Mike Jasper [EMAIL PROTECTED] wrote:

 Despite a long search on the archives, I couldn't find how to do this.
 Thanks in advance for what is likely a simple issue.
 
 I have a data set where the first column is name (i.e., 'Joe Smith',
 'Jane Doe', etc). The following columns are data associated with that
 person. I have many people with multiple rows. What I want is to get a
 new data frame out with only the people who have more than x
 occurrences in the first column.
 
 Here's what I've done, that's not working:
 
 Let's call my old data.frame all.data
 
 table(all.data$names)10
 
 I get a list of names and TRUE/FALSE values. I then want to make a
 list of the TRUEs and pass that to some subset type command like
 
 dup.names=table(all.data$names)10
 
 new.data=(all.data[all.data$names==dup.names,])
 
 That's not working because the dimensions are wrong (I think). But
 even when I tried to do part of it manually (to troubleshoot) like
 this
 
 dup.names=c('Joe Smith','Jane Doe','etc')
 
 I got warnings and it didn't work correctly. There must be a simple
 way to do this that I'm just not seeing. Thanks.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 



 

Finding fabulous fares is fun.

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


[R] Duncan post-hoc tests in R?

2007-03-13 Thread Bill Shipley
Hello,
I am looking for an R function that impliments Duncan's post-hoc test.  I am
aware of multcomp and its function glht but, unless I am missing
something, this cannot impliment the Duncan test.
Any help of pointers are welcome.

Bill Shipley

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


Re: [R] selecting rows with more than x occurrences in a given column(data type is names)

2007-03-13 Thread Dimitris Rizopoulos
try this:

set.seed(123)
all.data - data.frame(name = sample(c(Joe, Elen, Jane, Mike), 
8, TRUE),
x = rnorm(8), y = runif(8))
##
tab.nams - table(all.data$name)
nams - names(tab.nams[tab.nams = 2])
all.data[all.data$name %in% nams, ]


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


- Original Message - 
From: Mike Jasper [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Tuesday, March 13, 2007 3:38 PM
Subject: [R] selecting rows with more than x occurrences in a given 
column(data type is names)


 Despite a long search on the archives, I couldn't find how to do 
 this.
 Thanks in advance for what is likely a simple issue.

 I have a data set where the first column is name (i.e., 'Joe Smith',
 'Jane Doe', etc). The following columns are data associated with 
 that
 person. I have many people with multiple rows. What I want is to get 
 a
 new data frame out with only the people who have more than x
 occurrences in the first column.

 Here's what I've done, that's not working:

 Let's call my old data.frame all.data

 table(all.data$names)10

 I get a list of names and TRUE/FALSE values. I then want to make a
 list of the TRUEs and pass that to some subset type command like

 dup.names=table(all.data$names)10

 new.data=(all.data[all.data$names==dup.names,])

 That's not working because the dimensions are wrong (I think). But
 even when I tried to do part of it manually (to troubleshoot) like
 this

 dup.names=c('Joe Smith','Jane Doe','etc')

 I got warnings and it didn't work correctly. There must be a simple
 way to do this that I'm just not seeing. Thanks.

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


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

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


Re: [R] selecting rows with more than x occurrences in a given column (data type is names)

2007-03-13 Thread Marc Schwartz
On Tue, 2007-03-13 at 10:38 -0400, Mike Jasper wrote:
 Despite a long search on the archives, I couldn't find how to do this.
 Thanks in advance for what is likely a simple issue.
 
 I have a data set where the first column is name (i.e., 'Joe Smith',
 'Jane Doe', etc). The following columns are data associated with that
 person. I have many people with multiple rows. What I want is to get a
 new data frame out with only the people who have more than x
 occurrences in the first column.
 
 Here's what I've done, that's not working:
 
 Let's call my old data.frame all.data
 
 table(all.data$names)10
 
 I get a list of names and TRUE/FALSE values. I then want to make a
 list of the TRUEs and pass that to some subset type command like
 
 dup.names=table(all.data$names)10
 
 new.data=(all.data[all.data$names==dup.names,])
 
 That's not working because the dimensions are wrong (I think). But
 even when I tried to do part of it manually (to troubleshoot) like
 this
 
 dup.names=c('Joe Smith','Jane Doe','etc')
 
 I got warnings and it didn't work correctly. There must be a simple
 way to do this that I'm just not seeing. Thanks.


Something like this should work:

  NewDF - subset(all.data, names %in% unique(names[duplicated(names)]))

See ?duplicated, ?unique and ?%in% for more information.

HTH,

Marc Schwartz

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


Re: [R] selecting rows with more than x occurrences in a given column (data type is names)

2007-03-13 Thread Chuck Cleland
Mike Jasper wrote:
 Despite a long search on the archives, I couldn't find how to do this.
 Thanks in advance for what is likely a simple issue.
 
 I have a data set where the first column is name (i.e., 'Joe Smith',
 'Jane Doe', etc). The following columns are data associated with that
 person. I have many people with multiple rows. What I want is to get a
 new data frame out with only the people who have more than x
 occurrences in the first column.
 
 Here's what I've done, that's not working:
 
 Let's call my old data.frame all.data
 
 table(all.data$names)10
 
 I get a list of names and TRUE/FALSE values. I then want to make a
 list of the TRUEs and pass that to some subset type command like
 
 dup.names=table(all.data$names)10
 
 new.data=(all.data[all.data$names==dup.names,])
 
 That's not working because the dimensions are wrong (I think). But
 even when I tried to do part of it manually (to troubleshoot) like
 this
 
 dup.names=c('Joe Smith','Jane Doe','etc')
 
 I got warnings and it didn't work correctly. There must be a simple
 way to do this that I'm just not seeing. Thanks.

  Does this help?

df - data.frame(PERSON = rep(c(John,Tom,Sara,Mary),
  c(5,4,5,4)),
 Y = runif(18))

subset(df, PERSON %in% names(which(table(PERSON) = 5)))

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

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

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


Re: [R] selecting rows with more than x occurrences in a given column (data type is names)

2007-03-13 Thread Marc Schwartz
On Tue, 2007-03-13 at 10:32 -0500, Marc Schwartz wrote:
 On Tue, 2007-03-13 at 10:38 -0400, Mike Jasper wrote:
  Despite a long search on the archives, I couldn't find how to do this.
  Thanks in advance for what is likely a simple issue.
  
  I have a data set where the first column is name (i.e., 'Joe Smith',
  'Jane Doe', etc). The following columns are data associated with that
  person. I have many people with multiple rows. What I want is to get a
  new data frame out with only the people who have more than x
  occurrences in the first column.
  
  Here's what I've done, that's not working:
  
  Let's call my old data.frame all.data
  
  table(all.data$names)10
  
  I get a list of names and TRUE/FALSE values. I then want to make a
  list of the TRUEs and pass that to some subset type command like
  
  dup.names=table(all.data$names)10
  
  new.data=(all.data[all.data$names==dup.names,])
  
  That's not working because the dimensions are wrong (I think). But
  even when I tried to do part of it manually (to troubleshoot) like
  this
  
  dup.names=c('Joe Smith','Jane Doe','etc')
  
  I got warnings and it didn't work correctly. There must be a simple
  way to do this that I'm just not seeing. Thanks.
 
 
 Something like this should work:
 
   NewDF - subset(all.data, names %in% unique(names[duplicated(names)]))
 
 See ?duplicated, ?unique and ?%in% for more information.
 
 HTH,
 
 Marc Schwartz

Ack...sorry about that.  I misread the query as for any duplicated
occurrences. The solution provided by Dimitris is correct.

Marc

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


Re: [R] estimating an ARIMA model with constraints

2007-03-13 Thread Laurent Duvernet
Sorry if the notation is unclear. You got it right:

P(x)  = (1 - a_1*x - a_2*x^2) * (1 - b_1*x^23 - b_2*x^24) * (1 - c_1*x^168).

The a_i's, b_i's and c_i's are the coefs of the polynom P.

And there is also an MA part, which is Q(B) epsilon(t). Here epsilon(t) is 
the error process, and Q is another polynom of the same type as P (it could 
be different, that does not change the problem).

Q(x)  = (1 - alpha_1*x - alpha_2*x^2) * (1 - beta_1*x^23 - beta_2*x^24) * (1 
- gamma_1*x^168).

I can write X(t) = ..., but I'm not sure it would be a lot clearer...

X(t) =  a_1*X(t-1) + a_2*X(t-2) + b_1*X(t-23) + (b_2 + a_1*b_1)*X(t-24) + 
(a_1*b_2 + a_2*b_1)*X(t-25) + a2*b2 X(t-26) +  the terms around X(t-168) 
+ ... the MA part.

I hope everything is clear now.



From: Leeds, Mark (IED) [EMAIL PROTECTED]
To: Laurent Duvernet [EMAIL PROTECTED], r-help@stat.math.ethz.ch
Subject: RE: [R]  estimating an ARIMA model with constraints
Date: Tue, 13 Mar 2007 10:56:47 -0400


are the carats in your notation meant to be time subscripts ?

also, I think I know what a and b are meant to be ( the coefficients of
the polynomaisl corresponding
To the ar part of the model but correct me if I'm wrong ) but is there
an ma piece to it also ?
And I don't see an error term ?


I think you need to be clearer on your notation and write out the full
model in terms of X(t) = whatever because then more people will reply.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Laurent Duvernet
Sent: Tuesday, March 13, 2007 10:36 AM
To: r-help@stat.math.ethz.ch
Subject: [R] estimating an ARIMA model with constraints

Hi,

I am trying to estimate an ARIMA model in the case where I have some
specific knowledge about the coefficients that should be included in the
model. Take a classical ARIMA (or even ARMA) model:

P(B) X(t) = Q(B) epsilon(t),

where X(t) is the data, epsilon is a white noise, B is the backward
operator and P and Q are some polynoms. Additionally, assume that you
know in advance how P and Q look like. Typically, P could be something
like this:

P(x) = (1 - a(1)*x - a(2)*x^2) * (1 - b(1)*x^23 - b(2)*x^24) * (1 -
c(1)*x^168)

(That is in the case of hourly data, with lags 23 and 24 corresponding
to the day, and lag 168 for the week.) How do you estimate this kind of
model with R? The arima() and arima0() functions in the stats package do
not allow this kind of constraints on the polynoms. I've searched in the
packages dedicated to time series analysis, but I have not found a
solution. Has anyone an idea?

Thanks in advance!

Laurent Duvernet
EDF RD

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

_

mobile comme sur PC ! http://mobile.live.fr/messenger/bouygues/

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


[R] inconsistent behaviour of add1 and drop1 with a weighted linear model

2007-03-13 Thread Jenny Hodgson
Dear R Help,
I have noticed some inconsistent behaviour of add1 and drop1 with a 
weighted linear model, which affects the interpretation of the results.
I have these data to fit with a linear model, I want to weight them by 
the relative size of the geographical areas they represent.
_
  example
   yx1   x2   weights
1  -4.546477 0.1859556 50.0 0.9466022
2   1.484246 0.4740497 29.88000 1.3252430
3   2.203681 0.8594264 16.9 0.9466022
4   1.943163 0.8713360 42.11765 2.7766997
5   1.886473 0.9006082 19.0 0.9466022
6   1.795393 0.8455183 23.68421 1.1674760
7   1.878077 0.5641396 35.0 0.8203885
8  -4.215484 0.4356858 58.75000 0.4417477
9   1.993339 0.5440061 19.28571 0.8519420
10  1.560869 0.6285066 19.54545 0.8203885
11  2.761535 0.7017720 15.8 0.1262136
12  0.995959 0.4638751  0.0 0.9466022
13 -4.516514 0.2794199 77.85714 0.8834954
  sum(example$weights)
[1] 13.0

  model-lm(y~1,data=example,weights=weights)
  add1(model,.~.+x1+x2)
Single term additions

Model:
y ~ 1
   Df Sum of SqRSSAIC
none  94.000 27.719
x1  155.290 38.710 18.185
x2  158.630 35.371 17.012
  addterm(model,.~.+x1+x2)
Single term additions

Model:
y ~ 1
   Df Sum of SqRSSAIC
none  94.000 27.719
x1  155.290 38.710 18.185
x2  158.630 35.371 17.012

#so add1 and addterm (MASS package) give the same answer, nothing 
obviously untoward, but
#both SS and RSS change when you do...
  model-lm(y~x1,data=example,weights=weights)
  drop1(model)
Single term deletions

Model:
y ~ x1
   Df Sum of SqRSSAIC
none  30.164 14.942I would expect RSS to be 38.710
x1  144.377 74.541 24.703I would expect SS to be 
55.290 and RSS 94.000 #{3}#
  model-lm(y~x2,data=example,weights=weights)
  drop1(model)
Single term deletions

Model:
y ~ x2
   Df Sum of SqRSSAIC
none  37.922 17.918
x2  136.619 74.541 24.703 #{1}#

#not only are SS and RSS different, the relative importance of x1 and x2 
has swapped! I have checked that this
#does not happen if weights are not used (everything adds up as 
expected, but the null RSS and other SSs are not the same as any quoted 
here).
#The inconsistency is still there if you are not adding to a null model:
#NB I realise that x1 and x2 are correlated so whichever is last to be 
added appears to have a lower SS - this is not the issue
  add1(model,.~.+x1+x2)#This or...
Single term additions

Model:
y ~ x2
   Df Sum of SqRSSAIC
none  35.371 17.012
x1  118.576 16.794  9.329

  addterm(model,.~x1+x2)# ...this is inconsistent with:
Single term additions

Model:
y ~ x2
   Df Sum of SqRSSAIC
none  35.371 17.012
x1  118.576 16.794  9.329

  drop1(update(model,.~.+x1))#this or...
Single term deletions

Model:
y ~ x2 + x1
   Df Sum of SqRSSAIC
none  14.456  7.380
x2  115.708 30.164 14.942 #{4}#
x1  123.466 37.922 17.918 #{2}#

  dropterm(update(model,.~.+x1))#...this
Single term deletions

Model:
y ~ x2 + x1
   Df Sum of SqRSSAIC
none  14.456  7.380
x2  115.708 30.164 14.942
x1  123.466 37.922 17.918

#and the same thing happens with the x2 variable - compare below with above
  add1(update(model,.~x1),.~x1+x2)
Single term additions

Model:
y ~ x1
   Df Sum of SqRSSAIC
none  38.710 18.185
x2  121.916 16.794  9.329

  addterm(update(model,.~x1),.~x1+x2)
Single term additions

Model:
y ~ x1
   Df Sum of SqRSSAIC
none  38.710 18.185
x2  121.916 16.794  9.329

#Why do I think add1/addterm are the problem rather than drop1/dropterm?
#Because drop1/dropterm agree with the anova:

  model-lm(y~x2+x1,data=example,weights=weights)
  anova(model)
Analysis of Variance Table

Response: y
  Df Sum Sq Mean Sq F valuePr(F)   
x2 1 36.619  36.619  25.331 0.0005119 *** this agrees with 
#{1}# above
x1 1 23.466  23.466  16.233 0.0024035 ** this agrees with 
#{2}# above
Residuals 10 14.456   1.446 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  model-lm(y~x1+x2,data=example,weights=weights)
  anova(model)
Analysis of Variance Table

Response: y
  Df Sum Sq Mean Sq F valuePr(F)   
x1 1 44.377  44.377  30.698 0.0002474 *** this agrees with 
#{3}# above
x2 1 15.708  15.708  10.866 0.0080633 ** this agrees with 
#{4}# above
Residuals 10 14.456   1.446 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1


___

My question is, why does this inconsistency happen? And is it safe to 
assume that anova and drop1/dropterm are giving me the 

[R] Rcmdir does not work in SciVews-R

2007-03-13 Thread Kihwang Lee
Hi,

I have recently installed version 2.4.1 of R and also installed
SciViews-R 0.8.9. It worked fine. Then I installed the Rcmdr 1.2-7 from
CRAN . However the 'R commander menu' in the dockable panel does not
work. If I start Rcmdr in R without SciViews, it works perfectly.

Is there any way that I can use Rcmdr with SciViews?

Many thanks in advanve.

Kihwang

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


Re: [R] inconsistent behaviour of add1 and drop1 with a weighted linear model

2007-03-13 Thread Peter Dalgaard
Jenny Hodgson wrote:
 Dear R Help,
 I have noticed some inconsistent behaviour of add1 and drop1 with a 
 weighted linear model, which affects the interpretation of the results.
 I have these data to fit with a linear model, I want to weight them by 
 the relative size of the geographical areas they represent.
 _
   example
yx1   x2   weights
 1  -4.546477 0.1859556 50.0 0.9466022
 2   1.484246 0.4740497 29.88000 1.3252430
 3   2.203681 0.8594264 16.9 0.9466022
 4   1.943163 0.8713360 42.11765 2.7766997
 5   1.886473 0.9006082 19.0 0.9466022
 6   1.795393 0.8455183 23.68421 1.1674760
 7   1.878077 0.5641396 35.0 0.8203885
 8  -4.215484 0.4356858 58.75000 0.4417477
 9   1.993339 0.5440061 19.28571 0.8519420
 10  1.560869 0.6285066 19.54545 0.8203885
 11  2.761535 0.7017720 15.8 0.1262136
 12  0.995959 0.4638751  0.0 0.9466022
 13 -4.516514 0.2794199 77.85714 0.8834954
   sum(example$weights)
 [1] 13.0

   model-lm(y~1,data=example,weights=weights)
   add1(model,.~.+x1+x2)
 Single term additions

 Model:
 y ~ 1
Df Sum of SqRSSAIC
 none  94.000 27.719
 x1  155.290 38.710 18.185
 x2  158.630 35.371 17.012
   
Which version of R??!

I get (2.4.1 on Fedora 6):

  add1(model,.~.+x1+x2)
Single term additions

Model:
y ~ 1
   Df Sum of SqRSSAIC
none  74.541 24.703
x1  144.377 30.164 14.942
x2  136.619 37.922 17.918

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


Re: [R] gtk button: how to create signal handler?

2007-03-13 Thread jverzani
d. sarthi maheshwari samay.sar at gmail.com writes:

 
 Hi
 
 Kindly correct me if I am posting a wrong query in the forum.
 
 I am trying to handle my button:clicked event. But not able to proceed
 further. Please help.
 Following is my code:
 
 library(RGtk2)
 
 win - gtkWindowNew(type = NULL, show = TRUE)
 butt - gtkButtonNewWithLabel(Submit, show = TRUE)
 win$Add(butt)
 
 Now I want to do something when my button is clicked. How can I grab the
 clicked signal and define actions against it?
 


Dear Sarthi, 

If you aren't in need of the full power of GTK (which Michael's suggestion gives
you), you might want to look at the gWidgets and gWidgetsRGtk2 package which
simplify GUI construction a bit:

require(gWidgets)
gbutton(submit, cont=gwindow(example), handler=function(h,...) {
 cat(your action goes here\n)
})

The gWidgets package has a vignette with more demos.

--John



 Thanks in advance.
 
 --
 Regards
 Sarthi M.
 
   [[alternative HTML version deleted]]
 
 __
 R-help at stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 


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


Re: [R] An example of overloading [

2007-03-13 Thread Sender
Great. Thanks again for all the suggestions.

On 3/13/07, Vincent Goulet [EMAIL PROTECTED] wrote:

 Le Mardi 13 Mars 2007 00:28, Sender a écrit:
  Hello:
 
  Could anyone point me to a nice example where someone has created
 methods
  for [ on a user defined Class?
 
  I looked at the package Matrix but that was a little daunting. I'm
 looking
  for someone a little more introductory. I've tried to search the help
  section and the web but its difficult since [ isn't searchable.
 
  Thanks in advance!

 You might also have a look at the methods for [ and [- created
 for grouped data objects in the development version of package actuar.

 Creation of the objects:
 https://vgoulet.act.ulaval.ca/svn/R/actuar/trunk/actuar/R/grouped.data.R

 Extraction methods:

 https://vgoulet.act.ulaval.ca/svn/R/actuar/trunk/actuar/R/Extract.grouped.data.R

 Doc:

 https://vgoulet.act.ulaval.ca/svn/R/actuar/trunk/actuar/man/grouped.data.Rd

 https://vgoulet.act.ulaval.ca/svn/R/actuar/trunk/actuar/man/Extract.grouped.data.Rd

 Package:
 http://vgoulet.act.ulaval.ca/actuar/

 HTH

 --
   Vincent Goulet, Associate Professor
   École d'actuariat
   UniversitÃ(c) Laval, QuÃ(c)bec
   [EMAIL PROTECTED]   http://vgoulet.act.ulaval.ca

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


[[alternative HTML version deleted]]

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


Re: [R] turn regression coefficients into matrix or...

2007-03-13 Thread Jun Xu
Stephen, Norbert, Anup, and Mark, Thank you all for your help. With these 
tips, I now have a much better understanding of the structure in R. Another 
related question that has been haunting me is whether it is necessary to be 
a convert from other statistical packages to R. Obviously, the great 
advantage that R has is it's free and usually the newest stats technique is 
first implemented in R. I had extensive experience with SAS and Stata, but I 
really hate to keep investing int the never-satiated big financial abyss 
there (e.g., various editions of manuals. However, I have some reservation 
to  be a convert as inertia always plays a big role if the utility is not 
that big by switching from one software to another. What do you think?


From: Stephen Tucker [EMAIL PROTECTED]
To: Norbert NEUWIRTH [EMAIL PROTECTED], Jun Xu [EMAIL PROTECTED]
CC: r-help@stat.math.ethz.ch
Subject: Re: [R] turn regression coefficients into matrix or...
Date: Tue, 13 Mar 2007 07:07:53 -0700 (PDT)

I believe the short answer to your question lies in

  summary(ans.reg[[i]])$coefficients

which will give you a matrix with coefficients and standard errors (and
more). You can also find out what other information you can get from the
regressions if you type

  attributes(ans.reg[[i]])
  attributes(summary(ans.reg[[i]]))

and then see the names of the list elements (the regression functions and
summary() return objects of mode list) that might correspond to the
information you are looking for.

Good luck,

ST




--- Norbert NEUWIRTH [EMAIL PROTECTED] wrote:

  jun,
 
  im am also quite new to R. so i think, this is a question all we 
R-newbees
 
  ask  ;-). having had the same problem the other day, i solved it the
  following way:
 
    Multiple Regressions - Tables
 
  data(anscombe)  # load anscombe
  dataset (implemented somwhere in R)
  x5 - rnorm(11,14,1)# create an 
additional
 
  variable (at random)
  anscombe.nn - cbind(anscombe,x5)   # attach the 
variable
  to the dataset
  attach(anscombe.nn) # attach the dataset
  to the searchpath (just for convenience)
  anscombe.nn # have a look on the
  data
 
  ans.reg - vector(4, mode = list) # create empty list
  (just  for speeding up)
 
  for(i in 1:4){  # now the 4
  regressions are stored to the list
   j - i+1
   x1 - get(paste(x, i, sep = ))  # exogenous var. #1
   x2 - get(paste(x, j, sep = ))  # exogenous var. #2
   y - get(paste(y, i, sep = ))   # endogenous
   ans.reg[[i]] - glm(y ~ x1+x2,family=gaussian)  # do the regression
  (out of 4)
   print(summary(ans.reg[[i]],cor=FALSE))
  }
 
  detach(anscombe)# detach dataset 
from
  search path
  lapply(ans.reg, coef)   # see each 
regression
  in one line
  sapply(ans.reg, coef)   # have the
  coefficients in a table
  x-as.matrix(sapply(ans.reg, coef)) # convert table to
  matrix
  x
 
  this solution is quite comparable to Ligges(2007) [published in german 
and
 
  japanese, i think]
 
  i have an additional question to list-members, that have left the
  newbee-status yet: how can i get R to hand over the standard errors,
  significance levels etc, so that i can create a table with  coeff and SE
  and sig.?
 
  norbert
 
 
  Am 13.03.2007, 02:58 Uhr, schrieb Jun Xu [EMAIL PROTECTED]:
 
   I don't have much experience with r. What I am trying to do is to turn
   regression coefficients (after I run a lm or glm model) into some 
matrix
   such that I can do some post-estimation calculation, for example
   predicted
   probabilities in glm model, etc.. Or, is there any function in r that 
I
   can
   use to do something along that line? thanks.
  
   Jun Xu, Ph.D.
   Department of Sociology
   Ball State University
  
   _
   Mortgage rates as low as 4.625% - Refinance $150,000 loan for $579 a
   month.
   Intro*Terms
  
 
https://www2.nextag.com/goto.jsp?product=10035url=%2fst.jsptm=ysearch=mortgage_text_links_88_h27f6disc=yvers=743s=4056p=5117
  
   __
   R-help@stat.math.ethz.ch mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide
   http://www.R-project.org/posting-guide.html
   and provide commented, minimal, self-contained, reproducible code.
  
 
 
 
  --
  ---
  Mag. Norbert NEUWIRTH
 
  Roubiczekgasse 2/23
  A-1100  WIEN
  mob: +43 699 1835 0704
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  

Re: [R] inconsistent behaviour of add1 and drop1 with a weighted linear model

2007-03-13 Thread Bojanowski, M.J. \(Michal\)
Hmmm, this is the same I got

 add1(model,.~.+x1+x2)
Single term additions

Model:
y ~ 1
   Df Sum of SqRSSAIC
none  74.541 24.703
x1  144.377 30.164 14.942
x2  136.619 37.922 17.918 


R version 2.4.1 (2006-12-18) 
i386-pc-mingw32 

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

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


*** Note that my e-mail address has changed to [EMAIL PROTECTED]
*** Please update your address books accordingly. Thank you!

_
Michal Bojanowski
ICS / Sociology
Utrecht University
Heidelberglaan 2; 3584 CS Utrecht
Room 1428
[EMAIL PROTECTED]
http://www.fss.uu.nl/soc/bojanowski
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard
Sent: Tuesday, March 13, 2007 5:35 PM
To: Jenny Hodgson
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] inconsistent behaviour of add1 and drop1 with a
weighted linear model

Jenny Hodgson wrote:
 Dear R Help,
 I have noticed some inconsistent behaviour of add1 and drop1 with a 
 weighted linear model, which affects the interpretation of the
results.
 I have these data to fit with a linear model, I want to weight them by

 the relative size of the geographical areas they represent.
 __
 ___
   example
yx1   x2   weights
 1  -4.546477 0.1859556 50.0 0.9466022
 2   1.484246 0.4740497 29.88000 1.3252430
 3   2.203681 0.8594264 16.9 0.9466022
 4   1.943163 0.8713360 42.11765 2.7766997
 5   1.886473 0.9006082 19.0 0.9466022
 6   1.795393 0.8455183 23.68421 1.1674760
 7   1.878077 0.5641396 35.0 0.8203885
 8  -4.215484 0.4356858 58.75000 0.4417477
 9   1.993339 0.5440061 19.28571 0.8519420
 10  1.560869 0.6285066 19.54545 0.8203885
 11  2.761535 0.7017720 15.8 0.1262136
 12  0.995959 0.4638751  0.0 0.9466022
 13 -4.516514 0.2794199 77.85714 0.8834954   sum(example$weights) [1] 
 13.0

   model-lm(y~1,data=example,weights=weights)
   add1(model,.~.+x1+x2)
 Single term additions

 Model:
 y ~ 1
Df Sum of SqRSSAIC
 none  94.000 27.719
 x1  155.290 38.710 18.185
 x2  158.630 35.371 17.012
   
Which version of R??!

I get (2.4.1 on Fedora 6):

  add1(model,.~.+x1+x2)
Single term additions

Model:
y ~ 1
   Df Sum of SqRSSAIC
none  74.541 24.703
x1  144.377 30.164 14.942
x2  136.619 37.922 17.918

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

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


Re: [R] Rattle() GGobi()-Plots- How to save?

2007-03-13 Thread hadley wickham
On 3/13/07, j.joshua thomas [EMAIL PROTECTED] wrote:
 i tried with package DescribeDisplay

 dd_load(DescribeDisplay)
 Load describe display

 i couldnt find any documentation. could you give me a sample

I've just improved http://www.ggobi.org/describe-display/, and
uploaded a new DescribeDisplay package to CRAN (it may take a few days
before it is available)

I hope this helps,

Hadley

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


[R] Looking for ArfimaOxFit.ox and ArfimaOxPredict.ox files

2007-03-13 Thread Antonio Silva
Hi. I've installed the fSeries package, trying to do Arfima fitting.
Instructions in fSeries.pdf ask to use ArfimaOxFit.ox and 
ArfimaOxPredict.ox files, which i'm unable to find (the suggested path
described in fSeries.pdf does not contains the files). Does any one can
share those files with me, or provide a useful link?. Thank you all, me and
my thesis will be grateful.

[[alternative HTML version deleted]]

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


Re: [R] inconsistent behaviour of add1 and drop1 with a weighted linear model

2007-03-13 Thread Jenny Hodgson
I was using Version 2.3.1 for Windows (binary download version). Guess I
should be using the latest version, (but the reason is I'm writing up my
PhD and I thought my results would be more 'repeatable' if I didn't keep
changing my version of the software, I didn't really think there would
be any glitches as big as this). Sorry if this is a waste of your time.
And thanks very much for replying so quickly.

Jenny

_
Jenny Hodgson
Department of Biology - area 18
PO box 373
University of York
YO10 5YW
UK
Tel: 01904 328623



Peter Dalgaard wrote:

 Jenny Hodgson wrote:

 Dear R Help,
 I have noticed some inconsistent behaviour of add1 and drop1 with a 
 weighted linear model, which affects the interpretation of the results.
 I have these data to fit with a linear model, I want to weight them 
 by the relative size of the geographical areas they represent.
 _
  

   example
yx1   x2   weights
 1  -4.546477 0.1859556 50.0 0.9466022
 2   1.484246 0.4740497 29.88000 1.3252430
 3   2.203681 0.8594264 16.9 0.9466022
 4   1.943163 0.8713360 42.11765 2.7766997
 5   1.886473 0.9006082 19.0 0.9466022
 6   1.795393 0.8455183 23.68421 1.1674760
 7   1.878077 0.5641396 35.0 0.8203885
 8  -4.215484 0.4356858 58.75000 0.4417477
 9   1.993339 0.5440061 19.28571 0.8519420
 10  1.560869 0.6285066 19.54545 0.8203885
 11  2.761535 0.7017720 15.8 0.1262136
 12  0.995959 0.4638751  0.0 0.9466022
 13 -4.516514 0.2794199 77.85714 0.8834954
   sum(example$weights)
 [1] 13.0

   model-lm(y~1,data=example,weights=weights)
   add1(model,.~.+x1+x2)
 Single term additions

 Model:
 y ~ 1
Df Sum of SqRSSAIC
 none  94.000 27.719
 x1  155.290 38.710 18.185
 x2  158.630 35.371 17.012
   

 Which version of R??!

 I get (2.4.1 on Fedora 6):

  add1(model,.~.+x1+x2)
 Single term additions

 Model:
 y ~ 1
   Df Sum of SqRSSAIC
 none  74.541 24.703
 x1  144.377 30.164 14.942
 x2  136.619 37.922 17.918


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


Re: [R] timeDate business day

2007-03-13 Thread Tony Plate
The R timeDate class is in the fCalendar package.

Does anyone know how to change the output format of a timeDate object? 
(Other than by explicitly supplying a format= argument to the format() 
function.)  I tried creating a timeDate object, and then changing the 
format slot.  However, all the functions I used on the object ('print', 
'format', 'as.character', 'show') seemed to ignore the value in the 
format slot.

And does anyone else find it a little confusing that print() and show() 
convert timeDate to the local time zone, but as.character() and format() 
display it in the time zone of its FinCenter slot?

Here is a transcript:

  library(fCalendar)
  tt - c(2005-01-04, 2005-01-05, 2005-01-06, 2005-01-07)
  x - timeDate(tt)
  [EMAIL PROTECTED]
[1] %Y-%m-%d
  # Change the format on the timeDate object
  [EMAIL PROTECTED] - %Y%m%d
  x
An object of class timeDate
Slot Data:
[1] 2005-01-03 17:00:00 Mountain Standard Time
[2] 2005-01-04 17:00:00 Mountain Standard Time
[3] 2005-01-05 17:00:00 Mountain Standard Time
[4] 2005-01-06 17:00:00 Mountain Standard Time

Slot Dim:
[1] 4

Slot format:
[1] %Y%m%d

Slot FinCenter:
[1] GMT

  # Can get what I want by explicitly supplying format
  # argument to format()
  format(x, format=%Y%m%d)
[1] 20050104 20050105 20050106 20050107
  # But format() seems to ignore the format slot
  format(x)
[1] 2005-01-04 2005-01-05 2005-01-06 2005-01-07
  print(x)
GMT
[1] [2005-01-04] [2005-01-05] [2005-01-06] [2005-01-07]
  as.character(x)
[1] 2005-01-04 2005-01-05 2005-01-06 2005-01-07
attr(,control)
FinCenter
 GMT
 
  sessionInfo()
R version 2.4.1 (2006-12-18)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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

other attached packages:
   fCalendar fEcofin
240.10068 240.10067
  Sys.getenv(TZ)
TZ

 

-- Tony Plate

Michael Toews wrote:
 Those numbers look like ... well, numbers. You want characters! Try 
 converting the integer to a character before trying to do a string 
 parse, e.g.:
 
 ymd.int - c(20050104, 20050105, 20050106, 20050107, 20050110, 20050111, 
 20050113, 20050114)
 ymd - as.Date(as.character(ymd.int),%Y%m%d)
 
 As far as the other functions you are looking at (timeDate, 
 timeRelative) -- I've never seen these, so I'm guessing they are 
 S-PLUS. In R, you can use diff or difftime (which works with Date 
 and POSIXlt-or Date-Time classes) , e.g.:
 
 diff(ymd)
 diff(ymd,2)
 diff(ymd,3)
 
 or do some arithmetic:
 
 difftime(ymd[1],ymd[4])
 difftime(ymd[1],ymd[4],unit=weeks)
 
 Hopefully this is helpful to you!
 +mt
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


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


Re: [R] timeDate business day

2007-03-13 Thread Tony Plate
There are two articles describing time and date classes in the R-News 
letter:

Brian D. Ripley and Kurt Hornik. Date-time classes. R News, 1(2):8-11, 
June 2001.
http://cran.r-project.org/doc/Rnews/Rnews_2001-2.pdf

Gabor Grothendieck and Thomas Petzoldt. R help desk: Date and time 
classes in R. R News, 4(1):29-32, June 2004.
http://cran.r-project.org/doc/Rnews/Rnews_2004-1.pdf

The Ripley and Hornik article discusses the POSIXt (Posix time) 
classes: POSIXlt (POSIX local time) and POSIXct (POSIX calendar time).

The Grothendieck and Petzoldt article discusses the Date, chron and 
POSIXt classes, and has a very helpful table of how to do various 
operations on Date, chron and POSIXct objects.

There is also the fCalandar package, which includes a timeDate class and 
has support for holidays, operations on timeDate objects, and various 
other features useful for dealing with times and dates as they are used 
in financial data.

Obviously, there is the online help for the fCalendar package, but there 
are also three other documents describing how to work with timeDate objects:

Computing with R and S-Plus For Financial Engineers 1 - Part I - 
Markets, Basic Statistics, Date and Time Management, Diethelm W¨urtz
http://www.itp.phys.ethz.ch/econophysics/R/docs/fBasics.pdf

R and Rmetrics for Teaching.  Financial Engineering and Computational 
Finance, Part II, Dates, Time, and, Calendars, Diethelm W¨urtz
http://www.itp.phys.ethz.ch/econophysics/R/docs/rCalendar.pdf

S4 ’timeDate’ and ’timeSeries’ Classes for R, Diethelm W¨urtz
http://www.itp.phys.ethz.ch/econophysics/R/pdf/calendar.pdf


-- Tony Plate


Michael Toews wrote:
 Sadly, I don't know of any tutorials or much help on the web for R ... 
 that doesn't mean it doesn't exist ... you might just have to look 
 around for it (www.rseek.org is a good place to start)
 I've learned almost everything I know through:
 ?strptime
 
 Also check out the methods for the classes, for example:
 
 methods(class=Date)
 methods(class=POSIXct)
 
 And certainly check their help pages ... there is loads of stuff here 
 that I haven't discovered myself. (Note, if you are new to S3 classes .. 
 if it begins with the method, then . class, you only need to type the 
 beginning. For example summary(ymd) ... not summary.Date(ymd) if 
 ymd has `class(ymd) == Date `.
 
 I think the fundamental things to know are there are three main 
 DateTimeClasses:
 
   1. POSIXct - has date, time and optionally time-zone info -- very
  handy for using in data.frame objects (and frankly I think it
  should be renamed to DateTime since the class POSIXct has
  nothing really to do directly with date/times)
   2. POSIXlt - as far as I'm concerned, this is has the same
  functionality as POSIXct, but it cannot be used in data.frame
  objects (and frankly, I think it should be deprecated in favour of
  #1 to reduce future confusion)
   3. Date - use this if you don't care about times or time-zones
 
 But it would be nice to track down a good tutorial somewhere.
 +mt
 
 Young Cho wrote:
 Thanks so Michael! If you know of a tutorial or introductory document 
 about timeDate manipulation or time series manipulation in R, can you 
 share it? It is hard to find by googling... I'd very appreciate any 
 advice.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


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


Re: [R] Rcmdir does not work in SciVews-R

2007-03-13 Thread John Fox
Dear Kihwang,

I believe that you'll have to use an older version of the Rcmdr package with
SciViews; you can download version 1.1-2 of the Rcmdr from the SciViews web
page http://www.sciviews.org/SciViews-R/. For more information, you might
contact the SciViews developers.

I hope this helps,
 John


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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Kihwang Lee
 Sent: Tuesday, March 13, 2007 12:12 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Rcmdir does not work in SciVews-R
 
 Hi,
 
 I have recently installed version 2.4.1 of R and also 
 installed SciViews-R 0.8.9. It worked fine. Then I installed 
 the Rcmdr 1.2-7 from CRAN . However the 'R commander menu' in 
 the dockable panel does not work. If I start Rcmdr in R 
 without SciViews, it works perfectly.
 
 Is there any way that I can use Rcmdr with SciViews?
 
 Many thanks in advanve.
 
 Kihwang
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


[R] distance metrics

2007-03-13 Thread David Meyer
  Hello:
   
Does anyone know if there exists a package that handles methods for [
  for
dist objects?
   
I would like to access a dist object using matrix notation
   
e.g.
   
dMat = dist(x)
dMat[i,j]


You can use the [[ operator defined for distance matrices currently in 
package cba, which allows subsetting dist objects. (Note that this 
will move to the new proxy package on proximity measures very soon).

David

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


Re: [R] Freeman-Tukey arcsine transformation

2007-03-13 Thread Bos, Roger
I'm curious what this transformation does, but I am not curious enough to pay 
$14 to find out.  Someone once told me that the arcsine was a good way to 
transform data and make it more 'normal'.  I am wondering if this is an 
improved method.  Anyone know of a free reference?

 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard
Sent: Tuesday, March 13, 2007 10:58 AM
To: Inman, Brant A. M.D.
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Freeman-Tukey arcsine transformation

Inman, Brant A. M.D. wrote:
 R-Experts:

 Does anyone know if there are R functions to perform the Freeman-Tukey 
 double arcsine transformation and then backtransform it?

   

Well, if not, both are given by explicit formulas, so it shouldn't take long to 
implement, cf.:

The Teacher's Corner


*The Inverse of the Freeman-Tukey Double Arcsine Transformation

http://www.jstor.org/view/00031305/di020556/02p0095b/0?frame=noframedpi=3[EMAIL
 
PROTECTED]/01cce4405c00501bb027fbackcontext=pagebackurl=/cgi-bin/jstor/viewitem/00031305/di020556/02p0095b/[EMAIL
 PROTECTED]/01cce4405c00501bb027f%26config%3d%26PAGE%3d0config=jstorPAGE=0*



John J. Miller 


/The American Statistician/, Vol. 32, No. 4. (Nov., 1978),
p. 138. 


Stable URL:

http://links.jstor.org/sici?sici=0003-1305%28197811%2932%3A4%3C138%3ATIOTFD%3E2.0.CO%3B2-Z



  Abstract

A formula for the inverse of the Freeman-Tukey double arcsine
transformation is derived. This formula is useful when
expressing means of double arcsines as retransformed
proportions. When the mean is taken from original proportions
involving different n's, it is suggested that the harmonic mean
of the n's be used in the inversion formula.



 Thanks,

 Brant Inman
 Mayo Clinic

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


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

** * 
This message is for the named person's use only. It may 
contain confidential, proprietary or legally privileged 
information. No right to confidential or privileged treatment 
of this message is waived or lost by any error in 
transmission. If you have received this message in error, 
please immediately notify the sender by e-mail, 
delete the message and all copies from your system and destroy 
any hard copies. You must not, directly or indirectly, use, 
disclose, distribute, print or copy any part of this message 
if you are not the intended recipient.

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


[R] RODBC Excel sqlQuery insert into

2007-03-13 Thread toby_marks
I have searched the archives for using insert into to update spreadsheets 
using RODBC and have come up short. So, first off, is it possible?

I have put together a dummy xls table (c:\foo.xls)for exploring 
possibilities of RODBC.  Ultimately, I am interested in replacing much of 
our previous use of vba macros with R ( I'd prefer elimination, but will 
take what I can get ).  In order to achieve this, I will still have a need 
to update spreadsheets directly through R scripts. 

Simple queries seem to work fantastic!  But, I am missing something when 
it comes to writing.

sqlQuery( myChan,insert into [my customers$] ( CUST_ID, NAME, SOCIAL ) 
VALUES( 5,'robin',5678 )  )
[1] [RODBC] ERROR: Could not SQLExecDirect  S1000 -3035 
[Microsoft][ODBC Excel Driver] Operation must use an updateable query.


myChan = odbcConnectExcel(c:\\foo.xls)
myChan
RODB Connection 13
Details:
  case=nochange
  DBQ=c:\foo.xls
  DefaultDir=c:\
  Driver={Microsoft Excel Driver (*.xls)}
  DriverId=790
  MaxBufferSize=2048
  PageTimeout=5

sqlTables(myChan)
  TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS
1   c:\\fooNA 'my customers orders$'  TABLENA
2   c:\\fooNA'my customers$'  TABLENA
3   c:\\fooNA 'my products$'  TABLENA
4   c:\\fooNA  'poor table$'  TABLENA

sqlQuery(myChan,select * from [my customers$] )
  CUST_IDNAME SOCIALDOB
1   1superman   1234 1940-12-31
2   2  batman   2345 1960-01-01
3   3 wonderwoman   3456 1942-05-15
4   4   spiderman   4567 1982-09-30

sqlQuery(myChan,select * from [my customers orders$] )
  ORDER_ID CUST_ID   DATE PRODUCT_ID QUANTITY
11   3 1997-08-13  1   12
22   3 1998-07-23  7   24
33   1 1994-01-08  6   11
44   4 2001-11-13  5   32
55   2 1997-03-09  79

sqlQuery(myChan,select * from [my products$] )
  PRODUCT_ID PRODUCT_NAME
1  1 cape
2  2 mask
3  3   tights
4  4boots
5  5  goggles
6  6   gloves
7  7  aspirin
sqlQuery(myChan,select * from [poor table$] )
  a bunch of stuff F2  F3  F4   F5F6
1   NA NA  NANA NANA
2   NA NA  NANA NANA
3   NA NA  NA data_i_like more data I likeNA
4   NA NA 100blue  hot  94.16857
5   NA NA 200 red warm  35.85302
6   NA NA 300   green cold 232.09150
7   NA NA 400blue cold  45.40191

sqlQuery(myChan,select * from [my customers$] A, [my customers orders$] B 
where A.CUST_ID = B.CUST_ID AND A.SOCIAL  3000, as.is=TRUE) 
  CUST_IDNAME SOCIAL DOB ORDER_ID CUST_ID  DATE 
PRODUCT_ID QUANTITY
1   3 wonderwoman   3456 1942-05-15 00:00:002   3 
1998-07-23 00:00:00  7   24
2   3 wonderwoman   3456 1942-05-15 00:00:001   3 
1997-08-13 00:00:00  1   12
3   4   spiderman   4567 1982-09-30 00:00:004   4 
2001-11-13 00:00:00  5   32
$

f = sqlQuery( myChan,insert into [my customers$] ( CUST_ID, NAME, SOCIAL 
) VALUES( 5,'robin',5678 )  )

[1] [RODBC] ERROR: Could not SQLExecDirect   S1000 -3035 
[Microsoft][ODBC Excel Driver] Operation must use an updateable query.

Additional reference: 
http://www.microsoft.com/technet/scriptcenter/resources/officetips/jun05/tips0607.mspx


CONFIDENTIALITY NOTICE: This electronic mail transmission (i...{{dropped}}

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


Re: [R] Freeman-Tukey arcsine transformation

2007-03-13 Thread Sebastian P. Luque
On Tue, 13 Mar 2007 14:15:16 -0400,
Bos, Roger [EMAIL PROTECTED] wrote:

 I'm curious what this transformation does, but I am not curious enough
 to pay $14 to find out.  Someone once told me that the arcsine was a
 good way to transform data and make it more 'normal'.  I am wondering if
 this is an improved method.  Anyone know of a free reference?

My Zar¹, says this is just:


p' = 1/2 * (asin(sqrt(x / (n + 1))) + asin(sqrt((x + 1) / (n + 1


so solving for x should give the back-transformation.  It is recommended
when the proportions that need to be disciplined are very close to the
ends of the range (0, 1; 0, 100).


+ *Footnotes* +
¹ @BOOK{149,
  title = {Biostatistical analysis},
  publisher = {Prentice-Hall, Inc.},
  year = {1996},
  author = {Zar, J. H.},
  address = {Upper Saddle River, New Jersey},
  key = {149},
}


-- 
Seb

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


Re: [R] inconsistent behaviour of add1 and drop1 with a weighted linear model

2007-03-13 Thread Peter Dalgaard
Jenny Hodgson wrote:
 I was using Version 2.3.1 for Windows (binary download version). Guess I
 should be using the latest version, (but the reason is I'm writing up my
 PhD and I thought my results would be more 'repeatable' if I didn't keep
 changing my version of the software, I didn't really think there would
 be any glitches as big as this). Sorry if this is a waste of your time.
 And thanks very much for replying so quickly.

 Jenny

   

Always a good idea to check the NEWS file:

o   add1.lm() had been broken by other changes for weighted fits.

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


Re: [R] RODBC Excel sqlQuery insert into

2007-03-13 Thread James W. MacDonald
Hi Toby,

[EMAIL PROTECTED] wrote:
 I have searched the archives for using insert into to update spreadsheets 
 using RODBC and have come up short. So, first off, is it possible?

I don't think so. Writing to an Excel spreadsheet is probably easier 
done using the RDCOMClient package. There are some good examples of how 
to do things that come with the package. Searching the R-help archives 
should also come up with some good examples.

Best,

Jim




-- 
James W. MacDonald, M.S.
Biostatistician
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623


**
Electronic Mail is not secure, may not be read every day, and should not be 
used for urgent or sensitive issues.

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


Re: [R] Freeman-Tukey arcsine transformation

2007-03-13 Thread roger koenker
As a further footnote on this, I can't resist mentioning a letter  
that appears
in Technometrics (1977) by Steve  Portnoy who notes that

2 arcsin(sqrt(p)) = arcsin(2p - 1) + pi/2

and asks: it would be of historical interest to know if any early  
statisticians
were aware of this, and if so, why the former version was  
preferred.  The
latter version seems more convenient since it obviously obviates the  
need
for special tables that appear in many places.



url:www.econ.uiuc.edu/~rogerRoger Koenker
email   [EMAIL PROTECTED]   Department of Economics
vox:217-333-4558University of Illinois
fax:217-244-6678Champaign, IL 61820


On Mar 13, 2007, at 1:48 PM, Sebastian P. Luque wrote:

 On Tue, 13 Mar 2007 14:15:16 -0400,
 Bos, Roger [EMAIL PROTECTED] wrote:

 I'm curious what this transformation does, but I am not curious  
 enough
 to pay $14 to find out.  Someone once told me that the arcsine was a
 good way to transform data and make it more 'normal'.  I am  
 wondering if
 this is an improved method.  Anyone know of a free reference?

 My Zar¹, says this is just:


 p' = 1/2 * (asin(sqrt(x / (n + 1))) + asin(sqrt((x + 1) / (n + 1


 so solving for x should give the back-transformation.  It is  
 recommended
 when the proportions that need to be disciplined are very close  
 to the
 ends of the range (0, 1; 0, 100).


 + *Footnotes* +
 ¹ @BOOK{149,
   title = {Biostatistical analysis},
   publisher = {Prentice-Hall, Inc.},
   year = {1996},
   author = {Zar, J. H.},
   address = {Upper Saddle River, New Jersey},
   key = {149},
 }


 -- 
 Seb

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

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


[R] ASA Southern California Chapter Applied Statistics Workshop

2007-03-13 Thread Madeline Bauer
The Southern California Chapter of the American Statistical Association 
invites you to attend the 26th annual Applied Statistics Workshop on 
Saturday March 31, 2007 at the University of California Los Angeles.  The 
topic is Advances in Latent Variable Modeling presented by Professor 
Bengt Muthén, University of California, Los Angeles. For more information, 
go to www.sc-asa.org

[[alternative HTML version deleted]]

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


Re: [R] inconsistent behaviour of add1 and drop1 with a weighted linear model

2007-03-13 Thread hadley wickham
On 3/13/07, Peter Dalgaard [EMAIL PROTECTED] wrote:
 Jenny Hodgson wrote:
  I was using Version 2.3.1 for Windows (binary download version). Guess I
  should be using the latest version, (but the reason is I'm writing up my
  PhD and I thought my results would be more 'repeatable' if I didn't keep
  changing my version of the software, I didn't really think there would
  be any glitches as big as this). Sorry if this is a waste of your time.
  And thanks very much for replying so quickly.
 
  Jenny
 
 

 Always a good idea to check the NEWS file:

 o   add1.lm() had been broken by other changes for weighted fits.

Yes, but a little impractical.  Has any one ever considered a standard
for the news file so changes could be extracted and included in online
documentation somewhere?

Hadley

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


Re: [R] Freeman-Tukey arcsine transformation

2007-03-13 Thread Peter Dalgaard
Bos, Roger wrote:
 I'm curious what this transformation does, but I am not curious enough to pay 
 $14 to find out.  Someone once told me that the arcsine was a good way to 
 transform data and make it more 'normal'.  I am wondering if this is an 
 improved method.  Anyone know of a free reference?

  
   
Well, a paper copy of the American Statistician (1978) would be free in 
some sense

In the meantime I got detached from JSTOR (i.e., I went home), and I'm 
not prepared to jump through the relevant hoops for remote access at 
this point, but AFAIR it was a relatively trivial version of the simple 
arcsine transform, something like replacing asin(r/n) with the average 
of asin(r/(n+1)) and asin((r+1)/(n+1)). The point of the paper is that 
you can invert explicitly for r/n if n is known.

 /The American Statistician/, Vol. 32, No. 4. (Nov., 1978),
 p. 138. 


 Stable URL:
 
 http://links.jstor.org/sici?sici=0003-1305%28197811%2932%3A4%3C138%3ATIOTFD%3E2.0.CO%3B2-Z



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


[R] Adding bars to the right of existing ones using barplot

2007-03-13 Thread Jason Horn
I'm trying to create a barplot that has two sets of data next to each  
other.  I'm using barplot with the add=TRUE option, but this simply  
adds the second dataset on top of the first, obscuring it.  How do I  
add the new data to the right on the existing barplot so that both  
sets are visible?  I've been playing with all sorts of option and  
reading the list archives with no luck.

Thank you anyone who has the answer.

- Jason

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


Re: [R] RODBC Excel sqlQuery insert into

2007-03-13 Thread toby_marks
I do recall seeing posts on RDOM flying around from time to time and today 
have stumbled across as well through my RODBC  searches.  I have also been 
reminded from another reply of RCOM being a potential solution.  I had 
hoped to stick to more of a pure sql based process, but certainly R makes 
it easy to change course when necessary.  I shall do some digging into 
each of these packages now as well.  Thanks for the response!

--Cheers.





James W. MacDonald [EMAIL PROTECTED] 
03/13/2007 02:05 PM





To
[EMAIL PROTECTED]
cc
r-help@stat.math.ethz.ch
Subject
Re: [R] RODBC Excel sqlQuery  insert into






Hi Toby,

[EMAIL PROTECTED] wrote:
 I have searched the archives for using insert into to update 
spreadsheets 
 using RODBC and have come up short. So, first off, is it possible?

I don't think so. Writing to an Excel spreadsheet is probably easier 
done using the RDCOMClient package. There are some good examples of how 
to do things that come with the package. Searching the R-help archives 
should also come up with some good examples.

Best,

Jim




-- 
James W. MacDonald, M.S.
Biostatistician
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623


**
Electronic Mail is not secure, may not be read every day, and should not 
be used for urgent or sensitive issues.



CONFIDENTIALITY NOTICE: This electronic mail transmission (i...{{dropped}}

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


Re: [R] Rcmdir does not work in SciVews-R

2007-03-13 Thread Kihwang Lee
Tried. Did not work. Thanks anyway. I will contact the SciViews
developers as you suggested.

Kihwang

John Fox wrote:
 Dear Kihwang,
 
 I believe that you'll have to use an older version of the Rcmdr package with
 SciViews; you can download version 1.1-2 of the Rcmdr from the SciViews web
 page http://www.sciviews.org/SciViews-R/. For more information, you might
 contact the SciViews developers.
 
 I hope this helps,
  John
 
 
 John Fox
 Department of Sociology
 McMaster University
 Hamilton, Ontario
 Canada L8S 4M4
 905-525-9140x23604
 http://socserv.mcmaster.ca/jfox 
  
 
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Kihwang Lee
 Sent: Tuesday, March 13, 2007 12:12 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Rcmdir does not work in SciVews-R

 Hi,

 I have recently installed version 2.4.1 of R and also 
 installed SciViews-R 0.8.9. It worked fine. Then I installed 
 the Rcmdr 1.2-7 from CRAN . However the 'R commander menu' in 
 the dockable panel does not work. If I start Rcmdr in R 
 without SciViews, it works perfectly.

 Is there any way that I can use Rcmdr with SciViews?

 Many thanks in advanve.

 Kihwang

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


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


[R] segfault with correlation structures in nlme

2007-03-13 Thread José Rafael Ferrer Paris
Hi out there,

I am trying to fit a species accumulation curve (increase in number of
species known vs. sampling effort) for multiple regions and several
bootstrap samples. The bootstrap samples represent different
arrangements of the actual sample sequence.

 I fitted a series of nlme-models and everything seems OK, but since the
observations are correlated I tried to include some correlation
structure. Since the ARMA classes were not succesful in reducing this
correlation, I tried spatial correlation functions with sampling effort
(measured in time units) as a distance measure. As a result I got
several segfault errors (which I don't know what they exactly mean =/).

I was wondering if it was an effect of the model or the data I used, but
I was able to reproduce the error messages using the Ovary data set and
the example in the Pinheiro  Bates book:

library(nlme)
data(ovary)
fm10var.lme -  lme(follicles ~ sin(2 * pi * Time) +
cos(2 * pi * Time),data=Ovary,
random=pdDiag(~sin(2*pi*Time)))
fm50var.lme - update(fm10var.lme,correlation=corARMA(p=1,q=1))
fm10var.nlme -  nlme(follicles ~ A + B * sin(2 * pi * w * Time) +
  C * cos(2 * pi * w * Time),data=Ovary,
  fixed= A+B+C+w~1,
  random=pdDiag(A+B+w~1),
   start = c(fixef(fm50var.lme),1))
plot(ACF(fm10var.nlme,maxLag=10),alpha=.05)
fm20var.nlme - update(fm10var.nlme,corr=corAR1(0.311))
fm30var.nlme - update(fm10var.nlme,corr=corARMA(p=0,q=2))

fm60var.nlme - update(fm10var.nlme,corr=corGaus(form=~Time))

 *** caught segfault ***
address 0x1075e501, cause 'memory not mapped'

Traceback:
 1: eval(expr, envir, enclos)
 2: eval(modelExpression, env)
 3: assign(modelValue, eval(modelExpression, env), envir = thisEnv)
 4: function (newPars) {if (!missing(newPars)) {for (i in
names(ind)) {assign(i, clearNames(newPars[ind[[i]]]), envir
= env)}  assign(modelValue, eval(modelExpression, env),
envir = thisEnv)}modelValue}(c(-4.11936939372863,
0.157676781855328, -0.071492289279548, -3.89562017836122,
3.06079106423361, -0.0260217128029253, -2.83650117790746,
1.62924792896056, 0.0607736472981399, -0.834700672739711,
0.07926271837803, 0.0403415470454326, -0.698687811226831,
-0.121079563050668, 0.032722843419347, 0.0404804003710554,
0.379937934267249, 0.087562808768161, 3.08430247504295,
2.08510442577037, 0.103812382483994, 1.1306260898,
-1.70151546937888, -0.043262231409, 2.37971674786747,
-1.04307471138899, 0.0217885202778396, 2.60583067635322,
-0.638495324795519, -0.137018044847307, 1.70105176178795,
-3.07372462709182, -0.0445309584408364, 12.3518546784787,
-3.22126648052618, -1.69049623029482, 0.907261039321137))
 5: .C(fit_nlme, thetaPNLS = as.double(c(as.vector(unlist(sran)),
sfix)), pdFactor = as.double(pdFactor(nlmeSt$reStruct)),
as.integer(unlist(rev(grpShrunk))), as.integer(unlist(Dims)),
as.integer(attr(nlmeSt$reStruct, settings))[-(1:3)], as.double(cF),
as.double(vW), as.integer(unlist(cD)), settings =
as.double(pnlsSettings), additional = double(NReal * (pLen + 1)),
as.integer(!is.null(correlation)), as.integer(!is.null(weights)),
nlModel, NAOK = TRUE)
 6: nlme.formula(model = follicles ~ A + B * sin(2 * pi * w * Time) +
C * cos(2 * pi * w * Time), data = Ovary, fixed = A + B + C + w ~ 1,
random = pdDiag(A + B + w ~ 1), start = c(fixef(fm50var.lme), 1),
corr = corGaus(form = ~Time))
 7: eval(expr, envir, enclos)
 8: eval(call, parent.frame())
 9: update.nlme(fm10var.nlme, corr = corGaus(form = ~Time))
10: update(fm10var.nlme, corr = corGaus(form = ~Time))

The above was under:

R version 2.4.1 (2006-12-18)
nlme Version:   3.1-79
Linux 2.6.15-27-386 (Ubuntu 6.06)

Then I tried the same on another computer and got:
 *** caught segfault ***
address 0x82e4902a, cause 'memory not mapped'
Violación de segmento

R Version 2.3.1 (2006-06-01)
nlme Version:   3.1-74
Linux 2.6.12-10-386  (Ubuntu 5.10)

I worked out the example of rats body weights, also in the book, and it
gave no error, so the problem seems to be in using the corLin and
corGaus functions with a nlme fit. Apparently is neither my version of R
and nlme, nor the dataset. Can someone try to reproduce this? Or does
someone knows the cause/explanation/fix? 

Thanks very much 

JR Ferrer-Paris

-- 
Dipl.-Biol. JR Ferrer Paris
~~~
Laboratorio de Biología de Organismos --- Centro de Ecología
Instituto Venezolano de Investigaciones Científicas (IVIC) 
Apdo. 21827, Caracas 1020-A 
República Bolivariana de Venezuela

Tel: (+58-212) 504-1452
Fax: (+58-212) 504-1088

email: [EMAIL PROTECTED]
clave-gpg: 2C260A95

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


Re: [R] Adding bars to the right of existing ones using barplot

2007-03-13 Thread Petr Klasterecky
Add/subtract a small constant to/from your latter dataset (x-values) and 
plot it without axes.

Petr

Jason Horn napsal(a):
 I'm trying to create a barplot that has two sets of data next to each  
 other.  I'm using barplot with the add=TRUE option, but this simply  
 adds the second dataset on top of the first, obscuring it.  How do I  
 add the new data to the right on the existing barplot so that both  
 sets are visible?  I've been playing with all sorts of option and  
 reading the list archives with no luck.
 
 Thank you anyone who has the answer.
 
 - Jason
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

-- 
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic

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


Re: [R] Rattle() GGobi()-Plots- How to save?

2007-03-13 Thread Graham Williams
Received Wed 14 Mar 2007  1:53am +1100 from j.joshua thomas:
 i tried with package DescribeDisplay
 
 dd_load(DescribeDisplay)
Load describe display
 
 i couldnt find any documentation. could you give me a sample

Try 

 install.packages(DescribeDisplay)
 library(DescribeDisplay)

Then, within GGobi choose from the Tools menu to Save Display
Description. This will prompt you for a filename into which GGobi will
write an R script to recreate the current graphic. We can load this
script into R and plot:

 pd - dd_load(ggobi-saved-display-description.R)
 plot(pd)
 ggplot(pd)

I've updated the section on GGobi in the Rattle book to reflect
this. See http://datamining.togaware.com/survivor/index.html (or
specifically
http://datamining.togaware.com/survivor/GGobi_Option.html)

Regards,
Graham

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


Re: [R] Adding bars to the right of existing ones using barplot

2007-03-13 Thread Charilaos Skiadas

On Mar 13, 2007, at 3:34 PM, Jason Horn wrote:

 I'm trying to create a barplot that has two sets of data next to each
 other.  I'm using barplot with the add=TRUE option, but this simply
 adds the second dataset on top of the first, obscuring it.  How do I
 add the new data to the right on the existing barplot so that both
 sets are visible?  I've been playing with all sorts of option and
 reading the list archives with no luck.

Something like this?

a-rnorm(3,2,1)
b-rnorm(3,2,1)
barplot(rbind(a,b), beside=TRUE)


?barplot for more options ( in particular, the height argument)


 Thank you anyone who has the answer.

 - Jason

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College

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


[R] Rcmd and memory

2007-03-13 Thread Nair, Murlidharan T
I am running a recursive feature selection wrapper on svm for a large
data set. The routine gets progressively slower. I am deleting the
objects not required. Is there anything else you advise me look for?  

I tried running it from the command line but it does not print anything
on the screen. I did not specify any output file and was expecting the
screen to be the default. Can any one help me with this problem? Also
does running from the command line help in executing it faster? 

Thanks ../Murli

 

 

 


[[alternative HTML version deleted]]

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


[R] writing new varFunc class

2007-03-13 Thread Richard E. Glor
I'm trying to use nonlinear regression to estimate model parameters  
for a constant rate birth-death process conditioned on the fact that  
the population has not gone extinct.  Because the birth and death  
parameters obtained from standard application of gnls() appear to be  
biased, I'd like to write a new varFunc class for gnls() that  
accommodates the expected increase in variance with time.  The help  
documentation for varClasses notes that Users may define their own  
varFunc classes by specifying a constructor function and, at a  
minimum, methods for the functions coef, coef-, and initialize. For  
examples of these functions, see the methods for class varPower.,  
but I did not find the content offered in varPower to be particularly  
helpful in this regard.  If anybody has gone through the process of  
creating a new varFunc I'd love to hear from you.  The variance  
function I'd like to construct is from Bailey 1964:

(m*exp((lambda-mu)*t)*((lambda/mu)+1)*(exp((lambda-mu)*t)-1)/((lambda/ 
mu)-1)

, where m is the starting number of individuals, lambda is the birth  
rate, mu the death rate and t the time since the population's origin.

Cheers,
Rich

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


Re: [R] selecting rows with more than x occurrences in a given column(data type is names)

2007-03-13 Thread Mike Jasper
Thanks to all of you who got me the answer. The key I was missing was
%in%. Had never seen it before.

best.

On 3/13/07, Dimitris Rizopoulos [EMAIL PROTECTED] wrote:
 try this:

 set.seed(123)
 all.data - data.frame(name = sample(c(Joe, Elen, Jane, Mike),
 8, TRUE),
 x = rnorm(8), y = runif(8))
 ##
 tab.nams - table(all.data$name)
 nams - names(tab.nams[tab.nams = 2])
 all.data[all.data$name %in% nams, ]


 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


 - Original Message -
 From: Mike Jasper [EMAIL PROTECTED]
 To: r-help@stat.math.ethz.ch
 Sent: Tuesday, March 13, 2007 3:38 PM
 Subject: [R] selecting rows with more than x occurrences in a given
 column(data type is names)


  Despite a long search on the archives, I couldn't find how to do
  this.
  Thanks in advance for what is likely a simple issue.
 
  I have a data set where the first column is name (i.e., 'Joe Smith',
  'Jane Doe', etc). The following columns are data associated with
  that
  person. I have many people with multiple rows. What I want is to get
  a
  new data frame out with only the people who have more than x
  occurrences in the first column.
 
  Here's what I've done, that's not working:
 
  Let's call my old data.frame all.data
 
  table(all.data$names)10
 
  I get a list of names and TRUE/FALSE values. I then want to make a
  list of the TRUEs and pass that to some subset type command like
 
  dup.names=table(all.data$names)10
 
  new.data=(all.data[all.data$names==dup.names,])
 
  That's not working because the dimensions are wrong (I think). But
  even when I tried to do part of it manually (to troubleshoot) like
  this
 
  dup.names=c('Joe Smith','Jane Doe','etc')
 
  I got warnings and it didn't work correctly. There must be a simple
  way to do this that I'm just not seeing. Thanks.
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 


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



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


Re: [R] Freeman-Tukey arcsine transformation

2007-03-13 Thread Peter Dalgaard
Peter Dalgaard wrote:
 Bos, Roger wrote:
   
 I'm curious what this transformation does, but I am not curious enough to 
 pay $14 to find out.  Someone once told me that the arcsine was a good way 
 to transform data and make it more 'normal'.  I am wondering if this is an 
 improved method.  Anyone know of a free reference?

  
   
 
 Well, a paper copy of the American Statistician (1978) would be free in 
 some sense

 In the meantime I got detached from JSTOR (i.e., I went home), and I'm 
 not prepared to jump through the relevant hoops for remote access at 
 this point, but AFAIR it was a relatively trivial version of the simple 
 arcsine transform, something like replacing asin(r/n) with the average 
 of asin(r/(n+1)) and asin((r+1)/(n+1)). The point of the paper is that 
 you can invert explicitly for r/n if n is known.

   
Well, except for a couple of sqrt() it seems
 /The American Statistician/, Vol. 32, No. 4. (Nov., 1978),
 p. 138. 


 Stable URL:
 
 http://links.jstor.org/sici?sici=0003-1305%28197811%2932%3A4%3C138%3ATIOTFD%3E2.0.CO%3B2-Z


 

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


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


Re: [R] Freeman-Tukey arcsine transformation

2007-03-13 Thread Inman, Brant A. M.D.

The point of the given transformation is not so much for normality as it
is for variance stabilization.  The variance of the Freeman-Tukey
transform depends only on the denominator of the proportion in
question...something that can be used to advantage. 


Brant

-Original Message-
From: Peter Dalgaard [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 13, 2007 3:36 PM
To: Bos, Roger
Cc: Inman, Brant A. M.D.; r-help@stat.math.ethz.ch
Subject: Re: [R] Freeman-Tukey arcsine transformation

Peter Dalgaard wrote:
 Bos, Roger wrote:
   
 I'm curious what this transformation does, but I am not curious
enough to pay $14 to find out.  Someone once told me that the arcsine
was a good way to transform data and make it more 'normal'.  I am
wondering if this is an improved method.  Anyone know of a free
reference?

  
   
 
 Well, a paper copy of the American Statistician (1978) would be free
in 
 some sense

 In the meantime I got detached from JSTOR (i.e., I went home), and I'm

 not prepared to jump through the relevant hoops for remote access at 
 this point, but AFAIR it was a relatively trivial version of the
simple 
 arcsine transform, something like replacing asin(r/n) with the average

 of asin(r/(n+1)) and asin((r+1)/(n+1)). The point of the paper is that

 you can invert explicitly for r/n if n is known.

   
Well, except for a couple of sqrt() it seems
 /The American Statistician/, Vol. 32, No. 4. (Nov.,
1978),
 p. 138. 


 Stable URL:

http://links.jstor.org/sici?sici=0003-1305%28197811%2932%3A4%3C138%3ATIO
TFD%3E2.0.CO%3B2-Z


 

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


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


Re: [R] inconsistent behaviour of add1 and drop1 with a weighted linear model

2007-03-13 Thread Duncan Murdoch
On 3/13/2007 3:14 PM, hadley wickham wrote:
 On 3/13/07, Peter Dalgaard [EMAIL PROTECTED] wrote:
 Jenny Hodgson wrote:
 I was using Version 2.3.1 for Windows (binary download version). Guess I
 should be using the latest version, (but the reason is I'm writing up my
 PhD and I thought my results would be more 'repeatable' if I didn't keep
 changing my version of the software, I didn't really think there would
 be any glitches as big as this). Sorry if this is a waste of your time.
 And thanks very much for replying so quickly.

 Jenny


 Always a good idea to check the NEWS file:

 o   add1.lm() had been broken by other changes for weighted fits.
 
 Yes, but a little impractical.  Has any one ever considered a standard
 for the news file so changes could be extracted and included in online
 documentation somewhere?

It's in a structured format, and is online.  The readNEWS() function can
read it.  It would be nice if someone would contribute a more friendly
reader...

Try

readNEWS(url(http://cran.r-project.org/bin/windows/base/NEWS.R-2.5.0dev;),
chop=keepAll)[[c(2.5,2.5.0,BUG FIXES)]]

for the unfriendly but informative version.

Duncan Murdoch

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


Re: [R] Adding bars to the right of existing ones using barplot

2007-03-13 Thread Marc Schwartz
On Tue, 2007-03-13 at 15:34 -0400, Jason Horn wrote:
 I'm trying to create a barplot that has two sets of data next to each  
 other.  I'm using barplot with the add=TRUE option, but this simply  
 adds the second dataset on top of the first, obscuring it.  How do I  
 add the new data to the right on the existing barplot so that both  
 sets are visible?  I've been playing with all sorts of option and  
 reading the list archives with no luck.
 
 Thank you anyone who has the answer.
 
 - Jason

You might want to take note of the 'space' argument in ?barplot:

 a - 1:3
 b - 4:6

 # concatenate the two vectors and specify
 # that the space before the 4th bar should be
 # wider

 barplot(c(a, b), space = c(1, 1, 1, 3, 1, 1))

Also take note that barplot() returns the bar midpoints, which can be
helpful if you want to add any additional annotation to the plot.  See
the examples in ?barplot.

HTH,

Marc Schwartz

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


Re: [R] reading BMP into R

2007-03-13 Thread Michael Sumner
Another way:

require(sp)
require(rgdal)

library(rgdal)

## read using one of the many GDAL drivers
d - readGDAL(im.bmp)
summary(d)

## map colours for RGB and display
col - SGDF2PCT(d)
d$idx - col$idx
image(d, idx, col = col$ct)

## Available drivers:
gdalDrivers()



Milton Cezar Ribeiro wrote:
 / Hi R-gurus
// // How can I read my bmp files into R?
// // Kind regards,
// // // miltinho
// Brazil /
 / /

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


[R] lme4 and mcmcamp

2007-03-13 Thread estrain


Dear R users
I am trying to obtain p-values for (quasi)poisson lmer models, using
Markov-chain Monte Carlo sampling and the command summary.

 My problems is that p values derived from both these methods are
totally different. My question is
(1) there a bug in my code and


(2) How can I proceed, left with these uncertainties in the estimations of
 the p-values?

 Below is the corresponding R code with some output:
 ##
 fit-lmer(End~Treatment+offset(log(Area))+(1|Site/Treatment), family=poisson

 ## Results
 summary(fit)

AIC BIC loglik deviance
28.92 35.99 -8.46 16.92
Random effects

Groups NameVarianceStd dev.
Treatment * Site Intercept  5e-102.2361e-05
SiteIntercept  5e-10   2.2361e-05


number of obs 24 groups Treatment*Site 8 and Site 2

Fixed effects

 Estimate   Std error  z value   P
Intercept -3.8290   0.4995  -7.666   1.77e-14
Treatment 2 3.7970 0.505  7.516 5.51e-14

Treatment 3 0.2409 9.6704 0.359 0.719 Treatment 4 -0.2483 0.8661 -0.287 0.774

Correlation of fixed effects

Intra T2 T3
T2 -0.989
T3 -0.745 0.737
T4 -0.577 0.570 0.430  

 The p-values from mcmc are:

mcmcpvalue-function(samp)
{
std-backsolve(chol(var(samp)),
cbind(0,t(samp))-colMeans(samp),
transpose=TRUE)
sqdist-colSums(std*std)
sum(sqdist[-1]sqdist[1]/nrow(samp)
}

fitSI-mcmcsamp(fit,5)
library(coda)
HPDinterval(fitSI)

   lowerupper


Intercept -4.0778905 -3.1366836
Treatment2 3.4455972 4.3196598
Treatment 3 0.399302 1.287747
Treatment 4 -1.7898933 -0.2980325
log(Treatment*Site.(in)) -22.2198233 -19.7342530 
log(Site.(In)) -28.7857601 -23.0952939

mcmcpvalue(as.Matrix(fitSI[,1]))
etc

Intecept 0
Treatment 2 0
Treatment 3 0.0075
Treatment 4 0.00758
log(Treatment*Site.(in)) 0
log(Site.(In)) 0

Any help in explaining why these two results are completely different
would be much appreciated. I have tried the example and read all of the posts.

Cheers
Beth

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


Re: [R] multiplying matrix by vector of times

2007-03-13 Thread Gad Abraham
 Thanks for the tip about the empty vector, I ever knew you could do that. I
 just have one problem,
 
 Lets say Q is a 2x2 matrix
  p is a 1x2 matrix
  q is a 2x1 matrix
  y is vector of times, say y = c(5, 10)
 
 How do I multiply Q by each time y[i]?
 
 I would like to get the answer to the equation
 
 loglik[i] - log(p %*% expm(Q * y[i]) %*% q)
 
 Where first y=5 and then y=10 so that the answers to loglik for each i are
 put into the empty vector.
 
 I'm sure that I am missing something fairly obvious here but can't put my
 finger on it.

That's just what the code in my last message is doing:
iterating over the y vector, multiplying Q by each y[i], and storing the 
result in a different cell of loglik.

So you're not multiplying Q by a vector y, but Q by a scalar y[i].

Have a look at the R Introduction at 
http://cran.r-project.org/doc/manuals/R-intro.html,
especially section 2.

-- 
Gad Abraham
Department of Mathematics and Statistics
The University of Melbourne
Parkville 3010, Victoria, Australia
email: [EMAIL PROTECTED]
web: http://www.ms.unimelb.edu.au/~gabraham

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


[R] Sweave question: prevent expansion of unevaluated reused code chunk

2007-03-13 Thread Kevin R. Coombes
Hi,

Consider the following (much simplified) Sweave example:

--

First, we set the value of $x$:
chunk1,eval=FALSE=
x - 1
@

Then we set the value of $y$:
chunk2,eval=FALSE=
y - 2
@

Thus, the overall algorithm has this structure:
combined,eval=FALSE=
chunk1
chunk2
@

justDoIt,echo=FALSE=
combined
@

---

I'd like to be able to do something like this, where the combined 
chunk prints out in the final LaTeX document essentially verbatim.  In 
particular, I want to see the chunk1 unexpanded in that block, 
since this gives me a nice conceptual overview of the algorithm. (Of 
courser, this is more useful when chunk1 and chunk2 are much longer than 
they are in this example)

Is there an option that allows me to get this behavior?

Thanks,
Kevin

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


[R] AR(1) and gls

2007-03-13 Thread Kate Stark
Hi there,

I am using gls from the nlme library to fit an AR(1) regression model.
 
I am wondering if (and how) I can separate the auto-correlated and random
components of the residuals? Id like to be able to plot the fitted values +
the autocorrelated error (i.e. phi * resid(t-1)), to compare with the
observed values.

I am also wondering how I might go about calculating confidence (or
prediction) intervals around these new fitted values (i.e. fitted new =
fitted + autocorrelated error component)?

Thanks in advance,

Kate

==
Kate Stark  |  PhD candidate
Institute of Antarctic  Southern Ocean Studies 
Tasmanian Aquaculture  Fisheries Institute
University of Tasmania.

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


[R] Poisson rate test

2007-03-13 Thread Luis Salasar
Hi,

I would like to know how to perform a Poisson rate test in R, both to one 
sample and two sample. I have looked for it in CRAN homepage, but i couldn´t 
find it. Thanks,

Luis Ernesto.

 __


[[alternative HTML version deleted]]

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


Re: [R] Rcmd and memory

2007-03-13 Thread jim holtman
Your output is probably buffered. Uncheck the buffered output flag on the
Misc tab ( I am assuming that your are running under Windows, but you did
not say).  Are you paging because you have used up all your available
physical memory?  This would cause things to slow down.  Use the performance
tools (perfmon if Windows) to see you are out of physical memory and paging.

On 3/13/07, Nair, Murlidharan T [EMAIL PROTECTED] wrote:

 I am running a recursive feature selection wrapper on svm for a large
 data set. The routine gets progressively slower. I am deleting the
 objects not required. Is there anything else you advise me look for?

 I tried running it from the command line but it does not print anything
 on the screen. I did not specify any output file and was expecting the
 screen to be the default. Can any one help me with this problem? Also
 does running from the command line help in executing it faster?

 Thanks ../Murli








[[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 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?

[[alternative HTML version deleted]]

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


Re: [R] inconsistent behaviour of add1 and drop1 with a weighted linear model

2007-03-13 Thread hadley wickham
On 3/13/07, Duncan Murdoch [EMAIL PROTECTED] wrote:
 On 3/13/2007 3:14 PM, hadley wickham wrote:
  On 3/13/07, Peter Dalgaard [EMAIL PROTECTED] wrote:
  Jenny Hodgson wrote:
  I was using Version 2.3.1 for Windows (binary download version). Guess I
  should be using the latest version, (but the reason is I'm writing up my
  PhD and I thought my results would be more 'repeatable' if I didn't keep
  changing my version of the software, I didn't really think there would
  be any glitches as big as this). Sorry if this is a waste of your time.
  And thanks very much for replying so quickly.
 
  Jenny
 
 
  Always a good idea to check the NEWS file:
 
  o   add1.lm() had been broken by other changes for weighted fits.
 
  Yes, but a little impractical.  Has any one ever considered a standard
  for the news file so changes could be extracted and included in online
  documentation somewhere?

 It's in a structured format, and is online.  The readNEWS() function can
 read it.  It would be nice if someone would contribute a more friendly
 reader...

 Try

 readNEWS(url(http://cran.r-project.org/bin/windows/base/NEWS.R-2.5.0dev;),
 chop=keepAll)[[c(2.5,2.5.0,BUG FIXES)]]

 for the unfriendly but informative version.

Oh, that's neat.  One thing that would be very useful would be to
figure out what (if any) functions an news item refers to.  A grep
against all function names in base packages wouldn't be too hard to
do.

I'll think about it, and how to render it nicely in a webpage.

Hadley

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


Re: [R] Sweave question: prevent expansion of unevaluated reused code chunk

2007-03-13 Thread Seth Falcon
Kevin R. Coombes [EMAIL PROTECTED] writes:

 Hi,

 Consider the following (much simplified) Sweave example:

 --

 First, we set the value of $x$:
 chunk1,eval=FALSE=
 x - 1
 @

 Then we set the value of $y$:
 chunk2,eval=FALSE=
 y - 2
 @

 Thus, the overall algorithm has this structure:
 combined,eval=FALSE=
 chunk1
 chunk2
 @

 justDoIt,echo=FALSE=
 combined
 @

 ---

 I'd like to be able to do something like this, where the combined 
 chunk prints out in the final LaTeX document essentially verbatim.  In 
 particular, I want to see the chunk1 unexpanded in that block, 
 since this gives me a nice conceptual overview of the algorithm. (Of 
 courser, this is more useful when chunk1 and chunk2 are much longer than 
 they are in this example)

 Is there an option that allows me to get this behavior?

Maybe I'm not understanding what it is you want, but why not:

\begin{verbatim}
chunk1
chunk2
\end{verbatim}

What does putting this in an unevaluated chunk buy you?  The
chunkName markers are an internal detail of the document and so
must of the time these never appear in the rendered output.  Even in
your example, won't it be confusing that chunk1 and chunk2
won't have appeared in labels earlier in the rendered document?

+ seth

-- 
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
http://bioconductor.org

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


Re: [R] AR(1) and gls

2007-03-13 Thread Gad Abraham
Kate Stark wrote:
 Hi there,
 
 I am using gls from the nlme library to fit an AR(1) regression model.
  
 I am wondering if (and how) I can separate the auto-correlated and random
 components of the residuals? Id like to be able to plot the fitted values +
 the autocorrelated error (i.e. phi * resid(t-1)), to compare with the
 observed values.
 
 I am also wondering how I might go about calculating confidence (or
 prediction) intervals around these new fitted values (i.e. fitted new =
 fitted + autocorrelated error component)?

Since no one else has answered, I'll put in my 2c.

Why not use the arima() function?

Once you've fitted the AR(1) to it, you can extract the coefficients and 
the residuals, and look at the ACF and PACF of the residuals to see 
whether they are autocorrelated or not. tsdiag() is also useful. If an 
AR(1) captures all of the autocorrelation in the data, then the 
residuals will be iid. arima() also gives you standard errors for each 
estimated coefficient.

To get a prediction from the model, you can use arima.sim(). One simple 
way to get prediction intervals about the point prediction is to sample 
by calling arima.sim() repeatedly and then calculate quantiles.

-- 
Gad Abraham
Department of Mathematics and Statistics
The University of Melbourne
Parkville 3010, Victoria, Australia
email: [EMAIL PROTECTED]
web: http://www.ms.unimelb.edu.au/~gabraham

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


Re: [R] inconsistent behaviour of add1 and drop1 with a weighted linear model

2007-03-13 Thread Duncan Murdoch
On 3/13/2007 7:46 PM, hadley wickham wrote:
 On 3/13/07, Duncan Murdoch [EMAIL PROTECTED] wrote:
 On 3/13/2007 3:14 PM, hadley wickham wrote:
 On 3/13/07, Peter Dalgaard [EMAIL PROTECTED] wrote:
 Jenny Hodgson wrote:
 I was using Version 2.3.1 for Windows (binary download version). Guess I
 should be using the latest version, (but the reason is I'm writing up my
 PhD and I thought my results would be more 'repeatable' if I didn't keep
 changing my version of the software, I didn't really think there would
 be any glitches as big as this). Sorry if this is a waste of your time.
 And thanks very much for replying so quickly.

 Jenny


 Always a good idea to check the NEWS file:

 o   add1.lm() had been broken by other changes for weighted fits.
 Yes, but a little impractical.  Has any one ever considered a standard
 for the news file so changes could be extracted and included in online
 documentation somewhere?
 It's in a structured format, and is online.  The readNEWS() function can
 read it.  It would be nice if someone would contribute a more friendly
 reader...

 Try

 readNEWS(url(http://cran.r-project.org/bin/windows/base/NEWS.R-2.5.0dev;),
 chop=keepAll)[[c(2.5,2.5.0,BUG FIXES)]]

 for the unfriendly but informative version.
 
 Oh, that's neat.  One thing that would be very useful would be to
 figure out what (if any) functions an news item refers to.  A grep
 against all function names in base packages wouldn't be too hard to
 do.

I think we are reasonably consistent in referring to functions with 
parens following, e.g. add1.lm() above, so a search for patterns like 
that should find most of them.

Duncan Murdoch

 
 I'll think about it, and how to render it nicely in a webpage.
 
 Hadley

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


Re: [R] Sweave question: prevent expansion of unevaluated reused code chunk

2007-03-13 Thread Kevin R. Coombes
[1] In the example I presented, you're right; I can just use a verbatim 
environment. In the following more complicated example

combined,eval=FALSE
if (some.condition) {
chunk1
} else {
chunk2
}
@

I would still want to be able to see the outline of what is going on, 
and a verbatim environment wouldn't work.

[2] You are also correct that there is no advantage if I just call them 
chunk1 and chunk2. But if I call them something more interesting, 
like perform.quantile.normalization or truncate.and.log.transform,
then I can use this structure to explain the algorithm at a higher 
level.  If you go back to Knuth's original literate programming 
examples, this is exactly how he presents his examples. For instance, on 
page 104 of the Literate Programming book, he has

Program to print the first thousand prime numbers 2 =
program print_primes(output);
   const m = 1000; other constants of the program 5
   var Variables of the program 4
 begin Print the first m prime numbers 3;
 end.

Of course, he's writing pascal instead of R. But the stuff between  
are the program chunks, and he is displaying them without expanding the 
chunks. And, as a result, You get to see a high-level picture of the 
algorithm, keeping the details somewhere else.

Since I'm looking at the results of weave in Knuth's example, I don't 
know if he is using a verbatim environment or is automatically 
generating this using his implementation of weave for teX and pascal

But that's the idea.

Kevin

Seth Falcon wrote:
 Kevin R. Coombes [EMAIL PROTECTED] writes:
 
 Hi,

 Consider the following (much simplified) Sweave example:

 --

 First, we set the value of $x$:
 chunk1,eval=FALSE=
 x - 1
 @

 Then we set the value of $y$:
 chunk2,eval=FALSE=
 y - 2
 @

 Thus, the overall algorithm has this structure:
 combined,eval=FALSE=
 chunk1
 chunk2
 @

 justDoIt,echo=FALSE=
 combined
 @

 ---

 I'd like to be able to do something like this, where the combined 
 chunk prints out in the final LaTeX document essentially verbatim.  In 
 particular, I want to see the chunk1 unexpanded in that block, 
 since this gives me a nice conceptual overview of the algorithm. (Of 
 courser, this is more useful when chunk1 and chunk2 are much longer than 
 they are in this example)

 Is there an option that allows me to get this behavior?
 
 Maybe I'm not understanding what it is you want, but why not:
 
 \begin{verbatim}
 chunk1
 chunk2
 \end{verbatim}
 
 What does putting this in an unevaluated chunk buy you?  The
 chunkName markers are an internal detail of the document and so
 must of the time these never appear in the rendered output.  Even in
 your example, won't it be confusing that chunk1 and chunk2
 won't have appeared in labels earlier in the rendered document?
 
 + seth


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


Re: [R] Sweave question: prevent expansion of unevaluated reused code chunk

2007-03-13 Thread Berwin A Turlach
G'day Kevin,

On Tue, 13 Mar 2007 20:18:11 -0500
Kevin R. Coombes [EMAIL PROTECTED] wrote:

 [1] In the example I presented, you're right; I can just use a
 verbatim environment. In the following more complicated example [...]
 I would still want to be able to see the outline of what is going on, 
 and a verbatim environment wouldn't work.

If you want to have a literate programming environment in R, in
particular one where you can refer to code chunks that are only defined
later in the document, then I would investigate the package relax by
Peter Wolf.  See:

http://www.wiwi.uni-bielefeld.de/~wolf/software/relax/relax.html

And, for an example output just like you what you want:

http://www.wiwi.uni-bielefeld.de/~wolf/software/relax/hello-world.pdf

HTH.

Cheers,

Berwin

=== Full address =
Berwin A TurlachTel.: +65 6515 4416 (secr)
Dept of Statistics and Applied Probability+65 6515 6650 (self)
Faculty of Science  FAX : +65 6872 3919   
National University of Singapore 
6 Science Drive 2, Blk S16, Level 7  e-mail: [EMAIL PROTECTED]
Singapore 117546http://www.stat.nus.edu.sg/~statba

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


[R] Model matrix with redundant columns included

2007-03-13 Thread Hong Ooi

___


Hello,

Normally when you call model.matrix, you get a matrix that has
aliased/redundant columns deleted. For example:

 m - expand.grid(a=factor(1:3), b=factor(1:3))
 model.matrix(~a + b, m)
  (Intercept) a2 a3 b2 b3
1   1  0  0  0  0
2   1  1  0  0  0
3   1  0  1  0  0
4   1  0  0  1  0
5   1  1  0  1  0
6   1  0  1  1  0
7   1  0  0  0  1
8   1  1  0  0  1
9   1  0  1  0  1
attr(,assign)
[1] 0 1 1 2 2
attr(,contrasts)
attr(,contrasts)$a
[1] contr.treatment

attr(,contrasts)$b
[1] contr.treatment

The result is a matrix with 5 columns including the intercept.

However, for my purposes I need a matrix that includes all columns,
including those that would normally be redundant. Is there any way to do
this? For the example, this would be something like

  a1 a2 a3 b1 b2 b3
1  1  0  0  1  0  0
2  0  1  0  1  0  0
3  0  0  1  1  0  0
4  1  0  0  0  1  0
5  0  1  0  0  1  0
6  0  0  1  0  1  0
7  1  0  0  0  0  1
8  0  1  0  0  0  1
9  0  0  1  0  0  1

Including -1 as part of the model formula removes the intercept and adds
the column for the base level of the first variable, but not the rest.

Thanks,


-- 
Hong Ooi
Senior Research Analyst, IAG Limited
388 George St, Sydney NSW 2000
+61 (2) 9292 1566

___

The information transmitted in this message and its attachme...{{dropped}}

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


Re: [R] Model matrix with redundant columns included

2007-03-13 Thread Marc Schwartz
On Wed, 2007-03-14 at 14:57 +1100, Hong Ooi wrote:

 Hello,
 
 Normally when you call model.matrix, you get a matrix that has
 aliased/redundant columns deleted. For example:
 
  m - expand.grid(a=factor(1:3), b=factor(1:3))
  model.matrix(~a + b, m)
   (Intercept) a2 a3 b2 b3
 1   1  0  0  0  0
 2   1  1  0  0  0
 3   1  0  1  0  0
 4   1  0  0  1  0
 5   1  1  0  1  0
 6   1  0  1  1  0
 7   1  0  0  0  1
 8   1  1  0  0  1
 9   1  0  1  0  1
 attr(,assign)
 [1] 0 1 1 2 2
 attr(,contrasts)
 attr(,contrasts)$a
 [1] contr.treatment
 
 attr(,contrasts)$b
 [1] contr.treatment
 
 The result is a matrix with 5 columns including the intercept.
 
 However, for my purposes I need a matrix that includes all columns,
 including those that would normally be redundant. Is there any way to do
 this? For the example, this would be something like
 
   a1 a2 a3 b1 b2 b3
 1  1  0  0  1  0  0
 2  0  1  0  1  0  0
 3  0  0  1  1  0  0
 4  1  0  0  0  1  0
 5  0  1  0  0  1  0
 6  0  0  1  0  1  0
 7  1  0  0  0  0  1
 8  0  1  0  0  0  1
 9  0  0  1  0  0  1
 
 Including -1 as part of the model formula removes the intercept and adds
 the column for the base level of the first variable, but not the rest.
 
 Thanks,


There may be a better way, but this seems to work:

 m
  a b
1 1 1
2 2 1
3 3 1
4 1 2
5 2 2
6 3 2
7 1 3
8 2 3
9 3 3

MAT - do.call(cbind, lapply(m, function(x) model.matrix(~ x - 1)))

 MAT
  x1 x2 x3 x1 x2 x3
1  1  0  0  1  0  0
2  0  1  0  1  0  0
3  0  0  1  1  0  0
4  1  0  0  0  1  0
5  0  1  0  0  1  0
6  0  0  1  0  1  0
7  1  0  0  0  0  1
8  0  1  0  0  0  1
9  0  0  1  0  0  1

colnames(MAT) - names(unlist(lapply(m, levels)))
 
 MAT
  a1 a2 a3 b1 b2 b3
1  1  0  0  1  0  0
2  0  1  0  1  0  0
3  0  0  1  1  0  0
4  1  0  0  0  1  0
5  0  1  0  0  1  0
6  0  0  1  0  1  0
7  1  0  0  0  0  1
8  0  1  0  0  0  1
9  0  0  1  0  0  1


You can cbind() the (Intercept) column back in if you require.

HTH,

Marc Schwartz

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


[R] about bootstrapping

2007-03-13 Thread Ray Cheung
Dear All,

I've a 10 by 5 data frame like this

set.seed(1001)
a - rnorm(10)
b - rnorm(10)
c - rnorm(10)
d - rnorm(10)
e - rnorm(10)
A - cbind(a,b,c,d,e)

Each row is one datum. I want to resample within A[,5]. Fit the regression
lines lm(A[,5] ~ A[,1] + A[,2]) and lm(A[,5] ~ A[,3] + A[,4]) to each
bootstrap sample. I don't know how to write the statistics part. Can anybody
help me? Thank you very much.

Regards,

Ray

[[alternative HTML version deleted]]

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


[R] Need suggestion regarding analysis of high dimensional data

2007-03-13 Thread E Cell
Hi,
 I have two matrix of high dimension representing data for two classes. The 
matrix are of 1500 columns, each column represent one feature.
 
 Is it possible to extract the discriminating feature and non-discriminating 
feature by applying lda from MASS library. Or is there any other library which 
can do the same.
 
 Regards
 

-
 Here’s a new way to find what you're looking for - Yahoo! Answers 
[[alternative HTML version deleted]]

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


[R] aic for lrm

2007-03-13 Thread Robert Rodick
I cannot seem to get the aic or extractaic call to work with multinomial 
logistic regression models.

Here is what I am doing:
library('Design')
lrm1-lrm(r1~p1)
#where p1 is multinomial and r1 is binomial

library('MASS')
aic(lrm1)
Error in if (fam %in% c(gaussian, Gamma, inverse.gaussian)) p - p +  
:
argument is of length zero

also tried extract.aic and others to no avail
I was able to get aic to give what looked to be reasonable results with nnet 
functions like multinom -- am i missing basic statistics knowledge here or 
is there a problem with my code? thanks

_

Intro*Terms

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