Re: [R] scan() problem

2003-09-10 Thread Gabor Grothendieck

If the records are always of the form:

number,"...","...",number 

where ... may contain commas but not double quotes then here is a 
kludgy solution.  Perhaps its sufficient?

# scan in data using " as the delimiter and keep first and last fields
s <- scan("clipboard",skip=1,what=list("",NULL,NULL,NULL,""),sep="\"")

# remove commas from fields, convert to numeric and reshape into matrix
matrix(as.numeric(sub(",","",unlist(s))),nc=2)



--- Paul Bayer <[EMAIL PROTECTED]> wrote:
>Dear R-helpers,
>
>I have to read some large csv-files into R (30 - 100MB).
>Since reading with read.csv leads to "memory exhausted", I tried
>with scan(), skipping not needed columns by NULL-elements in
>"what".
>
>When these skipped elements are quoted strings with commata inside,
>R interprets each such quoted comma as element separator
>leading to wrong records in the rest of the line.
>
>A little test will show what I mean. I have the following "test.csv":
>
>"col.A","col.B","col.C","col.D"
>1,"quoted string","again, again again",123
>2,"nice quotes, isnt it","you got it",456
>
>First I read all elements:
>
> > tst <- scan("test.csv", what=list(a=0,b="",c="",d=0), sep=",", skip=1)
>Read 2 records
> > tst
>$a
>[1] 1 2
>
>$b
>[1] "quoted string""nice quotes, isnt it"
>
>$c
>[1] "again, again again" "you got it"
>
>$d
>[1] 123 456
>
>Everything is fine. Then I try to skip the 2nd column by giving b=NULL:
>
> > tst <- scan("test.csv", what=list(a=0,b=NULL,c="",d=0), sep=",", 
>skip=1)
>Read 2 records
>Warning message:
>number of items read is not a multiple of the number of columns
> > tst
>$a
>[1] 1 2
>
>$b
>NULL
>
>$c
>[1] "again, again again"" isnt it,you got it,456\n\n\n"
>
>$d
>[1] 123  NA
>
> >
>
>I got garbage.
>Isn't this a bug?
>Or did I something wrong?
>Is there a workaround?
>
>Thank you all,
>
>Paul Bayer,
>Feldafing, Germany
>
>__
>[EMAIL PROTECTED] mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Customised legend in lattice

2003-09-10 Thread Alexander . Herr
Hi List,

Am trying to customize a legend in trellis: Draws 2x5 lines in 5 colors and
2 linetypes. I would like to add two more items to the legend showing the
key for the line types above the colored legend.

Any suggestions welcome - thanks Herry

#
#Following example code:

library(gregmisc)
trellis.device(bg="white")
i1=0
i2=-1.89767506
i3=-1.17087085 
i4=-0.09853587
i5=0.87486320
a1=1.9106842
a2=0.7518519
x1<-seq(0,7, by=0.01)


y1<-inv.logit(a1+a2*(x1)+i1)
y2<-inv.logit(a1+a2*(x1)+i2)
y3<-inv.logit(a1+a2*(x1)+i3)
y4<-inv.logit(a1+a2*(x1)+i4)
y5<-inv.logit(a1+a2*(x1)+i5)

z1<-inv.logit(a2*(x1)+i1)
z2<-inv.logit(a2*(x1)+i2)
z3<-inv.logit(a2*(x1)+i3)
z4<-inv.logit(a2*(x1)+i4)
z5<-inv.logit(a2*(x1)+i5) 
as.data.frame(cbind(y1,y2,y3,y4,y5,z1,z2,z3,z4,z5))->tmp


leg.txt<-c("Rating 1","Rating 2","Rating 3","Rating 4","Rating 5")
colo<-rep(c("black","red","darkgreen","navyblue","rosybrown"),2)

plot4<-xyplot(y1+y2+y3+y4+y5+z1+z2+z3+z4+z5~x1, cex=2, xlab="number x",
ylab="Probability", 
bg="white", xlim=c(0,7), ylim=c(0,1), type="l",
allow.multiple=TRUE, 
data=tmp,
panel=function(x,y,subscripts,...){
 for(i in 1:5){
  panel.xyplot(x1,tmp[,i],col=colo[i],lwd=2,lty=1,...)
 }
 for(i in 6:10){
  panel.xyplot(x1,tmp[,i],col=colo[i],lwd=2,lty=2,...)
 }

}
 )

update(plot4, key = list(corner=c(0,1), x=0.65, y=0.35,
  points=list(c(1:5),col=colo[1:5],pch=19),
text=list(leg.txt),
 )
   ) 

##--- Not working part--XXX
update(plot4, key = list(corner=c(0,1), x=0.65, y=0.35,
  lines=list(c(1:2),col="black",lwd=1,lty=c(1:2)),
text=list(c("category 1","category 2")),
  points=list(c(1:5),col=colo[1:5],pch=19),
text=list(leg.txt),
 )
   ) 



Alexander Herr - Herry
Northern Futures
Davies Laboratory
PMB, Aitkenvale, QLD 4814
Phone (07) 4753 8510
Fax   (07) 4753 8650
Home: http://batcall.csu.edu.au/~aherr
Webadmin ABS: http://ausbats.org.au
Sustainable Ecosystems: http://www.cse.csiro.au/



[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Computing a CDF or many quantiles

2003-09-10 Thread Jerome Asselin

Also look at ecdf() from package "stepfun".

HTH,
Jerome Asselin

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Computing a CDF or many quantiles

2003-09-10 Thread Jerome Asselin
On September 10, 2003 04:03 pm, Kevin S. Van Horn wrote:
>
> Your method looks like a naive reimplementation of integration, and
> won't work so well for distributions that have the great majority of the
> probability mass concentrated in a small fraction of the sample space.
>  I was hoping for something that would retain the adaptability of
> integrate().

Yesterday, I've suggested to use approxfun(). Did you consider my 
suggestion? Below is an example.

N <- 500
x <- rexp(N)
y <- rank(x)/(N+1)
empCDF <- approxfun(x,y)
xvals <- seq(0,4,.01)
plot(xvals,empCDF(xvals),type="l",
xlab="Quantile",ylab="Cumulative Distribution Function")
lines(xvals,pexp(xvals),lty=2)
legend(2,.4,c("Empirical CDF","Exact CDF"),lty=1:2)


It's possible to tune in some parameters in approxfun() to better match 
your personal preferences. Have a look at help(approxfun) for details.

HTH,
Jerome Asselin

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Computing a CDF or many quantiles

2003-09-10 Thread Kevin S. Van Horn
Your method looks like a naive reimplementation of integration, and 
won't work so well for distributions that have the great majority of the 
probability mass concentrated in a small fraction of the sample space. 
I was hoping for something that would retain the adaptability of 
integrate().

(Ted Harding) wrote:

If that's all you want to do, then a very straightfoward approach should
be OK. I illustrate with a truncated normal distribution on [-1,1]:
 x <- (-1)+(0.001*(0:2000));pdf<-dnorm(x); pdf<-pdf/(sum(pdf)*0.001)
 CDF<-cumsum(pdf)*0.001
 plot(x,pdf,ylim=c(0,1),type="l");lines(x,CDF)
Quantiles:
 N=10;e<-CDF[1];
 for(i in (0:10)){
 j<-max(which(CDF<=i/N+e));print(c(x[j],CDF[j]))
 }
 

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] regression questions

2003-09-10 Thread Paul, David A
I have been puzzling over how to fit some fixed effects models
to a set of data.  My response function is

response <- function(a, b, c, alpha1, alpha2, indicator, t, t2)
{
z = a + 
b * (t) * exp(-alpha1 * t) +
indicator *c * (t2) * exp(-alpha2 * t2)
}

where t2 = t - 4 and "indicator" is a 0-1 vector denoting
when t > 4.  Each test subject receives equal doses at t = 0 and 
t = 4.  The dose can vary from subject to subject.

Also note the following:
1.  Var(e[it]) = sigma1^2 for t<=4; Var(e[it]) = sigma2^2 for t>4.
This is motivated by my data exploration.  
2.  b,c > 0 for biological interpretability
3.  t varies over {0,2,4,6,8,10}.  
4.  For a variety of reasons, "a", "alpha1", and "alpha2" must
be held constant over all of the test subjects.

The function nlsList( ) is not appropriate because it assumes
that all of the parameters are allowed to vary with each level of
a specified grouping variable (in this case, "subject.id").  
I have been able to fit nls( ) models using the following 
syntax:

model.nls1 <- 
nls(y ~ response(10, b[subject.id], c[subject.id], alpha1, alpha2, 
indicator, t, t2),
 data = foo.frame, 
 start = list(b = rep(25,12), c = rep(100,12), 
alpha1 = 0.5, alpha2 = 0.5), 
 trace = T)

The start values were motivated by some data exploration, and
the results appear to be stable.  The value "a=10" was fixed also
as a result of the initial data exploration, and appears necessary
in order for the model to be stable.

Unfortunately, the estimated b- and c-values for several subjects are
negative.  Also, nls( ) does not allow a "weights = " statement
like gnls( ) does.  When I try

model.nls1 <- 
gnls(y ~ response(10, b[subject.id], c[subject.id], alpha1, alpha2, 
indicator, t, t2),
 data = foo.frame, 
 start = list(b = rep(25,12), c = rep(100,12), 
alpha1 = 0.5, alpha2 = 0.5), 
 trace = T)

I get the message "Error in eval(expr, envir, enclos) : Object "b" not
found"
This surprises me, since my understanding is that gnls( ) is essentially
nls( ) but with "weights = " and "correlation = " options.  I suppose
that separate fixed effects for each subject could be estimated from
gnls( ) if I created a separate indicator variable for each subject and
added them to the data frame (I have not yet done this); however, this 
does not address the need for the b,c parameters to be constrained
greater than zero.


I would gratefully welcome suggestions.


Much thanks in advance,
   david paul

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] coef names in lm

2003-09-10 Thread Roger D. Peng
Maybe this will work for you:

df <- as.data.frame(design)
lm.2 <- lm(response ~ ., df)
-roger

Jean Eid wrote:

Dear all,
I am interested in finding out how to change the names of coefficients in
the lm function. I have a design matrix which I called "design" where each
variate has its own name. However when I issue the command:
lm.1<-lm(response~design-1, weights=some.weights)

and follow it with:

summary(lm.1)

it seems to paste as a character the names of the variates
with design i.e I have something like:
designAge
designPlace
designOccupation
...
as names of coefficients and instead I just wanted to be
it seems to do
Age
Place
Occupation.
P.S.. the reason I need this is because I am using the xtable library to
turn output into latex tables and do not want to manually delete each and
every single "design" word in the coefficients name vector.
Thank you so much for any feedback,

Jean Eid

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 

--
Together, we can stop attaching Word documents
http://www.fsf.org/philosophy/no-word-attachments.html
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] coef names in lm

2003-09-10 Thread Liaw, Andy
If you coerce "design" into a data frame and then do

lm.1 <- lm(response ~ . - 1, data=design, ...)

that should work.

Andy

> -Original Message-
> From: Jean Eid [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, September 10, 2003 4:28 PM
> To: [EMAIL PROTECTED]
> Subject: [R] coef names in lm
> 
> 
> Dear all,
> I am interested in finding out how to change the names of 
> coefficients in the lm function. I have a design matrix which 
> I called "design" where each variate has its own name. 
> However when I issue the command:
> 
> lm.1<-lm(response~design-1, weights=some.weights)
> 
> and follow it with:
> 
> summary(lm.1)
> 
> it seems to paste as a character the names of the variates
> with design i.e I have something like:
> 
> designAge
> designPlace
> designOccupation
> ...
> as names of coefficients and instead I just wanted to be
> it seems to do
> Age
> Place
> Occupation.
> 
> P.S.. the reason I need this is because I am using the xtable 
> library to turn output into latex tables and do not want to 
> manually delete each and every single "design" word in the 
> coefficients name vector.
> 
> Thank you so much for any feedback,
> 
> Jean Eid
> 
> __
> [EMAIL PROTECTED] mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
> 

--
Notice:  This e-mail message, together with any attachments,...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] coef names in lm

2003-09-10 Thread Jean Eid
Dear all,
I am interested in finding out how to change the names of coefficients in
the lm function. I have a design matrix which I called "design" where each
variate has its own name. However when I issue the command:

lm.1<-lm(response~design-1, weights=some.weights)

and follow it with:

summary(lm.1)

it seems to paste as a character the names of the variates
with design i.e I have something like:

designAge
designPlace
designOccupation
...
as names of coefficients and instead I just wanted to be
it seems to do
Age
Place
Occupation.

P.S.. the reason I need this is because I am using the xtable library to
turn output into latex tables and do not want to manually delete each and
every single "design" word in the coefficients name vector.

Thank you so much for any feedback,

Jean Eid

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] PLS LDA

2003-09-10 Thread Christoph Lehmann
Hi Andy

Great and thanks a lot! Yes, it is the package from Prof. Wehrens. So I
just run the PLS like a Logistic Regression, coding the endogenous
variable as binary. 
So no need of specifying a binary-link function (as we have to when
using glm)?
And yes of course: I need the LVs which give the best error rate. What
do you mean by "discretize the predictions in {0, 1}"? Does this mean I
assign a prediction either a 0 (if predicted values <=0.5) or a 1 if the
predicted value is >0.5?
I need to dive into the package tomorrow, so that I better understand
the material, but is there any way of calculating e.g. a leaving-one-out
cross-validation error?

Thanks and best regards

Christoph

On Wed, 2003-09-10 at 21:50, Liaw, Andy wrote:
> Do you mean the pls.pcr package by Prof. Wehrens?  This is what I do:
> 
> o  Code the two groups as 0s and 1s (numeric, not factor).
> 
> o  Run PLS as usual.  Cases with predicted values > 0.5 get 
>classified as 1s, otherwise as 0s.
> 
> o  Note that you need to modify the code inside the mvr() 
>function a bit if you want to use the built-in selection
>of number of LVs:  It selects the number that gives the
>best MSE, but what you really want is the number that
>gives the best error rate.  One trick is to discretize
>the predictions in {0, 1}, then the "MSE" will be error
>rate.
> 
> There are better ways to do this, but this works fairly well.
> 
> HTH,
> Andy 
> 
> > -Original Message-
> > From: Christoph Lehmann [mailto:[EMAIL PROTECTED] 
> > Sent: Wednesday, September 10, 2003 1:38 PM
> > To: [EMAIL PROTECTED]
> > Subject: [R] PLS LDA
> > 
> > 
> > Dear R experts
> > I saw and downloaded the fresh pls package for R. Is there 
> > any way of using this pls package for PLS discriminant 
> > analysis? If not, is there any other package available.
> > 
> > I need a way of classifying objects into e.g. two groups, 
> > where nbr_observations << nbr_variables
> > 
> > many thanks for your kind help
> > 
> > Christoph
> > -- 
> > Christoph Lehmann <[EMAIL PROTECTED]>
> > 
> > __
> > [EMAIL PROTECTED] mailing list 
> > https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
> > 
> 
> --
> Notice:  This e-mail message, together with any attachments,...{{dropped}}
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
-- 
Christoph Lehmann <[EMAIL PROTECTED]>

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] PLS LDA

2003-09-10 Thread Liaw, Andy
Do you mean the pls.pcr package by Prof. Wehrens?  This is what I do:

o  Code the two groups as 0s and 1s (numeric, not factor).

o  Run PLS as usual.  Cases with predicted values > 0.5 get 
   classified as 1s, otherwise as 0s.

o  Note that you need to modify the code inside the mvr() 
   function a bit if you want to use the built-in selection
   of number of LVs:  It selects the number that gives the
   best MSE, but what you really want is the number that
   gives the best error rate.  One trick is to discretize
   the predictions in {0, 1}, then the "MSE" will be error
   rate.

There are better ways to do this, but this works fairly well.

HTH,
Andy 

> -Original Message-
> From: Christoph Lehmann [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, September 10, 2003 1:38 PM
> To: [EMAIL PROTECTED]
> Subject: [R] PLS LDA
> 
> 
> Dear R experts
> I saw and downloaded the fresh pls package for R. Is there 
> any way of using this pls package for PLS discriminant 
> analysis? If not, is there any other package available.
> 
> I need a way of classifying objects into e.g. two groups, 
> where nbr_observations << nbr_variables
> 
> many thanks for your kind help
> 
> Christoph
> -- 
> Christoph Lehmann <[EMAIL PROTECTED]>
> 
> __
> [EMAIL PROTECTED] mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
> 

--
Notice:  This e-mail message, together with any attachments,...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] logistic regression for a data set with perfect separati

2003-09-10 Thread Ted Harding
On 10-Sep-03 Christoph Lehmann wrote:
> I have the follwoing data
>   V1 V2
> 1 -5.800  0
> 2 -4.800  0
> 3 -2.867  0
> 4 -0.867  0
> 5 -0.733  0
> 6 -1.667  0
> 7 -0.133  1
> 8  1.200  1
> 9  1.333  1
> 
> and I want to know, whether V1 can predict V2: of course it can, since
> there is a perfect separation between cases 1..6 and 7..9
> 
> How can I test, whether this conclusion (being able to assign an
> observation i to class j, only knowing its value on Variable V1)  holds
> also for the population, our data were drawn from? 
> 
> Means, which inference procedure is recommended? Logistic regression,
> for obvious reasons makes no sense.

This is not so much an R question, nor really a "which procedure"
question, since standard procedures are not usually equipped to deal
with such situations (beyond telling you in some way that the situation
is "out of bounds").

However, you can certainly investigate it by writing little R programs
to look at it from various points of view.

Let 'm' denote the location parameter for the CDF which models the
probability, and 's' the scale parameter (e.g. a logistic function).

For a start, clearly the maximum of the likelihood is 1, achieved when
s=0 and m is any value between -0.7333.. and -0.1333..

You can investigate the variation of the likelihood as m and s vary
by evaluating expressions like

m<-(-.07);s<-1.0;L<-plogis((V1-m)/s);2*sum(V2*log(L)+(1-V2)*log(1-L))

For instance, for any value of s>0, find the value of m which maximises
this. Then you can get an indication about your question by looking
for the value of s such that this maximised value (with sign changed)
is just on (say) the 5% point of a chisq[df=1]; my gropings suggest
that s=0.8, m=(-0.1) (approx). This gives you a pair (m,s) which is
just consistent with your data by this criterion. What, for instance,
is the probability for any value of V1 that V2=1/0?

E.g. for m=-0.1,s=0.8, consider the range -2 <= x <=2 (step=0.1):
 m<-(-0.10);s<-0.8;x<-0.1*(-20:20);L<-plogis((x-m)/s);L
 [1] 0.08509905 0.09534946 0.10669059 0.11920292 0.13296424 0.14804720
 [7] 0.16451646 0.18242552 0.20181322 0.22270014 0.24508501 0.26894142
[13] 0.29421497 0.32082130 0.34864514 0.37754067 0.40733340 0.43782350
[19] 0.46879063 0.5000 0.53120937 0.56217650 0.5920 0.62245933
[25] 0.65135486 0.67917870 0.70578503 0.73105858 0.75491499 0.77729986
[31] 0.79818678 0.81757448 0.83548354 0.85195280 0.86703576 0.88079708
[37] 0.89330941 0.90465054 0.91490095 0.92414182 0.93245331

so that P(V2=1) can be substantial (>0.1) for V1 as low as -1.8,
and P(V2=0) likewise for V2 as high as +1.6; yet this (m,s) is not
"rejected" on likelihood grounds. So, in answer to your substantive
question, it would seem that your data do not support the generalisation
you are asking about.

And so on; you can plot things out, etc. You can do a simulation study:
for a given (m,s), say the pair above, and a set of V1 values like those
which you have, what is the probability that you get a set of results
(V2) which show "perfect separation"?:-- find what proportion of
simulations satisfy

  max(which(V1[V2==0])) < min(which(V1[V2==1]))

Explore a grid of (m,s) values and estimate this proportion; smooth the
estimates and plot a contour diagram ... and so on!

Use R as a tool for questions like this, and do not necessarily expect to
find a procedure which is tailor-made for (e.g.) this particular question!

Best wishes,
Ted.



E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 167 1972
Date: 10-Sep-03   Time: 20:24:06
-- XFMail --

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] insert eps into microsft word

2003-09-10 Thread Brett Melbourne
Your problem may also be that you can't get the figure to print from Word?

To get Word to print anything other than a blank box for the eps, you will
need to install and use a postscript printer driver for your printer.

cheers
Brett

Brett Melbourne, Postdoctoral Fellow
Biological Invasions IGERT www.cpb.ucdavis.edu/bioinv
Center for Population Biology, Storer Hall
University of California Davis CA 95616


- Original Message - 
From: "Gavin Simpson" <[EMAIL PROTECTED]>
To: "Karim Elsawy" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, September 10, 2003 12:26 PM
Subject: Re: [R] insert eps into microsft word


> Depending on your version of Word that simply is *not* true!
>
> I can't test this here (I now have Word XP/2002) but my colleagues have
> Word 97 on their college-supplied service (yes, really!) and despite not
> being able to see a preview, they can quite happily import eps files I
> have produced during the course of my work. Admitedly a blank box in
> word is not the most user-friendly thing to work with, but this old
> version of Word will happily deal with the postscript produced.
>
> Having used Word 2000 and XP during the course of writing a PhD thesis
> that used R-generated plots extensively, I know first hand how easy it
> is to deal with eps files from R in Word.
>
> My setup involves using Ghostscript/GSView on Windows XP to view the eps
> plots I produce in R and then import them into Word XP (the eps filter
> now seems to add a preview for you), but if you have an earlier word
> version, GSView can easily add a preview for you.
>
> Also, onefile = TRUE does *not* produce eps files.
>
> I quote from ?postscript :
>
>   onefile: logical: if true (the default) allow multiple figures in one
>file.  If false, generate a file name containing the page
>number and use an EPSF header and no `DocumentMedia' comment.
>
> It is a bit confusing, but onefile = TRUE is for producing multi-page
> postscript documents, i.e. put all the plots to follow into a single
> postscript doc with (possibly) more than a single page.
>
> I know a number of people have suggested using a windows metafile.
> Whilst this might offer a solution to your problem, unless you are using
> a very-out-of-date version of Word I cannot see the advantages of using
> metafiles over postscript.
>
> HTH
>
> Gavin
>
> Karim Elsawy wrote:
>
> > it seems that word can not read encapsupalted postscripts generated by R
> > I used this command
> >
> > postscript("output.eps",horizontal=F,onefile=TRUE)
> > since onefile=TRUE produces an encapsualted postscript
> >
> > actually what I'm trying to do is to insert the postsript file into a
> > word document
> > since other formats like jpeg and bmp do not reproduce the same quality
> > like postscript
> > formats
> >
> >
> > any suggestions are very much appreciated
> > Karim
> >
> > __
> > [EMAIL PROTECTED] mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> >
> >
>
> -- 
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> Gavin Simpson [T] +44 (0)20 7679 5522
> ENSIS Research Fellow [F] +44 (0)20 7679 7565
> ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
> UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
> 26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
> London.  WC1H 0AP.
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] insert eps into microsft word

2003-09-10 Thread Peter Dalgaard BSA
"Rafael A. Irizarry" <[EMAIL PROTECTED]> writes:

> for word documents submitted to picky journals i usually use seomthing
> like this:
> 
> bitmap("plot_1.png",width=6,height=6,res=600,pointsize=12,family="Times")
> 
> on my computer this resutls in quality  just as good (to mu eye) as with
> postscript. you can also use adobe acrobat to convert postsctipt to
> something else.

Word seems generally unhappy with PostScript, not just the files R
makes. One option that I have seen come out rather nicely is to have
the plots as PDF and use Adobe Distiller as the backend so that the
whole thing becomes a PDF file.

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

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] insert eps into microsft word

2003-09-10 Thread Gavin Simpson
Depending on your version of Word that simply is *not* true!

I can't test this here (I now have Word XP/2002) but my colleagues have 
Word 97 on their college-supplied service (yes, really!) and despite not 
being able to see a preview, they can quite happily import eps files I 
have produced during the course of my work. Admitedly a blank box in 
word is not the most user-friendly thing to work with, but this old 
version of Word will happily deal with the postscript produced.

Having used Word 2000 and XP during the course of writing a PhD thesis 
that used R-generated plots extensively, I know first hand how easy it 
is to deal with eps files from R in Word.

My setup involves using Ghostscript/GSView on Windows XP to view the eps 
plots I produce in R and then import them into Word XP (the eps filter 
now seems to add a preview for you), but if you have an earlier word 
version, GSView can easily add a preview for you.

Also, onefile = TRUE does *not* produce eps files.

I quote from ?postscript :

 onefile: logical: if true (the default) allow multiple figures in one
  file.  If false, generate a file name containing the page
  number and use an EPSF header and no `DocumentMedia' comment.
It is a bit confusing, but onefile = TRUE is for producing multi-page 
postscript documents, i.e. put all the plots to follow into a single 
postscript doc with (possibly) more than a single page.

I know a number of people have suggested using a windows metafile. 
Whilst this might offer a solution to your problem, unless you are using 
a very-out-of-date version of Word I cannot see the advantages of using 
metafiles over postscript.

HTH

Gavin

Karim Elsawy wrote:

it seems that word can not read encapsupalted postscripts generated by R
I used this command
postscript("output.eps",horizontal=F,onefile=TRUE)
since onefile=TRUE produces an encapsualted postscript
actually what I'm trying to do is to insert the postsript file into a
word document
since other formats like jpeg and bmp do not reproduce the same quality
like postscript
formats
any suggestions are very much appreciated
Karim
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] how to calculate Spearman correlation with missing values

2003-09-10 Thread Torsten Hothorn
On Wed, 10 Sep 2003 [EMAIL PROTECTED] wrote:

> Hello, there:
> I got data matix with missing values. I want to calculate any possible 
> pairwise Spearman correlation rho for each column. Is there a function just 
> like cor(x, y, use="complete.obs") for Pearson correlation?
> Thanks in advance!
> 

?cor.test


> Josh
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
>

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] how to calculate Spearman correlation with missing values

2003-09-10 Thread szhan
Hello, there:
I got data matix with missing values. I want to calculate any possible 
pairwise Spearman correlation rho for each column. Is there a function just 
like cor(x, y, use="complete.obs") for Pearson correlation?
Thanks in advance!

Josh

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] logistic regression for a data set with perfect separation

2003-09-10 Thread David Firth
On Wednesday, Sep 10, 2003, at 18:50 Europe/London, Christoph Lehmann 
wrote:

Dear R experts

I have the follwoing data
  V1 V2
1 -5.800  0
2 -4.800  0
3 -2.867  0
4 -0.867  0
5 -0.733  0
6 -1.667  0
7 -0.133  1
8  1.200  1
9  1.333  1
and I want to know, whether V1 can predict V2: of course it can, since
there is a perfect separation between cases 1..6 and 7..9
How can I test, whether this conclusion (being able to assign an
observation i to class j, only knowing its value on Variable V1)  holds
also for the population, our data were drawn from?
For this you really need more data.  The only way you'll ever be able 
to reject that hypothesis is by finding an instance of 010 or 101 in 
the (ordered by V1) sample.  And if you find such then you can reject 
with certainty.

Means, which inference procedure is recommended? Logistic regression,
for obvious reasons makes no sense.
Not so obvious to me!  Logistic regression still makes sense, but care 
is needed in the method of estimation/inference.  The maximum 
likelihood solution in the above case is a model which says V2 is 1 
with certainty at some values of V1, and is zero with certainty at 
other values; and that seems an unwarranted inference with so little 
data.  That's a criticism of maximum likelihood, rather than a 
criticism of logistic regression.  (Think about the more extreme 
situation of tossing a coin once: if a head is observed, the ML 
solution is that the coin lands heads with certainty, ie that there no 
chance of tails.)

There are alternative (Bayesian and pseudo-Bayesian) methods of 
inference which can yield more sensible answers in general.  [One such 
is implemented in package brlr ("bias reduced logistic regression") on 
CRAN.]  To "test" the hypothesis described above, though, with the data 
you have, would seem to require a fully Bayesian analysis whose 
conclusions would depend strongly on the prior probability attached to 
the hypothesis.  ie you need more data...

I hope that helps in some way!

Regards,
David

Many thanks for your help

Christoph
--
Christoph Lehmann <[EMAIL PROTECTED]>
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] logistic regression for a data set with perfect separation

2003-09-10 Thread Juan Carlos Correa Morales
Hi:
Look at

Rousseeuw, P. J. and Christmann, A. (2003) Robustness against separations
and outliers in logistic regression, Computational Statistics & Data
Analysis, Vol. 43, pp. 315-332

Juan Carlos Correa, Ph.D.
Escuela de Estadistica
Universidad Nacional- Sede Medellin
Medellin COLOMBIA


On Wed, 10 Sep 2003, Christoph Lehmann wrote:

> Dear R experts
>
> I have the follwoing data
>   V1 V2
> 1 -5.800  0
> 2 -4.800  0
> 3 -2.867  0
> 4 -0.867  0
> 5 -0.733  0
> 6 -1.667  0
> 7 -0.133  1
> 8  1.200  1
> 9  1.333  1
>
> and I want to know, whether V1 can predict V2: of course it can, since
> there is a perfect separation between cases 1..6 and 7..9
>
> How can I test, whether this conclusion (being able to assign an
> observation i to class j, only knowing its value on Variable V1)  holds
> also for the population, our data were drawn from?
>
> Means, which inference procedure is recommended? Logistic regression,
> for obvious reasons makes no sense.
>
> Many thanks for your help
>
> Christoph
> --
> Christoph Lehmann <[EMAIL PROTECTED]>
>
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] logistic regression for a data set with perfect separation

2003-09-10 Thread Christoph Lehmann
Dear R experts

I have the follwoing data
  V1 V2
1 -5.800  0
2 -4.800  0
3 -2.867  0
4 -0.867  0
5 -0.733  0
6 -1.667  0
7 -0.133  1
8  1.200  1
9  1.333  1

and I want to know, whether V1 can predict V2: of course it can, since
there is a perfect separation between cases 1..6 and 7..9

How can I test, whether this conclusion (being able to assign an
observation i to class j, only knowing its value on Variable V1)  holds
also for the population, our data were drawn from? 

Means, which inference procedure is recommended? Logistic regression,
for obvious reasons makes no sense.

Many thanks for your help

Christoph
-- 
Christoph Lehmann <[EMAIL PROTECTED]>

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] insert eps into microsft word

2003-09-10 Thread Rafael A. Irizarry
for word documents submitted to picky journals i usually use seomthing
like this:

bitmap("plot_1.png",width=6,height=6,res=600,pointsize=12,family="Times")

on my computer this resutls in quality  just as good (to mu eye) as with
postscript. you can also use adobe acrobat to convert postsctipt to
something else.

On Wed, 10 Sep 2003, Karim Elsawy wrote:

> it seems that word can not read encapsupalted postscripts generated by R
> I used this command
> 
> postscript("output.eps",horizontal=F,onefile=TRUE)
> since onefile=TRUE produces an encapsualted postscript
> 
> actually what I'm trying to do is to insert the postsript file into a
> word document
> since other formats like jpeg and bmp do not reproduce the same quality
> like postscript
> formats
> 
> 
> any suggestions are very much appreciated
> Karim
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] insert eps into microsft word

2003-09-10 Thread Martin Biuw
You can also add a Windows metafile preview to your eps image using for 
instance Ghostscript.

Martin

On Wed, 10 Sep 2003 18:12:00 +0100, Karim Elsawy <[EMAIL PROTECTED]> 
wrote:

it seems that word can not read encapsupalted postscripts generated by R
I used this command
postscript("output.eps",horizontal=F,onefile=TRUE)
since onefile=TRUE produces an encapsualted postscript
actually what I'm trying to do is to insert the postsript file into a
word document
since other formats like jpeg and bmp do not reproduce the same quality
like postscript
formats
any suggestions are very much appreciated
Karim
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help



--
Martin Biuw
Sea Mammal Research Unit
Gatty Marine Laboratory, University of St Andrews
St Andrews, Fife KY16 8PA
Scotland
Ph: +44-(0)1334-462637
Fax: +44-(0)1334-462632
Web: http://smub.st.and.ac.uk
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] PLS LDA

2003-09-10 Thread Christoph Lehmann
Dear R experts
I saw and downloaded the fresh pls package for R. Is there any way of
using this pls package for PLS discriminant analysis? If not, is there
any other package available.

I need a way of classifying objects into e.g. two groups, where
nbr_observations << nbr_variables

many thanks for your kind help

Christoph
-- 
Christoph Lehmann <[EMAIL PROTECTED]>

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] scan() problem

2003-09-10 Thread Paul Bayer
Dear R-helpers,

I have to read some large csv-files into R (30 - 100MB).
Since reading with read.csv leads to "memory exhausted", I tried
with scan(), skipping not needed columns by NULL-elements in
"what".
When these skipped elements are quoted strings with commata inside,
R interprets each such quoted comma as element separator
leading to wrong records in the rest of the line.
A little test will show what I mean. I have the following "test.csv":

"col.A","col.B","col.C","col.D"
1,"quoted string","again, again again",123
2,"nice quotes, isnt it","you got it",456
First I read all elements:

> tst <- scan("test.csv", what=list(a=0,b="",c="",d=0), sep=",", skip=1)
Read 2 records
> tst
$a
[1] 1 2
$b
[1] "quoted string""nice quotes, isnt it"
$c
[1] "again, again again" "you got it"
$d
[1] 123 456
Everything is fine. Then I try to skip the 2nd column by giving b=NULL:

> tst <- scan("test.csv", what=list(a=0,b=NULL,c="",d=0), sep=",", 
skip=1)
Read 2 records
Warning message:
number of items read is not a multiple of the number of columns
> tst
$a
[1] 1 2

$b
NULL
$c
[1] "again, again again"" isnt it,you got it,456\n\n\n"
$d
[1] 123  NA
>

I got garbage.
Isn't this a bug?
Or did I something wrong?
Is there a workaround?
Thank you all,

Paul Bayer,
Feldafing, Germany
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] insert eps into microsft word

2003-09-10 Thread Marc Schwartz
On Wed, 2003-09-10 at 12:12, Karim Elsawy wrote:
> it seems that word can not read encapsupalted postscripts generated by R
> I used this command
> 
> postscript("output.eps",horizontal=F,onefile=TRUE)
> since onefile=TRUE produces an encapsualted postscript
> 
> actually what I'm trying to do is to insert the postsript file into a
> word document
> since other formats like jpeg and bmp do not reproduce the same quality
> like postscript
> formats
> 
> 
> any suggestions are very much appreciated
> Karim


Try this syntax:

postscript("output.eps", horizontal = FALSE, onefile = FALSE, 
   paper = "special")

Take note of the instructions in the Details section of ?postscript and
also re-read the description of 'onefile' ('**' are my add):

"logical: if true (the default) allow multiple figures in one file. **If
false**, generate a file name containing the page number and use an EPSF
header and no DocumentMedia comment."

HTH,

Marc Schwartz

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] insert eps into microsft word

2003-09-10 Thread David Khabie-Zeitoune
Have you tried win.metafile (I'm assuming you are using Windows)?
E.g.

win.metafile(file = "c:/test.wmf")
plot(rnorm(100))
dev.off()

WMF is a vectorised format (unlike jpeg or bmp) so should produce nice
scalable graphs.

-Original Message-
From: Karim Elsawy [mailto:[EMAIL PROTECTED] 
Sent: 10 September 2003 18:12
To: [EMAIL PROTECTED]
Subject: [R] insert eps into microsft word


it seems that word can not read encapsupalted postscripts generated by R
I used this command

postscript("output.eps",horizontal=F,onefile=TRUE)
since onefile=TRUE produces an encapsualted postscript

actually what I'm trying to do is to insert the postsript file into a
word document since other formats like jpeg and bmp do not reproduce the
same quality like postscript formats


any suggestions are very much appreciated
Karim

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] insert eps into microsft word

2003-09-10 Thread Ben Bolker

  If you're working in windows, the WMF (windows metafile) format is 
probably your best bet; it's a vector format like PostScript.

On Wed, 10 Sep 2003, Karim Elsawy wrote:

> it seems that word can not read encapsupalted postscripts generated by R
> I used this command
> 
> postscript("output.eps",horizontal=F,onefile=TRUE)
> since onefile=TRUE produces an encapsualted postscript
> 
> actually what I'm trying to do is to insert the postsript file into a
> word document
> since other formats like jpeg and bmp do not reproduce the same quality
> like postscript
> formats
> 
> 
> any suggestions are very much appreciated
> Karim
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 

-- 
620B Bartram Hall[EMAIL PROTECTED]
Zoology Department, University of Floridahttp://www.zoo.ufl.edu/bolker
Box 118525   (ph)  352-392-5697
Gainesville, FL 32611-8525   (fax) 352-392-3704

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] insert eps into microsft word

2003-09-10 Thread Karim Elsawy
it seems that word can not read encapsupalted postscripts generated by R
I used this command

postscript("output.eps",horizontal=F,onefile=TRUE)
since onefile=TRUE produces an encapsualted postscript

actually what I'm trying to do is to insert the postsript file into a
word document
since other formats like jpeg and bmp do not reproduce the same quality
like postscript
formats


any suggestions are very much appreciated
Karim

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] dataframe subsetting

2003-09-10 Thread Spencer Graves
Can you cut the data.frame down to just 2 rows and 2 columns that 
display the error?  You might find the error in the process of doing 
that.  If not, you should be able to distribute your same question with 
an example so anyone else can reproduce the problem.

This doesn't answer your question, but this technique can be used to 
resolve many difficult problems.

spencer graves

Ryan Thomas Moore wrote:
I can create a small dataset, "x" below, and subset out rows based on 
values of a certain variable.  However, on the dataset I'm working on now, 
"latdata" below, I get a subscript error.  Any advice is appreciated!

Ryan

Successful:


is.data.frame(x)
[1] TRUE

x
  X1 X2 X3
1  1  3  5
2  2  4  6
x[x$X2 %in% c(3),]
  X1 X2 X3
1  1  3  5
Unsuccessful:


is.data.frame(latdata)
[1] TRUE

is.numeric(latdata$intent)
[1] TRUE

table(latdata$intent)


  1   2   3   4   5   6 
 34  23  67 179 996   2 

unlikely <- latdata[latdata$intent %in% c(1,2,3,4),]
Error in x[[j]] : subscript out of bounds

--
Ryan T. Moore ~ Government & Social Policy
Ph.D. Candidate ~ Harvard University
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] dataframe subsetting

2003-09-10 Thread Thomas W Blackwell
Ryan  -

Puzzling.  My best guess is a misspelling or a truncation
in the column name "intent" within latdata in the context of

> unlikely <- latdata[latdata$intent %in% c(1,2,3,4),]

but I do not see any such misspelling in your email.  Could
you try again, using some other way to specify the column on
which you wish to subset ?  Such as: figure out what number
the column is (say it's the fifth column in latdata) and use

> unlikely <- latdata[latdata[[5]] %in% c(1,2,3,4),]

Otherwise, your R syntax looks fine to me.  Try also asking

> is.factor(latdata$intent)

but I don't think that would have caused the error message
you see.

-  tom blackwell  -  u michigan medical school  -  ann arbor  -

On Wed, 10 Sep 2003, Ryan Thomas Moore wrote:

> I can create a small dataset, "x" below, and subset out rows based on
> values of a certain variable.  However, on the dataset I'm working on now,
> "latdata" below, I get a subscript error.  Any advice is appreciated!
>
> Ryan
>
> Successful:
>
> > is.data.frame(x)
> [1] TRUE
> > x
>   X1 X2 X3
> 1  1  3  5
> 2  2  4  6
> > x[x$X2 %in% c(3),]
>   X1 X2 X3
> 1  1  3  5
>
> Unsuccessful:
>
> > is.data.frame(latdata)
> [1] TRUE
> > is.numeric(latdata$intent)
> [1] TRUE
> > table(latdata$intent)
>
>   1   2   3   4   5   6
>  34  23  67 179 996   2
> > unlikely <- latdata[latdata$intent %in% c(1,2,3,4),]
> Error in x[[j]] : subscript out of bounds
> --
> Ryan T. Moore ~ Government & Social Policy
> Ph.D. Candidate ~ Harvard University

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Multivariate Kalman filter with time-varying coefficients

2003-09-10 Thread David Khabie-Zeitoune
Hi

Does anyone know of any R code for estimating a *multivariate* state
space model using a Kalman filter where the output matrix H(t) is
time-varying but predictable (i.e. measurable w.r.t information at time
t-1) in the observation equation 

y(t) = H(t) z(t) + R w(t)? 

[Here y(t) are the observations, z(t) is the state variable, w(t) the
observation error and R R' the observation error covariance]

Cheers,
David

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Industrial Statistician Job (Basingstoke UK)

2003-09-10 Thread KINLEY_ROBERT
We (Eli Lilly & co) have a vacancy for an experienced industrial 
statistician who is familiar with mainstream statistical software, 
particularly  Splus (or R) and/or SAS and/or JMP.The role is to 
provide expertise and training in Statistics in support of 
process-improvement in all areas of the business, particularly Statistical 
Process Control, Design of Experiments, and Quality Control.

Full advert is in current issue of RSS News. 

If you or a colleague are interested, please e-mail a CV to [EMAIL PROTECTED] , 
or write to W.Curtis, HR Team, Eli Lilly & co., Kingsclere Road, 
Basingstoke, RG21 6XA

cheers  Bob Kinley
[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] C code for KalmnaLike

2003-09-10 Thread Paul Gilbert
My apologies. I now realize this question was more specifically about 
the KalmanLike and KalmanSmooth functions distributed in package ts with 
base, and not generally about code for calculating the Kalman smoother 
or likelihood from the Kalman filter. Of course, the sources for these 
functions are available and appear to be written in C.

Paul Gilbert

Paul Gilbert wrote:

[EMAIL PROTECTED] wrote:

Hi
it is possible to see the C code for the KalmanLike and Kalmansmooth 
functions with R?

It is possible to see all the code distributed with R and the R 
packages on CRAN. (This is why it is sometimes called an open source 
project.) Kalman smoothing and Kalman filtering, on which the 
likelihood calculation is usually based,  are not part of base R, but 
are in packages.  I am not sure about other packages, but the versions 
in the dse package are not written in C. There is a fortran version 
and an equivalent R version. There is a C version which is translated 
with f2c, but that is not the place to look if you are trying to 
understand the algorithm. The easiest code to read is the R version, 
but the fortran it the one that is used (by default) for reason of speed.

Otherwise, without using R, how can I get the code?

You can download the source from CRAN and examine it without using R. 
However, if you actually want to use the code, then I strongly suggest 
you use R too. The R code makes a call to fortran in order to speed 
the iterative part of the calculation, but the likelihood calculation 
from the residuals, all the error checking, plotting, and "nice to 
use" features are in the R code. If you want to use dse, then start by 
reading the dse user's guide distributed with the package bundle (in 
dse1/inst/doc/dse-guide.pdf) and getting familiar with R.  (When I 
have been asked questions like your's before, the next question has 
usually be something like: please give me a tutorial on the internal 
details of  your code, because I want to pull it  apart and use it 
somewhere else.  I am not very interested in the effort required for 
me to do that.)

Paul Gilbert

Thank arianna

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] what is set.fit in function predict.lm

2003-09-10 Thread Prof Brian Ripley
On Wed, 10 Sep 2003 [EMAIL PROTECTED] wrote:

> Hi, what es the parameter set.fit in function predict.lm, is set.fit True
> then i need the standard error How i cant calculate it?. It is the different
> what? i see the code of predict.lm How i cant see the matemathics formula 
> for the calculation of standard error.

> args(predict.lm)
function (object, newdata, se.fit = FALSE, scale = NULL, df = Inf,
interval = c("none", "confidence", "prediction"), level = 0.95,
type = c("response", "terms"), terms = NULL, na.action = na.pass,
...)

so I guess you meant `se.fit'.  That argument is documented on the help
page: if true it returns standard errors (estimated standard deviations)
for the predictions, without your calculating anything.

The formulae are in any good book on regression, although R is more
careful than most books in dealing with e.g. rank-deficient cases.

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

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] what is set.fit in function predict.lm

2003-09-10 Thread solares
Hi, what es the parameter set.fit in function predict.lm, is set.fit True
then i need the standard error How i cant calculate it?. It is the different
what? i see the code of predict.lm How i cant see the matemathics formula 
for the calculation of standard error.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Plot survey data

2003-09-10 Thread John Fox
Dear Anupam,

I may be wrong, but I don't think that there's any standard method to use 
in plotting with case weights. I can think of two approaches, however: (1) 
If you have a large sample, and if the range of the weights isn't too 
large, you could sample your observations with probability of inclusion in 
the plot proportional to the case weights. (2) You could plot the points 
with "size" proportional to the square root of the case weights (i.e., area 
proportional to the weights).

I hope that this helps,
 John
At 10:46 AM 9/10/2003 -0400, [EMAIL PROTECTED] wrote:
I am trying to make plots that take into account survey weights. This a
survey of the US population.  To start with I want to explore the data 
using pairs,
plot, coplots and lattice. Are there specialized methods that handle survey
weights for plotting? Any pointers?
Anupam.
-
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: [EMAIL PROTECTED]
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] dataframe subsetting

2003-09-10 Thread Ryan Thomas Moore

I can create a small dataset, "x" below, and subset out rows based on 
values of a certain variable.  However, on the dataset I'm working on now, 
"latdata" below, I get a subscript error.  Any advice is appreciated!

Ryan


Successful:

> is.data.frame(x)
[1] TRUE
> x
  X1 X2 X3
1  1  3  5
2  2  4  6
> x[x$X2 %in% c(3),]
  X1 X2 X3
1  1  3  5

Unsuccessful:

> is.data.frame(latdata)
[1] TRUE
> is.numeric(latdata$intent)
[1] TRUE
> table(latdata$intent)

  1   2   3   4   5   6 
 34  23  67 179 996   2 
> unlikely <- latdata[latdata$intent %in% c(1,2,3,4),]
Error in x[[j]] : subscript out of bounds


--
Ryan T. Moore ~ Government & Social Policy
Ph.D. Candidate ~ Harvard University

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] sort a matrix on just one column

2003-09-10 Thread Petr Pikal
Hi

On 10 Sep 2003 at 10:50, Paul Green wrote:

> How can I sort(decreasing) a matrix on just the first column?
> For example, I can I get
> 
>8  2
>7  5
>4  1
> 
> from
> 
>7  5
>4  1
>8  2

I am sure in help pages for sort() is a link to order()

> mat
 x y
[1,] 7 5
[2,] 4 1
[3,] 8 2

> o<-order(mat[,1],decreasing=T)

> mat[o,]
 x y
[1,] 8 2
[2,] 7 5
[3,] 4 1


> 
> Thanks
> 
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help

CheersPetr Pikal
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Making R packages (Unix)

2003-09-10 Thread Thomas Lumley
On Tue, 9 Sep 2003, Gattuso, Jean-Pierre wrote:

> Hi:
>
> I have have taken over from a colleague who
> prepared an R package and failed to build it on
> Windows. I am doing this with unix as I am a mac
> user. Below is the output I get when I use the
> build command:

This looks like what happens under Mac OS X, where tar doesn't recognise
the -X flag for eXcluding files [it's used for something else].

You can confirm by checking man tar.  I don't know if this will get fixed
for 1.8.0, but a work-around is to get GNU tar.

-thomas

> [gattuso:unix/R/CO2.Rcheck] gattuso% R CMD build CO2
> * checking for file 'CO2/DESCRIPTION' ... OK
> * preparing 'CO2':
> * checking whether 'INDEX' is up-to-date ... NO
> * use '--force' to overwrite the existing 'INDEX'
> * removing junk files
> * building 'CO2_1.0.tar.gz'
> tar: Unable to access
> /Users/gattuso/documents/unix/R/CO2.Rcheck/CO2_1.0.tar
> 
> tar: WARNING! These file names were not selected:
> /Users/gattuso/documents/unix/R/CO2.Rcheck/CO2_1.0.tar
> CO2_1.0.tar: No such file or directory
>
>
> I have read the R-exts.pdf document but did not
> find what I do wrong. In fact, there is little
> information on the use of R CMD build, both in
> the R-exts.pdf document and the man (R CMD build
> --help) pages.
>
> Do I need to make the CO2_1.0.tar file myself?
>
> Your help would be much appreciated!
>
> jp
> --
> 
> Jean-Pierre Gattuso | mailto:[EMAIL PROTECTED]
> | http://www.obs-vlfr.fr/~gattuso
>
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>

Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] sort a matrix on just one column

2003-09-10 Thread Paul Green
How can I sort(decreasing) a matrix on just the first column?
For example, I can I get
  8  2
  7  5
  4  1
from

  7  5
  4  1
  8  2
Thanks

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] geoR variogram problem

2003-09-10 Thread Paulo Justiniano Ribeiro Jr
Dave

GHard to tell withoiut see your data.
Pleas send me and example code (and data if necessary) and I will chack

P.J.


On Wed, 10 Sep 2003, Dave Nys wrote:

> Dear GeoR-er,
>
> If I use the variog function in the latest release of geoR, the first lag is
> always ignored.
> For instance, if you read in geodata, calculates the variogram using the
> variog function and give in a uvec like uvec=seq(0,max,by=2.44), it only
> starts giving results from distance=4.88 and ignores 2.44!
> This wasn't the case in former versions of geoR.  Is this done on purpose?
> Why?
>
> Tnx for your help,
> Dave Nys
> K.U.Leuven
> Laboratory for Forest, Nature and Landscape Research
> Vital De Costerstraat 102  B-3000 Leuven
> Tel. +32 (0)16 329751  Fax. +32 (0)16 329760
> email: [EMAIL PROTECTED]
>
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
>

Paulo Justiniano Ribeiro Jr
Departamento de Estatística
Universidade Federal do Paraná
Caixa Postal 19.081
CEP 81.531-990
Curitiba, PR  -  Brasil
Tel: (+55) 41 361 3471
Fax: (+55) 41 361 3141
e-mail: [EMAIL PROTECTED]
http://www.est.ufpr.br/~paulojus

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Plot survey data

2003-09-10 Thread TyagiAnupam
I am trying to make plots that take into account survey weights. This a 
survey of the US population.  To start with I want to explore the data using pairs, 
plot, coplots and lattice. Are there specialized methods that handle survey 
weights for plotting? Any pointers?
Anupam.

[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Off Topic: Good reference for sample size calculations

2003-09-10 Thread partha_bagchi
Following should help: 

1. "Sample Size Methodology (Statistical Modeling and Decision Science)" 
by Raghavarao and Desu (1990)
 Academic Press.

2. Russell Lenth's monograph - Some Practical Guide to Effective Sample 
Size
http://www.stat.uiowa.edu/techrep/tr303.pdf 

3. Introduction to Sample Size determination and Power Analysis for 
Clinical Trials
John Lachin, Controlled Clinical Trials, 2, 93-113 (1981)

4. Evaluation of Sample Size and Power for Analyses of Survival with 
Allowance for Nonuniform Patient Entry, Losses to Follow-up, 
Noncompliance, and Stratification
John Lachin & Mary Foulkes, Biometrics, 42, 507-519, September 
1986

Partha





"Warnes, Gregory R" <[EMAIL PROTECTED]>
Sent by: [EMAIL PROTECTED]
09/10/2003 08:37 AM

 
To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
cc: 
Subject:[R] Off Topic:  Good reference for sample size calculations



Hi All,

This is off topic, but we're drawing a blank here..

> In a presentation I'll be giving next week, I want to include a 
reference
> to a good general text on computing sample sizes for standard 
experiments.
> Can anyone recommend a good book to use for this purpose?
>
> Thanks,
>
> -Greg


LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] C code for KalmnaLike

2003-09-10 Thread Paul Gilbert
[EMAIL PROTECTED] wrote:

Hi
it is possible to see the C code for the KalmanLike and Kalmansmooth functions with R?
It is possible to see all the code distributed with R and the R packages 
on CRAN. (This is why it is sometimes called an open source project.) 
Kalman smoothing and Kalman filtering, on which the likelihood 
calculation is usually based,  are not part of base R, but are in 
packages.  I am not sure about other packages, but the versions in the 
dse package are not written in C. There is a fortran version and an 
equivalent R version. There is a C version which is translated with f2c, 
but that is not the place to look if you are trying to understand the 
algorithm. The easiest code to read is the R version, but the fortran it 
the one that is used (by default) for reason of speed.

Otherwise, without using R, how can I get the code?

You can download the source from CRAN and examine it without using R. 
However, if you actually want to use the code, then I strongly suggest 
you use R too. The R code makes a call to fortran in order to speed the 
iterative part of the calculation, but the likelihood calculation from 
the residuals, all the error checking, plotting, and "nice to use" 
features are in the R code. If you want to use dse, then start by 
reading the dse user's guide distributed with the package bundle (in 
dse1/inst/doc/dse-guide.pdf) and getting familiar with R.  (When I have 
been asked questions like your's before, the next question has usually 
be something like: please give me a tutorial on the internal details of  
your code, because I want to pull it  apart and use it somewhere else.  
I am not very interested in the effort required for me to do that.)

Paul Gilbert

Thank 
arianna

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] C code for KalmnaLike

2003-09-10 Thread Spencer Graves
	  Did you try www.r-project.org -> "Download CRAN" -> {select a local 
mirror} -> "Source code for all platforms"?

	  From what I hear, your prayers should be answered there (though I 
have no personnally built links to compiled code since S-Plus 3.3).

hope this helps.  spencer graves

[EMAIL PROTECTED] wrote:
Hi
it is possible to see the C code for the KalmanLike and Kalmansmooth functions 
with R?
Otherwise, without using R, how can I get the code?
Thank 
arianna

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Off Topic: Good reference for sample size calculations

2003-09-10 Thread Marc Schwartz
On Wed, 2003-09-10 at 07:37, Warnes, Gregory R wrote:
> Hi All,
> 
> This is off topic, but we're drawing a blank here..
> 
> > In a presentation I'll be giving next week, I want to include a reference
> > to a good general text on computing sample sizes for standard experiments.
> > Can anyone recommend a good book to use for this purpose?
> > 
> > Thanks,
> > 
> > -Greg


Greg,

How about:

Design and Analysis of Clinical Trials
Concepts and Methodologies
Shein-Chung Chow and Jen-pei Liu
Wiley, 1998 

Chapter 10: Sample Size Determination
Pages 424 - 482

Amazon.com link:

http://www.amazon.com/exec/obidos/tg/detail/-/047113404X/

HTH,

Marc Schwartz

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


RE: [R] Off Topic: Good reference for sample size calculations

2003-09-10 Thread Harold Doran
Jacob Cohen's book "Statistical Power Analysis for the Behavioral Sciences" is one.



 
--
Harold C. Doran
Director of Research and Evaluation
New American Schools
675 N. Washington Street, Suite 220
Alexandria, Virginia 22314
703.647.1628
  
 
 


-Original Message-
From: Warnes, Gregory R [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 10, 2003 8:37 AM
To: '[EMAIL PROTECTED]'
Subject: [R] Off Topic: Good reference for sample size calculations



Hi All,

This is off topic, but we're drawing a blank here..

> In a presentation I'll be giving next week, I want to include a reference
> to a good general text on computing sample sizes for standard experiments.
> Can anyone recommend a good book to use for this purpose?
> 
> Thanks,
> 
> -Greg


LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Off Topic: Good reference for sample size calculations

2003-09-10 Thread Warnes, Gregory R

Hi All,

This is off topic, but we're drawing a blank here..

> In a presentation I'll be giving next week, I want to include a reference
> to a good general text on computing sample sizes for standard experiments.
> Can anyone recommend a good book to use for this purpose?
> 
> Thanks,
> 
> -Greg


LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Need your help-SOS

2003-09-10 Thread Thomas W Blackwell
WeiQiang  -

As I read it, both difficulties arise on the DCOM side,
not in the R syntax.  Problem 1, and I'm just guessing,
could arise if you are not allowed to overwrite the
value of "Result" in the DCOM environment.  Try again,
using two different variable names in the two successive
lines.

Problem 2 would seem to have something to do with the
DCOM syntax for subscripting an array.  Inside R, the
syntax would be to use square brackets for subscripting x,
thus,  x[1,1] would return the upper left corner element.

I have no knowledge of DCOM, so I don't know how the
command  Response.write Result(1,1)  gets interpreted.

-  tom blackwell  -  u michigan medical school  -  ann arbor  -

On Wed, 10 Sep 2003 [EMAIL PROTECTED] wrote:

> Hello,
>
>   I am a newbie in R project and trying to call prcomp(x) of R function
> using (D)COM server communicate with R in ASP, and encountering the error
> "Runtime error -2147221493(8004000b). Automation Error, Object is static,
> operation not allowed."
>
>   Source code is shown as below:
>   <%
>   Set StatConn=Server.CreateObject("StatConnectorSrv.StatConnector")
>   StatConn.Init ("R")
>   Result=StatConn.Evaluate("x<-matrix(c(1,2,3,4,5,6,7,8,9),3)")
>   Result=StatConn.Evaluate("y<-prcomp(x)")
>   StatConn.Close
>   %>
>
>   I have another problem when displaying dimension variable
> "Result(1,1)" on client, there will be a "Type mismatch: 'Result'" error.
>   Source code is shown as below:
>   <%
>   Set StatConn=Server.CreateObject("StatConnectorSrv.StatConnector")
>   StatConn.Init ("R")
>   Result=StatConn.Evaluate("x<-matrix(c(1,2,3,4,5,6,7,8,9),3)")
>   Response.write Result(1,1)
>   StatConn.Close
>   %>
>
>   You are very appreciated if you help me on above issue.
>   Thanks Again!
>
> Regards,
> WeiQiang Li
> IT-Factory Information Systems
> Tel: 6485-2439
>
> __
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Need your help with SJava package on W2K

2003-09-10 Thread Raimondas B.
Dear R expert,

I have the problems with running R from Java on Windows 2000.
This is my what i get when i run the program:
Loading RInterpreter library

java.lang.UnsatisfiedLinkError: no RInterpreter in java.library.path

I set all variable (environment). I'd like to notice,that Java from R works
fine, initialization was without any problems.

Please help me to solve me this problem.
Raimondas

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] geoR variogram problem

2003-09-10 Thread Dave Nys
Dear GeoR-er,

If I use the variog function in the latest release of geoR, the first lag is
always ignored.
For instance, if you read in geodata, calculates the variogram using the
variog function and give in a uvec like uvec=seq(0,max,by=2.44), it only
starts giving results from distance=4.88 and ignores 2.44!
This wasn't the case in former versions of geoR.  Is this done on purpose?
Why?

Tnx for your help,
Dave Nys
K.U.Leuven
Laboratory for Forest, Nature and Landscape Research
Vital De Costerstraat 102  B-3000 Leuven
Tel. +32 (0)16 329751  Fax. +32 (0)16 329760
email: [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] C code for KalmnaLike

2003-09-10 Thread orasi


Hi
it is possible to see the C code for the KalmanLike and Kalmansmooth functions 
with R?
Otherwise, without using R, how can I get the code?
Thank 
arianna

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Need your help-SOS

2003-09-10 Thread WeiQiang . Li
Hello,

  I am a newbie in R project and trying to call prcomp(x) of R function
using (D)COM server communicate with R in ASP, and encountering the error
"Runtime error -2147221493(8004000b). Automation Error, Object is static,
operation not allowed."

  Source code is shown as below:
  <%
  Set StatConn=Server.CreateObject("StatConnectorSrv.StatConnector")
  StatConn.Init ("R")
  Result=StatConn.Evaluate("x<-matrix(c(1,2,3,4,5,6,7,8,9),3)")
  Result=StatConn.Evaluate("y<-prcomp(x)")
  StatConn.Close
  %>

  I have another problem when displaying dimension variable
"Result(1,1)" on client, there will be a "Type mismatch: 'Result'" error.
  Source code is shown as below:
  <%
  Set StatConn=Server.CreateObject("StatConnectorSrv.StatConnector")
  StatConn.Init ("R")
  Result=StatConn.Evaluate("x<-matrix(c(1,2,3,4,5,6,7,8,9),3)")
  Response.write Result(1,1)
  StatConn.Close
  %>

  You are very appreciated if you help me on above issue.
  Thanks Again!

Regards,
WeiQiang Li
IT-Factory Information Systems
Tel: 6485-2439

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help