[R] scalassoc package

2006-04-18 Thread Jan de Leeuw

Many new things at

http://www.cuddyvalley.org/psychoR/

The scalassoc package, which fits exponential distance association  
models
to indicator matrices, it now at version 1.0.0. It seems to be robust  
and
can analyze large examples easily. It is a major improvement (in  
speed and

robustness) over the distassoc package, which is at the same site.

scalassoc does something neat (if you like that sort of thing). It  
writes
the changing configurations to a plotwindow for your default device,  
showing
the iterations as a movie. But, if you have ffmpeg installed in your  
path,

then it also has the option to write the iterations to a quicktime movie
file. Currently this creates a lot of intermediate jpeg's (although  
it cleans up

after itself). It may be possible to use ffmpeg to stream them directly
into a movie file.


Just to give you an idea, the data are in the n x k_j indicator  
matrices G_j, where g_{ijl}=1
if object i is in category (level) l of variable j. The log- 
likelihood we maximize is


pastedGraphic.pdf
Description: Adobe PDF document



Variable j has k_j levels, and after we are done we can make a Voronoi
diagram (using the deldir package) of the k_j points y_{jl}. Maximizing
the likelihood means trying to make sure each of the x_i is in the  
"correct"
Voronoi cell, i.e. the Voronoi cell corresponding with the category  
of variable j that i was

in (i.e. for which g_{ijl}=1). This generalizes multidimensional IRT
models, the choice models used for voting data in political science,
the Goodman-Haberman-Gilula-Ritov distance association models, the
Luce-Shepard choice model, and so on, to multivariate/multicategory  
data.


It is part of the "Gifi Goes Logistic" project.
The algorithm is based on majorization, starting with multiple  
correspondence

analysis, and each iteration does one step of a truncated SVD (with a
different target in each iteration). The movies show the movement of X
from one iteration to the next.

===
Jan de Leeuw; Distinguished Professor and Chair, UCLA Department of  
Statistics;
Editor: Journal of Multivariate Analysis, Journal of Statistical  
Software

US mail: 8125 Math Sciences Bldg, Box 951554, Los Angeles, CA 90095-1554
phone (310)-825-9550;  fax (310)-206-5658;  email: [EMAIL PROTECTED]
.mac: jdeleeuw ++  aim: deleeuwjan ++ skype: j_deleeuw
homepages: http://gifi.stat.ucla.edu ++ http://www.cuddyvalley.org
  
 
-

  No matter where you go, there you are. --- Buckaroo Banzai
   http://gifi.stat.ucla.edu/sounds/nomatter.au
  
 
-




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

[R] Unfound objects in function

2006-04-18 Thread Colin Beale
A couple of my functions that were working last week seem to have been
changed over the weekend and no longer work, but I can't understand why
not: it seems that objects defined at the start of the function are not
located further on in the function, when this worked fine before. An
example follows at the end, using the package spatstat, though the
problem seems more general. My only guess is that I've accidentally
changed something to do with the environment that functions are
searching in to exclude themselves, but if so I've no idea how I did or
how I can cancel it!

Thanks in advance,

Colin


library (spatstat)

kernelEst <- function (data, max.r = 10, edge = TRUE) {

  if (!is.ppp (data)) stop ("data must be a point process object")

  i <- 0.1
  diff<- 1
  smo <- 1

  while (diff > 0) {
olddiff <- diff
oldsmo  <- smo
smo <- density.ppp (data, sigma = 2 * i, edge = edge)
lambda  <- smo[data]
Ki  <- Kinhom (data[,data$window], lambda = lambda, r = seq (0,
max.r, length = 100), correction = "trans")
diff<- sum (Ki$theo - Ki$trans)
i   <- i + 0.1
if (i > max.r) stop ("no suitable kernel found within 0.2 to
max.r")
  }

  if (abs (olddiff) > abs (diff)) return (smo) else return (oldsmo)
}

data (simdat)
test <- kernelEst (simdat)
Error in while (diff > 0) { : missing value where TRUE/FALSE needed

 

> version
 _  
platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor2.1
year 2005   
month12 
day  20 
svn rev  36812  
language R

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


[R] get the parameter estimates from lm model

2006-04-18 Thread Luis Ridao Cruz
R-help,

Sorry for posting the same question (almost) once again.

I'm using a lm  model for some data.
The code is below:

fitData <- glm(pm ~ age + mw , family = binomial(link = logit), maxit =
30, data = inputModel1)

"age" is a factor and "mw" is a continous variable.

The summary function does not provide the parameter estimates for 
the first level of the categorical variable (I think the others are
relative to the first,isn't it?).

How can I get all the parameter estimates in the model?


Thank you in advance



I run on a Windows Xp machine

> version
 _  
platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor2.1
year 2005   
month12 
day  20 
svn rev  36812  
language R

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


[R] get the parameter estimates from lm model - was "glm"

2006-04-18 Thread Luis Ridao Cruz
R-help,

Sorry for the mistake in my previous message.
I have written "lm" but in the function call is "glm".

Everything  should be "glm".

Sorry for the inconvenience.

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


Re: [R] get the parameter estimates from lm model

2006-04-18 Thread TEMPL Matthias
Do you have a look at

names(fitData)
fitData$coef

Best,
Matthias

> -Ursprüngliche Nachricht-
> Von: [EMAIL PROTECTED] [mailto:r-help-
> [EMAIL PROTECTED] Im Auftrag von Luis Ridao Cruz
> Gesendet: Dienstag, 18. April 2006 10:23
> An: r-help@stat.math.ethz.ch
> Betreff: [R] get the parameter estimates from lm model
> 
> R-help,
> 
> Sorry for posting the same question (almost) once again.
> 
> I'm using a lm  model for some data.
> The code is below:
> 
> fitData <- glm(pm ~ age + mw , family = binomial(link = logit), maxit =
> 30, data = inputModel1)
> 
> "age" is a factor and "mw" is a continous variable.
> 
> The summary function does not provide the parameter estimates for
> the first level of the categorical variable (I think the others are
> relative to the first,isn't it?).
> 
> How can I get all the parameter estimates in the model?
> 
> 
> Thank you in advance
> 
> 
> 
> I run on a Windows Xp machine
> 
> > version
>  _
> platform i386-pc-mingw32
> arch i386
> os   mingw32
> system   i386, mingw32
> status
> major2
> minor2.1
> year 2005
> month12
> day  20
> svn rev  36812
> language R
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-
> guide.html

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


Re: [R] get the parameter estimates from lm model

2006-04-18 Thread Dimitris Rizopoulos
Look at:

?contrasts
?contr.treatment


I hope it helps.

Best,
Dimitris


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

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


- Original Message - 
From: "Luis Ridao Cruz" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, April 18, 2006 10:22 AM
Subject: [R] get the parameter estimates from lm model


> R-help,
>
> Sorry for posting the same question (almost) once again.
>
> I'm using a lm  model for some data.
> The code is below:
>
> fitData <- glm(pm ~ age + mw , family = binomial(link = logit), 
> maxit =
> 30, data = inputModel1)
>
> "age" is a factor and "mw" is a continous variable.
>
> The summary function does not provide the parameter estimates for
> the first level of the categorical variable (I think the others are
> relative to the first,isn't it?).
>
> How can I get all the parameter estimates in the model?
>
>
> Thank you in advance
>
>
>
> I run on a Windows Xp machine
>
>> version
> _
> platform i386-pc-mingw32
> arch i386
> os   mingw32
> system   i386, mingw32
> status
> major2
> minor2.1
> year 2005
> month12
> day  20
> svn rev  36812
> language R
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 


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


Re: [R] Unfound objects in function

2006-04-18 Thread Prof Brian Ripley
It does not say `unfound' it says `missing value'.  See ?NA.
Note it is the value and not the object that is said to be missing.

Looks like on your data that one or more of the values you are summing is 
NA.

On Tue, 18 Apr 2006, Colin Beale wrote:

> A couple of my functions that were working last week seem to have been
> changed over the weekend and no longer work, but I can't understand why
> not: it seems that objects defined at the start of the function are not
> located further on in the function, when this worked fine before. An
> example follows at the end, using the package spatstat, though the
> problem seems more general. My only guess is that I've accidentally
> changed something to do with the environment that functions are
> searching in to exclude themselves, but if so I've no idea how I did or
> how I can cancel it!
>
> Thanks in advance,
>
> Colin
>
>
> library (spatstat)
>
> kernelEst <- function (data, max.r = 10, edge = TRUE) {
>
>  if (!is.ppp (data)) stop ("data must be a point process object")
>
>  i <- 0.1
>  diff<- 1
>  smo <- 1
>
>  while (diff > 0) {
>olddiff <- diff
>oldsmo  <- smo
>smo <- density.ppp (data, sigma = 2 * i, edge = edge)
>lambda  <- smo[data]
>Ki  <- Kinhom (data[,data$window], lambda = lambda, r = seq (0,
> max.r, length = 100), correction = "trans")
>diff<- sum (Ki$theo - Ki$trans)
>i   <- i + 0.1
>if (i > max.r) stop ("no suitable kernel found within 0.2 to
> max.r")
>  }
>
>  if (abs (olddiff) > abs (diff)) return (smo) else return (oldsmo)
> }
>
> data (simdat)
> test <- kernelEst (simdat)
> Error in while (diff > 0) { : missing value where TRUE/FALSE needed
>
>
>
>> version
> _
> platform i386-pc-mingw32
> arch i386
> os   mingw32
> system   i386, mingw32
> status
> major2
> minor2.1
> year 2005
> month12
> day  20
> svn rev  36812
> language R
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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

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


[R] Extra \input command in Sweave created figures.

2006-04-18 Thread Fredrik Karlsson
Dear list,

I am using Sweave to generate figures and tables for my thesis. Now, I
have run into the problem that all of a sudden, Sweave produces not
only an \includegraphics command, but a
\include command as well. This breakes LaTeX processing.

This is an example:

The code:


\begin{figure}[htbp]
  \centering
<>=
sel <-   mannerDF$target %in% c("skal","kal","sal","gal") &
mannerDF$onsetLength == 1
print(
  dotplot(
  
prop.table(table(mannerDF$agem[sel],mannerDF$target[sel],mannerDF$manner[sel]),1)
  ,auto.key=list(
 space="right"
 )
  )
  )
@
\caption[Relative frequence of occurence for each manner of
articulation in simple productions of Skal,kal,gal and
sal]{Relative frequence of occurence for each manner of
 articulation in simple productions of the skal,kal,gal and sal
 target words.}
  \label{fig:manner-skal-simple}
\end{figure}

Produces this LaTeX output when run through Sweave:



\begin{figure}[htbp]
  \centering
\input{manner-mannerSimpleSkal}
\includegraphics{manner-mannerSimpleSkal}
\caption[Relative frequence of occurence for each manner of
articulation in simple productions of Skal,kal,gal and
sal]{Relative frequence of occurence for each manner of
 articulation in simple productions of the skal,kal,gal and sal
 target words.}
  \label{fig:manner-skal-simple}
\end{figure}

What is causing the extra \input? I had this problem once before, but
was enable then to fix the problem by randomly adding and removing
blank space. Now, this problem seem to have occured in 18 figures,
which means I would like to find the acctual problem this time rather
than trying to remove the symptoms.

Thankful for all the help I could get.

/Fredrik

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


[R] adding lines to scatterplot3d

2006-04-18 Thread andrea valle
Hi to all,
I usually use R for simple 2D graphs so now I cannot solve the 
following problem (which I suppose very simple too).

I'm using scatterplot3d. I want to add dotted lines parallel to the 3 
axes, in order to create a sort of cage in the 3D box (so to represent 
subdomains in my dataspace).
I saw that points3d can be used to draw points or lines to the existing 
plot but actually I'm able only to draw points (I grabbed an example 
from the web)

Could anyone post a line of code with an example?


Thanks a lot


-a-

Andrea Valle
DAMS - Facoltà di Scienze della Formazione
Università degli Studi di Torino
http://www.semiotiche.it/andrea
[EMAIL PROTECTED]
[[alternative text/enriched version deleted]]

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

Re: [R] using betareg: problems with anova and predict

2006-04-18 Thread Achim Zeileis
On Mon, 17 Apr 2006, Paul Johnson wrote:

> Dear R-helpers:
>
> We have had fun using betareg to fit models with proportions as
> dependent variables.
>
> However, in the analysis of these models we found some wrinkles and
> don't know where is the best place to start looking for a fix.
>
> The problems we see (so far) are that
>
> 1. predict ignores newdata

The reason for this is that predict.betareg() does not take a newdate
argument, you need to use the terms argument instead.

> 2. anova does not work

...because there is no anova() method for betareg objects.

I think it is owrth addressing both issues in betareg, I'll write to you
and Alexandre (the package maintainer) off-list.
Z

> Here is the small working example:
>
> 
> x <- c(1, 3, 1, 4, 5, 3, 5, 2, 5, 2)
> y <- c(.3, .4, .4, .5, , .7, .4, .3, .4, .3, .5)
> x2 <- c( 4, 2, 1, 5, 1, 2, 4, 2, 1, 3)
> library(betareg)
> mybreg <- betareg(y~x)
> summary(mybreg)
>
> predict(mybreg, newdata=data.frame(x=c(2,2)))
>
> mybreg2 <- betareg(y~x+x2)
> summary(mybreg)
> anova(mybreg, mybreg2)
>
> ---
> Example output:
>
> > predict(mybreg, newdata=data.frame(x=c(2,2)))
>  [1] 0.3903155 0.4207632 0.3903155 0.4362319 0.4518258 0.4207632 0.4518258
>  [8] 0.4054484 0.4518258 0.4054484
> ...
> > anova(mybreg, mybreg2)
> Error in as.double.default(lapply(objects, df.residual)) :
>   (list) object cannot be coerced to 'double'
>
> I have been digging in this a little bit and notice betareg does not
> return the log likelihood at the maximum likelihood estimates, but I
> am able to hack the file /usr/lib/R/library/betareg/R/betareg and save
> the "value" of the optim function and print that out, so at least I
> can do a likelihood-ratio test by hand in place of the anova.  But I'm
> stumped on why the predict ignores newdata.
>
> I'm using R-2.1.1 on Fedora Core Linux 5 with the betareg package from CRAN.
>
> In case you are interested in betareg, we have found this article to
> be extremely readable and helpful: FERRARI, S.L.P., CRIBARI-NETO, F.
> (2004). Beta regression for  modeling rates and proportions. Journal
> of Applied Statistics, v. 31, n. 7, p. 799-815.
>
>
> --
> Paul E. Johnson
> Professor, Political Science
> 1541 Lilac Lane, Room 504
> University of Kansas
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


Re: [R] Subset dataframe based on condition

2006-04-18 Thread Sachin J
Thanx Steve and Tony for your help.
   
  Sachin

Tony Plate <[EMAIL PROTECTED]> wrote:
  Works OK for me:

> x <- data.frame(a=10^(-2:7), b=10^(10:1))
> subset(x, a > 1)
a b
4 1e+01 1e+07
5 1e+02 1e+06
6 1e+03 1e+05
7 1e+04 1e+04
8 1e+05 1e+03
9 1e+06 1e+02
10 1e+07 1e+01
> subset(x, a > 1 & b < a)
a b
8 1e+05 1000
9 1e+06 100
10 1e+07 10
>

Do you get all "numeric" for the following?

> sapply(x, class)
a b
"numeric" "numeric"
>

If not, then your data frame is probably encoding the information in 
some way that you don't want (though if it was as factors, I would have 
expected a warning from the comparison operator).

You might get more help by distilling your problem to a simple example 
that can be tried out by others.

-- Tony Plate

Sachin J wrote:
> Hi,
> 
> I am trying to extract subset of data from my original data frame 
> based on some condition. For example : (mydf -original data frame, submydf 
> - subset dada frame)
> 
> >submydf = subset(mydf, a > 1 & b <= a), 
> 
> here column a contains values ranging from 0.01 to 10. I want to 
> extract only those matching condition 1 i.e a > . But when i execute 
> this command it is not giving me appropriate result. The subset df - 
> submydf contains rows with 0.01 also. Please help me to resolve this 
> problem.
> 
> Thanks in advance.
> 
> Sachin
> 
> 
> -
> 
> [[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
> 




-

[[alternative HTML version deleted]]

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


Re: [R] Extra \input command in Sweave created figures.

2006-04-18 Thread Dieter Menne
Fredrik Karlsson  gmail.com> writes:

> I am using Sweave to generate figures and tables for my thesis. Now, I
> have run into the problem that all of a sudden, Sweave produces not
> only an \includegraphics command, but a
> \include command as well. This breakes LaTeX processing.
> 


Check if you have set split=TRUE in the Sweave options.

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


Re: [R] adding lines to scatterplot3d

2006-04-18 Thread Dieter Menne
andrea valle  di.unito.it> writes:

> 
> I'm using scatterplot3d. I want to add dotted lines parallel to the 3 
> axes, in order to create a sort of cage in the 3D box (so to represent 
> subdomains in my dataspace).
> I saw that points3d can be used to draw points or lines to the existing 
> plot but actually I'm able only to draw points (I grabbed an example 
> from the web)

See example 5 in the documentation, and use type="l" to produce connecting 
lines.

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


Re: [R] adding lines to scatterplot3d

2006-04-18 Thread andrea valle
Thanks a lot,  I having it working.

Is it possible to have dashed or dotted lines?
I wasn't able to find a fitting type.

Best

-a-

On 18 Apr 2006, at 14:42, Dieter Menne wrote:

> andrea valle  di.unito.it> writes:
>
>>
>> I'm using scatterplot3d. I want to add dotted lines parallel to the 3
>> axes, in order to create a sort of cage in the 3D box (so to represent
>> subdomains in my dataspace).
>> I saw that points3d can be used to draw points or lines to the 
>> existing
>> plot but actually I'm able only to draw points (I grabbed an example
>> from the web)
>
> See example 5 in the documentation, and use type="l" to produce 
> connecting lines.
>
> 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
>
>
Andrea Valle
DAMS - Facoltà di Scienze della Formazione
Università degli Studi di Torino
http://www.semiotiche.it/andrea
[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


Re: [R] adding lines to scatterplot3d

2006-04-18 Thread Uwe Ligges
andrea valle wrote:

> Thanks a lot,  I having it working.
> 
> Is it possible to have dashed or dotted lines?
> I wasn't able to find a fitting type.


All as in standard plot functions:

lty="dotted" or lty="dashed" should do the trick.

Uwe Ligges



> Best
> 
> -a-
> 
> On 18 Apr 2006, at 14:42, Dieter Menne wrote:
> 
> 
>>andrea valle  di.unito.it> writes:
>>
>>
>>>I'm using scatterplot3d. I want to add dotted lines parallel to the 3
>>>axes, in order to create a sort of cage in the 3D box (so to represent
>>>subdomains in my dataspace).
>>>I saw that points3d can be used to draw points or lines to the 
>>>existing
>>>plot but actually I'm able only to draw points (I grabbed an example
>>>from the web)
>>
>>See example 5 in the documentation, and use type="l" to produce 
>>connecting lines.
>>
>>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
>>
>>
> 
> Andrea Valle
> DAMS - Facoltà di Scienze della Formazione
> Università degli Studi di Torino
> http://www.semiotiche.it/andrea
> [EMAIL PROTECTED]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] adding lines to scatterplot3d

2006-04-18 Thread andrea valle
Ah! It does.

Thanks a lot.

(I use R for batch processing, and I when I discover the right setup I 
don't change it for months... so I always forget basics...sorry)

Best

-a-

On 18 Apr 2006, at 15:18, Uwe Ligges wrote:

> andrea valle wrote:
>
>> Thanks a lot,  I having it working.
>> Is it possible to have dashed or dotted lines?
>> I wasn't able to find a fitting type.
>
>
> All as in standard plot functions:
>
> lty="dotted" or lty="dashed" should do the trick.
>
> Uwe Ligges
>
>
>
>> Best
>> -a-
>> On 18 Apr 2006, at 14:42, Dieter Menne wrote:
>>> andrea valle  di.unito.it> writes:
>>>
>>>
 I'm using scatterplot3d. I want to add dotted lines parallel to the 
 3
 axes, in order to create a sort of cage in the 3D box (so to 
 represent
 subdomains in my dataspace).
 I saw that points3d can be used to draw points or lines to the 
 existing
 plot but actually I'm able only to draw points (I grabbed an example
 from the web)
>>>
>>> See example 5 in the documentation, and use type="l" to produce 
>>> connecting lines.
>>>
>>> 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
>>>
>>>
>> Andrea Valle
>> DAMS - Facoltà di Scienze della Formazione
>> Università degli Studi di Torino
>> http://www.semiotiche.it/andrea
>> [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
>
>
Andrea Valle
DAMS - Facoltà di Scienze della Formazione
Università degli Studi di Torino
http://www.semiotiche.it/andrea
[EMAIL PROTECTED]

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


[R] how to change legend size in a figure

2006-04-18 Thread Baoqiang Cao
Dear All,

I am producing a figure with many curves on it. How do I make the legends for 
all those curves smaller so that it can fit the figure itself? The commands I 
used for ploting are:

plot(x1,y1,col=1,lty=1)
lines(x2,y2,col=2,lty=2)
...
legend(0.3,0.4,c("name1","name2",...),col=1:20,lty=1:20)

Any tips for making the legend fit the figure will very welcome! Thanks!

Best,
 Baoqiang Cao

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


[R] lambda, uncertainty coefficient (& Somers D)

2006-04-18 Thread Antti Arppe
Dear colleagues in R,

Has anybody implemented the

1) (Goodman & Kruskal) lambda

or the

2) (Thiel's) uncertainty coefficient

statistics (in the asymmetric and symmetric forms), or is anyone aware 
that they might reside in some package? A search in the R archives 
does indicate that they are (somehow) part of the CoCo package, but I 
would rather not start learning how to transform my data into 
CoCo-format in order to access these functions, regardless of whether 
the CoCo versions are actually intended for calculating the actual 
statistic or for some other package internal purposes, as may 
sometimes be the case.

Furthermore, it appears to me that the 'somers2' function in the Hmisc 
package applies Somers' D only to 2x2 and not larger tables. Am I 
mistaken, or does there exist somewhere else an implementation of the 
Somers' D statistic for the more general RxC tables? This was queried 
in 1999, but no response seemed then to be forthcoming.

Thanks and regards,

-Antti Arppe
-- 
==
Antti Arppe - Master of Science (Engineering)
Researcher & doctoral student (Linguistics)
E-mail: [EMAIL PROTECTED]
WWW: http://www.ling.helsinki.fi/~aarppe

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


Re: [R] how to change legend size in a figure

2006-04-18 Thread Charles Annis, P.E.
cex=0.8 (or whatever you like) as in 

legend(0.3,0.4,c("name1","name2",...),col=1:20,lty=1:20, cex=0.8)


Charles Annis, P.E.

[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Baoqiang Cao
Sent: Tuesday, April 18, 2006 9:38 AM
To: r-help@stat.math.ethz.ch
Subject: [R] how to change legend size in a figure

Dear All,

I am producing a figure with many curves on it. How do I make the legends
for all those curves smaller so that it can fit the figure itself? The
commands I used for ploting are:

plot(x1,y1,col=1,lty=1)
lines(x2,y2,col=2,lty=2)
...
legend(0.3,0.4,c("name1","name2",...),col=1:20,lty=1:20)

Any tips for making the legend fit the figure will very welcome! Thanks!

Best,
 Baoqiang Cao

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

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


[R] Nonlinear Regression model: Diagnostics

2006-04-18 Thread Sachin J
Hi,
   
  I am trying to run the following nonlinear regression model. 
   
  > nreg <- nls(y ~ exp(-b*x), data = mydf, start = list(b = 0), alg = 
"default", trace = TRUE)
   
  OUTPUT: 
  24619327 :  0 
24593178 :  0.0001166910 
24555219 :  0.0005019005 
24521810 :  0.001341571 
24500774 :  0.002705402 
24490713 :  0.004401078 
24486658 :  0.00607728 
24485115 :  0.007484372 
24484526 :  0.008552635 
24484298 :  0.009314779 
24484208 :  0.009837009 
24484172 :  0.01018542 
24484158 :  0.01041381 
24484152 :  0.01056181 
24484150 :  0.01065700 
24484149 :  0.01071794 
24484148 :  0.01075683 
24484148 :  0.01078161 
24484148 :  0.01079736 
24484148 :  0.01080738 
24484148 :  0.01081374 
Nonlinear regression model
  model:  y ~ exp(-b * x) 
   data:  mydf 
 b 
0.01081374 
 residual sum-of-squares:  24484148 

  My question is how do I interpret the results of this model. 
   
  > profile(nreg)
   
  24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
24484156 :   
Error in prof$getProfile() : number of iterations exceeded maximum of 50
   
  I am unable to understand the error cause. Any pointers would be of great 
help. 
   
  Regards,
  Sachin


-

[[alternative HTML version deleted]]

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


Re: [R] how to change legend size in a figure

2006-04-18 Thread Christos Hatzis
Use a smaller cex within legend (e.g. cex=0.75) to adjust the size of the
printed text.  This controls the size of the legend.  Also, you can play
with xjust and yjust for finer control of how the legend box is justified at
the specified position.

-Christos  

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Baoqiang Cao
Sent: Tuesday, April 18, 2006 9:38 AM
To: r-help@stat.math.ethz.ch
Subject: [R] how to change legend size in a figure

Dear All,

I am producing a figure with many curves on it. How do I make the legends
for all those curves smaller so that it can fit the figure itself? The
commands I used for ploting are:

plot(x1,y1,col=1,lty=1)
lines(x2,y2,col=2,lty=2)
...
legend(0.3,0.4,c("name1","name2",...),col=1:20,lty=1:20)

Any tips for making the legend fit the figure will very welcome! Thanks!

Best,
 Baoqiang Cao

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

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


Re: [R] how to change legend size in a figure

2006-04-18 Thread Dimitris Rizopoulos
probably the 'cex' and 'ncol' arguments of legend() will be useful 
here.

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://www.med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm



- Original Message - 
From: "Baoqiang Cao" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, April 18, 2006 3:38 PM
Subject: [R] how to change legend size in a figure


> Dear All,
>
> I am producing a figure with many curves on it. How do I make the 
> legends for all those curves smaller so that it can fit the figure 
> itself? The commands I used for ploting are:
>
> plot(x1,y1,col=1,lty=1)
> lines(x2,y2,col=2,lty=2)
> ...
> legend(0.3,0.4,c("name1","name2",...),col=1:20,lty=1:20)
>
> Any tips for making the legend fit the figure will very welcome! 
> Thanks!
>
> Best,
> Baoqiang Cao
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
> 


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


Re: [R] Unfound objects in function

2006-04-18 Thread Peter Ehlers
Colin,

Did you use correction = "trans" in Kinhom in the past? I think
Ki$trans will contain a number of NAs. Try

diff<- sum (Ki$theo - Ki$trans, na.rm = TRUE)

Peter Ehlers

Colin Beale wrote:
> A couple of my functions that were working last week seem to have been
> changed over the weekend and no longer work, but I can't understand why
> not: it seems that objects defined at the start of the function are not
> located further on in the function, when this worked fine before. An
> example follows at the end, using the package spatstat, though the
> problem seems more general. My only guess is that I've accidentally
> changed something to do with the environment that functions are
> searching in to exclude themselves, but if so I've no idea how I did or
> how I can cancel it!
> 
> Thanks in advance,
> 
> Colin
> 
> 
> library (spatstat)
> 
> kernelEst <- function (data, max.r = 10, edge = TRUE) {
> 
>   if (!is.ppp (data)) stop ("data must be a point process object")
> 
>   i <- 0.1
>   diff<- 1
>   smo <- 1
> 
>   while (diff > 0) {
> olddiff <- diff
> oldsmo  <- smo
> smo <- density.ppp (data, sigma = 2 * i, edge = edge)
> lambda  <- smo[data]
> Ki  <- Kinhom (data[,data$window], lambda = lambda, r = seq (0,
> max.r, length = 100), correction = "trans")
> diff<- sum (Ki$theo - Ki$trans)
> i   <- i + 0.1
> if (i > max.r) stop ("no suitable kernel found within 0.2 to
> max.r")
>   }
> 
>   if (abs (olddiff) > abs (diff)) return (smo) else return (oldsmo)
> }
> 
> data (simdat)
> test <- kernelEst (simdat)
> Error in while (diff > 0) { : missing value where TRUE/FALSE needed
> 
>  
> 
> 
>>version
> 
>  _  
> platform i386-pc-mingw32
> arch i386   
> os   mingw32
> system   i386, mingw32  
> status  
> major2  
> minor2.1
> year 2005   
> month12 
> day  20 
> svn rev  36812  
> language R
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] MLE

2006-04-18 Thread Ben Bolker
  cs.uct.ac.za> writes:

> 
> 
> Hi ,
> 
> I want to compute the MLE for a simple sample of data, say
> 45,26,98,65,25,36,42,62,28,36,15,48,45, of which I obviously have the mean
> and the sd. Is there a way of calling the log normal and already
> diffrentiated formula other than entering the whole formula.
> 
> Victor
> 

  You haven't given us enough information/described your problem
clearly enough.  The maximum likelihood
estimate of _what_?  fitdistr() in the MASS package might help.
If you want (log)likelihoods dlnorm (for log normal), dnorm
might help.
   
  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


Re: [R] lambda, uncertainty coefficient (& Somers D)

2006-04-18 Thread Frank E Harrell Jr
Antti Arppe wrote:
> Dear colleagues in R,
> 
> Has anybody implemented the
> 
> 1) (Goodman & Kruskal) lambda
> 
> or the
> 
> 2) (Thiel's) uncertainty coefficient
> 
> statistics (in the asymmetric and symmetric forms), or is anyone aware 
> that they might reside in some package? A search in the R archives 
> does indicate that they are (somehow) part of the CoCo package, but I 
> would rather not start learning how to transform my data into 
> CoCo-format in order to access these functions, regardless of whether 
> the CoCo versions are actually intended for calculating the actual 
> statistic or for some other package internal purposes, as may 
> sometimes be the case.
> 
> Furthermore, it appears to me that the 'somers2' function in the Hmisc 
> package applies Somers' D only to 2x2 and not larger tables. Am I 
> mistaken, or does there exist somewhere else an implementation of the 
> Somers' D statistic for the more general RxC tables? This was queried 
> in 1999, but no response seemed then to be forthcoming.

Somers' D is for a 2-category response variable.  X may have any number 
of categories as long as they are ordered.

Frank Harrell

> 
> Thanks and regards,
> 
>   -Antti Arppe


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

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


[R] how funciton "expression" produces subscript

2006-04-18 Thread Jing Yang
Dear R-users,

does anyone know how funciton "expression" produces subscript?

Best,Jing

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

Re: [R] how funciton "expression" produces subscript

2006-04-18 Thread Christos Hatzis
See ?plotmath for the answer to your question and many more regarding math
expression drawing.
It might be worth printing this help page for future reference.

-Christos 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jing Yang
Sent: Tuesday, April 18, 2006 10:24 AM
To: r-help
Subject: [R] how funciton "expression" produces subscript

Dear R-users,

does anyone know how funciton "expression" produces subscript?

Best,Jing

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


[R] what happen?

2006-04-18 Thread zhang jian
Hi!
I want to choose part of the data. But it has a question.

> attach(PIKO)
> PIKO[1:5,]
 code species  dbh x y   tag status branch
92  10142PIKO 38.9  6.05 12.81 10165  alive  0
109 10213PIKO 41.0  6.71 26.21 10202  alive  0
135 10222PIKO 48.3 18.98 21.28 10214  alive  0
146 10223PIKO 47.0 19.45 22.83 10224  alive  0
147 10223PIKO 20.0 19.74 28.65 10225  alive  0
> n=PIKO[dbh>=25,]
> n[1:5,]
 code species  dbh x y   tag status branch
92  10142PIKO 38.9  6.05 12.81 10165  alive  0
109 10213PIKO 41.0  6.71 26.21 10202  alive  0
135 10222PIKO 48.3 18.98 21.28 10214  alive  0
146 10223PIKO 47.0 19.45 22.83 10224  alive  0
152 10223PIKO 33.5 16.94 27.25 10230  alive  0
*> n=PIKO[status="snag",]
Error in "[.data.frame"(PIKO, status = "snag", ) :
unused argument(s) (status ...)
*

[[alternative HTML version deleted]]

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


[R] Question about PLS regression

2006-04-18 Thread Andris Jankevics
Hello useRs,

I am new user to R and also statistics. Why predicted results in this example 
are different? Is the order of variables in X matrix important?

library (pls)
set.seed (1)
Y1 <- c(1,2,3,4,5,6,7,8,9,10)
Y2 <- c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0)
X1 <- rnorm(10,sd=0.2)
X2 <- rnorm(10,sd=1)
X3 <- rnorm(10,sd=0.1)
X4 <- rnorm(10,sd=0.1)
X5 <- rnorm(10,sd=0.1)

KAL <- data.frame(num=c(1:10))
KAL$Y <- as.matrix(cbind (Y1,Y2))
KAL$X <- as.matrix(cbind (X1,X2,X3,X4,X5))
KAL2 <- data.frame(num=c(1:10))
KAL2$Y <- as.matrix(cbind (Y1,Y2))
KAL2$X <- as.matrix(cbind (X5,X4,X3,X2,X1))

PLS <- plsr (Y~X,data=KAL, 4,validation = "CV")
PLS2 <- plsr (Y~X,data=KAL2,4, validation = "CV")

X1v <- rnorm(10,sd=0.1)
X2v <- rnorm(10,sd=1)
X3v <- rnorm(10,sd=0.1)
X4v <- rnorm(10,sd=0.1)
X5v <- rnorm(10,sd=0.1)
VAL <- data.frame(num=c(1:10))
VAL$X <- as.matrix(cbind(X1v,X2v,X3v,X4v,X5v))

predict (PLS,VAL,4)
predict (PLS2,VAL,4)

Thank You,

Andris Jankevics

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


Re: [R] what happen?

2006-04-18 Thread Dimitris Rizopoulos
Look at: ?Comparison; you need:

PIKO[status == "snag", ]


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://www.med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm


- Original Message - 
From: "zhang jian" <[EMAIL PROTECTED]>
To: "r-help" 
Sent: Tuesday, April 18, 2006 4:45 PM
Subject: [R] what happen?


> Hi!
> I want to choose part of the data. But it has a question.
>
>> attach(PIKO)
>> PIKO[1:5,]
> code species  dbh x y   tag status branch
> 92  10142PIKO 38.9  6.05 12.81 10165  alive  0
> 109 10213PIKO 41.0  6.71 26.21 10202  alive  0
> 135 10222PIKO 48.3 18.98 21.28 10214  alive  0
> 146 10223PIKO 47.0 19.45 22.83 10224  alive  0
> 147 10223PIKO 20.0 19.74 28.65 10225  alive  0
>> n=PIKO[dbh>=25,]
>> n[1:5,]
> code species  dbh x y   tag status branch
> 92  10142PIKO 38.9  6.05 12.81 10165  alive  0
> 109 10213PIKO 41.0  6.71 26.21 10202  alive  0
> 135 10222PIKO 48.3 18.98 21.28 10214  alive  0
> 146 10223PIKO 47.0 19.45 22.83 10224  alive  0
> 152 10223PIKO 33.5 16.94 27.25 10230  alive  0
> *> n=PIKO[status="snag",]
> Error in "[.data.frame"(PIKO, status = "snag", ) :
>unused argument(s) (status ...)
> *
>
> [[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
> 


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


Re: [R] Question about PLS regression

2006-04-18 Thread Andris Jankevics
I am sorry. It was my fault. My example is wrong. I need also rearrange a 
validation data set too.
But I have a sligthy different results with my real data. Where can the 
problem be?

Andris Jankevics

On Otrdiena, 18. Aprīlis 2006 17:55, Andris Jankevics wrote:
> Hello useRs,
>
> I am new user to R and also statistics. Why predicted results in this
> example are different? Is the order of variables in X matrix important?
>
> library (pls)
> set.seed (1)
> Y1 <- c(1,2,3,4,5,6,7,8,9,10)
> Y2 <- c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0)
> X1 <- rnorm(10,sd=0.2)
> X2 <- rnorm(10,sd=1)
> X3 <- rnorm(10,sd=0.1)
> X4 <- rnorm(10,sd=0.1)
> X5 <- rnorm(10,sd=0.1)
>
> KAL <- data.frame(num=c(1:10))
> KAL$Y <- as.matrix(cbind (Y1,Y2))
> KAL$X <- as.matrix(cbind (X1,X2,X3,X4,X5))
> KAL2 <- data.frame(num=c(1:10))
> KAL2$Y <- as.matrix(cbind (Y1,Y2))
> KAL2$X <- as.matrix(cbind (X5,X4,X3,X2,X1))
>
> PLS <- plsr (Y~X,data=KAL, 4,validation = "CV")
> PLS2 <- plsr (Y~X,data=KAL2,4, validation = "CV")
>
> X1v <- rnorm(10,sd=0.1)
> X2v <- rnorm(10,sd=1)
> X3v <- rnorm(10,sd=0.1)
> X4v <- rnorm(10,sd=0.1)
> X5v <- rnorm(10,sd=0.1)
> VAL <- data.frame(num=c(1:10))
> VAL$X <- as.matrix(cbind(X1v,X2v,X3v,X4v,X5v))
>
> predict (PLS,VAL,4)
> predict (PLS2,VAL,4)
>
> Thank You,
>
> Andris Jankevics
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

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

[R] 3D pie

2006-04-18 Thread COMTE Guillaume
Hi all,

 

Is there a way to draw 3D pie with R (like excel does)?

 

I know how to do it in 2D, just by using pie(something)...

 

I know it isn't the best way to represent data, but people are sometimes
more interested by the look and feel than by the accuracy of the
results...

 

If there is no way, have you another suggestion ? (i already use
dotchart instead of pie)

 

Thks to all of you.

COMTE Guillaume


[[alternative HTML version deleted]]

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


Re: [R] lambda, uncertainty coefficient (& Somers D)

2006-04-18 Thread Marc Schwartz (via MN)
On Tue, 2006-04-18 at 16:40 +0300, Antti Arppe wrote:
> Dear colleagues in R,
> 
> Has anybody implemented the
> 
> 1) (Goodman & Kruskal) lambda
> 
> or the
> 
> 2) (Thiel's) uncertainty coefficient
> 
> statistics (in the asymmetric and symmetric forms), or is anyone aware 
> that they might reside in some package? A search in the R archives 
> does indicate that they are (somehow) part of the CoCo package, but I 
> would rather not start learning how to transform my data into 
> CoCo-format in order to access these functions, regardless of whether 
> the CoCo versions are actually intended for calculating the actual 
> statistic or for some other package internal purposes, as may 
> sometimes be the case.
> 
> Furthermore, it appears to me that the 'somers2' function in the Hmisc 
> package applies Somers' D only to 2x2 and not larger tables. Am I 
> mistaken, or does there exist somewhere else an implementation of the 
> Somers' D statistic for the more general RxC tables? This was queried 
> in 1999, but no response seemed then to be forthcoming.
> 
> Thanks and regards,
> 
>   -Antti Arppe


Antti,

Under a separate e-mail to you, I have sent a text file containing R
code for the above and other related association measures.

If anyone else is interested in these, please let me know and I will be
more than happy to forward them on. I did not want to consume a lot of
bandwidth here.

HTH,

Marc Schwartz

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


[R] R and ViM

2006-04-18 Thread Michael Graber
Dear all,

I'm starting to learn R, but I'm already programing for a while, using 
ViM as editor. Therefore I'd like to be able to use R together with 
ViM.

My question now is, whether there are already people out there knowing 
how to do this in a similar easy way as with Emacs, and if those would 
be willing to share this knowledge.
I did already research on the web on this topic, but i couldn't find 
satisfying answers, except one good looking approach on the ViM-website 
with a perl-script called funnel.pl, which I couldn't make running on 
my mac OSX 10.3.9 so far.

I'd be grateful for help.

Thanks,
Michael Graber

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


Re: [R] R and ViM

2006-04-18 Thread Sundar Dorai-Raj


Michael Graber wrote:
> Dear all,
> 
> I'm starting to learn R, but I'm already programing for a while, using 
> ViM as editor. Therefore I'd like to be able to use R together with 
> ViM.
> 
> My question now is, whether there are already people out there knowing 
> how to do this in a similar easy way as with Emacs, and if those would 
> be willing to share this knowledge.
> I did already research on the web on this topic, but i couldn't find 
> satisfying answers, except one good looking approach on the ViM-website 
> with a perl-script called funnel.pl, which I couldn't make running on 
> my mac OSX 10.3.9 so far.
> 
> I'd be grateful for help.
> 
> Thanks,
> Michael Graber
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Try RSiteSearch('vim editor') at the R prompt. I got 28 hits.

HTH,

--sundar

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


[R] store levels in a string

2006-04-18 Thread Daniele Medri
Dear R-users,

i need to store in a variable a string made from levels of a factor

e.g.

a<-("a","a","b","b")
af<-factor(a)

mylevels<- ...a string with all the levels(af)

Thanks
--
DM

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


Re: [R] lambda, uncertainty coefficient (& Somers D)

2006-04-18 Thread Marc Schwartz (via MN)
On Tue, 2006-04-18 at 10:30 -0500, Marc Schwartz (via MN) wrote:
> On Tue, 2006-04-18 at 16:40 +0300, Antti Arppe wrote:
> > Dear colleagues in R,
> > 
> > Has anybody implemented the
> > 
> > 1) (Goodman & Kruskal) lambda
> > 
> > or the
> > 
> > 2) (Thiel's) uncertainty coefficient
> > 
> > statistics (in the asymmetric and symmetric forms), or is anyone aware 
> > that they might reside in some package? A search in the R archives 
> > does indicate that they are (somehow) part of the CoCo package, but I 
> > would rather not start learning how to transform my data into 
> > CoCo-format in order to access these functions, regardless of whether 
> > the CoCo versions are actually intended for calculating the actual 
> > statistic or for some other package internal purposes, as may 
> > sometimes be the case.
> > 
> > Furthermore, it appears to me that the 'somers2' function in the Hmisc 
> > package applies Somers' D only to 2x2 and not larger tables. Am I 
> > mistaken, or does there exist somewhere else an implementation of the 
> > Somers' D statistic for the more general RxC tables? This was queried 
> > in 1999, but no response seemed then to be forthcoming.
> > 
> > Thanks and regards,
> > 
> > -Antti Arppe
> 
> 
> Antti,
> 
> Under a separate e-mail to you, I have sent a text file containing R
> code for the above and other related association measures.
> 
> If anyone else is interested in these, please let me know and I will be
> more than happy to forward them on. I did not want to consume a lot of
> bandwidth here.
> 
> HTH,
> 
> Marc Schwartz


[Replying to r-help only]

Antti,

Each of my e-mails directly to you, including the code file, using
either:

  [EMAIL PROTECTED] (located on your web page)

or 

  [EMAIL PROTECTED] (used here)

have bounced, with access denied/user unknown errors.

Can you please confirm a correct e-mail address?

Thanks,

Marc

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


Re: [R] store levels in a string

2006-04-18 Thread Marc Schwartz (via MN)
On Tue, 2006-04-18 at 17:52 +0200, Daniele Medri wrote:
> Dear R-users,
> 
> i need to store in a variable a string made from levels of a factor
> 
> e.g.
> 
> a<-("a","a","b","b")

The above should be:

a <- c("a","a","b","b")
 ^

> af<-factor(a)
> 
> mylevels<- ...a string with all the levels(af)
> 
> Thanks
> --
> DM

> mylevels <- levels(af)

> mylevels
[1] "a" "b"


See ?levels, which is listed in the "See Also" for ?factor.

HTH,

Marc Schwartz

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


Re: [R] store levels in a string

2006-04-18 Thread Daniele Medri
Il giorno mar, 18/04/2006 alle 11.00 -0500, Marc Schwartz (via MN):
> > mylevels<- ...a string with all the levels(af)
> > mylevels <- levels(af)
> 
> > mylevels
> [1] "a" "b"

I don't need to store these two levels, but a string with the values
"ab".

Thanks

Cheers
--
DM

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


Re: [R] R and ViM

2006-04-18 Thread Ted Harding
On 18-Apr-06 Sundar Dorai-Raj wrote:
> Michael Graber wrote:
>> I'm starting to learn R, but I'm already programing for
>> a while, using ViM as editor. Therefore I'd like to be
>> able to use R together with ViM.
>> [...]
> 
> Try RSiteSearch('vim editor') at the R prompt. I got 28 hits.
> 
> HTH,
> 
> --sundar

And, out of interest (being a vim addict), I did that, getting

  > RSiteSearch('vim editor')
  A search query has been submitted to http://search.r-project.org
  The results page should open in your browser shortly

which it duly did. However -- and this is what's interesting --
I entered the command in R running on my machine B, at which
I'm sitting.

This machine B is independently displaying the Firefox browser
running on Machine C (via X Windows; Linux on both machines).

And that's the browser where the search results appeared.

So R running on B can hijack Firefox on C. How does it know?

Hmmm ...
Ted.


E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 18-Apr-06   Time: 17:24:22
-- XFMail --

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


Re: [R] store levels in a string

2006-04-18 Thread Marc Schwartz (via MN)
On Tue, 2006-04-18 at 18:07 +0200, Daniele Medri wrote:
> Il giorno mar, 18/04/2006 alle 11.00 -0500, Marc Schwartz (via MN):
> > > mylevels<- ...a string with all the levels(af)
> > > mylevels <- levels(af)
> > 
> > > mylevels
> > [1] "a" "b"
> 
> I don't need to store these two levels, but a string with the values
> "ab".
> 
> Thanks
> 
> Cheers
> --
> DM

> paste(levels(af), collapse = "")
[1] "ab"

See ?paste.

HTH,

Marc Schwartz

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


Re: [R] second try; writing user-defined GLM link function

2006-04-18 Thread Prof Brian Ripley
Is this something that is fairly widely useful?  If so, it is something 
that we could add to the stats package.  (We ought in any case to make it 
easier to extend glm families, and this could be an example.  If so, I'd 
like a reference for its use.)

There is a good reason why logit is implmented as

> make.link("logit")
$linkfun
function (mu)
.Call("logit_link", mu, PACKAGE = "stats")


$linkinv
function (eta)
.Call("logit_linkinv", eta, PACKAGE = "stats")


$mu.eta
function (eta)
.Call("logit_mu_eta", eta, PACKAGE = "stats")


$valideta
function (eta)
TRUE


which is that these functions protect against underflow/overflow of exp, 
and why I suggested looking at make.link("probit").

You can write your linkfun and linkinv more accurately using plogis and 
qlogis.


On Mon, 17 Apr 2006, Mark Herzog wrote:

> I was a little hesitant to post to everyone until I figured out why
> there is a discrepancy in the intercept estimates when compared to the
> same model run in SAS vs. R.  Everything else comes out correctly,
> including the other coefficient estimates... so perhaps it is just the
> numerical method used.  I think glm in R is using IWLS, and SAS is using ML.
>
> If anyone has another idea feel free to let me know.  Here is my
> modified binomial family, now called logexposure.  Since there is no
> other choice for the link for this new logexposure "family", I have just
> embedded the make.link inside the logexposure family.
>
> Good luck and I'd appreciate any comments.
>
> logexposure<-function (link="logit",ExposureDays) {
> logexp<-make.link("logit")
> logexp$linkfun<-function(mu,expos=ExposureDays) {
> log((mu^(1/expos))/(1-mu^(1/expos)))
> }
> logexp$linkinv<-function(eta,expos=ExposureDays) {
> (exp(eta)/(1+exp(eta)))^expos
> }
> logexp$mu.eta<-function(eta,expos=ExposureDays) {
> (expos*exp(eta*expos)*(1+exp(eta))^(-expos-1))
> }

...

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

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


Re: [R] R and ViM

2006-04-18 Thread Martin Maechler
> "Sundar" == Sundar Dorai-Raj <[EMAIL PROTECTED]>
> on Tue, 18 Apr 2006 10:43:30 -0500 writes:

Sundar> Michael Graber wrote:
>> Dear all,
>> 
>> I'm starting to learn R, but I'm already programing for a
>> while, using ViM as editor. Therefore I'd like to be able
>> to use R together with ViM.
>> 
>> My question now is, whether there are already people out
>> there knowing how to do this in a similar easy way as
>> with Emacs, and if those would be willing to share this
>> knowledge.  I did already research on the web on this
>> topic, but i couldn't find satisfying answers, except one
>> good looking approach on the ViM-website with a
>> perl-script called funnel.pl, which I couldn't make
>> running on my mac OSX 10.3.9 so far.
>> 
>> I'd be grateful for help.
>> 
>> Thanks, Michael Graber
>> 
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do
>> read the posting guide!
>> http://www.R-project.org/posting-guide.html

Sundar> Try RSiteSearch('vim editor') at the R prompt. I got
Sundar> 28 hits.

yeah, sure. But did you look at them?
I only browsed them quickly, but many don't seem to be relevant,
and the few that *seemed* to be relevant, mentioned the Sciviews
web page on "Editors for R"
  http://www.sciviews.org/_rgui/projects/Editors.html
and that has one line for 'vim' which gives a link that goes to
a "vimscript" page that gives the above mentioned 'funnel.pl' ..

So, I think Michael is still looking for more useful hints...

Martin Maechler, ETH Zurich

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


[R] Any R/S course coming up this April in the bay area?

2006-04-18 Thread paul king
Please email me info on dates, etc

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


Re: [R] R and ViM

2006-04-18 Thread Gabor Grothendieck
This was just posted this week:

https://www.stat.math.ethz.ch/pipermail/r-help/2006-April/092457.html

and I think there are some relevant macros on the vim web page
I use vim but do not use anything special with it.  It gives syntax
highlighting out of the box.

On 4/18/06, Michael Graber <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> I'm starting to learn R, but I'm already programing for a while, using
> ViM as editor. Therefore I'd like to be able to use R together with
> ViM.
>
> My question now is, whether there are already people out there knowing
> how to do this in a similar easy way as with Emacs, and if those would
> be willing to share this knowledge.
> I did already research on the web on this topic, but i couldn't find
> satisfying answers, except one good looking approach on the ViM-website
> with a perl-script called funnel.pl, which I couldn't make running on
> my mac OSX 10.3.9 so far.
>
> I'd be grateful for help.
>
> Thanks,
> Michael Graber
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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


Re: [R] R and ViM

2006-04-18 Thread Prof Brian Ripley
yOn Tue, 18 Apr 2006, [EMAIL PROTECTED] wrote:

> On 18-Apr-06 Sundar Dorai-Raj wrote:
>> Michael Graber wrote:
>>> I'm starting to learn R, but I'm already programing for
>>> a while, using ViM as editor. Therefore I'd like to be
>>> able to use R together with ViM.
>>> [...]
>>
>> Try RSiteSearch('vim editor') at the R prompt. I got 28 hits.
>>
>> HTH,
>>
>> --sundar
>
> And, out of interest (being a vim addict), I did that, getting
>
>  > RSiteSearch('vim editor')
>  A search query has been submitted to http://search.r-project.org
>  The results page should open in your browser shortly
>
> which it duly did. However -- and this is what's interesting --
> I entered the command in R running on my machine B, at which
> I'm sitting.
>
> This machine B is independently displaying the Firefox browser
> running on Machine C (via X Windows; Linux on both machines).
>
> And that's the browser where the search results appeared.
>
> So R running on B can hijack Firefox on C. How does it know?

?browseURL


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

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


Re: [R] R and ViM

2006-04-18 Thread Ted Harding
On 18-Apr-06 Prof Brian Ripley wrote:
>>  [...]
>>  > RSiteSearch('vim editor')
>>  A search query has been submitted to http://search.r-project.org
>>  The results page should open in your browser shortly
>>
>> which it duly did. However -- and this is what's interesting --
>> I entered the command in R running on my machine B, at which
>> I'm sitting.
>>
>> This machine B is independently displaying the Firefox browser
>> running on Machine C (via X Windows; Linux on both machines).
>>
>> And that's the browser where the search results appeared.
>>
>> So R running on B can hijack Firefox on C. How does it know?
> 
> ?browseURL

Wow! Wonders never cease! (Still unsure about the underlying
mechanism, but then X can be a hall of mirrors to the uninitiated).

Thanks for the hint!
Ted.


E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 18-Apr-06   Time: 18:26:30
-- XFMail --

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


Re: [R] Specifying an appropriate error term in a hierarchical regression

2006-04-18 Thread Chris Bergstresser
On 17 Apr 2006 23:55:14 +0200, Peter Dalgaard <[EMAIL PROTECTED]> wrote:
> Confusing nesting and nesting...
>
> The / operator is designed to handle cases like this
>
> a b
> 1 1
> 1 2
> 2 1
> 2 2
>
> in which the numbering of b only makes sense within a - no connection
> between b=1 when a=1 and when a=2 (think group1, member1). In this
> case, the interaction a:b makes sense, but a main effect of b does
> not.

   This makes sense.  It sounds like there's no need for the "/"
operator, assuming the factors are numbered appropriately.  Is this
correct?

> It is not clear to me what B(A) is supposed to mean in Kirk's
> terminology. Sounds like it could be the total sum of squares for the
> b stratum, which is the effect of b ignoring a (?).

SSB(A), as Kirk defines it, is "the pooled simple main effects of
treatment B at each level of treatment A".  Or [AB] - [A], if you
prefer.

   I suppose my primary problem is specifying a different denominator
for each level of the F test in the ANOVA.  I can specify an overall
error term (using "Error" in the model specification) but for the
example in the book the F-test for factor A is MSA/MSB(A), while the
F-test for factor B(A) is MSB(A)/MSerror.
   It doesn't seem like it's possible to do this using a single "aov"
command; I have to run it once with each appropriate error term or do
the F-test by hand.  That can't be right, can it?

-- Chris

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


Re: [R] R debugging options

2006-04-18 Thread Larry Howe
On Monday April 17 2006 21:08, Francisco J. Zagmutt wrote:
> RSiteSearch("debug") or RSiteSearch("debugging") will give you a lot or
> relevant information.  I personally use library(debug) extensivelly and it
> should do all the taks you asked about. There is a nice article describing
> the debug lilbrary in the 2003/3 issue of R News
> http://cran.r-project.org/doc/Rnews/Rnews_2003-3.pdf
>
> Cheers
>
> Francisco

Wow! That is a great package. I think it does all I need.

Is there a way to turn on debugging for all loaded functions? My source file 
contains many functions and I would prefer not to have to mtrace() each one. 
Something like

>mtrace(how_do_I_get_a_list_of_all_loaded_functions)

?

Larry

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


Re: [R] April Course***R/S-plus in San Francisco

2006-04-18 Thread elvis

   Check out our upcoming 2-day "R/S-plus Fundamentals and Programming
   Techniques" in San Francisco: www.xlsolutions-corp.com/Rfund.htm
    San Franciso,April  27-28
Payment due AFTER the class
   Course Description:
   This two-day beginner to intermediate R/S-plus course focuses on a
   broad spectrum of topics, from reading raw data to a comparison of R
   and S. We will learn the essentials of data manipulation, graphical
   visualization and R/S-plus programming. We will explore statistical
   data analysis tools,including graphics with data sets. How to enhance
   your plots, build your own packages (librairies) and connect via
   ODBC,etc.
   We will perform some statistical modeling and fit linear regression
   models. Participants are encouraged to bring data for interactive
   sessions
   With the following outline:
   - An Overview of R and S
   - Data Manipulation and Graphics
   - Using Lattice Graphics
   - A Comparison of R and S-Plus
   - How can R Complement SAS?
   - Writing Functions
   - Avoiding Loops
   - Vectorization
   - Statistical Modeling
   - Project Management
   - Techniques for Effective use of R and S
   - Enhancing Plots
   - Using High-level Plotting Functions
   - Building and Distributing Packages (libraries)
   - Connecting; ODBC, Rweb, Orca via sockets and via Rjava
   Email us for group discounts.
   Email Sue Turner: [EMAIL PROTECTED]
   Phone: 206-686-1578
   Visit us: www.xlsolutions-corp.com/training.htm
   Please let us know if you and your colleagues are interested in this
   classto take advantage of group discount. Register now to secure your
   seat!
   Interested in R/Splus Advanced course? email us.
   Cheers,
   Elvis Miller, PhD
   Manager Training.
   XLSolutions Corporation
   206 686 1578
   www.xlsolutions-corp.com
   [EMAIL PROTECTED]
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Compare two Power law or Exponential distributions

2006-04-18 Thread Emmanuel Levy
Dear All,

I'd like to compare exponential or power-law distributions.

To do so, people are often referred to the ks.test. However,
I imagine ks.test wouldn't be as powerful as a test specifically
designed for a distribution type.

So my question is, is there a more specific test for each of
these distribution? (exponential or power-law)

Thanks for your hints!

  E

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


[R] Jeffries-Matusita distance

2006-04-18 Thread ALMANSA ORTIZ, JOSUE
I've calculated as follows:

 

matusita<-function(f1,f2,lw,up){

 

 fmatu<-function(x) ( sqrt(f1(x)) - sqrt(f2(x)) )^2

 

 sqrt (integrate( fmatu, lower=lw, upper=up, subdivisions=100)$value)

 

}

 

 

 

Josué Almansa 
Unitat de Recerca en Serveis Sanitaris 
Institut Municipal d'Investigació Mèdica, IMIM 
c/ Doctor Aiguader, 80 
08003 Barcelona 
e-mail: [EMAIL PROTECTED] 

 


[[alternative HTML version deleted]]

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

Re: [R] 3D pie

2006-04-18 Thread Patrick Burns
You can see my opinion of 3D piecharts at

http://www.burns-stat.com/pages/Tutor/spreadsheet_addiction.html

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")

COMTE Guillaume wrote:

>Hi all,
>
> 
>
>Is there a way to draw 3D pie with R (like excel does)?
>
> 
>
>I know how to do it in 2D, just by using pie(something)...
>
> 
>
>I know it isn't the best way to represent data, but people are sometimes
>more interested by the look and feel than by the accuracy of the
>results...
>
> 
>
>If there is no way, have you another suggestion ? (i already use
>dotchart instead of pie)
>
> 
>
>Thks to all of you.
>
>COMTE Guillaume
>
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>
>  
>

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


[R] predict.nls confidence intervals

2006-04-18 Thread Alice Shelly
Hello-
It has been several years since anyone has asked, so i am asking again- has 
anyone created a routine to estimate confidence intervals for predictions from 
nls models (ala Bates and Watts 1988)?

Thanks -
Alice Shelly
[[alternative HTML version deleted]]

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


[R] installation of package "randomForest" failed

2006-04-18 Thread Ruth Meili
Hello

I'd like to try out some functions in the package randomForest. Therefore, 
I did install this package. However, it is not possible to load the 
library, although I have R-Version 2.1.1 (i.e. later than 2.0.0). The 
commands I used and the Answers/Error from R is as follows:

 > 
install.packages("C://Programme//R//rw2011//library//randomForest_4.5-16.zip", 
lib="C://Programme//R//rw2011//library//randomForest",repos = NULL)
package 'randomForest' successfully unpacked and MD5 sums checked
updating HTML package descriptions
 > library(randomForest)
Fehler in library(randomForest) : 'randomForest' ist kein gültiges Paket -- 
vor 2.0.0 installiert?

I run in this problem for the first time. Until now, I used to install new 
packages by copying the*.zip-file to the "library"-directory in the 
rw2011-directory. This seam not to work anymore. So I tried using the 
function install.package(), but I did not success.

Does anybody know the Problem? I did not find any hints in the NEWS.
Thanks anyway.
Ruth






**
This footnote confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

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


Re: [R] what happen?

2006-04-18 Thread Manuel López-Ibáñez


zhang jian wrote:

> *> n=PIKO[status="snag",]
> Error in "[.data.frame"(PIKO, status = "snag", ) :
> unused argument(s) (status ...)

"=" is the assignment operator, you should use "==" as in:
n=PIKO[status=="snag",]


__ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.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


Re: [R] installation of package "randomForest" failed

2006-04-18 Thread Peter Ehlers
Ruth,

Does your R know about the library
  "C://Programme//R//rw2011//library//randomForest"
?

I suspect that you want
  lib = "C://Programme//R//rw2011//library"
in your install.packages() call. Or you could just leave the 'lib='
argument at its default.

Peter Ehlers


Ruth Meili wrote:
> Hello
> 
> I'd like to try out some functions in the package randomForest. Therefore, 
> I did install this package. However, it is not possible to load the 
> library, although I have R-Version 2.1.1 (i.e. later than 2.0.0). The 
> commands I used and the Answers/Error from R is as follows:
> 
>  > 
> install.packages("C://Programme//R//rw2011//library//randomForest_4.5-16.zip",
>  
> lib="C://Programme//R//rw2011//library//randomForest",repos = NULL)
> package 'randomForest' successfully unpacked and MD5 sums checked
> updating HTML package descriptions
>  > library(randomForest)
> Fehler in library(randomForest) : 'randomForest' ist kein gültiges Paket -- 
> vor 2.0.0 installiert?
> 
> I run in this problem for the first time. Until now, I used to install new 
> packages by copying the*.zip-file to the "library"-directory in the 
> rw2011-directory. This seam not to work anymore. So I tried using the 
> function install.package(), but I did not success.
> 
> Does anybody know the Problem? I did not find any hints in the NEWS.
> Thanks anyway.
> Ruth
> 
> 
> 
> 
> 
> 
> **
> This footnote confirms that this email message has been swept by
> MIMEsweeper for the presence of computer viruses.
> 
> www.clearswift.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

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


Re: [R] store levels in a string

2006-04-18 Thread Daniele Medri
Il giorno mar, 18/04/2006 alle 11.29 -0500, Marc Schwartz (via MN):
> > paste(levels(af), collapse = "")
> [1] "ab"
> 
> See ?paste.

:) more simple: toString(levels(x))

Thanks,

Cheers
--
DM

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


[R] nls - nonlinear regression

2006-04-18 Thread Sachin J

Hi, I am trying to run the following nonlinear regression model.
  > nreg <- nls(y ~ exp(-b*x), data = mydf, start = list(b = 0), alg = 
"default", trace = TRUE) OUTPUT: 24619327 :  0   24593178 :  
0.0001166910   24555219 :  0.0005019005   24521810 :  0.001341571   24500774 :  
0.002705402   24490713 :  0.004401078   24486658 :  0.00607728   24485115 :  
0.007484372   24484526 :  0.008552635   24484298 :  0.009314779   24484208 :  
0.009837009   24484172 :  0.01018542   24484158 :  0.01041381   24484152 :  
0.01056181   24484150 :  0.01065700   24484149 :  0.01071794   24484148 :  
0.01075683   24484148 :  0.01078161   24484148 :  0.01079736   24484148 :  
0.01080738   24484148 :  0.01081374   Nonlinear regression modelmodel:  y ~ 
exp(-b * x)  data:  mydfb   0.01081374residual 
sum-of-squares:  24484148   My question is how do I interpret the results 
of this model.  > profile(nreg) 24484156 : 24484156 :
 24484156 : 24484156 : 24484156 : 24484156 : 24484156 : 
24484156 : 24484156 : 24484156 : 24484156 : 24484156 : 
24484156 : 24484156 : 24484156 : 24484156 : 24484156 : 
24484156 : 24484156 : 24484156 : 24484156 : 24484156 : 
24484156 : 24484156 : 24484156 : 24484156 : 24484156 : 
24484156 : 24484156 : 24484156 : 24484156 : 24484156 : 
24484156 : 24484156 : 24484156 : 24484156 : 24484156 : 
24484156 : 24484156 : 24484156 : 24484156 : 24484156 : 
24484156 : 24484156 : 24484156 : 24484156 : 24484156 : 
24484156 : 24484156 : 24484156 : 24484156 : Error in 
prof$getProfile() : number of iterations exceeded maximum of 50 I am 
unable to understand the error cause. Any pointers would be of great help.  
Regards,Sachin  


-

[[alternative HTML version deleted]]

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


Re: [R] store levels in a string

2006-04-18 Thread Marc Schwartz (via MN)
On Tue, 2006-04-18 at 20:53 +0200, Daniele Medri wrote:
> Il giorno mar, 18/04/2006 alle 11.29 -0500, Marc Schwartz (via MN):
> > > paste(levels(af), collapse = "")
> > [1] "ab"
> > 
> > See ?paste.
> 
> :) more simple: toString(levels(x))
> 
> Thanks,
> 
> Cheers
> --
> DM

Actually, you don't quite get the same result:

> toString(levels(af))
[1] "a, b"

Note the inclusion of the ', '.  

See the first line in toString.default() which is:

  string <- paste(x, collapse = ", ")

HTH,

Marc

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


Re: [R] predict.nls confidence intervals

2006-04-18 Thread Prof Brian Ripley
It is _just two days_ since someone asked:

https://stat.ethz.ch/pipermail/r-help/2006-April/092437.html

and that question was answered several times in the recent past, so I at 
least declined to answer it again.

A quick search via RSiteSearch() shows several explanations

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/68606.html
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/35599.html
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/7549.html

and even an (approximate) solution

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

If non-linearity matters, simulation can be very effective.


On Tue, 18 Apr 2006, Alice Shelly wrote:

> Hello-

> It has been several years since anyone has asked, so i am asking again- 
> has anyone created a routine to estimate confidence intervals for 
> predictions from nls models (ala Bates and Watts 1988)?
>
> Thanks -
> Alice Shelly
>   [[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
>

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

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


[R] questioin about cluster in R

2006-04-18 Thread Jane Ren

Hi,All.Sorry for the group mail.
I recently met a question and I have struggled on that for a while but 
failed to found the solution.

I have a distance matrix as below.

---
03533936
350103251
331003049
93230035
365149350
---
I want to do cluster with average method.

rown<-c("A", "B", "C", "D", "E")
mydistMatrix <- read.table("D:\\5.distance",row.names = rown)

mydistObj<-as.dist(mydistMatrix, diag = FALSE, upper = FALSE)

mycluster <- hclust(mydistObj,method="average")

bmp(filename = " D:\\5_ave.bmp")
plot(mycluster,hang=-1)

dev.off()
---
The result is something like

   |
   20|
   |   ___
   15|   | |
   |   | |
   10|   | ---
   |   | |  (intersection)  |
   5  |   |   ---|
   |   |  |  |  --
   0  |   |  |  | |  |

   EA   DBC

Then I want to set a threshold to cluster them. Say 5.
But I don't know when A-D  distance is larger than 5 or not.
I can draw a line to see whether A-D distance is larger than 5 or but. When 
when the dataset is large, it is difficult to tell.


So I wonder whether there is a way in R to display the distance value at the 
intersection so that we can see the exact value of it.
or there is way to show or save the distance matrix after the average 
algorithm.

Thanks a  lots!
Focus

_
Don’t just search. Find. Check out the new MSN Search!

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

Re: [R] installation of package "randomForest" failed

2006-04-18 Thread Uwe Ligges
Ruth Meili wrote:

> Hello
> 
> I'd like to try out some functions in the package randomForest. Therefore, 
> I did install this package. However, it is not possible to load the 
> library, although I have R-Version 2.1.1 (i.e. later than 2.0.0). The 
> commands I used and the Answers/Error from R is as follows:
> 
>  > 
> install.packages("C://Programme//R//rw2011//library//randomForest_4.5-16.zip",
>  
> lib="C://Programme//R//rw2011//library//randomForest",repos = NULL)
> package 'randomForest' successfully unpacked and MD5 sums checked
> updating HTML package descriptions
>  > library(randomForest)
> Fehler in library(randomForest) : 'randomForest' ist kein gültiges Paket -- 
> vor 2.0.0 installiert?

Where did you get the zip file from?

Most easily, you can install a package by simply saying
   install.packages("randomForest")
if you have an active internet connection.

Anyway, you might want to upgrade your version of R to R-2.2.1 or even 
R-2.3.0 beta (to be released next monday) and help testing.

Uwe Ligges


> I run in this problem for the first time. Until now, I used to install new 
> packages by copying the*.zip-file to the "library"-directory in the 
> rw2011-directory. This seam not to work anymore. So I tried using the 
> function install.package(), but I did not success.
> 
> Does anybody know the Problem? I did not find any hints in the NEWS.
> Thanks anyway.
> Ruth
> 
> 
> 
> 
> 
> 
> **
> This footnote confirms that this email message has been swept by
> MIMEsweeper for the presence of computer viruses.
> 
> www.clearswift.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

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


Re: [R] second try; writing user-defined GLM link function

2006-04-18 Thread Prof Brian Ripley
A couple more comments:

The null deviance is wrong here, as the code assumes that the link
function maps constant vectors to constant vectors, which it does not 
here.  You can circumvent that by setting an offset.

Even setting dispersion = 1 I get slightly different se's.

Here's a more robust way to specify the link:

logexp <- function(days = 1)
{
 linkfun <- function(mu) qlogis(mu^(1/days))
 linkinv <- function(eta) plogis(eta)^days
 mu.eta <- function(eta)
   days*.Call("logit_mu_eta", eta, PACKAGE = "stats")*plogis(eta)^(days-1)
 valideta <- function(eta) TRUE
 link <- paste("logexp(", days, ")", sep="")
 structure(list(linkfun = linkfun, linkinv = linkinv,
mu.eta = mu.eta, valideta = valideta, name = link),
   class = "link-glm")
}

and in 2.4.0 you will able to use binomial(logexp(nestdata$exposure)).



On Mon, 17 Apr 2006, Mark Herzog wrote:

> I was a little hesitant to post to everyone until I figured out why
> there is a discrepancy in the intercept estimates when compared to the
> same model run in SAS vs. R.  Everything else comes out correctly,
> including the other coefficient estimates... so perhaps it is just the
> numerical method used.  I think glm in R is using IWLS, and SAS is using ML.
>
> If anyone has another idea feel free to let me know.  Here is my
> modified binomial family, now called logexposure.  Since there is no
> other choice for the link for this new logexposure "family", I have just
> embedded the make.link inside the logexposure family.
>
> Good luck and I'd appreciate any comments.
>
> logexposure<-function (link="logit",ExposureDays) {
> logexp<-make.link("logit")
> logexp$linkfun<-function(mu,expos=ExposureDays) {
> log((mu^(1/expos))/(1-mu^(1/expos)))
> }
> logexp$linkinv<-function(eta,expos=ExposureDays) {
> (exp(eta)/(1+exp(eta)))^expos
> }
> logexp$mu.eta<-function(eta,expos=ExposureDays) {
> (expos*exp(eta*expos)*(1+exp(eta))^(-expos-1))
> }
> variance <- function(mu) mu * (1 - mu)
> validmu <- function(mu) all(mu > 0) && all(mu < 1)
> dev.resids <- function(y, mu, wt) .Call("binomial_dev_resids",
> y, mu, wt, PACKAGE = "stats")
> aic <- function(y, n, mu, wt, dev) {
> m <- if (any(n > 1))
> n
> else wt
> -2 * sum(ifelse(m > 0, (wt/m), 0) * dbinom(round(m *
> y), round(m), mu, log = TRUE))
> }
> initialize <- expression({
> if (NCOL(y) == 1) {
> if (is.factor(y)) y <- y != levels(y)[1]
> n <- rep.int(1, nobs)
> if (any(y < 0 | y > 1)) stop("y values must be 0 <= y <= 1")
> mustart <- (weights * y + 0.5)/(weights + 1)
> m <- weights * y
> if (any(abs(m - round(m)) > 0.001))
>  warning("non-integer successes in a binomial glm!")
> } else if (NCOL(y) == 2) {
> if (any(abs(y - round(y)) > 0.001))
> warning("non-integer counts in a binomial glm!")
> n <- y[, 1] + y[, 2]
> y <- ifelse(n == 0, 0, y[, 1]/n)
> weights <- weights * n
> mustart <- (n * y + 0.5)/(n + 1)
> } else stop("for the binomial family,",
> " y must be a vector of 0 and 1's\n",
> "or a 2 column matrix where col 1 is",
> " no. successes and col 2 is no. failures")
> })
> structure(list(family="logexposure", link=logexp,
> linkfun=logexp$linkfun,
> linkinv=logexp$linkinv, variance=variance, dev.resids=dev.resids,
> aic=aic, mu.eta=logexp$mu.eta, initialize=initialize,
> validmu=validmu,
> valideta=logexp$valideta), class = "family")
> }
>
> #Example
> nestdata<-read.table("http://www.branta.org/ShafferChatNestData/chat.txt";)
> chat.glm.logexp<-glm(survive/trials~parastat+nest_ht*patsize,
>   family=logexposure(ExposureDays=nestdata$expos),data=nestdata)
> # if you have MASS installed
> library(MASS)
> chat.step<-stepAIC(chat.glm.logexp,scope=list(upper=~parastat+nest_ht*patsize,lower=~1))
> chat.step$anova
> summary(chat.step)
>
> #Not run:
> # note this compares to following results from SAS :
> #  Criteria For Assessing Goodness Of Fit
> #
> #Criterion DF   ValueValue/DF
> #Deviance 289193.9987  0.6713
> #Scaled Deviance  289193.9987  0.6713
> #Pearson Chi-Square   289537.8609  1.8611
> #Scaled Pearson X2289537.8609  1.8611
> #Log Likelihood  -96.9994
> #Algorithm converged.
> #   Analysis Of Parameter Estimates
> #
> #Standard Wald 95%   Chi-
> #Parameter   DF  Estimate ErrorLimits   Square Pr > ChiSq
> ##Intercept   1  2.6973   0.2769   2.1546  3.2399   94.92  <.0001
> #parastat01 -1.0350   0

[R] R and tcltk

2006-04-18 Thread Talita Leite
Hi people,

I'm trying to run simple commands using tcltk in R but I got strange errors. 
Look at this:

>library(tcltk)
Loading Tcl/Tk interface ... done
>tclRequire("Iwidgets")
 4.0.1
>tt <- tktoplevel()
>tn <- tkwidget(tt, "iwidgets::tabnotebook")
Erro em structure(.External("dotTclObjv", objv, PACKAGE = "tcltk"), class = 
"tclObj") :
[tcl] wrong # args: should be "switch ?switches? string pattern body 
... ?default body?".

I recently installed R 2.2.1 in suse 10. I've been using the last versions 
of R and I didn't have those problems with tcltk. I'll appreciate some help.

Thanx

Talita

___
Talita Perciano Costa Leite
Mestranda em Ciência da Computação
Universidade Federal de São Carlos - UFSCar
Departamento de Computação
Grupo de Arquitetura, Processamento de Imagens e Sinais - GAPIS

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


[R] R Reference Card (especially useful for Newbies)

2006-04-18 Thread Berton Gunter
 

Newbies (and others!) may find useful the R Reference Card made available by
Tom Short and Rpad at http://www.rpad.org/Rpad/Rpad-refcard.pdf  or through
the "Contributed" link on CRAN (where some other reference cards are also
linked). It categorizes and organizes a bunch of R's basic, most used
functions so that they can be easily found. For example, paste() is under
the "Strings" heading and expand.grid() is under "Data Creation." For
newbies struggling to find the right R function as well as veterans who
can't quite remember the function name, it's very handy.
 
-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box

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

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


Re: [R] April Course***R/S-plus in San Francisco

2006-04-18 Thread elvis

   Check out our upcoming 2-day "R/S-plus Fundamentals and Programming
   Techniques" in San Francisco: www.xlsolutions-corp.com/Rfund.htm
    San Franciso,April  27-28
Payment due AFTER the class
   Course Description:
   This two-day beginner to intermediate R/S-plus course focuses on a
   broad spectrum of topics, from reading raw data to a comparison of R
   and S. We will learn the essentials of data manipulation, graphical
   visualization and R/S-plus programming. We will explore statistical
   data analysis tools,including graphics with data sets. How to enhance
   your plots, build your own packages (librairies) and connect via
   ODBC,etc.
   We will perform some statistical modeling and fit linear regression
   models. Participants are encouraged to bring data for interactive
   sessions
   With the following outline:
   - An Overview of R and S
   - Data Manipulation and Graphics
   - Using Lattice Graphics
   - A Comparison of R and S-Plus
   - How can R Complement SAS?
   - Writing Functions
   - Avoiding Loops
   - Vectorization
   - Statistical Modeling
   - Project Management
   - Techniques for Effective use of R and S
   - Enhancing Plots
   - Using High-level Plotting Functions
   - Building and Distributing Packages (libraries)
   - Connecting; ODBC, Rweb, Orca via sockets and via Rjava
   Email us for group discounts.
   Email Sue Turner: [EMAIL PROTECTED]
   Phone: 206-686-1578
   Visit us: www.xlsolutions-corp.com/training.htm
   Please let us know if you and your colleagues are interested in this
   classto take advantage of group discount. Register now to secure your
   seat!
   Interested in R/Splus Advanced course? email us.
   Cheers,
   Elvis Miller, PhD
   Manager Training.
   XLSolutions Corporation
   206 686 1578
   www.xlsolutions-corp.com
   [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


Re: [R] R debugging options

2006-04-18 Thread John Fox
Dear Larry,

I'm not aware of an existing function that lists functions, but here's a
simple solution:

listFunctions <- function(all.names=FALSE, envir=.GlobalEnv){
# all.names=TRUE: include names beginning with "."
# envir: environment to search
Objects <- objects(envir, all.names=all.names)
if (length(Objects) == 0) Objects
else names(which(sapply(Objects, 
function(object) is.function(eval(parse(text=object),
envir=envir)
}

Getting mtrace() to use the function names returned by listFunctions() is a
bit tricky, because of the way mtrace() evaluates its arguments. You could
do something like the following:

for(f in listFunctions()) mtrace(char.fname=f)

Perhaps someone else knows of an existing or better solution.

I hope this helps,
 John


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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Larry Howe
> Sent: Tuesday, April 18, 2006 12:46 PM
> To: r-help@stat.math.ethz.ch
> Subject: Re: [R] R debugging options
> 
> On Monday April 17 2006 21:08, Francisco J. Zagmutt wrote:
> > RSiteSearch("debug") or RSiteSearch("debugging") will give 
> you a lot 
> > or relevant information.  I personally use library(debug) 
> extensivelly 
> > and it should do all the taks you asked about. There is a 
> nice article 
> > describing the debug lilbrary in the 2003/3 issue of R News 
> > http://cran.r-project.org/doc/Rnews/Rnews_2003-3.pdf
> >
> > Cheers
> >
> > Francisco
> 
> Wow! That is a great package. I think it does all I need.
> 
> Is there a way to turn on debugging for all loaded functions? 
> My source file contains many functions and I would prefer not 
> to have to mtrace() each one. 
> Something like
> 
> >mtrace(how_do_I_get_a_list_of_all_loaded_functions)
> 
> ?
> 
> Larry
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html

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


Re: [R] R and ViM

2006-04-18 Thread Peter Dalgaard
(Ted Harding) <[EMAIL PROTECTED]> writes:

> On 18-Apr-06 Prof Brian Ripley wrote:
> >>  [...]
> >>  > RSiteSearch('vim editor')
> >>  A search query has been submitted to http://search.r-project.org
> >>  The results page should open in your browser shortly
> >>
> >> which it duly did. However -- and this is what's interesting --
> >> I entered the command in R running on my machine B, at which
> >> I'm sitting.
> >>
> >> This machine B is independently displaying the Firefox browser
> >> running on Machine C (via X Windows; Linux on both machines).
> >>
> >> And that's the browser where the search results appeared.
> >>
> >> So R running on B can hijack Firefox on C. How does it know?
> > 
> > ?browseURL
> 
> Wow! Wonders never cease! (Still unsure about the underlying
> mechanism, but then X can be a hall of mirrors to the uninitiated).
> 
> Thanks for the hint!
> Ted.

Actually, I think this belongs in a group of _mis_features in the
current user interface landscape, along with saved sessions & the
like. It sounds smart, right until you want to view a file on machine
B, say file://foo, which machine C and hence Firefox has no knowledge
about. You then realize that the only way you are going to view that
file is to shut down Firefox on C and start a new one on B. Attempting
to start one on B, as in "firefox file://foo" will just send a message
to the one on C telling it to display file://foo...

I usually get bitten by this in the reverse situation: remote login to
work machine, run R, do help.start(), and "Firefox can't find the file
at /tmp/RtmpZVbVef/.R/doc/html/index.html".

It sort of indicates missing perspective on the part of the
developers: They have forgotten about the fact that browsers might be
used for information *not* on the Internet.

(SAS tries to get around the problem of non-local access to its help
pages by setting up a local HTTP server, only to be foiled by
firewalling...)

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

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


[R] Different results under Windows and Linux

2006-04-18 Thread Kamila Naxerova
Hi everyone,

disturbingly, a PCA yields different results when I run the analysis 
under Windows and Linux.
I open the same workspace (which is on an independent partition) and 
perform the exact same function (by using the history file). 
Interestingly, PC1 is the same, but PC2 comes out totally different.

Thanks!
Kamila

Windows: 
platform i386-pc-mingw32
arch i386  
os   mingw32   
system   i386, mingw32 
status 
major2 
minor2.1   
year 2005  
month12
day  20
svn rev  36812 
language R   


Linux (Suse 10, Kernel 2.6.13-15.8-default)
platform i686-pc-linux-gnu
arch i686
os   linux-gnu
system   i686, linux-gnu
status
major2
minor2.1
year 2005
month12
day  20
svn rev  36812
language R

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


Re: [R] R and ViM

2006-04-18 Thread Jose Quesada
Hmm, how timely.

I posted yesterday my solution to integrate R and vim. The message is
in my sent box but I don't think it showed up in the list... Here it
is again:

Hi All,

If you use vim to edit R code, you may be interested in this.
I have put together a personalized syntax file, some code templates,
and a way to send code from Vim to R using autoHotKeys (windows).

http://www.andrew.cmu.edu/user/jquesada/RvimSuite/instructions.html

Actually, the little autoHotKeys can be useful even if you don't use
vim just to send the example R code from the help pages to the
console.

Best wishes,
-Jose

PS:
@list moderators
Any idea why my message (from a @gmail account) appeared in the sent
box but never on the list?

On 4/18/06, Michael Graber <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> I'm starting to learn R, but I'm already programing for a while, using
> ViM as editor. Therefore I'd like to be able to use R together with
> ViM.
>
> My question now is, whether there are already people out there knowing
> how to do this in a similar easy way as with Emacs, and if those would
> be willing to share this knowledge.
> I did already research on the web on this topic, but i couldn't find
> satisfying answers, except one good looking approach on the ViM-website
> with a perl-script called funnel.pl, which I couldn't make running on
> my mac OSX 10.3.9 so far.
>
> I'd be grateful for help.
>
> Thanks,
> Michael Graber
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>


--
Cheers,
-Jose
--
Jose Quesada, PhD.

[EMAIL PROTECTED]   Dept. of Psychology
http://www.andrew.cmu.edu/~jquesada Sussex University
Brighton, 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


Re: [R] R and ViM

2006-04-18 Thread Peter Dalgaard
"Jose Quesada" <[EMAIL PROTECTED]> writes:

> Hmm, how timely.
> 
> I posted yesterday my solution to integrate R and vim. The message is
> in my sent box but I don't think it showed up in the list... Here it
> is again:
> 
> Hi All,
> 
> If you use vim to edit R code, you may be interested in this.
> I have put together a personalized syntax file, some code templates,
> and a way to send code from Vim to R using autoHotKeys (windows).
> 
> http://www.andrew.cmu.edu/user/jquesada/RvimSuite/instructions.html
> 
> Actually, the little autoHotKeys can be useful even if you don't use
> vim just to send the example R code from the help pages to the
> console.
> 
> Best wishes,
> -Jose
> 
> PS:
> @list moderators
> Any idea why my message (from a @gmail account) appeared in the sent
> box but never on the list?

I saw it the first time... Could it be that your mail reader is set up
to ignore mail from yourself?

Rather than resending stuff, it is preferable to check the archives

https://stat.ethz.ch/pipermail/r-help/2006-April/date.html
https://stat.ethz.ch/pipermail/r-help/2006-April/092457.html 

which are easily reachable via

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


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

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


Re: [R] Different results under Windows and Linux

2006-04-18 Thread Kamila Naxerova
Thanks Bert, I did not describe the problem accurately enough.

Actually, by now, I found out that floating-point imprecision is the 
reason for my confusion. The problem does not arise with the prcomp() 
function but rather with my data preprocessing:

 > means=apply(dev,2,mean,na.rm=T)
 > means
windows 371.19100102494,  432.458908438674   etc.
linux   371.191001024941,432.458908438674   etc.

 > stdev=apply(dev,2,sd,na.rm=T)
 > stdev
windows 872.234567580374, 1324.05572667875   etc.
linux   872.234567580372, 1324.05572667875   etc.

Thanks!
Kamila





Berton Gunter wrote:

>Please provide better documentation to help diagnose the problem. What are
>the PC's ?
>
>-- Bert Gunter
>Genentech Non-Clinical Statistics
>South San Francisco, CA
> 
>"The business of the statistician is to catalyze the scientific learning
>process."  - George E. P. Box
> 
> 
>
>  
>
>>-Original Message-
>>From: [EMAIL PROTECTED] 
>>[mailto:[EMAIL PROTECTED] On Behalf Of Kamila Naxerova
>>Sent: Tuesday, April 18, 2006 3:12 PM
>>To: r-help@stat.math.ethz.ch
>>Subject: [R] Different results under Windows and Linux
>>
>>Hi everyone,
>>
>>disturbingly, a PCA yields different results when I run the analysis 
>>under Windows and Linux.
>>I open the same workspace (which is on an independent partition) and 
>>perform the exact same function (by using the history file). 
>>Interestingly, PC1 is the same, but PC2 comes out totally different.
>>
>>Thanks!
>>Kamila
>>
>>Windows: 
>>platform i386-pc-mingw32
>>arch i386  
>>os   mingw32   
>>system   i386, mingw32 
>>status 
>>major2 
>>minor2.1   
>>year 2005  
>>month12
>>day  20
>>svn rev  36812 
>>language R   
>>
>>
>>Linux (Suse 10, Kernel 2.6.13-15.8-default)
>>platform i686-pc-linux-gnu
>>arch i686
>>os   linux-gnu
>>system   i686, linux-gnu
>>status
>>major2
>>minor2.1
>>year 2005
>>month12
>>day  20
>>svn rev  36812
>>language R
>>
>>__
>>R-help@stat.math.ethz.ch mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide! 
>>http://www.R-project.org/posting-guide.html
>>
>>
>>
>
>
>
>  
>

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


[R] How to efficiently extract or construct the residual covariance matrix from lme()?

2006-04-18 Thread Andrew Robinson
Dear R-community,

I'm trying to get the estimated residual covariance matrices from an
lme object.  If we write the model as:

Y = X \beta + Z b + \epsilon

and assume that b ~ N(0, P) and \epsilon ~ N(0, \Sigma), where P is
non-diagonal and \Sigma might have correlation and weights components,
then I'm looking for efficient estimates of

\Sigma

and

ZPZ' + \Sigma

I can find P easily enough, but I'm wondering if there's an easy way
to get at Z and \Sigma.  Also I can move to lmer() if that simplifies
the problem.

Cheers

Andrew
-- 
Andrew Robinson  
Department of Mathematics and StatisticsTel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
Email: [EMAIL PROTECTED] http://www.ms.unimelb.edu.au

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


[R] about "intersection set" and "union set"

2006-04-18 Thread XinMeng
Hello sir: 

group1:1,2,3,4 
group2:1,3,4,5 
group3:2,4,8,9 
.. ... 
group1000:9,3,8,2 

I wanna get the "intersection set" and "union set". I've tried command 
"setdiff"and "union",but only two groups is permited.How can I deal with multi 
groups to find the "intersection set" and "union set"? 

Thanks a lot! 
My best  
 




--
***
Xin Meng 
Capitalbio Corporation
National Engineering Research Center 
for Beijing Biochip Technology 
BioPharma-informatics & Software Dept. 
Research Engineer
Tel: +86-10-80715888/80726868-6438
Fax: +86-10-80726790
[EMAIL PROTECTED] 
Address:18 Life Science Parkway, 
Changping District, Beijing 102206, China

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

Re: [R] about "intersection set" and "union set"

2006-04-18 Thread Gabor Grothendieck
This was just discussed recently.  See the following thread:

http://tolstoy.newcastle.edu.au/R/help/06/04/24923.html

On 4/18/06, XinMeng <[EMAIL PROTECTED]> wrote:
> Hello sir:
>
> group1:1,2,3,4
> group2:1,3,4,5
> group3:2,4,8,9
> .. ...
> group1000:9,3,8,2
>
> I wanna get the "intersection set" and "union set". I've tried command 
> "setdiff"and "union",but only two groups is permited.How can I deal with 
> multi groups to find the "intersection set" and "union set"?
>
> Thanks a lot!
> My best
>
>
>
>
>
> --
> ***
> Xin Meng
> Capitalbio Corporation
> National Engineering Research Center
> for Beijing Biochip Technology
> BioPharma-informatics & Software Dept.
> Research Engineer
> Tel: +86-10-80715888/80726868-6438
> Fax: +86-10-80726790
> [EMAIL PROTECTED]
> Address:18 Life Science Parkway,
> Changping District, Beijing 102206, China
>
>
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>

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


[R] isoMDS and 0 distances

2006-04-18 Thread Tyler Smith
Hi,

I'm trying to do a non-metric multidimensional scaling using isoMDS. 
However, I have some '0' distances in my data, and I'm not sure how to 
deal with them. I'd rather not drop rows from the original data, as I am 
comparing several datasets (morphology and molecular data) for the same 
individuals, and it's interesting to see how much morphological 
variation can be associated with an identical genotype.

I've tried replacing the 0's with NA, but the isoMDS appears to stop on 
the first iteration and the stress does not improve:

distA # A dist object with 13695 elements, 4 of which == 0
cmdsA <- cmdscale(distA, k=2)

distB <- distA
distB[which(distB==0)] <- NA

isoA <- isoMDS(distB, cmdsA)
initial  value 21.835691
final  value 21.835691
converged

The other approach I've tried is replacing the 0's with small numbers. 
In this case isoMDS does reduce the stress values.

min(distA[which(distA>0)])
[1] 0.02325581

distC <- distA
distC[which(distC==0)] <- 0.001
isoC <- isoMDS(distC)
initial  value 21.682854
iter   5 value 16.862093
iter  10 value 16.451800
final  value 16.339224
converged

So my questions are: what am I doing wrong in the first example? Why 
does isoMDS converge without doing anything? Is replacing the 0's with 
small numbers an appropriate alternative?

Thanks for your time,

Tyler
R 2.2.1

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


Re: [R] second try; writing user-defined GLM link function

2006-04-18 Thread Mark Herzog
It's probable that Roger's pdf that he provided is much more appropriate 
(or perhaps may have a good reference).  However, if interested, the 
specific example used for my code, is from the following paper (and is 
now widely being used in many avian nesting studies, but I leave to 
others to decide if useful in a much broader context):

Shaffer, T.  2004. A unifying approach to analyzing nest success. Auk 
121(2): 526-540.

In this paper Shaffer develops the link, but only cites 
McCullugh/Nelder, and Hosmer/Lemeshow (which I don't think discuss any 
other links for the binomial family besides those already available in R)
On his website ( 
http://www.npwrc.usgs.gov/resource/birds/nestsurv/nestsurv.htm ), 
Shaffer has some code examples in SAS (with the data embedded in his 
example code).  My previous email, with code and example, provides a 
direct link to a datafile with that same data.  I am fairly certain he 
would be willing to offer that data for use, if desired.

Mark
Mark Herzog, Ph.D.
Program Leader, San Francisco Bay Research
Wetland Division, PRBO Conservation Science
4990 Shoreline Highway 1
Stinson Beach, CA 94970
(415) 893-7677 x308
[EMAIL PROTECTED]

Prof Brian Ripley wrote:
> Is this something that is fairly widely useful?  If so, it is something 
> that we could add to the stats package.  (We ought in any case to make it 
> easier to extend glm families, and this could be an example.  If so, I'd 
> like a reference for its use.)
> 
> There is a good reason why logit is implmented as
> 
>> make.link("logit")
> $linkfun
> function (mu)
> .Call("logit_link", mu, PACKAGE = "stats")
> 
> 
> $linkinv
> function (eta)
> .Call("logit_linkinv", eta, PACKAGE = "stats")
> 
> 
> $mu.eta
> function (eta)
> .Call("logit_mu_eta", eta, PACKAGE = "stats")
> 
> 
> $valideta
> function (eta)
> TRUE
> 
> 
> which is that these functions protect against underflow/overflow of exp, 
> and why I suggested looking at make.link("probit").
> 
> You can write your linkfun and linkinv more accurately using plogis and 
> qlogis.
> 
> 
> On Mon, 17 Apr 2006, Mark Herzog wrote:
> 
>> I was a little hesitant to post to everyone until I figured out why
>> there is a discrepancy in the intercept estimates when compared to the
>> same model run in SAS vs. R.  Everything else comes out correctly,
>> including the other coefficient estimates... so perhaps it is just the
>> numerical method used.  I think glm in R is using IWLS, and SAS is using ML.
>>
>> If anyone has another idea feel free to let me know.  Here is my
>> modified binomial family, now called logexposure.  Since there is no
>> other choice for the link for this new logexposure "family", I have just
>> embedded the make.link inside the logexposure family.
>>
>> Good luck and I'd appreciate any comments.
>>
>> logexposure<-function (link="logit",ExposureDays) {
>> logexp<-make.link("logit")
>> logexp$linkfun<-function(mu,expos=ExposureDays) {
>> log((mu^(1/expos))/(1-mu^(1/expos)))
>> }
>> logexp$linkinv<-function(eta,expos=ExposureDays) {
>> (exp(eta)/(1+exp(eta)))^expos
>> }
>> logexp$mu.eta<-function(eta,expos=ExposureDays) {
>> (expos*exp(eta*expos)*(1+exp(eta))^(-expos-1))
>> }
> 
> ...
>

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


Re: [R] R and ViM

2006-04-18 Thread François Pinard
[Michael Graber]

>[...] I'd like to be able to use R together with ViM.  [...]  My 
>question now is, whether there are already people out there knowing how 
>to do this in a similar easy way as with Emacs [...]

I've been an Emacs user for a very long time, and then, switched to Vim.
See http://pinard.progiciels-bpi.ca/opinions/editors.html, if you feel 
curious, for a few personal thoughts on Emacs.

For R, I tried sticking to a mere interactive shell, taking advantage of 
the "GNU readline" interface built into R, with Vim as an external 
editor.  For sending R code from Vim to R, one merely selects the code 
to send within Vim using the mouse, and paste it directly with the mouse 
in the interactive shell window running R.  Simple and comfortable!  :-)

Emacs offers ESS, which has many interesting features.  However, despite 
quite attractive, it did not fully seduce me: a bit because I try to 
avoid returning to Emacs keystroke habits, a bit because ESS is heavy 
weighted compared to Vim + R-in-a-shell solution, a bit because ESS adds 
distracting idiosyncrasies, like scrolling differently or opening extra 
windows at times.  R already offers enough options I could customize if 
I want to read help in a browser or a pager, and at good speed.  (Of 
course, if you use an heavy browser, you feel it; but "links -g" is OK!)

An ESS nicety that my current setup does not really replace is the 
automatic highlighting or R output.  One of the advantages of this 
output highlighting is visually spotting R requests and replies.  As 
a compromise, I'm using this bit of a kludge in my Rprofile file:

if (interactive()) {
local({
options(editor='vim -c "set ft=r"')
if (Sys.getenv('TERM') %in% c('rxvt', 'xterm')) {
onglet = 2
options(prompt=paste(sep='',
 formatC('', width=80-onglet), '\033[;30;45m',
 formatC('', width=onglet), '\033[0m\n',
 options('prompt')))
}
})
}

The "set ft=r" bit ensures proper highlighting and coloration within 
Vim, whenever edit() or fix() are used.  Here "vim" could be replaced by 
"gvim" or "gvim -f", say.  (In my Vim configuration, "vim" uses the GUI 
automatically if started within X; or uses the console mode otherwise.)

Then, the R prompt is modified to visually mark each request-reply 
interaction with a white separating line holding a small violet marker 
at the right.  It works nicely for me in almost all circumstances (there 
are a few, uncommon exceptions).  Usual scrolling of the shell window 
allows me to quickly find R commands and replies, even if much less 
colourful than with ESS.  I'm ready to pay that price for simplicity.

A last trick which is convenient in my case.  My X window manager allows 
customization of keystrokes.  (I'm using Openbox, but surely many other 
window manages offer that possibility too.)  For all 26 of 
Ctrl-Alt-Letter, the same small "openbox-helper" (Python) script of mine 
is called with the Letter given as an option, which may launch 
applications in turn.  This is how Ctrl-Alt-R opens a shell window 
running R, and Ctrl-Alt-M opens a shell window running Maxima.  In both 
these shells, Ctrl-D closes the application and the window.  This is 
convenient for quick mathematical jobs, and quite in the spirit of Vim 
(fast and easy start/exit, instead of long running like Emacs).

-- 
François Pinard   http://pinard.progiciels-bpi.ca

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


[R] Thousands Separator

2006-04-18 Thread David Feldman
I am a new R user, and am struggling with how to add a comma to the  
tick mark labels in a bwplot or a boxplot.

I think the default values of the labels are fine, I just want them  
to appear with commas.

If I use the function boxplot, I can then use
   axis(2,labels=format(axTicks(2),big.mark=","))
but that just overlays them on the existing labels which I don't know  
how to turn off.

This method does not appear to work at all with bwplot, but I am not  
sure why.

Any help would be appreciated.

Thanks,

David

---
David Feldman
The Taylor Feldman Group, LLC
www.taylorfeldman.com
(530) 400-5470

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


[R] [R-pkgs] Version 1.0 of hapassoc now available from CRAN

2006-04-18 Thread Sigal Blay
Version 1.0 of hapassoc now available from CRAN

hapassoc is an R package for likelihood inference of trait associations 
with SNP haplotypes and other attributes using the EM Algorithm. Recent 
changes include the addition of anova and logLik methods for the 
class hapassoc, to allow users to perform likelihood ratio tests of 
haplotype effects. Other changes include bug-fixes and improvements to 
the documentation, such as the addition of a package vignette. See the 
exerpt from the ChangeLog for more details.

ChangeLog

2006-04-04 Version 1.0

 * hapassoc(): the "baseline" argument is documented to have default
   equal to the most common haplotype, but the code to implement this
   default was lost and needed to be replaced.
 * hapassoc(): added a "verbose" flag. Default is verbose=FALSE. If
   TRUE users see the iteration number and value of the convergence
   criterion at each iteration of the EM algorithm.
 * pre.hapassoc(): added a "verbose" flag. Default is verbose=TRUE.
   If TRUE users see a list of the SNP genotypes used to form
   haplotypes and a list of the other "non-haplotype" variables.
 * Package vignette "hapassoc" added. After loading the package, type
   vignette("hapassoc") to view.

2006-03-22

 * Overall addition of the log-likelihood functions
 * hapassoc(): function now returns log-likelihood and model
 * logLik.hapassoc(): New function to extract the log-likelihood from
   a hapassoc object
 * anova.hapassoc(): New function to perform likelihood ratio test on
   two hapassoc objects.

2006-02-02 Minor changes:

 * EMvar(): fixed a bug occurring when all haplotype phases are known.
 * RecodeHaplos(): fixed a bug where a single column of non-haplotype
   data in a non-allelic data set was losing its name.
 * hapassoc(): Change "..." argument of hapassoc to "start".
   Previously the only intended use of "..." was to allow the user to
   pass in "start" for starting values to the glm function, rather
   than to allow the user to pass in other optional arguments to glm.
   We have now made this more explicit by making this argument more
   specific.

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

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


Re: [R] R and ViM

2006-04-18 Thread Martin Maechler
> "PD" == Peter Dalgaard <[EMAIL PROTECTED]>
> on 19 Apr 2006 01:06:02 +0200 writes:

PD> "Jose Quesada" <[EMAIL PROTECTED]> writes:
>> Hmm, how timely.
>> 
>> I posted yesterday my solution to integrate R and
>> vim. The message is in my sent box but I don't think it
>> showed up in the list... Here it is again:
>> 
>> Hi All,
>> 
>> If you use vim to edit R code, you may be interested in
>> this.  I have put together a personalized syntax file,
>> some code templates, and a way to send code from Vim to R
>> using autoHotKeys (windows).
>> 
>> http://www.andrew.cmu.edu/user/jquesada/RvimSuite/instructions.html
>> 
>> Actually, the little autoHotKeys can be useful even if
>> you don't use vim just to send the example R code from
>> the help pages to the console.
>> 
>> Best wishes, -Jose
>> 
>> PS: @list moderators Any idea why my message (from a
>> @gmail account) appeared in the sent box but never on the
>> list?

PD> I saw it the first time... Could it be that your mail
PD> reader is set up to ignore mail from yourself?

PD> Rather than resending stuff, it is preferable to check
PD> the archives

PD> https://stat.ethz.ch/pipermail/r-help/2006-April/date.html
PD> https://stat.ethz.ch/pipermail/r-help/2006-April/092457.html

PD> which are easily reachable via

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

Indeed. Please do check the archives.

Now back to the subject:  Jose, I think your main contribution
is based on "autoHotKeys"  and that only works on Windoze, right? 
Michael explicitly mentioned he's working in Mac OS X.

Martin

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


Re: [R] second try; writing user-defined GLM link function

2006-04-18 Thread Mark Herzog
Excellent!

So to provide the final summary for everyone's sake, based on Dr. 
Ripley's revisions, and now a revised logexposure "family" function to 
use with the improved link function (until 2.4.0 makes it simpler) :

# Logistical Exposure Link Function
# See Shaffer, T.  2004. A unifying approach to analyzing nest success.
# Auk 121(2): 526-540.

logexp <- function(days = 1)
{
 linkfun <- function(mu) qlogis(mu^(1/days))
 linkinv <- function(eta) plogis(eta)^days
 mu.eta <- function(eta)
   days*.Call("logit_mu_eta", eta,
PACKAGE = "stats")*plogis(eta)^(days-1)
 valideta <- function(eta) TRUE
 link <- paste("logexp(", days, ")", sep="")
 structure(list(linkfun = linkfun, linkinv = linkinv,
mu.eta = mu.eta, valideta = valideta, name = link),
 class = "link-glm")
}

# Modified binomial family function (that allows logexp link function)
logexposure<-function (link="logexp",ExposureDays) {

 variance <- function(mu) mu * (1 - mu)
 validmu <- function(mu) all(mu > 0) && all(mu < 1)
 dev.resids <- function(y, mu, wt) .Call("binomial_dev_resids",
 y, mu, wt, PACKAGE = "stats")
 aic <- function(y, n, mu, wt, dev) {
 m <- if (any(n > 1))
 n
 else wt
 -2 * sum(ifelse(m > 0, (wt/m), 0) * dbinom(round(m *
 y), round(m), mu, log = TRUE))
 }
 initialize <- expression({
 if (NCOL(y) == 1) {
 if (is.factor(y)) y <- y != levels(y)[1]
 n <- rep.int(1, nobs)
 if (any(y < 0 | y > 1)) stop("y values must be 0 <= y <= 1")
 mustart <- (weights * y + 0.5)/(weights + 1)
 m <- weights * y
 if (any(abs(m - round(m)) > 0.001))
  warning("non-integer successes in a binomial glm!")
 } else if (NCOL(y) == 2) {
 if (any(abs(y - round(y)) > 0.001))
 warning("non-integer counts in a binomial glm!")
 n <- y[, 1] + y[, 2]
 y <- ifelse(n == 0, 0, y[, 1]/n)
 weights <- weights * n
 mustart <- (n * y + 0.5)/(n + 1)
 } else stop("for the binomial family,",
 " y must be a vector of 0 and 1's\n",
 "or a 2 column matrix where col 1 is",
 " no. successes and col 2 is no. failures")
 })
 structure(list(family="binomial", link=logexp(ExposureDays),
linkfun=logexp(ExposureDays)$linkfun,
linkinv=logexp(ExposureDays)$linkinv, variance=variance,
dev.resids=dev.resids, aic=aic,
mu.eta=logexp(ExposureDays)$mu.eta, initialize=initialize,
validmu=validmu, valideta=logexp$valideta), class = "family")
}

#Example
nestdata<-read.table("http://www.branta.org/ShafferChatNestData/chat.txt";)
chat.glm.logexp<-glm(survive/trials~parastat+nest_ht*patsize,family=logexposure(ExposureDays=nestdata$expos),data=nestdata)
# if you have MASS installed
library(MASS)
chat.step<-stepAIC(chat.glm.logexp,scope=list(upper=~parastat+nest_ht*patsize,lower=~1))
chat.step$anova
summary(chat.step)


Mark Herzog, Ph.D.
Program Leader, San Francisco Bay Research
Wetland Division, PRBO Conservation Science
4990 Shoreline Highway 1
Stinson Beach, CA 94970
(415) 893-7677 x308
[EMAIL PROTECTED]

Prof Brian Ripley wrote:
> A couple more comments:
> 
> The null deviance is wrong here, as the code assumes that the link
> function maps constant vectors to constant vectors, which it does not 
> here.  You can circumvent that by setting an offset.
> 
> Even setting dispersion = 1 I get slightly different se's.
> 
> Here's a more robust way to specify the link:
> 
> logexp <- function(days = 1)
> {
> linkfun <- function(mu) qlogis(mu^(1/days))
> linkinv <- function(eta) plogis(eta)^days
> mu.eta <- function(eta)
>   days*.Call("logit_mu_eta", eta, PACKAGE = 
> "stats")*plogis(eta)^(days-1)
> valideta <- function(eta) TRUE
> link <- paste("logexp(", days, ")", sep="")
> structure(list(linkfun = linkfun, linkinv = linkinv,
>mu.eta = mu.eta, valideta = valideta, name = link),
>   class = "link-glm")
> }
> 
> and in 2.4.0 you will able to use binomial(logexp(nestdata$exposure)).
>

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


Re: [R] Thousands Separator

2006-04-18 Thread Uwe Ligges
David Feldman wrote:
> I am a new R user, and am struggling with how to add a comma to the  
> tick mark labels in a bwplot or a boxplot.
> 
> I think the default values of the labels are fine, I just want them  
> to appear with commas.
> 
> If I use the function boxplot, I can then use
>axis(2,labels=format(axTicks(2),big.mark=","))
> but that just overlays them on the existing labels which I don't know  
> how to turn off.


Specify in your plot function: yaxt="n" (see ?par)


> This method does not appear to work at all with bwplot, but I am not  
> sure why.

Because it is not a base graphics function but a lattice graphics.

Uwe Ligges



> Any help would be appreciated.
> 
> Thanks,
> 
> David
> 
> ---
> David Feldman
> The Taylor Feldman Group, LLC
> www.taylorfeldman.com
> (530) 400-5470
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] isoMDS and 0 distances

2006-04-18 Thread Prof Brian Ripley
Short answer: you cannot compare distances including NAs, so there is no 
way to find a monotone mapping of distances.

If the data really are identical for two rows, you can easily drop one of 
them whilst doing MDS, and then assign the position found for one to the 
other.

On Tue, 18 Apr 2006, Tyler Smith wrote:

> Hi,
>
> I'm trying to do a non-metric multidimensional scaling using isoMDS.
> However, I have some '0' distances in my data, and I'm not sure how to
> deal with them. I'd rather not drop rows from the original data, as I am
> comparing several datasets (morphology and molecular data) for the same
> individuals, and it's interesting to see how much morphological
> variation can be associated with an identical genotype.
>
> I've tried replacing the 0's with NA, but the isoMDS appears to stop on
> the first iteration and the stress does not improve:
>
> distA # A dist object with 13695 elements, 4 of which == 0
> cmdsA <- cmdscale(distA, k=2)
>
> distB <- distA
> distB[which(distB==0)] <- NA
>
> isoA <- isoMDS(distB, cmdsA)
> initial  value 21.835691
> final  value 21.835691
> converged
>
> The other approach I've tried is replacing the 0's with small numbers.
> In this case isoMDS does reduce the stress values.
>
> min(distA[which(distA>0)])
> [1] 0.02325581
>
> distC <- distA
> distC[which(distC==0)] <- 0.001
> isoC <- isoMDS(distC)
> initial  value 21.682854
> iter   5 value 16.862093
> iter  10 value 16.451800
> final  value 16.339224
> converged
>
> So my questions are: what am I doing wrong in the first example? Why
> does isoMDS converge without doing anything? Is replacing the 0's with
> small numbers an appropriate alternative?
>
> Thanks for your time,
>
> Tyler
> R 2.2.1
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

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