[R] Linear model and time series

2007-03-30 Thread Andre Jung
Dear all,

I have three timeseries Uts, Vts, Wts. The relation between the time
series can be expressed as

Uts = x Vts + y Wts + residuals

How would I feed this to lm() to evaluate the unknowns x and y?

Thanks,
andre

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] faster computation of cumulative multinomial distribution

2007-03-30 Thread Alberto Vieira Ferreira Monteiro
Theo Borm wrote:
>
> Think of a sort of "power roulette", played with 58 balls
> simultaneously, with a wheel containing 36 red/black slots of unequal
> size, and 1 green slot. I need to calculate the probability that each of
> the 36 red/black slots contains at least one ball.
>
Ah, now we come to a more precise problem :-)

> I have a hunch that it won't work as my p vector typically contains
> values like:
>
> p<-c(0.99, 0.005, 0.003, 0.001, 0.0005, 0.0003, 0.0001, 0.5,
> 0.3, 0.2).
>
So you should expect that only 1/5 will be in the low-prob
hole in the average?

> keeping in mind that the first "green" slot (0.99) represents my
> "remainder" class (which may be empty), and calculating the probability
> that with 9 trials I get exactly one in each of the other  slots:
>
> p=0.005*0.003*0.001*0.0005*0.0003*0.0001*0.5*0.3*0.2*9!
>
> =~ 2.45*10^-27
>
> so, I'm looking for very rare events.
>
Indeed you are!

> to calculate this figure even marginally /accurately/ with a monte carlo
> simulation would require in well excess of 4*10^26 iterations.
>
Hmmm That's right. No way to do a Monte Carlo here!

Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Trouble installing package 'sp' in R 2.4.1

2007-03-30 Thread Duncan Murdoch
On 3/30/2007 3:37 PM, Roger Bivand wrote:
> On Fri, 30 Mar 2007, Duncan Murdoch wrote:
> 
>> On 3/30/2007 2:39 PM, Gaurav Ghosh wrote:
>>> Hi all,
>>>
>>> I just installed R 2.4.1 and tried to install the package 'sp' working down 
>>> from the 'Packages' menu in the R GUI.  The package would not install and I 
>>> got the following message:
>>>
>>> "trying URL 
>>> 'http://cran.us.r-project.org/bin/windows/contrib/2.4/sp_0.9-10.zip'
>>> Error in download.file(url, destfile, method, mode = "wb") : 
>>> cannot open URL 
>>> 'http://cran.us.r-project.org/bin/windows/contrib/2.4/sp_0.9-10.zip'
>>> In addition: Warning message:
>>> cannot open: HTTP status was '404 Not Found' 
>>> Warning in download.packages(pkgs, destdir = tmpd, available = available,  
>>> : 
>>>  download of package 'sp' failed"
>>>
>>> I tried to find the installation file "sp_0.9-10.zip" through the 
>>> CRAN website, but was unable to do so.  So I was wondering if there was 
>>> some other way to get this package I need.  Or perhaps  there might be some 
>>> problem with the website itself.
>>
>> You didn't say which mirror you were using, but it looks like a problem 
>> there.  I just tried from one of the Canadian mirrors and there was no 
>> problem finding the package.
> 
>>From HTTP, the mirror mentioned inline http://cran.us.r-project.org/ has 
> problems, is well behind on versions in the project pages, and
> 
> http://cran.us.r-project.org/bin/windows/contrib/2.4/
> 
> has no sp package at all. The last check summary is dated 2007-03-16.
> 
> Please try another mirror; if anyone could find out what is the matter 
> with the mirror, and get it corrected, that would be welcome.

I've let them know they're a couple of weeks behind on updates.

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] Using split() several times in a row?

2007-03-30 Thread Stephen Tucker
Hi Sergey,

I believe the code below should get you close to want you want.

For dates, I usually store them as "POSIXct" classes in data frames, but
according to Gabor Grothendieck and Thomas Petzoldt's R Help Desk article
, I should probably be
using "chron" date and times...

Nonetheless, POSIXct casses are what I know so I can show you that to get the
month out of your column (replace "8.29.97" with your variable), you can do
the following:

month = format(strptime("8.29.97",format="%m.%d.%y"),format="%m")

Or,
month = as.data.frame(strsplit("8.29.97","\\."))[1,]

In any case, here is a code, in which I follow a series of function
application and definitions (which effectively includes successive
application of split() and lapply().

Best regards,

ST

# define data (I just made this up)
df <-
data.frame(month=as.character(rep(1:3,each=30)),fac=factor(rep(1:2,each=15)),
data1=round(runif(90),2),
data2=round(runif(90),2))

# define functions to split the data and another
# to get statistics
doSplits <- function(df) {
  unlist(lapply(split(df,df$month),function(x)
split(x,x$fac)),recursive=FALSE)
}
getStats <- function(x,f) {
  return(as.data.frame(lapply(x[unlist(lapply(x,mode))=="numeric" &
unlist(lapply(x,class))!="factor"],f)))
}
# create a matrix of data, means, and standard deviations
listMatrix <- cbind(Data=doSplits(df),
   Means=lapply(doSplits(df),getStats,mean),
   SDs=lapply(doSplits(df),getStats,sd))

# function to subtract means and divide by standard deviations
transformData <- function(x) {
  newdata <- x$Data
  matchedNames <- match(names(x$Means),names(x$Data))
  newdata[matchedNames] <-
sweep(sweep(data.matrix(x$Data[matchedNames]),2,unlist(x$Means),"-"),
  2,unlist(x$SDs),"/")
  return(newdata)
}
# apply to data
newDF <- lapply(as.data.frame(t(listMatrix)),transformData)

# Defind Fold function
Fold <- function(f, x, L) for(e in L) x <- f(x, e)
# Apply this to the data
finalData <- Fold(rbind,vector(),newDF)






--- Sergey Goriatchev <[EMAIL PROTECTED]> wrote:

> Hi, fellow R users.
> 
> I have a question about sapply and split combination.
> 
> I have a big dataframe (4 observations, 21 variables). First
> variable (factor) is "date" and it is in format "8.29.97", that is, I
> have monthly data. Second variable (also factor) has levels 1 to 6
> (fractiles 1 to 5 and missing value with code 6). The other 19
> variables are numeric.
> For each month I have several hunder observations of 19 numeric and 1
> factor.
> 
> I am normalizing the numeric variables by dividing val1 by val2, where:
> 
> val1: (for each month, for each numeric variable) difference between
> mean of ith numeric variable in fractile 1, and mean of ith numeric
> variable in fractile 5.
> 
> val2: (for each month, for each numeric variable) standard deviation
> for ith numeric variable.
> 
> Basically, as far as I understand, I need to use split() function several
> times.
> To calculate val1 I need to use split() twice - first to split by
> month and then split by fractile. Is this even possible to do (since
> after first application of split() I get a list)??
> 
> Is there a smart way to perform this normalization computation?
> 
> My knowledge of R is not so advanced, but I need to know an efficient
> way to perform calculations of this kind.
> 
> Would really appreciate some help from experienced R users!
> 
> Regards,
> S
> 
> -- 
> Laziness is nothing more than the habit of resting before you get tired.
> - Jules Renard (writer)
> 
> Experience is one thing you can't get for nothing.
> - Oscar Wilde (writer)
> 
> When you are finished changing, you're finished.
> - Benjamin Franklin (Diplomat)
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Wikibooks

2007-03-30 Thread Duncan Murdoch
On 3/30/2007 5:05 PM, Peter Dalgaard wrote:
> Deepayan Sarkar wrote:
>> On 3/30/07, Sarah Goslee <[EMAIL PROTECTED]> wrote:
>>   
>>> On 3/30/07, Alberto Monteiro <[EMAIL PROTECTED]> wrote:
>>> 
 Deepayan Sarkar wrote:
   
> I was just looking at this page, and it makes me curious: what gives
> anyone the right to take someone else's mailing list post and include
> that in a Wiki?
>
> 
 Thinks there were posted to public mailing lists are freely
 copied and distributed. It's a scary thought; I may have posted
 things in 10 or 12 years ago that might cause me problems today,
 but I was pretty aware that I was posting to the whole world.
   
>> There's a difference between public archiving and copying.
>>
>>   
>>> It's not that simple. Dealing with international contributors it's even 
>>> worse.
>>> Under US law (the only one I'm familiar with), the author of a mailing list
>>> post or any other written work _automatically holds copyright_ to that
>>> post (although not to the ideas contained therein, but to that particular
>>> description of the ideas). (Of course, if the ideas are original to the 
>>> author,
>>> it's good form to acknowledge that regardless of whether the exact words
>>> are used).
>>> 
>> I believe this is true for all countries that are signatory to the
>> Berne convention (which is pretty much all countries [1]). The US in
>> fact was one of the later ones to get into it, before which you had to
>> explicitly copyright things if you wanted copyright.
>>
>> -Deepayan
>>
>> [1] http://upload.wikimedia.org/wikipedia/commons/6/6c/Berne_Convention.png
>>   
> Yes. It's pretty obvious that by posting you agree to publication, and 
> presumably also to archiving.  Think "Letters to the Editor". However, 
> you do not agree to just any republication (in particular not to 
> commercial usage -- say someone wants to publish the collected works of 
> a particularly prolific correspondent, without  paying and obtaining 
> consent). 
> 
> Interestingly, BYTE magazine back in the late 80's actually ran a Best 
> of BIX column with postings from their bulletin board. I've always 
> wondered how (and whether) they handled the copyright issues.
> 
> There is a middle ground of "fair use" and the right to citation, 
> though. I certainly don't expect to be cited by everyone using code 
> snippets from one of my posts.

"Fair use" varies quite a bit from country to country.  I've no idea 
about Denmark's laws, but Canada has no "fair use" doctrine in the US 
sense, just a much more limited "fair dealing" doctrine.  Last time I 
looked Wikipedia had a pretty good description of this.

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.


[R] X11 and linux and plotting and the vertical axis

2007-03-30 Thread Leeds, Mark \(IED\)
I use R on linux and I go through exceed from a windows machine.

Depending on the amount of plots I do on a screen, sometimes the numbers
on the vertical axis
of the plots don't show up. I tried infinite of combinations of mar and
cex but nothing helps.
Yet, if instead of shooting the graphic upto the screen, I send it to a
pdf file or
a postscript file, the numbers on the vertical axis of the plots do show
up.

I've included a test.pdf file that shows the plot but the #'s show up
there and not
if I send the same plot to the screen. 

Below my version info, I've also included the output of doing par() at
the prompt in case that some of my
default settings look weird. I know next to nothing  about R graphics
but the problem 
definitely doesn't have anything to do with mar or cex though because
I've played with them pretty much the 
whole day.

If anyone knows of a thread on this or knos what needs to be changed, it
would
Be much appreciated. Thanks.


version
   _   
platform   i686-pc-linux-gnu   
arch   i686
os linux-gnu   
system i686, linux-gnu 
status 
major  2   
minor  4.0 
year   2006
month  10  
day03  
svn rev39566   
language   R   
version.string R version 2.4.0 (2006-10-03)


 par()
$xlog
[1] FALSE

$ylog
[1] FALSE

$adj
[1] 0.5

$ann
[1] TRUE

$ask
[1] FALSE

$bg
[1] "transparent"

$bty
[1] "o"

$cex
[1] 1

$cex.axis
[1] 1

$cex.lab
[1] 1

$cex.main
[1] 1.2

$cex.sub
[1] 1

$cin
[1] 0.1730130 0.1960814

$col
[1] "black"

$col.axis
[1] "black"

$col.lab
[1] "black"

$col.main
[1] "black"

$col.sub
[1] "black"

$cra
[1] 15 17

$crt
[1] 0

$csi
[1] 0.1960814

$cxy
[1] 0.02996404 0.03781139

$din
[1] 6.989727 6.989727


$err
[1] 0

$family
[1] ""

$fg
[1] "black"

$fig
[1] 0 1 0 1

$fin
[1] 6.989727 6.989727

$font
[1] 1

$font.axis
[1] 1

$font.lab
[1] 1

$font.main
[1] 2

$font.sub
[1] 1

$gamma
[1] 1

$lab
[1] 5 5 7

$las
[1] 0

$lend
[1] "round"

$lheight
[1] 1

$ljoin
[1] "round"

$lmitre
[1] 10

$lty
[1] "solid"

$lwd
[1] 1

$mai
[1] 1.15 0.803934 0.803934 0.411771

$mar
[1] 5.1 4.1 4.1 2.1



$mex
[1] 1

$mfcol
[1] 1 1

$mfg
[1] 1 1 1 1

$mfrow
[1] 1 1

$mgp
[1] 3 1 0

$mkh
[1] 0.001

$new
[1] FALSE

$oma
[1] 0 0 0 0

$omd
[1] 0 1 0 1

$omi
[1] 0 0 0 0

$pch
[1] 1

$pin
[1] 5.774022 5.185778

$plt
[1] 0.1150165 0.9410891 0.1430693 0.8849835

$ps
[1] 12

$pty
[1] "m"

$smo
[1] 1

$srt
[1] 0

$tck
[1] NA

$tcl
[1] -0.5

$usr
[1] 0 1 0 1

$xaxp
[1] 0 1 5

$xaxs
[1] "r"


$xaxt
[1] "s"

$xpd
[1] FALSE

$yaxp
[1] 0 1 5

$yaxs
[1] "r"

$yaxt
[1] "s"


This is not an offer (or solicitation of an offer) to buy/sell the 
securities/instruments mentioned or an official confirmation.  Morgan Stanley 
may deal as principal in or own or act as market maker for 
securities/instruments mentioned or may advise the issuers.  This is not 
research and is not from MS Research but it may refer to a research 
analyst/research report.  Unless indicated, these views are the author's and 
may differ from those of Morgan Stanley research or others in the Firm.  We do 
not represent this is accurate or complete and we may not update this.  Past 
performance is not indicative of future returns.  For additional information, 
research reports and important disclosures, contact me or see 
https://secure.ms.com/servlet/cls.  You should not use e-mail to request, 
authorize or effect the purchase or sale of any security or instrument, to send 
transfer instructions, or to effect any other transactions.  We cannot 
guarantee that any such requests received via e-mail will be processed in a 
timely manner.  This communication is solely for the addressee(s) and may 
contain confidential information.  We do not waive confidentiality by 
mistransmission.  Contact me if you do not wish to receive these 
communications.  In the UK, this communication is directed in the UK to those 
persons who are market counterparties or intermediate customers (as defined in 
the UK Financial Services Authority's rules).
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] faster computation of cumulative multinomial distribution

2007-03-30 Thread theo borm
Alberto Monteiro wrote:
> Theo Borm wrote:
>   
>> I have a series of /unequal/ probabilities [p1,p2,...,pk], describing
>> mutually exclusive events, and a "remainder" class with a probability
>> p0=1-p1-p2--pk, and need to calculate, for a given number of trials
>> t>=k, the combined probability that each of the classes 1...k 
>> contains at least 1 "event" (the remainder class may be empty).
>>
>> To me this reaks of a sum of multinomial distributions, and indeed, I
>> can readily calculate the correct answer for small figures t,k using 
>> a small R program.
>>
>> 
> The multinomial distribution is a sum of independent cathegorial
> distributions, so there's no such thing as a sum of multinomial
> distributions - unless the sum of multinomial distributions is
> also a multinomial distribution.
>
> Yikes. I think I am saying too much.
>
> Just look here:
> http://en.wikipedia.org/wiki/Multinomial_distribution
>   
*sorry. that should have read "sum of multinomial probabilities"

The following article (first page freely available):

A Representation for Multinomial Cumulative Distribution Functions*
Bruce Levin
/The Annals of Statistics/, Vol. 9, No. 5 (Sep., 1981), pp. 1123-1126

describes more or less what I mean, only instead of calculating

pN=pN(t,p1,p2,...,pt,a1,a2,...at) = P(n1<=a1, n2<=a2, n3<=a3,  , nt<=at)

I need to calculate
pN= P(n1>=0, n2>=1, n3>=1,  , nt>=1)
with n1+n2+n3+...+nt=total number of trials

(Note that for notational purposes I renamed my index [0...k] to Levin's
[1...t], hence category 1 represents the "remainder" class, and my
"number of trials" t becomes Levin's sum of a1+a2+a3+...+at  )

Also note  the change from "<=" to ">="
>
> But what do you want to calculate? The probabilities?
>   
I want to calculate single (compound) probability, given t mutually
exclusive and exhaustive events and k trials that the first "slot"
contains /at least/ zero events AND all the other "slots" contain at
least one event.

Think of a sort of "power roulette", played with 58 balls
simultaneously, with a wheel containing 36 red/black slots of unequal
size, and 1 green slot. I need to calculate the probability that each of
the 36 red/black slots contains at least one ball.
> I don't know what you want to do, but maybe this is the case
> where a Monte Carlo Simulation would give a fast and accurate
> result.
>   
hmmm

I have a hunch that it won't work as my p vector typically contains
values like:

p<-c(0.99, 0.005, 0.003, 0.001, 0.0005, 0.0003, 0.0001, 0.5,
0.3, 0.2).

keeping in mind that the first "green" slot (0.99) represents my
"remainder" class (which may be empty), and calculating the probability
that with 9 trials I get exactly one in each of the other  slots:
 
p=0.005*0.003*0.001*0.0005*0.0003*0.0001*0.5*0.3*0.2*9!

=~ 2.45*10^-27

so, I'm looking for very rare events.

to calculate this figure even marginally /accurately/ with a monte carlo
simulation would require in well excess of 4*10^26 iterations.


> Let's say you want to estimate some function of the outcome 
> of this multinomial. Just to fix ideas:
>
> # p - the probabilities
> p <- c(1, 2, 3, 2, 4, 4, 2, 1, 2, 3, 1, 2, 3, 4, 3, 2, 1, 2) 
> # normalize so that sum(p) = 1
> p <- p / sum(p)
> # get k
> k <- length(p)
> # number of trials, say 100
> t <- 100
> # x is the simulation for each trial. x[1] is the number of
> # times we got the thing with probability p[1], etc
> #
> # x <- rmultinom(1, k, p) # simulates 1 experiment
> #
> # f is the function that you will use to "evaluate" x
> #
> f <- function(x) {
>   return(sum(x * 1.05^-(0:(length(x)-1  # anything can come here
> }
> #
> # A Monte Carlo simulation will generate "a lot" of xs and
> # get a distribution of f(x)
> #
> # Simulate 1 xs
> x <- rmultinom(1, k, p) # takes almost zero time
> # Evaluate 1 f(x). apply(matrix, 1 (rows) or 2 (coluns), function)
> f.dist <- apply(x, 2, f)
> # analyse it
> hist(f.dist) # etc
>
>   
>> R has dbinom /and/ pbinom functions, but unfortunately only a dmultinom
>> and no pmultinom function... perhaps because there is no (known) 
>> faster way?
>>
>> 
> There's a rmultinom
>   

Thanks,


with kind regards,

Theo Borm.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 NA values

2007-03-30 Thread Charilaos Skiadas
On Mar 30, 2007, at 10:56 AM, Gavin Simpson wrote:

> This is R, there is always a way (paraphrasing an R-Helper the name of
> whom I forget just now).

Can't resist, it's one of my favorite fortunes ;)

That would be Simon 'Yoda' Blomberg:

library(fortunes)
fortune(109)

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.


Re: [R] faster computation of cumulative multinomial distribution

2007-03-30 Thread Alberto Monteiro
Theo Borm wrote:
> 
> I have a series of /unequal/ probabilities [p1,p2,...,pk], describing
> mutually exclusive events, and a "remainder" class with a probability
> p0=1-p1-p2--pk, and need to calculate, for a given number of trials
> t>=k, the combined probability that each of the classes 1...k 
> contains at least 1 "event" (the remainder class may be empty).
> 
> To me this reaks of a sum of multinomial distributions, and indeed, I
> can readily calculate the correct answer for small figures t,k using 
> a small R program.
> 
The multinomial distribution is a sum of independent cathegorial
distributions, so there's no such thing as a sum of multinomial
distributions - unless the sum of multinomial distributions is
also a multinomial distribution.

Yikes. I think I am saying too much.

Just look here:
http://en.wikipedia.org/wiki/Multinomial_distribution

> However, in my typical experiment, k ranges from ~20-60 and t from
> ~40-100, and having to calculate these for about 6e9 experiments, a
> quick calculation on the back of a napkin shows me that I will not be
> able to complete these calculations before the expected end
> of the universe.
>
But what do you want to calculate? The probabilities?
 
> I already figured out that in this particular case I may use reciprocal
> probabilities, and if I do this I get an equation with "only" 2^k 
> terms, which would shorten my computations to a few decades.
> 
> Isn't there a faster (numerical approximation?) way to do this?
> 
I don't know what you want to do, but maybe this is the case
where a Monte Carlo Simulation would give a fast and accurate
result.

Let's say you want to estimate some function of the outcome 
of this multinomial. Just to fix ideas:

# p - the probabilities
p <- c(1, 2, 3, 2, 4, 4, 2, 1, 2, 3, 1, 2, 3, 4, 3, 2, 1, 2) 
# normalize so that sum(p) = 1
p <- p / sum(p)
# get k
k <- length(p)
# number of trials, say 100
t <- 100
# x is the simulation for each trial. x[1] is the number of
# times we got the thing with probability p[1], etc
#
# x <- rmultinom(1, k, p) # simulates 1 experiment
#
# f is the function that you will use to "evaluate" x
#
f <- function(x) {
  return(sum(x * 1.05^-(0:(length(x)-1  # anything can come here
}
#
# A Monte Carlo simulation will generate "a lot" of xs and
# get a distribution of f(x)
#
# Simulate 1 xs
x <- rmultinom(1, k, p) # takes almost zero time
# Evaluate 1 f(x). apply(matrix, 1 (rows) or 2 (coluns), function)
f.dist <- apply(x, 2, f)
# analyse it
hist(f.dist) # etc

> R has dbinom /and/ pbinom functions, but unfortunately only a dmultinom
> and no pmultinom function... perhaps because there is no (known) 
> faster way?
> 
There's a rmultinom

Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Wikibooks

2007-03-30 Thread Clint Bowman
On Fri, 30 Mar 2007, Peter Dalgaard wrote:

> Deepayan Sarkar wrote:
> > On 3/30/07, Sarah Goslee <[EMAIL PROTECTED]> wrote:
> >
> >> On 3/30/07, Alberto Monteiro <[EMAIL PROTECTED]> wrote:
> >>
> >>> Deepayan Sarkar wrote:
> >>>
>  I was just looking at this page, and it makes me curious: what gives
>  anyone the right to take someone else's mailing list post and include
>  that in a Wiki?
> 
> 
> >>> Thinks there were posted to public mailing lists are freely
> >>> copied and distributed. It's a scary thought; I may have posted
> >>> things in 10 or 12 years ago that might cause me problems today,
> >>> but I was pretty aware that I was posting to the whole world.
> >>>
> >
> > There's a difference between public archiving and copying.
> >
> >
> >> It's not that simple. Dealing with international contributors it's even 
> >> worse.
> >> Under US law (the only one I'm familiar with), the author of a mailing list
> >> post or any other written work _automatically holds copyright_ to that
> >> post (although not to the ideas contained therein, but to that particular
> >> description of the ideas). (Of course, if the ideas are original to the 
> >> author,
> >> it's good form to acknowledge that regardless of whether the exact words
> >> are used).
> >>
> >
> > I believe this is true for all countries that are signatory to the
> > Berne convention (which is pretty much all countries [1]). The US in
> > fact was one of the later ones to get into it, before which you had to
> > explicitly copyright things if you wanted copyright.
> >
> > -Deepayan
> >
> > [1] http://upload.wikimedia.org/wikipedia/commons/6/6c/Berne_Convention.png
> >
> Yes. It's pretty obvious that by posting you agree to publication, and
> presumably also to archiving.  Think "Letters to the Editor". However,
> you do not agree to just any republication (in particular not to
> commercial usage -- say someone wants to publish the collected works of
> a particularly prolific correspondent, without  paying and obtaining
> consent).
>
> Interestingly, BYTE magazine back in the late 80's actually ran a Best
> of BIX column with postings from their bulletin board. I've always
> wondered how (and whether) they handled the copyright issues.
>
> There is a middle ground of "fair use" and the right to citation,
> though. I certainly don't expect to be cited by everyone using code
> snippets from one of my posts.
>
> -pd
>

My wife has edited just such a collection (of Compuserve forum messages)
and is currently engaged in writing another.  And yes, obtaining and
keeping track of a hundred citations through the editing process is quite
the chore--but not so bad that she isn't willing to embark on another
book.  Needless to say, she cringes at the looseness of copyright tracking
that occurs on email lists and wikis.

Clint

Clint BowmanINTERNET:   [EMAIL PROTECTED]
Air Dispersion Modeler  INTERNET:   [EMAIL PROTECTED]
Air Quality Program VOICE:  (360) 407-6815
Department of Ecology   FAX:(360) 407-7534

USPS:   PO Box 47600, Olympia, WA 98504-7600
Parcels:300 Desmond Drive, Lacey, WA 98503-1274

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Copyright of messages (was Wikibooks)

2007-03-30 Thread Prof Brian Ripley
What you agree to _is_ covered in the R posting guide and its references, 
as well as what is expected of posters in respecting the rights of others.

Perhaps time yet again to remind people:

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


On Fri, 30 Mar 2007, Peter Dalgaard wrote:

> Deepayan Sarkar wrote:
>> On 3/30/07, Sarah Goslee <[EMAIL PROTECTED]> wrote:
>>
>>> On 3/30/07, Alberto Monteiro <[EMAIL PROTECTED]> wrote:
>>>
 Deepayan Sarkar wrote:

> I was just looking at this page, and it makes me curious: what gives
> anyone the right to take someone else's mailing list post and include
> that in a Wiki?
>
>
 Thinks there were posted to public mailing lists are freely
 copied and distributed. It's a scary thought; I may have posted
 things in 10 or 12 years ago that might cause me problems today,
 but I was pretty aware that I was posting to the whole world.

>>
>> There's a difference between public archiving and copying.
>>
>>
>>> It's not that simple. Dealing with international contributors it's even 
>>> worse.
>>> Under US law (the only one I'm familiar with), the author of a mailing list
>>> post or any other written work _automatically holds copyright_ to that
>>> post (although not to the ideas contained therein, but to that particular
>>> description of the ideas). (Of course, if the ideas are original to the 
>>> author,
>>> it's good form to acknowledge that regardless of whether the exact words
>>> are used).
>>>
>>
>> I believe this is true for all countries that are signatory to the
>> Berne convention (which is pretty much all countries [1]). The US in
>> fact was one of the later ones to get into it, before which you had to
>> explicitly copyright things if you wanted copyright.
>>
>> -Deepayan
>>
>> [1] http://upload.wikimedia.org/wikipedia/commons/6/6c/Berne_Convention.png
>>
> Yes. It's pretty obvious that by posting you agree to publication, and
> presumably also to archiving.  Think "Letters to the Editor". However,
> you do not agree to just any republication (in particular not to
> commercial usage -- say someone wants to publish the collected works of
> a particularly prolific correspondent, without  paying and obtaining
> consent).
>
> Interestingly, BYTE magazine back in the late 80's actually ran a Best
> of BIX column with postings from their bulletin board. I've always
> wondered how (and whether) they handled the copyright issues.
>
> There is a middle ground of "fair use" and the right to citation,
> though. I certainly don't expect to be cited by everyone using code
> snippets from one of my posts.
>
>-pd
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Wikibooks

2007-03-30 Thread Peter Dalgaard
Deepayan Sarkar wrote:
> On 3/30/07, Sarah Goslee <[EMAIL PROTECTED]> wrote:
>   
>> On 3/30/07, Alberto Monteiro <[EMAIL PROTECTED]> wrote:
>> 
>>> Deepayan Sarkar wrote:
>>>   
 I was just looking at this page, and it makes me curious: what gives
 anyone the right to take someone else's mailing list post and include
 that in a Wiki?

 
>>> Thinks there were posted to public mailing lists are freely
>>> copied and distributed. It's a scary thought; I may have posted
>>> things in 10 or 12 years ago that might cause me problems today,
>>> but I was pretty aware that I was posting to the whole world.
>>>   
>
> There's a difference between public archiving and copying.
>
>   
>> It's not that simple. Dealing with international contributors it's even 
>> worse.
>> Under US law (the only one I'm familiar with), the author of a mailing list
>> post or any other written work _automatically holds copyright_ to that
>> post (although not to the ideas contained therein, but to that particular
>> description of the ideas). (Of course, if the ideas are original to the 
>> author,
>> it's good form to acknowledge that regardless of whether the exact words
>> are used).
>> 
>
> I believe this is true for all countries that are signatory to the
> Berne convention (which is pretty much all countries [1]). The US in
> fact was one of the later ones to get into it, before which you had to
> explicitly copyright things if you wanted copyright.
>
> -Deepayan
>
> [1] http://upload.wikimedia.org/wikipedia/commons/6/6c/Berne_Convention.png
>   
Yes. It's pretty obvious that by posting you agree to publication, and 
presumably also to archiving.  Think "Letters to the Editor". However, 
you do not agree to just any republication (in particular not to 
commercial usage -- say someone wants to publish the collected works of 
a particularly prolific correspondent, without  paying and obtaining 
consent). 

Interestingly, BYTE magazine back in the late 80's actually ran a Best 
of BIX column with postings from their bulletin board. I've always 
wondered how (and whether) they handled the copyright issues.

There is a middle ground of "fair use" and the right to citation, 
though. I certainly don't expect to be cited by everyone using code 
snippets from one of my posts.

-pd

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Wikibooks

2007-03-30 Thread Adaikalavan Ramasamy
On a related note, one might be interested in checking out citizendium 
which is spin off wikipedia but 1) has more stringent identity 
verification and 2) uses a two-tier system of editors and authors. See 
http://www.citizendium.org/cfa.html.



Deepayan Sarkar wrote:
> On 3/30/07, Sarah Goslee <[EMAIL PROTECTED]> wrote:
>> On 3/30/07, Alberto Monteiro <[EMAIL PROTECTED]> wrote:
>>> Deepayan Sarkar wrote:
 I was just looking at this page, and it makes me curious: what gives
 anyone the right to take someone else's mailing list post and include
 that in a Wiki?

>>> Thinks there were posted to public mailing lists are freely
>>> copied and distributed. It's a scary thought; I may have posted
>>> things in 10 or 12 years ago that might cause me problems today,
>>> but I was pretty aware that I was posting to the whole world.
> 
> There's a difference between public archiving and copying.
> 
>> It's not that simple. Dealing with international contributors it's even 
>> worse.
>> Under US law (the only one I'm familiar with), the author of a mailing list
>> post or any other written work _automatically holds copyright_ to that
>> post (although not to the ideas contained therein, but to that particular
>> description of the ideas). (Of course, if the ideas are original to the 
>> author,
>> it's good form to acknowledge that regardless of whether the exact words
>> are used).
> 
> I believe this is true for all countries that are signatory to the
> Berne convention (which is pretty much all countries [1]). The US in
> fact was one of the later ones to get into it, before which you had to
> explicitly copyright things if you wanted copyright.
> 
> -Deepayan
> 
> [1] http://upload.wikimedia.org/wikipedia/commons/6/6c/Berne_Convention.png
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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] RWiki, tcltk and plot

2007-03-30 Thread Alberto Monteiro
Dirk Eddelbuettel wrote:
>
>> My question: is there any way to integrate the plot part into
>> a tcltk window?
> 
> Are you aware of the tkrplot package on CRAN ?
> 
No.

Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] zip.file.extract on Windows

2007-03-30 Thread Gregg Lind
Hello R-help!

I just wanted to share a tip might help others of us stuck on R.

The documentation for zip.file.extract is rather scant, and a few 
examples would.  

When using zip.file.extract, the first argument should be the full (or 
relative) path and the second the name of the zip file, it seems. 

While this is counterintuitive to me, that it should get the part from 
the first argument, and apply that path to the second, it seems to how 
this works.

This seems to me to be the wrong approach, since it won't handle folders 
inside the zipfile correctly. 

Am I missing something?  Should I just use "unz" instead?

Thanks,

Gregg L.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] RWiki, tcltk and plot

2007-03-30 Thread Greg Snow
Look at the tkrplot package.

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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Alberto Monteiro
> Sent: Friday, March 30, 2007 1:28 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] RWiki, tcltk and plot
> 
> I think I - almost - got the knack for GUI programming using 
> the tcltk library. Maybe I will update the RWiki with this:
> 
> #
> #
> #
> 
> library(tcltk)
> 
> #
> # Create some matrix - nothing about tcltk here # matrix <- 
> cbind(rnorm(100), rpois(100, lambda=10),
>   runif(100), rt(100, df=2), rt(100, df=4))
> 
> colnames(matrix) <- c("Normal", "Poisson (lambda=10)",
>   "U(0,1)", "Student t (nu=2)", "Student t (nu=4)")
> 
> #
> # Now comes the interesting part
> #
> tt <- tktoplevel()
> tkwm.title(tt, "A bunch of distributions") dist.widget <- 
> NULL plot.widget <- NULL for (i in 1:length(colnames(matrix))) {
>   dist.widget[[i]] <- tklabel(tt, text=(colnames(matrix))[i])
>   plot.widget[[i]] <- local({
> n <- i
> tkbutton(tt, text="PLOT", command=function() plot(matrix[,n]))
>   })
>   tkgrid(dist.widget[[i]], row=i-1)
>   tkgrid(plot.widget[[i]], row=i-1, column=1) }
> 
> #
> # Game over - click and watch !!!
> #
> ###
> #
> 
> My question: is there any way to integrate the plot part into 
> a tcltk window?
> 
> Alberto Monteiro
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Wikibooks

2007-03-30 Thread Deepayan Sarkar
On 3/30/07, Sarah Goslee <[EMAIL PROTECTED]> wrote:
> On 3/30/07, Alberto Monteiro <[EMAIL PROTECTED]> wrote:
> > Deepayan Sarkar wrote:
> > >
> > > I was just looking at this page, and it makes me curious: what gives
> > > anyone the right to take someone else's mailing list post and include
> > > that in a Wiki?
> > >
> > Thinks there were posted to public mailing lists are freely
> > copied and distributed. It's a scary thought; I may have posted
> > things in 10 or 12 years ago that might cause me problems today,
> > but I was pretty aware that I was posting to the whole world.

There's a difference between public archiving and copying.

> It's not that simple. Dealing with international contributors it's even worse.
> Under US law (the only one I'm familiar with), the author of a mailing list
> post or any other written work _automatically holds copyright_ to that
> post (although not to the ideas contained therein, but to that particular
> description of the ideas). (Of course, if the ideas are original to the 
> author,
> it's good form to acknowledge that regardless of whether the exact words
> are used).

I believe this is true for all countries that are signatory to the
Berne convention (which is pretty much all countries [1]). The US in
fact was one of the later ones to get into it, before which you had to
explicitly copyright things if you wanted copyright.

-Deepayan

[1] http://upload.wikimedia.org/wikipedia/commons/6/6c/Berne_Convention.png

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] RWiki, tcltk and plot

2007-03-30 Thread Dirk Eddelbuettel
On Fri, Mar 30, 2007 at 05:28:14PM -0200, Alberto Monteiro wrote:
> My question: is there any way to integrate the plot part into
> a tcltk window?

Are you aware of the tkrplot package on CRAN ?

Dirk

-- 
Hell, there are no rules here - we're trying to accomplish something. 
  -- Thomas A. Edison

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Wikibooks

2007-03-30 Thread hadley wickham
> Under US law (the only one I'm familiar with), the author of a mailing list
> post or any other written work _automatically holds copyright_ to that
> post (although not to the ideas contained therein, but to that particular
> description of the ideas).

That's true in almost any country - see the Berne convention.

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] Wikibooks

2007-03-30 Thread Sarah Goslee
On 3/30/07, Alberto Monteiro <[EMAIL PROTECTED]> wrote:
> Deepayan Sarkar wrote:
> >
> > I was just looking at this page, and it makes me curious: what gives
> > anyone the right to take someone else's mailing list post and include
> > that in a Wiki?
> >
> Thinks there were posted to public mailing lists are freely
> copied and distributed. It's a scary thought; I may have posted
> things in 10 or 12 years ago that might cause me problems today,
> but I was pretty aware that I was posting to the whole world.

It's not that simple. Dealing with international contributors it's even worse.
Under US law (the only one I'm familiar with), the author of a mailing list
post or any other written work _automatically holds copyright_ to that
post (although not to the ideas contained therein, but to that particular
description of the ideas). (Of course, if the ideas are original to the author,
it's good form to acknowledge that regardless of whether the exact words
are used).

So, in the US, nobody has the right to take one person's words and put
them in another form. The mailing list archive is one thing, but putting
material from that archive into a wiki (rather than linking to it) requires
the author's permission, at least technically.

I'm by no means an expert on copyright, but this is something that
comes up periodically on many email lists.

Sarah
-- 
Sarah Goslee
http://www.functionaldiversity.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] Trouble installing package 'sp' in R 2.4.1

2007-03-30 Thread Roger Bivand
On Fri, 30 Mar 2007, Duncan Murdoch wrote:

> On 3/30/2007 2:39 PM, Gaurav Ghosh wrote:
> > Hi all,
> > 
> > I just installed R 2.4.1 and tried to install the package 'sp' working down 
> > from the 'Packages' menu in the R GUI.  The package would not install and I 
> > got the following message:
> > 
> > "trying URL 
> > 'http://cran.us.r-project.org/bin/windows/contrib/2.4/sp_0.9-10.zip'
> > Error in download.file(url, destfile, method, mode = "wb") : 
> > cannot open URL 
> > 'http://cran.us.r-project.org/bin/windows/contrib/2.4/sp_0.9-10.zip'
> > In addition: Warning message:
> > cannot open: HTTP status was '404 Not Found' 
> > Warning in download.packages(pkgs, destdir = tmpd, available = available,  
> > : 
> >  download of package 'sp' failed"
> > 
> > I tried to find the installation file "sp_0.9-10.zip" through the 
> > CRAN website, but was unable to do so.  So I was wondering if there was 
> > some other way to get this package I need.  Or perhaps  there might be some 
> > problem with the website itself.
> 
> 
> You didn't say which mirror you were using, but it looks like a problem 
> there.  I just tried from one of the Canadian mirrors and there was no 
> problem finding the package.

>From HTTP, the mirror mentioned inline http://cran.us.r-project.org/ has 
problems, is well behind on versions in the project pages, and

http://cran.us.r-project.org/bin/windows/contrib/2.4/

has no sp package at all. The last check summary is dated 2007-03-16.

Please try another mirror; if anyone could find out what is the matter 
with the mirror, and get it corrected, that would be welcome.

> 
> 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.
> 

-- 
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.


Re: [R] Wikibooks

2007-03-30 Thread Alberto Monteiro
Deepayan Sarkar wrote:
> 
> I was just looking at this page, and it makes me curious: what gives
> anyone the right to take someone else's mailing list post and include
> that in a Wiki? 
>
Thinks there were posted to public mailing lists are freely
copied and distributed. It's a scary thought; I may have posted
things in 10 or 12 years ago that might cause me problems today,
but I was pretty aware that I was posting to the whole world.

Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] RWiki, tcltk and plot

2007-03-30 Thread Alberto Monteiro
I think I - almost - got the knack for GUI programming using the
tcltk library. Maybe I will update the RWiki with this:

#
#
#

library(tcltk)

#
# Create some matrix - nothing about tcltk here
#
matrix <- cbind(rnorm(100), rpois(100, lambda=10), 
  runif(100), rt(100, df=2), rt(100, df=4))

colnames(matrix) <- c("Normal", "Poisson (lambda=10)", 
  "U(0,1)", "Student t (nu=2)", "Student t (nu=4)")

#
# Now comes the interesting part
#
tt <- tktoplevel()
tkwm.title(tt, "A bunch of distributions")
dist.widget <- NULL
plot.widget <- NULL
for (i in 1:length(colnames(matrix))) {
  dist.widget[[i]] <- tklabel(tt, text=(colnames(matrix))[i])
  plot.widget[[i]] <- local({
n <- i
tkbutton(tt, text="PLOT", command=function() plot(matrix[,n]))
  })
  tkgrid(dist.widget[[i]], row=i-1)
  tkgrid(plot.widget[[i]], row=i-1, column=1)
}

#
# Game over - click and watch !!!
#
###
#

My question: is there any way to integrate the plot part into
a tcltk window?

Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Wikibooks

2007-03-30 Thread Deepayan Sarkar
On 3/30/07, Dieter Menne <[EMAIL PROTECTED]> wrote:
> Ben Bolker  zoo.ufl.edu> writes:
>
> >   Well, we do have an R wiki -- http://wiki.r-project.org/rwiki/doku.php --
> > although it is not as active as I'd like.  (We got stuck halfway through
> > porting Paul Johnson's "R Tips" to it ...)   Please contribute!
>
> I once tried:
>
> http://wiki.r-project.org/rwiki/doku.php?id=guides:lmer-tests

I was just looking at this page, and it makes me curious: what gives
anyone the right to take someone else's mailing list post and include
that in a Wiki? I'm not saying that anyone involved would object, but
there is the technicality of licensing: the wiki page claims to be
under a certain creative commons license; was permission obtained from
all the contributors? Does posting to r-help automatically constitute
such permission?  More importantly, since the wiki contents can be
edited, where is the guarantee that some text attributed to someone is
really what someone said?

One solution would be to link to the posts rather than repeating them,
perhaps with a one line summary of what information is contained in
the post. This could then form the basis of more comments and links
over time. In any case, the wiki needs to provide some guidance on
this.

-Deepayan

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Trouble installing package 'sp' in R 2.4.1

2007-03-30 Thread Duncan Murdoch
On 3/30/2007 2:39 PM, Gaurav Ghosh wrote:
> Hi all,
> 
> I just installed R 2.4.1 and tried to install the package 'sp' working down 
> from the 'Packages' menu in the R GUI.  The package would not install and I 
> got the following message:
> 
> "trying URL 
> 'http://cran.us.r-project.org/bin/windows/contrib/2.4/sp_0.9-10.zip'
> Error in download.file(url, destfile, method, mode = "wb") : 
> cannot open URL 
> 'http://cran.us.r-project.org/bin/windows/contrib/2.4/sp_0.9-10.zip'
> In addition: Warning message:
> cannot open: HTTP status was '404 Not Found' 
> Warning in download.packages(pkgs, destdir = tmpd, available = available,  : 
>  download of package 'sp' failed"
> 
> I tried to find the installation file "sp_0.9-10.zip" through the 
> CRAN website, but was unable to do so.  So I was wondering if there was some 
> other way to get this package I need.  Or perhaps  there might be some 
> problem with the website itself.


You didn't say which mirror you were using, but it looks like a problem 
there.  I just tried from one of the Canadian mirrors and there was no 
problem finding the package.

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.


[R] Trouble installing package 'sp' in R 2.4.1

2007-03-30 Thread Gaurav Ghosh
Hi all,

I just installed R 2.4.1 and tried to install the package 'sp' working down 
from the 'Packages' menu in the R GUI.  The package would not install and I got 
the following message:

"trying URL 
'http://cran.us.r-project.org/bin/windows/contrib/2.4/sp_0.9-10.zip'
Error in download.file(url, destfile, method, mode = "wb") : 
cannot open URL 
'http://cran.us.r-project.org/bin/windows/contrib/2.4/sp_0.9-10.zip'
In addition: Warning message:
cannot open: HTTP status was '404 Not Found' 
Warning in download.packages(pkgs, destdir = tmpd, available = available,  : 
 download of package 'sp' failed"

I tried to find the installation file "sp_0.9-10.zip" through the 
CRAN website, but was unable to do so.  So I was wondering if there was some 
other way to get this package I need.  Or perhaps  there might be some problem 
with the website itself.

Thanks,

Gaurav Ghosh
Graduate Student,

Department of Agricultural Economics and Rural Sociology,

311 Armsby Building,

Pennsylvania State University,

University Park, PA 16802

Ph:  814-865-1128


[[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] Minimum valid number of observations for rpart

2007-03-30 Thread David Farrar
 
  Regarding interpretable output, I assume you have looked at the 
  mds plot?  
   
  regards,
  Farrar

[EMAIL PROTECTED] wrote:
  Hi,
I wonder if anyone knows a study dealing with the minimum valid number of
observations when using CART?.
On top of that, when using RandomForest, is it possible to obtained a
interpretable tree model as the graphical output of the analysis, just
like in "rpart"?

Thanks a lot in advance

Javier Lozano
Universidad de León
Spain

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Model comparison

2007-03-30 Thread Charles C. Berry

On Fri, 30 Mar 2007, Jo?o Fadista wrote:


Dear all,

I would like to know if I can compare by a significance test 2 models 
with different kind of parameters. Perhaps I am wrong but I think that 
we can only compare 2 models if one is a sub model of the other.





The literature you seek is on 'non-nested' models. Here is a start:

Bradley Efron
Comparing non-nested linear models
J. of the Amer. Stat'l. Assn.
79:791-803,1984


Google is your friend. Try 'non-nested test' and 'non-nested model'
and you will get many hits.


[snip]
Charles C. Berry(858) 534-2098
 Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]   UC San Diego
http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0901

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


Re: [R] Using functions in LAPACK in a C program

2007-03-30 Thread Prof Brian Ripley
I think all these points are answered in the README.packages for R 2.5.0 
alpha (and probably for 2.4.1 too).


You can use pexports to create Rlapack.exp, for example.

On Fri, 30 Mar 2007, [EMAIL PROTECTED] wrote:

Many thanks to Brian for his very useful information and help. A quick 
look at mgcv package already gives me some directions to try. I remember 
that I tried to use Rlapack.dll instead of R.dll without success, 
perhaps because I don't know how to build an import library for 
Rlapack.dll and link against it (README.packages shows how to do this 
for R.dll using R.exp, but I could not find Rlapack.exp). I will try to 
see if I can figure out this part using VC++6.0.


Yes, I am still using R-2.2.1. I did try to upgrade it to R-2.4.1. 
However, the newer versions cause some troubles for my C programs. They 
produce error messages when my DLL are loaded into R. The problem 
relates to function calls such as isfinite. I haven't figured out why my 
C programs have this problem with newer versions of R but not with 
version 2.2.1. I remember there was a post on this issue in this list, 
but I did not see any solution. I hope to find a clue about it too so 
that I can keep the pace of R development.






Paul.








- Original Message -


From: Prof Brian Ripley <[EMAIL PROTECTED]>


Date: Friday, March 30, 2007 1:56 am


Subject: Re: [R] Using functions in LAPACK in a C program


To: Paul August <[EMAIL PROTECTED]>


Cc: r-help@stat.math.ethz.ch






On Thu, 29 Mar 2007, Paul August wrote:









Hi,









I wonder where I can find an example of using a function in




LAPACK




library in a user's own C code.









In about 20 R packages, e.g. the recommended package mgcv.









I wrote a C program which will be




compiled and linked to produce a DLL file and then loaded into




R. I hope




to use a function from LAPACK library, for example, dgesdd, in




the




program. Following R manual, I call the function by




F77_CALL(dgesdd) in




the program. The program can be compiled without problems.




However, when




it is linked to produce a DLL file, I get an error message









  Test.obj : error LNK2001: unresolved external symbol _dgesdd_




  Test.dll : fatal error LNK1120: 1 unresolved externals









I use VC++6.0 and the command of linking is something like this









  link.exe Rdll.lib /nologo /dll /out:Test.dll




/libpath:C:\R\R-2.2.1\src\gnuwin32 Test.obj









Apparently, the linker cannot resolve dgesdd from Rdll.lib. If




anyone




knows what I missed here or any example that shows how this




can be done




properly, please let me know. Thanks a lot.









It is in Rlapack.dll not R.dll.









The linking information is in 'Writing R Extensions' for those




using the




recommended compilation system (search for LAPACK_LIBS).









You will need to build an import library for Rlapack.dll and




link against




that.









And BTW you seem to be using R 2.2.1: please update as we can




only offer




accurate advice on recent systems.









--




Brian D.




Ripley,  [EMAIL PROTECTED]




Professor of Applied Statistics, 




http://www.stats.ox.ac.uk/~ripley/University of




Oxford, Tel:  +44 1865 272861 (self)




1 South Parks




Road, +44 1865 272866 (PA)




Oxford OX1 3TG,




UK    Fax:  +44 1865 272595









__




R-help@stat.math.ethz.ch mailing list




https://stat.ethz.ch/mailman/listinfo/r-help




PLEASE do read the posting guide http://www.R-




project.org/posting-guide.html




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







---
Dr. Paul Y. Peng
Associate Professor of Biostatistics
Department of Community Health and Epidemiology
  and Department of Mathematics and Statistics
Queen's University, Kingston, ON, K7L 3N6

Phone: 613-533-6000 Ext 78525
Email: [EMAIL PROTECTED]
Fax: 613-533-6794
---

[[alternative HTML version deleted]]




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


Re: [R] Minimum valid number of observations for rpart

2007-03-30 Thread Prof Brian Ripley

On Fri, 30 Mar 2007, [EMAIL PROTECTED] wrote:


Hi,
I wonder if anyone knows a study dealing with the minimum valid number of
observations when using CART?.


I have no idea what you mean by 'valid' here.
Could you answer the question for logistic regression to indicate to us 
what form of answer you are expecting?



On top of that, when using RandomForest, is it possible to obtained a
interpretable tree model as the graphical output of the analysis, just
like in "rpart"?


By definition randomForest (sic) does not produce a tree but a forest.


Thanks a lot in advance

Javier Lozano
Universidad de León
Spain



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


Re: [R] Using functions in LAPACK in a C program

2007-03-30 Thread pengp
Many thanks to Brian for his very useful information and help. A quick look at 
mgcv package already gives me some directions to try. I remember that I tried 
to use Rlapack.dll instead of R.dll without success, perhaps because I don't 
know how to build an import library for Rlapack.dll and link against it 
(README.packages shows how to do this for R.dll using R.exp, but I could not 
find Rlapack.exp). I will try to see if I can figure out this part using 
VC++6.0.





Yes, I am still using R-2.2.1. I did try to upgrade it to R-2.4.1. However, the 
newer versions cause some troubles for my C programs. They produce error 
messages when my DLL are loaded into R. The problem relates to function calls 
such as isfinite. I haven't figured out why my C programs have this problem 
with newer versions of R but not with version 2.2.1. I remember there was a 
post on this issue in this list, but I did not see any solution. I hope to find 
a clue about it too so that I can keep the pace of R development.





Paul.








- Original Message -


From: Prof Brian Ripley <[EMAIL PROTECTED]>


Date: Friday, March 30, 2007 1:56 am


Subject: Re: [R] Using functions in LAPACK in a C program


To: Paul August <[EMAIL PROTECTED]>


Cc: r-help@stat.math.ethz.ch





> On Thu, 29 Mar 2007, Paul August wrote:


> 


> > Hi,


> >


> > I wonder where I can find an example of using a function in 


> LAPACK 


> > library in a user's own C code.


> 


> In about 20 R packages, e.g. the recommended package mgcv.


> 


> > I wrote a C program which will be 


> > compiled and linked to produce a DLL file and then loaded into 


> R. I hope 


> > to use a function from LAPACK library, for example, dgesdd, in 


> the 


> > program. Following R manual, I call the function by 


> F77_CALL(dgesdd) in 


> > the program. The program can be compiled without problems. 


> However, when 


> > it is linked to produce a DLL file, I get an error message


> >


> >  Test.obj : error LNK2001: unresolved external symbol _dgesdd_


> >  Test.dll : fatal error LNK1120: 1 unresolved externals


> >


> > I use VC++6.0 and the command of linking is something like this


> >


> >  link.exe Rdll.lib /nologo /dll /out:Test.dll 


> /libpath:C:\R\R-2.2.1\src\gnuwin32 Test.obj


> >


> > Apparently, the linker cannot resolve dgesdd from Rdll.lib. If 


> anyone 


> > knows what I missed here or any example that shows how this 


> can be done 


> > properly, please let me know. Thanks a lot.


> 


> It is in Rlapack.dll not R.dll.


> 


> The linking information is in 'Writing R Extensions' for those 


> using the 


> recommended compilation system (search for LAPACK_LIBS).


> 


> You will need to build an import library for Rlapack.dll and 


> link against 


> that.


> 


> And BTW you seem to be using R 2.2.1: please update as we can 


> only offer 


> accurate advice on recent systems.


> 


> -- 


> Brian D. 


> Ripley,  [EMAIL PROTECTED]


> Professor of Applied Statistics,  


> http://www.stats.ox.ac.uk/~ripley/University of 


> Oxford, Tel:  +44 1865 272861 (self)


> 1 South Parks 


> Road, +44 1865 272866 (PA)


> Oxford OX1 3TG, 


> UK    Fax:  +44 1865 272595


> 


> __


> R-help@stat.math.ethz.ch mailing list


> https://stat.ethz.ch/mailman/listinfo/r-help


> PLEASE do read the posting guide http://www.R-


> project.org/posting-guide.html


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


> 

---
Dr. Paul Y. Peng
Associate Professor of Biostatistics
Department of Community Health and Epidemiology
   and Department of Mathematics and Statistics
Queen's University, Kingston, ON, K7L 3N6

Phone: 613-533-6000 Ext 78525
Email: [EMAIL PROTECTED]
Fax: 613-533-6794
---

[[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] Makeconf on Windows - where?

2007-03-30 Thread Duncan Murdoch
On 3/30/2007 11:53 AM, Paul Roebuck wrote:
> Read in the Windows release notes for 2.4.0 that:
> 
>   There is a new file etc/Makeconf that provides an
>   approximation to the Unix version and may help with
>   src/Makefile's.
> 
> Yet when I look at the CRAN binary I have for 2.4.1patched,
> there are five files in the $R_HOME/etc directory, but no
> Makeconf. Is the file only available with custom installs?

That may be an oversight that it never got added to the build script for 
the installer.  I'll take a look and see if it would be useful with a 
binary install.

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] Wikibooks

2007-03-30 Thread hadley wickham
> If entering a new page is really the way to ask a question, then you
> should write this on the front page, and as a possible way to contribute
> on the getting-started page.  It would also be a good idea to tell
> people like me how to find those questions. ("Recent Edits" seems a
> little too broad, with too little in the way of subject matter in the
> comments, but maybe that's just because nobody's asking questions yet.)

I don't think it's a good idea to use the wiki as a way to ask
questions.  We already have a great forum to ask questions - this
mailing list.  Creating a new place to ask questions potentially
fragments the community of people available to answer questions.

I think the wiki would be more appropriate as a way to record
collective best practices, but this relies on it being easy to find
them again.

> And it would be a good idea to seed the wiki with a lot of questions,
> just to get some activity going.

That's good for people who want to ask questions, but people who want
their questions answered are presented with many blank pages
(http://www.wikipatterns.com/display/wikipatterns/Empty+Pages), and
will be discouraged.

> And maybe set up a page for pointers to questions that are languishing
> unanswered?  I think the key is to make it easy to ask a question and
> easy to answer one, so don't put too much bureaucracy into the process.

I think it's useful to consider more the purpose of the wiki - what
makes it different to the mailing list? to the website? to the
existing documentation?  How can the strengths of the wiki form be
used to our advantage?

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] Wikibooks

2007-03-30 Thread hadley wickham
On 3/30/07, Alberto Monteiro <[EMAIL PROTECTED]> wrote:
> Philippe Grosjean wrote:
> >
> > As other have pointed out, the main reason for the lack of success
> > of the R Wiki is that the mailing lists, particularly R-Help, are
> > sooo successful. However, I continue to consider that the mailing
> > list is suboptimal in two cases: (1) when text is not enough to
> > express the idea, and (2) for frequent questions that would
> > certainly deserve a good compilation on a wiki page and a
> > redirection to it everytime the question is asked.
> >
> I think there's one case where the mailing list is non-optimal:
> finding examples. This is where a wiki would be great.
>
> Say I don't know (and I can't understand the help) how to
> use the rnorm function. If I do RSiteSearch("rnorm"), I
> will get too much useless information. OTOH, an ideal wikipedia
> would have a page http://www.r-wiki.org/rnorm, where I could
> find examples, learn the theory, browse the source code, and
> have links to similar functions. OK, maybe that's too much, I
> would be happy just to have some examples :-)

Good documentation is hard to write, usually much harder than writing
the code it documents.  I think coming up with good documentation for
a package is on the order of difficulty of a large refereed paper (or
a book!), and yet you never get any recognition for it, only
complaints when it is inadequate.  Journals like JSS are an attempt to
allow software to recieve academic credit, but only provide
recognition for a specific form of documentation, the expanded
tutorial.  http://tinyurl.com/l7ufz has a good description of the
multiple types of documentation that are needed.

Many of the functions in R can not be properly used without the
appropriate statistical background and it is impossible to provide
this in the documentation. Many R functions are very well documented,
by experts in the field, in conjunction with a book that provides the
statistical background.  Unfortunately all the best things in life are
NOT free, unless you happen to be attached to a good academic library.

The r wiki is a technical solution to a sociological problem.

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] Wikibooks

2007-03-30 Thread Romain Francois
Alberto Monteiro wrote:
> Philippe Grosjean wrote:
>   
>> As other have pointed out, the main reason for the lack of success 
>> of the R Wiki is that the mailing lists, particularly R-Help, are 
>> sooo successful. However, I continue to consider that the mailing 
>> list is suboptimal in two cases: (1) when text is not enough to 
>> express the idea, and (2) for frequent questions that would 
>> certainly deserve a good compilation on a wiki page and a 
>> redirection to it everytime the question is asked.
>>
>> 
> I think there's one case where the mailing list is non-optimal:
> finding examples. This is where a wiki would be great.
>
> Say I don't know (and I can't understand the help) how to
> use the rnorm function. If I do RSiteSearch("rnorm"), I
> will get too much useless information. OTOH, an ideal wikipedia
> would have a page http://www.r-wiki.org/rnorm, where I could
> find examples, learn the theory, browse the source code, and 
> have links to similar functions. OK, maybe that's too much, I
> would be happy just to have some examples :-)
>   
Hi,

Do you mean something like (it fullfills basically all your requirements) :

R> rnorm # get the code
R> ?rnorm   # get the help page

The wiki already has a similar thing, for example for rnorm, you can go to:
http://wiki.r-project.org/rwiki/doku.php?id=rdoc:stats:Normal

There has been (recently and less recently) some discussions on the
r-sig-wiki list about why sometimes you get ~~RDOC~~ instead of the
documentation page, it is still a work in progress.

The only tricky bit is how do I know that I have to go to stats:normal,
well you can ask that to R, for example using that small function :

wikiHelp <- function( ... , sarcasm = TRUE ){
if(  length(hp <- help(...) ) > 0 ){
  hp <- tail( strsplit(hp[1], "/")[[1]], 3 )
  wikiPage <-
sprintf("http://wiki.r-project.org/rwiki/doku.php?id=rdoc:%s:%s";,
hp[1],  hp[3])
   cat("the following wiki page will be displayed in your browser:",
 wikiPage,
 ">>> Please feel free to add information if you have
some, " , sep = "\n")
  if( sarcasm) cat( ">>> except if you are an evil person\n")
   browseURL(wikiPage)
} else print( hp )
  }

R> wikiHelp( rnorm )
R> wikiHelp( tkWidgets )
R> wikiHelp( seq )
R> wikiHelp( fewqfrwasaqwetgqwtr) # no such page exists



> Also, RSiteSearching is dangerous, because if someone replies
> in an ignorant or malicous way (let's be creative: someone asks
> "how can I open the file CONFIG.SYS", and an evil person replies 
> with file.remove("CONFIG.SYS")), then this wrong answer may
> be accessed by newbies. A wikipedia _may_ have wrong answers,
> but these are (hopefully) ephemeral.
>   
Are there many people willing to just blindly copy anything and expect
the good result to be returned ?
I don't think there are many evil person around
> BTW, is it too hard to include the wiki in RSiteSearch?
>   

The wiki has its own search engine already, so you can go there and use
it. I guess you can search for "search" there and get info on how to
search .
If you are using a Gecko based browser (firefox, flock, ...) you might
want to check that extension that would search the wiki pages for you as
well as the results from the R site search:
http://addictedtor.free.fr/rsitesearch/

HTH,

Romain

> Alberto Monteiro
-- 
Mango Solutions
data analysis that delivers

Tel:  +44(0) 1249 467 467
Fax:  +44(0) 1249 467 468
Mob:  +44(0) 7813 526 123

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Makeconf on Windows - where?

2007-03-30 Thread Paul Roebuck
Read in the Windows release notes for 2.4.0 that:

  There is a new file etc/Makeconf that provides an
  approximation to the Unix version and may help with
  src/Makefile's.

Yet when I look at the CRAN binary I have for 2.4.1patched,
there are five files in the $R_HOME/etc directory, but no
Makeconf. Is the file only available with custom installs?

--
SIGSIG -- signature too long (core dumped)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Minimum valid number of observations for rpart

2007-03-30 Thread fjlozl
Hi,
I wonder if anyone knows a study dealing with the minimum valid number of
observations when using CART?.
On top of that, when using RandomForest, is it possible to obtained a
interpretable tree model as the graphical output of the analysis, just
like in "rpart"?

Thanks a lot in advance

Javier Lozano
Universidad de León
Spain

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Inquiry

2007-03-30 Thread Patrick Burns
My interpretation of the question (which of course may be
wrong) has an answer that is the opposite of 'round':

When a result is printed, it is rounded to a certain number of
digits (controlled by the 'digits' argument of 'print').  Just because
it is printed like that, doesn't mean the actual value is rounded.
Values are kept with as much precision as possible.  For double
precision data, there are roughly 15 decimal places available.


Patrick Burns
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

John Kane wrote:

>I am not sure I understand your question but have a
>look at ?round and the signif command on that page.  
>
>--- Inmaculada López García <[EMAIL PROTECTED]> wrote:
>
>  
>
>>Good morning,
>>
>>I have a question about R, I would like to know how
>>it is possible not to
>>chop the result of an operation. How many decimals
>>it is possible to obtain?
>>
>>Thank you in advance,
>>I. López
>>-
>>Inmaculada López García
>>Dpto. Estadística y Matemática Aplicada
>>Universidad de Almería
>>La Cañada de San Urbano, s/n
>>04120  Almería (SPAIN)
>>Tfno.: +34 950 01 57 75
>>Fax:+34 950 01 51 67
>>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-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/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] Using split() several times in a row?

2007-03-30 Thread Sergey Goriatchev
Hi, fellow R users.

I have a question about sapply and split combination.

I have a big dataframe (4 observations, 21 variables). First
variable (factor) is "date" and it is in format "8.29.97", that is, I
have monthly data. Second variable (also factor) has levels 1 to 6
(fractiles 1 to 5 and missing value with code 6). The other 19
variables are numeric.
For each month I have several hunder observations of 19 numeric and 1 factor.

I am normalizing the numeric variables by dividing val1 by val2, where:

val1: (for each month, for each numeric variable) difference between
mean of ith numeric variable in fractile 1, and mean of ith numeric
variable in fractile 5.

val2: (for each month, for each numeric variable) standard deviation
for ith numeric variable.

Basically, as far as I understand, I need to use split() function several times.
To calculate val1 I need to use split() twice - first to split by
month and then split by fractile. Is this even possible to do (since
after first application of split() I get a list)??

Is there a smart way to perform this normalization computation?

My knowledge of R is not so advanced, but I need to know an efficient
way to perform calculations of this kind.

Would really appreciate some help from experienced R users!

Regards,
S

-- 
Laziness is nothing more than the habit of resting before you get tired.
- Jules Renard (writer)

Experience is one thing you can't get for nothing.
- Oscar Wilde (writer)

When you are finished changing, you're finished.
- Benjamin Franklin (Diplomat)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Testing random effect in logistic mixed model

2007-03-30 Thread Julien
 Hi
When using linear mixed model, I could test for the effect of the random
part of the model using a likelihood ratio test comparing two model with and
without the random part.

model.lmer=lmer(y~x+(1|r))
model.lm = lm(y~x)
anova(model.lmer,model.lm)

However, this does not work with a mixed model with binomial or poisson
distribution

> model.lmer = lmer(z~x+(1|r),family=binomial)
> model.glm =  glm(z~x,family=binomial)
> anova(model.lmer,model.glm)
 Erreur dans FUN(X[[1]], ...) : aucun slot de nom "call" pour cet objet de
la classe "glm"
De plus : Warning message:
arguments supplémentaires ignorés in: logLik.glm(X[[2]], ...)

My question is how cold I test for a random effect in logistic mixed model
because the anova function does not work here?

Thanks

Julien Martin

-- 



13:36

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 NA values

2007-03-30 Thread Gavin Simpson
On Fri, 2007-03-30 at 16:25 +0200, Sergio Della Franca wrote:
> This is that i obtained.
> 
> There isn't a method to replace the NA values only for character variable?

This is R, there is always a way (paraphrasing an R-Helper the name of
whom I forget just now). If you mean a canned function, not that I'm
aware of.

Here is one way:

## some example data - not exactly like yours
set.seed(1234)
dat <- data.frame(test = sample(c("t","f"), 9, replace = TRUE), 
  num = c(10,14,25,NA,40,45,44,47,NA))

## add an NA to dat$test to match your example
dat$test[8] <- NA

## print out dat
dat

## count the various options in $test and return the name of
## the most frequent
freq <- names(which.max(table(dat$test)))

## replace NA in $test with most frequent
dat$test[is.na(dat$test)] <- freq

## print out dat again to show this worked
dat

There may be better ways - the names(which.max(table(...))) seems a bit
clunky to me but it is Friday afternoon and it's been a long week...

And, as this /is/ R, you could wrap that into a function for you use on
other data sets, but I'll leave that bit up to you.

HTH

G

> 
> 2007/3/30, Gabor Grothendieck <[EMAIL PROTECTED]>:
> >
> > I assume you are referring to na.roughfix in randomForest.  I don't think
> > it
> > works for logical vectors or for factors outside of data frames:
> >
> > > library(randomForest)
> > > DF <- data.frame(a = c(T, F, T, NA, T), b = c(1:3, NA, 5))
> > > na.roughfix(DF)
> > Error in na.roughfix.data.frame(DF) : na.roughfix only works for
> > numeric or factor
> > > DF$a <- factor(DF$a)
> > > na.roughfix(DF$a)
> > Error in na.roughfix.default(DF$a) : roughfix can only deal with numeric
> > data.
> > > na.roughfix(DF)
> >  a   b
> > 1  TRUE 1.0
> > 2 FALSE 2.0
> > 3  TRUE 3.0
> > 4  TRUE 2.5
> > 5  TRUE 5.0
> >
> >
> > On 3/30/07, Sergio Della Franca <[EMAIL PROTECTED]> wrote:
> > > Dear R-Helpers,
> > >
> > >
> > > I have the following data set(y):
> > >
> > >  Test_Result   #_Test
> > >t 10
> > >f 14
> > >f 25
> > >f NA
> > >f 40
> > >t45
> > >t44
> > > 47
> > >tNA
> > >
> > >
> > > I want to replace the NA values with the following method:
> > > - for the numeric variable, replace NA with median
> > > - for character variable , replace NA with the most frequent level
> > >
> > > If i use x<-na.roughfix(y) the NA values are correctly replaced.
> > > But if i x<-na.roughfix(y$Test_Result) i obtain the following error:
> > >
> > > roughfix can only deal with numeric data.
> > >
> > > How can i solve this proble that i met every time i want to replace only
> > the
> > > NA values of a column (type character)?
> > >
> > > Thank you in advance.
> > >
> > >
> > > Sergio Della Franca
> > >
> > >[[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.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Wikibooks

2007-03-30 Thread Alberto Monteiro

Duncan Murdoch wrote:
>
>> This works when there's a decent documentation for the function.
>> The functions in the tcltk package, for example, are horribly
>> undocumented, and asking for help only loops to a general
>> help about all (and none) of the functions.
> 
> I don't remember if you've said which platform you're working on,
> but if you're on Windows, the TCL/TK documentation is available to 
> you.  It's in RHOME/Tcl/doc.  This is mentioned in the ?tcltk R help 
> topic.
> 
I always find it easier to get the help from the Internet, even
using Google (search for "tcl/tk grid", for example) than with
the internal documentation...

> I believe most Unix-like systems with TCL/TK support installed would 
> have the same documentation available, but I don't know where.
> 
> That documentation assumes you're using a TCL interpreter rather 
> than R, so the syntax is all wrong, but there's a mechanical 
> translation from it to R syntax which is described in the 
> ?TkCommands R help topic.
> 
> So these functions may be horribly documented, but they're not 
> horribly undocumented.
>
:-))

Ok, maybe I should shut up complaining and actually _do_ something
useful, like going into the R-Wiki and _writing_ everything I learned
about R in the past 6 months...

Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 NA values

2007-03-30 Thread Gabor Grothendieck
Not as part of na.roughfix.

You could convert your character strings to factors
and back again:

library(randomForest)
DF <- data.frame(a = c(T, F, T, NA, T),
  b = c(1:3, NA, 5),
  c = c("b", "b", NA, "d", "e"),
  d = factor(c("a", "a", NA, "d", "e")),
  stringsAsFactors = FALSE)
DF$a <- factor(DF$a)
DF$c <- factor(DF$c)
DF <- na.roughfix(DF)
DF$c <- as.character(DF$c)
DF




On 3/30/07, Sergio Della Franca <[EMAIL PROTECTED]> wrote:
> This is that i obtained.
>
> There isn't a method to replace the NA values only for character variable?
>
>
>
>
>
>
> 2007/3/30, Gabor Grothendieck <[EMAIL PROTECTED]>:
> > I assume you are referring to na.roughfix in randomForest.  I don't think
> it
> > works for logical vectors or for factors outside of data frames:
> >
> > > library(randomForest)
> > > DF <- data.frame(a = c(T, F, T, NA, T), b = c(1:3, NA, 5))
> > > na.roughfix(DF)
> > Error in na.roughfix.data.frame(DF) : na.roughfix only works for
> > numeric or factor
> > > DF$a <- factor(DF$a)
> > > na.roughfix(DF$a)
> > Error in na.roughfix.default(DF$a) : roughfix can only deal with numeric
> data.
> > > na.roughfix(DF)
> >  a   b
> > 1  TRUE 1.0
> > 2 FALSE 2.0
> > 3  TRUE 3.0
> > 4  TRUE 2.5
> > 5  TRUE 5.0
> >
> >
> > On 3/30/07, Sergio Della Franca <[EMAIL PROTECTED]> wrote:
> > > Dear R-Helpers,
> > >
> > >
> > > I have the following data set(y):
> > >
> > >  Test_Result   #_Test
> > >t 10
> > >f 14
> > >f 25
> > >f NA
> > >f 40
> > >t45
> > >t44
> > > 47
> > >tNA
> > >
> > >
> > > I want to replace the NA values with the following method:
> > > - for the numeric variable, replace NA with median
> > > - for character variable , replace NA with the most frequent level
> > >
> > > If i use x<-na.roughfix(y) the NA values are correctly replaced.
> > > But if i x<-na.roughfix(y$Test_Result) i obtain the following error:
> > >
> > > roughfix can only deal with numeric data.
> > >
> > > How can i solve this proble that i met every time i want to replace only
> the
> > > NA values of a column (type character)?
> > >
> > > Thank you in advance.
> > >
> > >
> > > Sergio Della Franca
> > >
> > >[[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.


Re: [R] Inquiry

2007-03-30 Thread John Kane
I am not sure I understand your question but have a
look at ?round and the signif command on that page.  

--- Inmaculada López García <[EMAIL PROTECTED]> wrote:

> 
> 
> Good morning,
> 
> I have a question about R, I would like to know how
> it is possible not to
> chop the result of an operation. How many decimals
> it is possible to obtain?
> 
> Thank you in advance,
> I. López
> -
> Inmaculada López García
> Dpto. Estadística y Matemática Aplicada
> Universidad de Almería
> La Cañada de San Urbano, s/n
> 04120  Almería (SPAIN)
> Tfno.: +34 950 01 57 75
> Fax:+34 950 01 51 67
> 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-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] ANOVA and confidence intervals plot

2007-03-30 Thread Max Manfrin

Dear *,
	I would like to obtain for each factor of my anova model the  
"response variable vs factor" plot with means and 95% Tukey HSD  
intervals.


I would appreciate any information on how to do that.

Cheers

Max MANFRIN Tel.: +32 (0)2 650 3168
IRIDIA - CoDE, CP 194/6 Fax.: +32 (0)2 650 2715
Université Libre de Bruxelles
Av. F. D. Roosevelt, 50
1050 Brussels Email: [EMAIL PROTECTED]
BELGIUM  WWW: http://iridia.ulb.ac.be/~mmanfrin

gpg DSA: 0x7E67B4C4
gpg fingerprint: C2E9 1689 CADD 7CAE 2FAB A355 8FD9 9DD1 7E67 B4C4





PGP.sig
Description: This is a digitally signed message part
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Wikibooks

2007-03-30 Thread Alberto Monteiro

Duncan Murdoch wrote:
>
>> This works when there's a decent documentation for the function.
>> The functions in the tcltk package, for example, are horribly
>> undocumented, and asking for help only loops to a general
>> help about all (and none) of the functions.
> 
> I don't remember if you've said which platform you're working on,
> but if you're on Windows, the TCL/TK documentation is available to 
> you.  It's in RHOME/Tcl/doc.  This is mentioned in the ?tcltk R help 
> topic.
> 
I always find it easier to get the help from the Internet, even
using Google (search for "tcl/tk grid", for example) than with
the internal documentation...

> I believe most Unix-like systems with TCL/TK support installed would 
> have the same documentation available, but I don't know where.
> 
> That documentation assumes you're using a TCL interpreter rather 
> than R, so the syntax is all wrong, but there's a mechanical 
> translation from it to R syntax which is described in the 
> ?TkCommands R help topic.
> 
> So these functions may be horribly documented, but they're not 
> horribly undocumented.
>
:-))

Ok, maybe I should shut up complaining and actually _do_ something
useful, like going into the R-Wiki and _writing_ everything I learned
about R in the past 6 months...

Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 NA values

2007-03-30 Thread Sergio Della Franca
This is that i obtained.

There isn't a method to replace the NA values only for character variable?






2007/3/30, Gabor Grothendieck <[EMAIL PROTECTED]>:
>
> I assume you are referring to na.roughfix in randomForest.  I don't think
> it
> works for logical vectors or for factors outside of data frames:
>
> > library(randomForest)
> > DF <- data.frame(a = c(T, F, T, NA, T), b = c(1:3, NA, 5))
> > na.roughfix(DF)
> Error in na.roughfix.data.frame(DF) : na.roughfix only works for
> numeric or factor
> > DF$a <- factor(DF$a)
> > na.roughfix(DF$a)
> Error in na.roughfix.default(DF$a) : roughfix can only deal with numeric
> data.
> > na.roughfix(DF)
>  a   b
> 1  TRUE 1.0
> 2 FALSE 2.0
> 3  TRUE 3.0
> 4  TRUE 2.5
> 5  TRUE 5.0
>
>
> On 3/30/07, Sergio Della Franca <[EMAIL PROTECTED]> wrote:
> > Dear R-Helpers,
> >
> >
> > I have the following data set(y):
> >
> >  Test_Result   #_Test
> >t 10
> >f 14
> >f 25
> >f NA
> >f 40
> >t45
> >t44
> > 47
> >tNA
> >
> >
> > I want to replace the NA values with the following method:
> > - for the numeric variable, replace NA with median
> > - for character variable , replace NA with the most frequent level
> >
> > If i use x<-na.roughfix(y) the NA values are correctly replaced.
> > But if i x<-na.roughfix(y$Test_Result) i obtain the following error:
> >
> > roughfix can only deal with numeric data.
> >
> > How can i solve this proble that i met every time i want to replace only
> the
> > NA values of a column (type character)?
> >
> > Thank you in advance.
> >
> >
> > Sergio Della Franca
> >
> >[[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] math-operations and the R-Wiki

2007-03-30 Thread Alberto Monteiro
Dimitris Rizopoulos wrote:
>
> 513 %/% 100
> 
> 513 %% 100
>
Now this is a great opportunity to improve the R-Wiki.

What about a "Pascal" page in the R-Wiki, where a list
of Pascal-to-R translations would be available?

Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] math-operations

2007-03-30 Thread Schmitt, Corinna
Thanks, it works.

Corinna



-Ursprüngliche Nachricht-
Von: Guazzetti Stefano [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 30. März 2007 15:41
An: Schmitt, Corinna; r-help@stat.math.ethz.ch
Betreff: R: [R] math-operations

I guess you need "%%" and ""%/%"

try  
> 513 %/% 100
[1] 5
> 513 %% 100
[1] 13

?"%%"


Stefano


-Messaggio originale-
Da: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] conto di Schmitt, Corinna
Inviato: venerdì 30 marzo 2007 15.34
A: r-help@stat.math.ethz.ch
Oggetto: [R] math-operations


Hallo R-experts,

for a function I need to work with the commands "div" and "mod" known
from Pascal and Ruby. The only help I know is "ceiling()" and "floor()"
in R. Do "div" and "mod" exist? When yes please send me a little
example.

In Pascal-Syntax I want: 
513 div 100 = 5
513 mod 100 = 13

How can I get this in R-syntax?

Thanks, Corinna

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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] faster computation of cumulative multinomial distribution

2007-03-30 Thread Theo Borm
Dear list members,

I have a series of /unequal/ probabilities [p1,p2,...,pk], describing
mutually exclusive events, and a "remainder" class with a probability
p0=1-p1-p2--pk, and need to calculate, for a given number of trials
t>=k, the combined probability that each of the classes 1...k contains
at least 1 "event" (the remainder class may be empty).

To me this reaks of a sum of multinomial distributions, and indeed, I
can readily calculate the correct answer for small figures t,k using a
small R program.

However, in my typical experiment, k ranges from ~20-60 and t from
~40-100, and having to calculate these for about 6e9 experiments, a
quick calculation on the back of a napkin shows me that I will not be
able to complete these calculations before the expected end of the universe.

I already figured out that in this particular case I may use reciprocal
probabilities, and if I do this I get an equation with "only" 2^k terms,
which would shorten my computations to a few decades.

Isn't there a faster (numerical approximation?) way to do this?

R has dbinom /and/ pbinom functions, but unfortunately only a dmultinom
and no pmultinom function... perhaps because there is no (known) faster way?

with kind regards,

Theo Borm

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] math-operations

2007-03-30 Thread Alberto Murta
On Friday 30 March 2007 14:46, Alberto Murta wrote:
> On Friday 30 March 2007 14:34, Schmitt, Corinna wrote:
> > Hallo R-experts,
> >
> > for a function I need to work with the commands "div" and "mod" known
> > from Pascal and Ruby. The only help I know is "ceiling()" and "floor()"
> > in R. Do "div" and "mod" exist? When yes please send me a little
> > example.
> >
> > In Pascal-Syntax I want:
> > 513 div 100 = 5
>
> trunc(513 / 5)

Sorry! it's   trunc(513 / 100)

>
> > 513 mod 100 = 13
>
> 513 %% 100
>
> > How can I get this in R-syntax?
> >
> > Thanks, Corinna
> >
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html and provide commented,
> > minimal, self-contained, reproducible code.

-- 
   Alberto G. Murta
IPIMAR - Portuguese Institute of Fisheries and Marine Research
Avenida de Brasilia s/n; 1449-006 Lisboa; Portugal
Tel: +351 213027120; Fax: +351 213015948; email: [EMAIL PROTECTED]

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


Re: [R] math-operations

2007-03-30 Thread Duncan Murdoch
On 3/30/2007 9:34 AM, Schmitt, Corinna wrote:
> Hallo R-experts,
> 
> for a function I need to work with the commands "div" and "mod" known
> from Pascal and Ruby. The only help I know is "ceiling()" and "floor()"
> in R. Do "div" and "mod" exist? When yes please send me a little
> example.
> 
> In Pascal-Syntax I want: 
> 513 div 100 = 5
> 513 mod 100 = 13
> 
> How can I get this in R-syntax?

div is %/% and mod is %%.  These (and the other arithmetic operators in 
R) are described in the ?Arithmetic help topic.  The full list of all 
operators is in the "R Language Definition" manual, near the start of 
the "Evaluation of expressions" chapter.

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.


[R] R: math-operations

2007-03-30 Thread Guazzetti Stefano
I guess you need "%%" and ""%/%"

try  
> 513 %/% 100
[1] 5
> 513 %% 100
[1] 13

?"%%"


Stefano


-Messaggio originale-
Da: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] conto di Schmitt, Corinna
Inviato: venerdì 30 marzo 2007 15.34
A: r-help@stat.math.ethz.ch
Oggetto: [R] math-operations


Hallo R-experts,

for a function I need to work with the commands "div" and "mod" known
from Pascal and Ruby. The only help I know is "ceiling()" and "floor()"
in R. Do "div" and "mod" exist? When yes please send me a little
example.

In Pascal-Syntax I want: 
513 div 100 = 5
513 mod 100 = 13

How can I get this in R-syntax?

Thanks, Corinna

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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Inquiry

2007-03-30 Thread Petr PIKAL
Petr Pikal
[EMAIL PROTECTED]
- Postoupil do Petr PIKAL/CTCAP dne 30.03.2007 15:47 -

Petr PIKAL/CTCAP napsal dne 30.03.2007 15:01:58:

> Hi
> 
> Do you mean rounding. If yes you can consult 
> ?round, ?floor, ?ceiling.
> 
> If you want just to print different amount of digits you can look at
> options(digits=n) or ?sprintf or ?format
> 
> Regards
> 
> Petr Pikal
> [EMAIL PROTECTED]
> 
> [EMAIL PROTECTED] napsal dne 30.03.2007 13:12:23:
> 
> > 
> > 
> > Good morning,
> > 
> > I have a question about R, I would like to know how it is possible not 
to
> > chop the result of an operation. How many decimals it is possible to 
obtain?
> > 
> > Thank you in advance,
> > I. López
> > -
> > Inmaculada López García
> > Dpto. Estadística y Matemática Aplicada
> > Universidad de Almería
> > La Cañada de San Urbano, s/n
> > 04120  Almería (SPAIN)
> > Tfno.:+34 950 01 57 75
> > Fax:+34 950 01 51 67
> > 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-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] math-operations

2007-03-30 Thread Alberto Murta
On Friday 30 March 2007 14:34, Schmitt, Corinna wrote:
> Hallo R-experts,
>
> for a function I need to work with the commands "div" and "mod" known
> from Pascal and Ruby. The only help I know is "ceiling()" and "floor()"
> in R. Do "div" and "mod" exist? When yes please send me a little
> example.
>
> In Pascal-Syntax I want:
> 513 div 100 = 5

trunc(513 / 5)

> 513 mod 100 = 13

513 %% 100

>
> How can I get this in R-syntax?
>
> Thanks, Corinna
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html and provide commented, minimal,
> self-contained, reproducible code.

-- 
   Alberto G. Murta
IPIMAR - Portuguese Institute of Fisheries and Marine Research
Avenida de Brasilia s/n; 1449-006 Lisboa; Portugal
Tel: +351 213027120; Fax: +351 213015948; email: [EMAIL PROTECTED]

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


Re: [R] CLUSTER Package

2007-03-30 Thread Martin Maechler
It seems nobody else was willing to help here
(when the original poster did not at all follow the posting
guide).

In the mean time, someone else has asked me about part of this,
so let me answer in public :

> "MM" == Martin Maechler <[EMAIL PROTECTED]>
> on Mon, 12 Mar 2007 17:23:30 +0100 writes:

MM> Hi Vallejo, I'm pretty busy currently, and feel your
MM> question has much more to do with how to use R more
MM> generally than with using the functions from the cluster
MM> package.

MM> So you may get help from other R-help readers, but maybe
MM> only after you have followed the posting-guide and give
MM> a reproducible example as you're asked there.

MM> Regards, Martin Maechler

> "VallejoR" == Vallejo, Roger <[EMAIL PROTECTED]>
> on Mon, 12 Mar 2007 10:28:01 -0400 writes:

VallejoR> Hi Martin, In using the Cluster Package, I have
VallejoR> results for PAM and DIANA clustering algorithms
VallejoR> (below "part" and "hier" objects):



VallejoR> part <- pam(trout, bestk) # PAM results


VallejoR> hier <- diana(trout) # DIANA results


VallejoR> GeneNames <- show(RG$genes) # Gene Names are in this object

(RG is what)?


VallejoR> But I would like also to know what genes (NAMES)
VallejoR> are included in each cluster. I tried
VallejoR> unsuccessfully to send these results to output
VallejoR> files (clusters with gene Names). This must be an
VallejoR> easy task for a good R programmer. I will
VallejoR> appreciate very much directions or R code on how
VallejoR> to send the PAM and DIANA results to output files
VallejoR> including information on genes (Names) per each
VallejoR> cluster.

For diana(), a *hierarchical* clustering {as agnes()}, you need
to decide about the number of clusters yourself.
Then, as the example in  help(diana.object) shows,
you can use cutree() to get the grouping vector:

Here's a reproducible example :

library(cluster)
data(votes.repub)
dv <- diana(votes.repub, metric = "manhattan", stand = TRUE)
print(dv)
plot(dv)

## Cut into 2 groups:
dv2 <- cutree(as.hclust(dv), k = 2)
table(dv2) # 8 and 42 group members
rownames(votes.repub)[dv2 == 1]

## For two groups, does the metric matter ?
dv0 <- diana(votes.repub, stand = TRUE) # default: Euclidean
dv.2 <- cutree(as.hclust(dv0), k = 2)
table(dv2 == dv.2)## identical group assignments



For pam(), it's even simpler :

data(ruspini)
pr <- pam(ruspini, 4)
plot(pr)

# Hit  to see next plot: 
str(pr)
## or
summary(pr)
## .. shows you that there's a component 'clustering' :

pr$clustering
## a grouping vector with case-labels {your Gene names}; here "1","2",.."150:

## and to get them ``visually'':
split(rownames(ruspini), pr$clustering)
## $`1`
##  [1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10" "11" "12" "13" "14" 
"15"
## [16] "16" "17" "18" "19" "20"

## $`2`
##  [1] "21" "22" "23" "24" "25" "26" "27" "28" "29" "30" "31" "32" "33" "34" 
"35"
## [16] "36" "37" "38" "39" "40" "41" "42" "43"

## $`3`
##  [1] "44" "45" "46" "47" "48" "49" "50" "51" "52" "53" "54" "55" "56" "57" 
"58"
## [16] "59" "60"

## $`4`
##  [1] "61" "62" "63" "64" "65" "66" "67" "68" "69" "70" "71" "72" "73" "74" 
"75"

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] math-operations

2007-03-30 Thread Dimitris Rizopoulos
513 %/% 100

513 %% 100

check ?"%/%" for more info.


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: "Schmitt, Corinna" <[EMAIL PROTECTED]>
To: 
Sent: Friday, March 30, 2007 3:34 PM
Subject: [R] math-operations


> Hallo R-experts,
>
> for a function I need to work with the commands "div" and "mod" 
> known
> from Pascal and Ruby. The only help I know is "ceiling()" and 
> "floor()"
> in R. Do "div" and "mod" exist? When yes please send me a little
> example.
>
> In Pascal-Syntax I want:
> 513 div 100 = 5
> 513 mod 100 = 13
>
> How can I get this in R-syntax?
>
> Thanks, Corinna
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 


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.


[R] math-operations

2007-03-30 Thread Schmitt, Corinna
Hallo R-experts,

for a function I need to work with the commands "div" and "mod" known
from Pascal and Ruby. The only help I know is "ceiling()" and "floor()"
in R. Do "div" and "mod" exist? When yes please send me a little
example.

In Pascal-Syntax I want: 
513 div 100 = 5
513 mod 100 = 13

How can I get this in R-syntax?

Thanks, Corinna

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


Re: [R] Wikibooks

2007-03-30 Thread Duncan Murdoch
On 3/30/2007 9:16 AM, Alberto Monteiro wrote:
> Romain Francois wrote:
>>
>>> Say I don't know (and I can't understand the help) how to
>>> use the rnorm function. If I do RSiteSearch("rnorm"), I
>>> will get too much useless information. OTOH, an ideal wikipedia
>>> would have a page http://www.r-wiki.org/rnorm, where I could
>>> find examples, learn the theory, browse the source code, and 
>>> have links to similar functions. OK, maybe that's too much, I
>>> would be happy just to have some examples :-)
>> 
>> Do you mean something like (it fullfills basically all your 
>> requirements) :
>> 
>> R> rnorm # get the code
>> R> ?rnorm   # get the help page
>>
> This works when there's a decent documentation for the function.
> The functions in the tcltk package, for example, are horribly
> undocumented, and asking for help only loops to a general
> help about all (and none) of the functions.

I don't remember if you've said which platform you're working on, but if 
you're on Windows, the TCL/TK documentation is available to you.  It's 
in RHOME/Tcl/doc.  This is mentioned in the ?tcltk R help topic.

I believe most Unix-like systems with TCL/TK support installed would 
have the same documentation available, but I don't know where.

That documentation assumes you're using a TCL interpreter rather than R, 
so the syntax is all wrong, but there's a mechanical translation from it 
to R syntax which is described in the ?TkCommands R help topic.

So these functions may be horribly documented, but they're not horribly 
undocumented.

Duncan Murdoch

>  
>> The wiki already has a similar thing, for example for rnorm, you can 
>> go to: http://wiki.r-project.org/rwiki/doku.php?id=rdoc:stats:Normal
>> 
> I didn't like the way it worked. I searched for rnorm and Norm,
> and I got a list of pages. Even for this trivial example, I
> have no idea how I could find anything using the Search.
> 
>> There has been (recently and less recently) some discussions on the
>> r-sig-wiki list about why sometimes you get ~~RDOC~~ instead of the
>> documentation page, it is still a work in progress.
>> 
>> The only tricky bit is how do I know that I have to go to 
>> stats:normal, well you can ask that to R, for example using that 
>> small function :
>> 
>> wikiHelp <- function( ... , sarcasm = TRUE ){
>> if(  length(hp <- help(...) ) > 0 ){
>>   hp <- tail( strsplit(hp[1], "/")[[1]], 3 )
>>   wikiPage <-
>> sprintf("http://wiki.r-project.org/rwiki/doku.php?id=rdoc:%s:%s";,
>> hp[1],  hp[3])
>>cat("the following wiki page will be displayed in your 
>> browser:", wikiPage, ">>> Please feel 
>> free to add information if you have some, " , sep = "\n")  if( 
>> sarcasm) cat( ">>> except if you are an evil person\n")  
>>  browseURL(wikiPage)} else print( hp )  }
>> 
> Nice code :-)
> 
> R> wikiHelp( rnorm )
> 
> ~~RDOC~~ # what is this?
> 
> R> wikiHelp( tkWidgets )
> 
> No documentation for 'tkWidgets' in specified packages and libraries:
> you could try 'help.search("tkWidgets")'
> 
> R> wikiHelp( seq )
> 
> Here it worked as expected.
> 
>> 
>> The wiki has its own search engine already, so you can go there
>> and use it. I guess you can search for "search" there and get
>> info on how to search.
>>
> :-)
> 
> Or I could ask help(help) to learn how help works :-P
> 
> Alberto Monteiro
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Wikibooks

2007-03-30 Thread Alberto Monteiro
Romain Francois wrote:
>
>> Say I don't know (and I can't understand the help) how to
>> use the rnorm function. If I do RSiteSearch("rnorm"), I
>> will get too much useless information. OTOH, an ideal wikipedia
>> would have a page http://www.r-wiki.org/rnorm, where I could
>> find examples, learn the theory, browse the source code, and 
>> have links to similar functions. OK, maybe that's too much, I
>> would be happy just to have some examples :-)
> 
> Do you mean something like (it fullfills basically all your 
> requirements) :
> 
> R> rnorm # get the code
> R> ?rnorm   # get the help page
>
This works when there's a decent documentation for the function.
The functions in the tcltk package, for example, are horribly
undocumented, and asking for help only loops to a general
help about all (and none) of the functions.
 
> The wiki already has a similar thing, for example for rnorm, you can 
> go to: http://wiki.r-project.org/rwiki/doku.php?id=rdoc:stats:Normal
> 
I didn't like the way it worked. I searched for rnorm and Norm,
and I got a list of pages. Even for this trivial example, I
have no idea how I could find anything using the Search.

> There has been (recently and less recently) some discussions on the
> r-sig-wiki list about why sometimes you get ~~RDOC~~ instead of the
> documentation page, it is still a work in progress.
> 
> The only tricky bit is how do I know that I have to go to 
> stats:normal, well you can ask that to R, for example using that 
> small function :
> 
> wikiHelp <- function( ... , sarcasm = TRUE ){
> if(  length(hp <- help(...) ) > 0 ){
>   hp <- tail( strsplit(hp[1], "/")[[1]], 3 )
>   wikiPage <-
> sprintf("http://wiki.r-project.org/rwiki/doku.php?id=rdoc:%s:%s";,
> hp[1],  hp[3])
>cat("the following wiki page will be displayed in your 
> browser:", wikiPage, ">>> Please feel 
> free to add information if you have some, " , sep = "\n")  if( 
> sarcasm) cat( ">>> except if you are an evil person\n")  
>  browseURL(wikiPage)} else print( hp )  }
> 
Nice code :-)

R> wikiHelp( rnorm )

~~RDOC~~ # what is this?

R> wikiHelp( tkWidgets )

No documentation for 'tkWidgets' in specified packages and libraries:
you could try 'help.search("tkWidgets")'

R> wikiHelp( seq )

Here it worked as expected.

> 
> The wiki has its own search engine already, so you can go there
> and use it. I guess you can search for "search" there and get
> info on how to search.
>
:-)

Or I could ask help(help) to learn how help works :-P

Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 NA values

2007-03-30 Thread Gabor Grothendieck
I assume you are referring to na.roughfix in randomForest.  I don't think it
works for logical vectors or for factors outside of data frames:

> library(randomForest)
> DF <- data.frame(a = c(T, F, T, NA, T), b = c(1:3, NA, 5))
> na.roughfix(DF)
Error in na.roughfix.data.frame(DF) : na.roughfix only works for
numeric or factor
> DF$a <- factor(DF$a)
> na.roughfix(DF$a)
Error in na.roughfix.default(DF$a) : roughfix can only deal with numeric data.
> na.roughfix(DF)
  a   b
1  TRUE 1.0
2 FALSE 2.0
3  TRUE 3.0
4  TRUE 2.5
5  TRUE 5.0


On 3/30/07, Sergio Della Franca <[EMAIL PROTECTED]> wrote:
> Dear R-Helpers,
>
>
> I have the following data set(y):
>
>  Test_Result   #_Test
>t 10
>f 14
>f 25
>f NA
>f 40
>t45
>t44
> 47
>tNA
>
>
> I want to replace the NA values with the following method:
> - for the numeric variable, replace NA with median
> - for character variable , replace NA with the most frequent level
>
> If i use x<-na.roughfix(y) the NA values are correctly replaced.
> But if i x<-na.roughfix(y$Test_Result) i obtain the following error:
>
> roughfix can only deal with numeric data.
>
> How can i solve this proble that i met every time i want to replace only the
> NA values of a column (type character)?
>
> Thank you in advance.
>
>
> Sergio Della Franca
>
>[[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.


Re: [R] Wikibooks

2007-03-30 Thread hadley wickham
> >
> > I once tried:
> >
> > http://wiki.r-project.org/rwiki/doku.php?id=guides:lmer-tests
> >
> > but I don't think I will do this again on the existing Wiki. I am a frequent
> > Wikipedia-Writer, so I know how it works, but this was discouraging.
> >
> > 1) The structure of the Wiki was and is still incomprehensibly to me. I 
> > needed
> > too much time to find out how to put the stuff into it.
>
> Really bad. This was the best design we obtained after a hard work of
> several tens of people. Sorry for you. By the way, did you ever noticed
> that Wikipedia basically has NO structure? It is intended to be mostly
> accessed by KEYWORDS. On the main page, you have: "main" (that page),
> then "content" (explanation and general links to the whole content),
> plus a couple of selected content links (featured, recent, random).

Why is how wikipedia structured relevant?  The R wiki is not an
encyclopedia, it has a quite different purpose which would be
facilitiated by better structure.  Obviously at some point the
decision was made to structure the site by type of document (large
guide, short tips, package information etc), but why?  Wouldn't it be
more appropriate to organise it around subjects?  (Of course coming up
with a good subject classification is fiendishly difficult, but
perhaps the R keywords hierarchy would have been a good start).

> So, if you like this structure, that is, basically, no structure and
> access through keywords... why not to do the same with the R Wiki? Just
> type your keyword in the top-right text entry and click "search". Then,
> you don't need to care about that "structure that is still
> incomprehensible to you".

If search is the most important navigational element why is it not
more obvious?  Additionally the recent changes button right next to
the search box makes it harder to distinguish whether the text field
is related to search or recent changes.

> > 2) I decided to use the "large guides" section, because I wanted the thread
> > transcript to be one one page. If you check the revision history, you will 
> > find
> > that I needed more than three hours to get it working. The main reason is 
> > the
> > sluggish response, and the incomprehensible error messages or the lack of it
> > when some " was not matched or whatever (Thanks, Ben, for correcting the
> > remaining errors). This is a problem of the Wiki software used, other Wikis 
> > such
> > as Media(pedia) are much more tolerant or informant.
>
> As I said, sluggish response is probably due to a combination of a slow
> Internet communication from your computer to the server at the time you
> edited your page, the edition of a too large page, and lack of edition
> section per section (you can edit each paragraph separately). I already
> made some corrections on the Wiki when I was in USA (the server is in
> Belgium, Europe), and it was not sluggish at all... On other
> circumstances, I noted a much slower reaction, too. That's Internet!

Regardless of the reasons, the fact remains that at least one person
has found it difficult and slow.  Whenever one person complains you
can be sure that 10 other people have tried and given up without
complaining.

Wiki syntax is difficult and the page explaining it is poorly structured.

> DokuWiki is NOT slower than Mediawiki, especially with an underused Wiki
> site as R wiki is currently.
>
> > Then, Philippe Grosjean informed me: "Your page is way too long and is a 
> > rather
> > crude copy and paste from the long thread in the mailing list."
>
> Yes, I still believe so. Wiki pages are more effective when they are
> kept short.

This is not a good way to build up a community around a wiki.  The
evidence regarding whether many small interlinked pages is more
preferrered or more effective than one large page is scanty, and often
it comes down to personal preference.

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] Wikibooks

2007-03-30 Thread Alberto Monteiro

Duncan Murdoch wrote:
> 
> But the wiki doesn't offer a way to ask questions.  I'd be just as 
> happy to answer questions there as here, but there are none there to 
> answer 
> (and the advice there is to ask questions here).
> 
> I don't know how to organize a wiki to make it easy to ask and 
> answer questions.  It's a reasonably good way to collect reference 
> information, but it's not very well suited to Q&A.
> 
The way to ask questions in the Wiki is to micro-vandalize it :-)))

Since anyone can edit, if I don't know how to use some function,
I can _create_ this page and fill it with my doubts - in the hope
that someone will then fix it latter.

Example:

  rnorm

  This is a very weird function, because things like rnorm(0.975) 
  should return 1.96, but returns numeric(0)

And then someone would either rename the page to qnorm, or write
a new rnorm page.

Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Inquiry

2007-03-30 Thread Inmaculada López García


Good morning,

I have a question about R, I would like to know how it is possible not to
chop the result of an operation. How many decimals it is possible to obtain?

Thank you in advance,
I. López
-
Inmaculada López García
Dpto. Estadística y Matemática Aplicada
Universidad de Almería
La Cañada de San Urbano, s/n
04120  Almería (SPAIN)
Tfno.:   +34 950 01 57 75
Fax:+34 950 01 51 67
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.


Re: [R] Tail area of sum of Chi-square variables

2007-03-30 Thread Klaus Nordhausen
Hi,

thanks everyone! 

pchisqsum() in the "survey" package does exactly what I was looking for!

Best wishes,

Klaus


 Original-Nachricht 
Datum: Thu, 29 Mar 2007 07:45:15 -0700 (PDT)
Von: Thomas Lumley <[EMAIL PROTECTED]>
An: S Ellison <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED], [EMAIL PROTECTED], r-help@stat.math.ethz.ch, [EMAIL 
PROTECTED]
Betreff: Re: [R] Tail area of sum of  Chi-square variables

> 
> The Satterthwaite approximation is surprisingly good, especially in the 
> most interesting range in the right tail (say 0.9 to 0.999). There is also
> another, better, approximation with a power of a chi-squared distribution 
> that has been used in the survey literature.
> 
> However, since it is easy to write down the characteristic function and 
> perfectly feasible to invert it by numerical integration, we might as well
> use the right answer.
> 
>   -thomas
> 
> On Thu, 29 Mar 2007, S Ellison wrote:
> >> I was wondering if there are any R functions that give the tail area
> >> of a sum of chisquare distributions of the type:
> >> a_1 X_1 + a_2 X_2
> >> where a_1 and a_2 are constants and X_1 and X_2 are independent
> >> chi-square variables with different degrees of freedom.
> >
> > You might also check out Welch and Satterthwaite's (separate) papers on
> effective degrees of freedom for compound estimates of variance, which led
> to a thing called the welch-satterthwaite equation by one (more or less
> notorious, but widely used) document called the ISO Guide to Expression of
> Uncertainty in Measurement (ISO, 1995). The original papers are
> > B. L. Welch, J. Royal Stat. Soc. Suppl.(1936)  3 29-48
> > B. L. Welch, Biometrika, (1938) 29 350-362
> > B. L. Welch, Biometrika, (1947) 34 28-35
> >
> > F. E. Satterthwaite, Psychometrika (1941) 6 309-316
> > F. E. Satterthwaite, Biometrics Bulletin, (1946) 2 part 6 110-114
> >
> > The W-S equation - which I believe is a special case of Welch's somewhat
> more general treatment - says that if you have multiple independent
> estimated variances v[i] (could be more or less equivalent to your a_i X_i?) 
> with
> degrees of freedom nu[i], the distribution of their sum is approximately a
> scaled chi-squared distribution with effective degrees of freedom
> nu.effective given by
> >
> > nu.effective =  sum(v[i])^2 / sum((v[i]^2)/nu[i] )
> >
> > If I recall correctly, with an observed variance s^2 (corresponding to
> the sum(v[i] above if those are observed varianes), nu*(s^2 /sigma^2) is
> distributed as chi-squared with degrees of freedom nu, so the scaling factor
> for quantiles would come out of there (depending whether you're after the
> tail areas for s^2 given sigma^2 or for a confidence interval for sigma^2
> given s^2)
> >
> > However, I will be most interested to see what a more exact calculation
> provides!
> >
> > Steve Ellison
> >
> >
> > ***
> > This email and any attachments are confidential. Any use,
> co...{{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.
> >
> 
> Thomas Lumley Assoc. Professor, Biostatistics
> [EMAIL PROTECTED] University of Washington, Seattle

-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Wikibooks

2007-03-30 Thread Duncan Murdoch
On 3/30/2007 7:34 AM, Alberto Monteiro wrote:
> Duncan Murdoch wrote:
>> 
>> But the wiki doesn't offer a way to ask questions.  I'd be just as 
>> happy to answer questions there as here, but there are none there to 
>> answer 
>> (and the advice there is to ask questions here).
>> 
>> I don't know how to organize a wiki to make it easy to ask and 
>> answer questions.  It's a reasonably good way to collect reference 
>> information, but it's not very well suited to Q&A.
>> 
> The way to ask questions in the Wiki is to micro-vandalize it :-)))
> 
> Since anyone can edit, if I don't know how to use some function,
> I can _create_ this page and fill it with my doubts - in the hope
> that someone will then fix it latter.
> 
> Example:
> 
>   rnorm
> 
>   This is a very weird function, because things like rnorm(0.975) 
>   should return 1.96, but returns numeric(0)
> 
> And then someone would either rename the page to qnorm, or write
> a new rnorm page.

If entering a new page is really the way to ask a question, then you 
should write this on the front page, and as a possible way to contribute 
on the getting-started page.  It would also be a good idea to tell 
people like me how to find those questions. ("Recent Edits" seems a 
little too broad, with too little in the way of subject matter in the 
comments, but maybe that's just because nobody's asking questions yet.)

And it would be a good idea to seed the wiki with a lot of questions, 
just to get some activity going.

And maybe set up a page for pointers to questions that are languishing 
unanswered?  I think the key is to make it easy to ask a question and 
easy to answer one, so don't put too much bureaucracy into the process.


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.


[R] Model comparison

2007-03-30 Thread João Fadista
Dear all,
 
I would like to know if I can compare by a significance test 2 models with 
different kind of parameters. Perhaps I am wrong but I think that we can only 
compare 2 models if one is a sub model of the other.
 

Med venlig hilsen / Regards

João Fadista
Ph.d. studerende / Ph.d. student



 AARHUS UNIVERSITET / UNIVERSITY OF AARHUS  
Det Jordbrugsvidenskabelige Fakultet / Faculty of Agricultural Sciences 
Forskningscenter Foulum / Research Centre Foulum
Genetik og Bioteknologi / Dept. of Genetics and Biotechnology   
Blichers Allé 20, P.O. BOX 50   
DK-8830 Tjele   

Tel: +45 8999 1900  
Direct:  +45 8999 1900  
Mobile:  +45
E-mail:  [EMAIL PROTECTED]    
Web: www.agrsci.dk   


Tilmeld dig DJF's nyhedsbrev / Subscribe Faculty of Agricultural Sciences 
Newsletter  . 

Denne email kan indeholde fortrolig information. Enhver brug eller 
offentliggørelse af denne email uden skriftlig tilladelse fra DJF er ikke 
tilladt. Hvis De ikke er den tiltænkte adressat, bedes De venligst straks 
underrette DJF samt slette emailen.

This email may contain information that is confidential. Any use or publication 
of this email without written permission from Faculty of Agricultural Sciences 
is not allowed. If you are not the intended recipient, please notify Faculty of 
Agricultural Sciences immediately and delete this email.

 

[[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] Regarding Vista

2007-03-30 Thread Alberto Monteiro

John Kane wrote:
> 
> As a somewhat desperate workaround try installing R on
> a USB and see if you can run if from there.  I have
> 2.4.1 on a USB and it seems to work fine albeit a bit 
> more slowly than from the hard drive.
> 
I love this quote, in http://zoonek2.free.fr/UNIX/48_R/02.html,
from Barry Rowlingson: 

  At some point the complexity of
  installing things like this for Windows will cross the
  complexity of installing Linux... (PS excepting
  live-Linux installs like Knoppix)

Maybe we have reached this point :-)

Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Regarding Vista

2007-03-30 Thread John Kane

--- Dieter Menne <[EMAIL PROTECTED]> wrote:

>   ccilindia.co.in> writes:
> 
> > 
> > I am facing the same problem in my case. R 2.4.1
> have installed 
> > successfully, but when i try to install the
> packages from a local zip 
> > file. It gives the following error message. 
> > +++
> > > utils:::menuInstallLocal()
> > Error in zip.unpack(pkg, tmpDir) : cannot open
> file 'C:/Program 
> >
>
Files/R/R-2.4.1/library/file5d2b5841/aaMI/chtml/aaMI.chm'
> > > 
> > +++
> > 
> > Please tell me how to install the packages in a
> corporate environment. I 
> > mean i could not understand your reply, may you be
> a bit more elaborate so 
> > that i can fix up the problem in my corporate
> laptop.

As a somewhat desperate workaround try installing R on
a USB and see if you can run if from there.  I have
2.4.1 on a USB and it seems to work fine albeit a bit 
more slowly than from the hard drive.  


> The general recommendation in the FAQ Prof. Ripley
> mentions works for me; so
> does switching of User Account Control (english?)
> totally. This may not be
> feasible for you on a corporate laptop. I tried the
> following method: Download
> the updates locally, remove the chm folder, install
> from local zip file. Works
> for some packages, but when a DLL is included, the
> story starts again, and you
> cannot remove these. 
> 
> So, sorry, currently no simple solution for
> corporate laptops where you don't
> have full rights.
> 
> Dieter
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Wikibooks

2007-03-30 Thread Alberto Monteiro
Philippe Grosjean wrote:
> 
> As other have pointed out, the main reason for the lack of success 
> of the R Wiki is that the mailing lists, particularly R-Help, are 
> sooo successful. However, I continue to consider that the mailing 
> list is suboptimal in two cases: (1) when text is not enough to 
> express the idea, and (2) for frequent questions that would 
> certainly deserve a good compilation on a wiki page and a 
> redirection to it everytime the question is asked.
> 
I think there's one case where the mailing list is non-optimal:
finding examples. This is where a wiki would be great.

Say I don't know (and I can't understand the help) how to
use the rnorm function. If I do RSiteSearch("rnorm"), I
will get too much useless information. OTOH, an ideal wikipedia
would have a page http://www.r-wiki.org/rnorm, where I could
find examples, learn the theory, browse the source code, and 
have links to similar functions. OK, maybe that's too much, I
would be happy just to have some examples :-)

Also, RSiteSearching is dangerous, because if someone replies
in an ignorant or malicous way (let's be creative: someone asks
"how can I open the file CONFIG.SYS", and an evil person replies 
with file.remove("CONFIG.SYS")), then this wrong answer may
be accessed by newbies. A wikipedia _may_ have wrong answers,
but these are (hopefully) ephemeral.

BTW, is it too hard to include the wiki in RSiteSearch?

Alberto Monteiro

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Wikibooks

2007-03-30 Thread Duncan Murdoch
On 3/30/2007 5:27 AM, Philippe Grosjean wrote:
> 
> Bert Gunter wrote:
>> Question:
>>
>> Many (perhaps most?) questions on the list are easily answerable simply by
>> checking existing R Docs (Help file/man pages, Intro to R, etc.). Why would
>> a Wiki be more effective in deflecting such questions from the mailing list
>> than them? Why would too helpful R experts be more inclined to refer people
>> to the Wiki than the existing docs? Bottom line: it's psychology at issue
>> here, I think, not the form of the docs. 
> 
> Answer:
> 
> The online help, vignettes and manuals have a very intimidating (i.e., 
> technical) presentation for people that tend to be afraid of such a 
> crude presentation. It is apparently not your case, and this is probably 
> why you even don't realize this could be a problem for a non negligible 
> fraction of R. The Wiki was primarily targeted to them. As you say: it's 
> psychology at issue here.
> 
> As other have pointed out, the main reason for the lack of success of 
> the R Wiki is that the mailing lists, particularly R-Help, are sooo 
> successful. However, I continue to consider that the mailing list is 
> suboptimal in two cases: (1) when text is not enough to express the 
> idea, and (2) for frequent questions that would certainly deserve a good 
> compilation on a wiki page and a redirection to it everytime the 
> question is asked.

But the wiki doesn't offer a way to ask questions.  I'd be just as happy 
to answer questions there as here, but there are none there to answer 
(and the advice there is to ask questions here).

I don't know how to organize a wiki to make it easy to ask and answer 
questions.  It's a reasonably good way to collect reference information, 
but it's not very well suited to Q&A.

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.


[R] substitute NA values

2007-03-30 Thread Sergio Della Franca
Dear R-Helpers,


I have the following data set(y):

  Test_Result   #_Test
t 10
f 14
f 25
f NA
f 40
t45
t44
47
tNA


I want to replace the NA values with the following method:
- for the numeric variable, replace NA with median
- for character variable , replace NA with the most frequent level

If i use x<-na.roughfix(y) the NA values are correctly replaced.
But if i x<-na.roughfix(y$Test_Result) i obtain the following error:

roughfix can only deal with numeric data.

How can i solve this proble that i met every time i want to replace only the
NA values of a column (type character)?

Thank you in advance.


Sergio Della Franca

[[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] Wikibooks

2007-03-30 Thread Philippe Grosjean

..<°}))><
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..

Dieter Menne wrote:
> Ben Bolker  zoo.ufl.edu> writes:
> 
>>   Well, we do have an R wiki -- http://wiki.r-project.org/rwiki/doku.php --
>> although it is not as active as I'd like.  (We got stuck halfway through
>> porting Paul Johnson's "R Tips" to it ...)   Please contribute!
> 
> I once tried:
> 
> http://wiki.r-project.org/rwiki/doku.php?id=guides:lmer-tests
> 
> but I don't think I will do this again on the existing Wiki. I am a frequent
> Wikipedia-Writer, so I know how it works, but this was discouraging.
> 
> 1) The structure of the Wiki was and is still incomprehensibly to me. I needed
> too much time to find out how to put the stuff into it.

Really bad. This was the best design we obtained after a hard work of 
several tens of people. Sorry for you. By the way, did you ever noticed 
that Wikipedia basically has NO structure? It is intended to be mostly 
accessed by KEYWORDS. On the main page, you have: "main" (that page), 
then "content" (explanation and general links to the whole content), 
plus a couple of selected content links (featured, recent, random).

So, if you like this structure, that is, basically, no structure and 
access through keywords... why not to do the same with the R Wiki? Just 
type your keyword in the top-right text entry and click "search". Then, 
you don't need to care about that "structure that is still 
incomprehensible to you".

> 2) I decided to use the "large guides" section, because I wanted the thread
> transcript to be one one page. If you check the revision history, you will 
> find
> that I needed more than three hours to get it working. The main reason is the
> sluggish response, and the incomprehensible error messages or the lack of it
> when some " was not matched or whatever (Thanks, Ben, for correcting the
> remaining errors). This is a problem of the Wiki software used, other Wikis 
> such
> as Media(pedia) are much more tolerant or informant.

As I said, sluggish response is probably due to a combination of a slow 
Internet communication from your computer to the server at the time you 
edited your page, the edition of a too large page, and lack of edition 
section per section (you can edit each paragraph separately). I already 
made some corrections on the Wiki when I was in USA (the server is in 
Belgium, Europe), and it was not sluggish at all... On other 
circumstances, I noted a much slower reaction, too. That's Internet!

DokuWiki is NOT slower than Mediawiki, especially with an underused Wiki 
site as R wiki is currently.

> Then, Philippe Grosjean informed me: "Your page is way too long and is a 
> rather
> crude copy and paste from the long thread in the mailing list."

Yes, I still believe so. Wiki pages are more effective when they are 
kept short.

> I disagree. Why do you have a "large guides" section? And taking into account
> the amount of work I put into reformatting the transcript, I decided it was my
> first and last contribution to the Wiki.

The "large guides" section is for ... large guides, of course... but who 
said that they should be all contained in a single page??? Just quoting 
http://wiki.r-project.org/rwiki/doku.php?id=guides:guides: "If it is a 
larger contribution with many pages, create a dedicated subsection in 
tutorials (like “stats-with-r”, for instance)." The key is there: a 
large guide should better be represented by several wiki pages collected 
together in a dedicated subsection. Is it that hard to understand?

Philippe Grosjean

> Dieter Menne
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Wikibooks

2007-03-30 Thread Philippe Grosjean


Bert Gunter wrote:
> Question:
> 
> Many (perhaps most?) questions on the list are easily answerable simply by
> checking existing R Docs (Help file/man pages, Intro to R, etc.). Why would
> a Wiki be more effective in deflecting such questions from the mailing list
> than them? Why would too helpful R experts be more inclined to refer people
> to the Wiki than the existing docs? Bottom line: it's psychology at issue
> here, I think, not the form of the docs. 

Answer:

The online help, vignettes and manuals have a very intimidating (i.e., 
technical) presentation for people that tend to be afraid of such a 
crude presentation. It is apparently not your case, and this is probably 
why you even don't realize this could be a problem for a non negligible 
fraction of R. The Wiki was primarily targeted to them. As you say: it's 
psychology at issue here.

As other have pointed out, the main reason for the lack of success of 
the R Wiki is that the mailing lists, particularly R-Help, are sooo 
successful. However, I continue to consider that the mailing list is 
suboptimal in two cases: (1) when text is not enough to express the 
idea, and (2) for frequent questions that would certainly deserve a good 
compilation on a wiki page and a redirection to it everytime the 
question is asked.

Best,

Philippe Grosjean
-- 
..<°}))><
  ) ) ) ) )
( ( ( ( (Prof. Philippe Grosjean
  ) ) ) ) )
( ( ( ( (Numerical Ecology of Aquatic Systems
  ) ) ) ) )   Mons-Hainaut University, Belgium
( ( ( ( (
..



> Disclaimer 1: None of this is meant to reflect one way or ther other on the
> usefulness of Wikis as a documentation format -- only their ability to
> change the Help list culture.
> 
> Disclaimer 2: Others have repeatedly made similar comments (asking us to
> refer people to the docs rather than providing explicit answers, I mean).
> 
> Cheers,
> Bert Gunter
> Genentech Nonclinical Statistics
> South San Francisco, CA 94404
> 650-467-7374
> 
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Frank E Harrell Jr
> Sent: Thursday, March 29, 2007 3:32 PM
> To: Ben Bolker
> Cc: r-help@stat.math.ethz.ch
> Subject: Re: [R] Wikibooks
> 
> Ben Bolker wrote:
>> Alberto Monteiro  centroin.com.br> writes:
>>
>>> As a big fan of Wikipedia, it's frustrating to see how little there is
> about 
>>> R in the correlated project, the Wikibooks:
>>>
>>> http://en.wikibooks.org/wiki/R_Programming
>>>
>>> Alberto Monteiro
>>>
>>   Well, we do have an R wiki -- http://wiki.r-project.org/rwiki/doku.php
> --
>> although it is not as active as I'd like.  (We got stuck halfway through
>> porting Paul Johnson's "R Tips" to it ...)   Please contribute!
>>   Most of the (considerable) effort people expend in answering
>> questions about R goes to the mailing lists -- I personally would like it
> if some
>> tiny fraction of that energy could be redirected toward the wiki, where
>> information can be presented in a nicer format and (ideally) polished
>> over time -- rather than having to dig back through multiple threads on
> the
>> mailing lists to get answers.  (After that we have to get people
>> to look for the answers on the wiki.)
> 
> I would like to strongly second Ben.  In some ways, R experts are too 
> nice.  Continuing to answer the same questions over and over does not 
> lead to a better way using R wiki.  I would rather see the work go into 
> enhancing the wiki and refactoring information, and responses to many 
> r-help please for help be "see wiki topic x".  While doing this let's 
> consider putting a little more burden on new users to look for good 
> answers already provided.
> 
> Frank
> 
>>   Just my two cents -- and I've been delinquent in my 
>> wiki'ing recently too ...
>>
>>   Ben Bolker
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/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] Hmisc summary.formula.reverse export problem

2007-03-30 Thread Lauri Nikkinen
Thanks Brian,



I was trying to get that object printed out with columns separated by
semicolon. The reason for this is that I'm trying to get it to MS Excel. If
this is not possible, I probably should turn into using Latex.


-Lauri

2007/3/30, Prof Brian Ripley <[EMAIL PROTECTED]>:
>
> Well, write.table works on 'tables', that is matrix-like objects.
> An object summary is not matrix-like.
>
> You may be looking for
>
> capture.output(print(taulu3), file="O:/taulu1.txt")
>
>
> On Fri, 30 Mar 2007, Lauri Nikkinen wrote:
>
> > Dear R-users,
> >
> > I'm trying to export object taulu3 from R to a text file (separated with
> > semicolon). Object taulu3 is made with summary.formula in Hmisc package:
> >
> > taulu3 <- summary(sp ~ pdg_newtext, data=tr_ekahj, method="reverse",
> > overall=TRUE)
> > class(taulu3)
> > [1] "summary.formula.reverse"
> >
> > When I try to export the object taulu3, I get the following error
> message:
> >
> > write.table(taulu3, "O:/taulu1.txt", sep=";")
> >
> > Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors
> =
> > stringsAsFactors) :
> >cannot coerce class "summary.formula.reverse" into a data.frame
> >
> > How can I get this object exported properly? I'm using Windows XP and I
> > don't know latex yet.
> >
> > Regards,
> > Lauri
> >
> >   [[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.
> >
>
> --
> Brian D. Ripley,  [EMAIL PROTECTED]
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel:  +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UKFax:  +44 1865 272595
>

[[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] R equivalent of S+SeqTrial?

2007-03-30 Thread francogrex

Thanks again; It's ok I'm using the ldBands function now, the ld98.exe is
just a small file to download into the path. I can calculate the alpha
spending function and determine (given the Z statistics of my observations)
if at the interim analysis the null hypothesis is to be rejected or not.
But Does this function allow me to calculate the conditional power given the
accumulating data? (I know they give the exit probabilities but is it those
that I need?) and in the documentations they make a reference to another
function using a bayesian method (Gaussian Bayesian Posterior and Predictive
Distributions), but i'm not comfortable yet using the bayesian methods.


On Wed, 2007-03-28 at 10:49 -0500, Douglas Bates wrote:
> On 3/28/07, Marc Schwartz <[EMAIL PROTECTED]> wrote:
> > On Wed, 2007-03-28 at 02:42 -0700, francogrex wrote:
> > > Does anyone know of an R package that is equivalent of S+SeqTrial for
> > > analysis of clinical trials using group sequential methods? Thanks.
> >
> > I don't know that there are fully functional equivalents, but you might
> > want to look at the following:
> >
> > 1. The GroupSeq package on CRAN:
> >
> >   http://cran.r-project.org/src/contrib/Descriptions/GroupSeq.html
> >
> >
> > 2. The ldBands() function in Frank Harrell's Hmisc package on CRAN:
> >
> >   http://biostat.mc.vanderbilt.edu/s/Hmisc/html/ldBands.html
> >
> > This also requires the ld98 executable, which is available from:
> >
> >   http://www.biostat.wisc.edu/landemets/
> 
> There is also the ldbounds package on CRAN for calculating Lan-DeMets
> boundaries.  It was prepared by students working with Dave DeMets and
> does not require the ld98 executable.

-- 
View this message in context: 
http://www.nabble.com/R-equivalent-of-S%2BSeqTrial--tf3478858.html#a9749485
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Kmeans centers

2007-03-30 Thread Sergio Della Franca
Thank you very much Gavin,

The set.seed is the correct function i need.

Now the kmeans is permanent and doesn't change results every time i run.





2007/3/30, Gavin Simpson <[EMAIL PROTECTED]>:
>
> On Fri, 2007-03-30 at 09:07 +0200, Sergio Della Franca wrote:
> > My simple problem is that when i run kmeans this give me different
> > results because if centers is a number, a random set of (distinct)
> > rows in x is chosen as the initial centres.
>
> You can stop this and make it reproducible by setting the seed for the
> random number generator before doing kmeans - this way the same
> (pseudo)random set of rows get selected each time:
>
> dat <- data.frame(a = rnorm(100), b = rnorm(100), c = rnorm(100))
> set.seed(1234)
> km <- kmeans(dat, 2)
> set.seed(1234)
> km2 <- kmeans(dat, 2)
> all.equal(km, km2) ## TRUE
>
> But ask yourself is this is helpful? Are the solutions similar each time
> you run the function (without setting the seed) and get different
> results? If the runs give very different results then it is likely that
> you are finding local minima not an optimal solution - a common problem
> with iterative algorithms using random starts.
>
> One solution to this /is/ to use several random starts and see if you
> get similar results. Some samples may switch clusters, but if the bulk
> of samples assigned to same cluster (i.e. together, not in cluster "1"
> as the cluster number is random) then you can be happy with the result.
> That some samples switch clusters may just indicate that there isn't a
> clearly defined clustering of all your samples - some are intermediate
> between clusters.
>
> Another is to use a hierarchical cluster analysis (via hclust()). Cut it
> at the number of clusters you want and use the centers (sic) of those
> clusters as the starting points for kmeans. This way the hclust()
> results get you close to a good solution, which kmeans then updates as
> it is not constrained by having a hierarchical structure.
>
> There is an example of this in Modern Applied Statistics with S (2002 -
> Venables and Ripley, Springer), but if you don't have this book, you can
> see the MASS scripts for Chapter 11 of the book. The MASS scripts should
> have been provided with your copy of R, in
> RINSTALL/library/MASS/scripts/ where RINSTALL is the where your version
> of R is installed. Then you want ch11.R in that directory. Look at
> section 11.2 Cluster Analysis in that file
>
> >
> > About me the problem is simple.
> >
> > The question i ask you is if it possible that centers could be
> > different from number.
> > i.e. instead of indicate a number of center, could be possible
> > indicate different character lable to identify the cluster i want to
> > obtain?
>
> No. And this is why, despite how clear and simple the problem is to you,
> you need to show us an example of your data! Surly, if you have
> information that exactly identifies the clusters you want to find, why
> do you need a clustering algorithm to find them for you?
>
> G
>
> >
> > thk you
> >
> >
> >
> > 2007/3/29, Gavin Simpson <[EMAIL PROTECTED]>:
> > On Thu, 2007-03-29 at 15:02 +0200, Sergio Della Franca wrote:
> > > Dear R-Helpers,
> > >
> > > I read in the R documentation, about kmeans:
> > >
> > >   centers
> > >
> > > Either the number of clusters or a set of initial (distinct)
> > cluster
> > > centres. *If a number*, a random set of (distinct) rows in x
> > is chosen as
> > > the initial centres.
> > > My question is: could it be possible that the centers are
> > character and not
> > > number?
> >
> > I think you misunderstand - centers is the number of clusters
> > you want
> > to partition your data into. How else would you specify the
> > number of
> > clusters other than by a number? So no, it has to be a numeric
> > number.
> >
> > The alternative use of centers is to provide known starting
> > points for
> > the algorithm, such as from the results of a hierarchical
> > cluster
> > analysis, that are the locations of the cluster centroids, for
> > each
> > cluster, on each of the feature variables.
> >
> > Also, argument x to kmeans() is specific about requiring a
> > numeric
> > matrix (or something coercible to one), so characters here are
> > not
> > allowed either.
> >
> > But then again, I may not have understood what it is that you
> > are
> > asking, but that is not surprising given that you have not
> > provided an
> > example of what you are trying to do, and how you tried to do
> > it but
> > failed.
> >
> > > and provide commented, minimal, self-contained, reproducible
> > code.
> >
> > ^^^
> >