Re: [R] question about non-linear least squares in R

2007-09-05 Thread apjaworski
Here is one way of getting a reasonable fit:

1.  Scale your y's by dividing all values by 1e6.
2.  Plot x vs. y.  The plot looks like a quadratic function.
3.  Fit a quadratic const. + B*x^2 - this a linear regression problem so
use lm.
4.  Plot the predictions.
5.  Eyball the necessary shift - MA is around 0.01.  Refit const. +
B*(x-.01)^2.  Should get const.=1.147 and B=139.144
6.  Use start=list(const.= 1.147, A=0, B=1.147, MA=.01).  nls should
converge in 4 iterations.

In general, good starting points may be crucial to nls convergence.
Scaling the y's to reasonable values also helps.

Hope this helps,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Yu (Warren)  
 Wang 
 [EMAIL PROTECTED]  To 
 Sent by:  r-help@stat.math.ethz.ch  
 [EMAIL PROTECTED] r-help@stat.math.ethz.ch  
 at.math.ethz.chcc 
   
   Subject 
 09/05/2007 02:51  [R] question about non-linear least 
 AMsquares in R
   
   
   
   
   
   




Hi, everyone,
My question is: It's not every time that you can get a converged
result from the nls function. Is there any solution for me to get a
reasonable result? For example:

x - c(-0.06,-0.04,-0.025,-0.015,-0.005,0.005,0.015,0.025,0.04,0.06)

y -
c(1866760,1457870,1314960,1250560,1184850,1144920,1158850,1199910,1263850,1452520)


fitOup- nls(y ~ constant + A*(x-MA)^4 + B*(x-MA)^2,
start=list(constant=1000, A=1, B=-100, MA=0),
control=nls.control(maxiter=100, minFactor=1/4096), trace=TRUE)



 For this one, I cannot get the converged result, how can I reach it? To
use another funtion or to modify some settings for nls?

Thank you very much!

Yours,

Warren

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

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


Re: [R] integrate

2007-08-22 Thread apjaworski
As Duncan Murdoch mentioned in his reply, the problem is with the fact that
your function is not really a properly defined function in the sense of
assigning a unique y to each x.  The integrate function uses an adaptive
quadrature routine which probably makes multiple calls to the function
being integrated and expects to get the same y's for the same x's every
time.

If you want to get a number close to 20 (for your example) you need an
integration routine which will use single evaluation of your function at
each value of x.  A simple method like rectangular approximation on a grid
or the so-called trapezoidal rule will do just that.

Here is a very crude prototype of such an integrator:

integrate1 - function(f, lower, upper){
   f - match.fun(f)
   xx - seq(lower, upper, length=100)
   del - xx[2] - xx[1]
   yy - f(xx[-100])
return(del*sum(yy))

Now when you run integrate1(my.fun, -10, 10) you will get a number close to
20 but, of course, every time you do it you will get a different value.

Hope this helps,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Santanu  
 Pramanik 
 [EMAIL PROTECTED]  To 
 .umd.edu r-help@stat.math.ethz.ch  
 Sent by:   cc 
 [EMAIL PROTECTED] 
 at.math.ethz.ch   Subject 
   [R] integrate   
   
 08/22/2007 02:56  
 PM
   
   
   




Hi,
I am trying to integrate a function which is approximately constant
over the range of the integration. The function is as follows:

 my.fcn = function(mu){
+ m = 1000
+ z = 0
+ z.mse = 0
+ for(i in 1:m){
+ z[i] = rnorm(1, mu, 1)
+ z.mse = z.mse + (z[i] - mu)^2
+ }
+ return(z.mse/m)
+ }

 my.fcn(-10)
[1] 1.021711
 my.fcn(10)
[1] 0.9995235
 my.fcn(-5)
[1] 1.012727
 my.fcn(5)
[1] 1.033595
 my.fcn(0)
[1] 1.106282

The function takes the value (approx) 1 over the range of mu. So the
integration result should be close to 20 if we integrate over (-10, 10).
But R gives:

 integrate(my.fcn, -10, 10)
685.4941 with absolute error  7.6e-12

 integrate(Vectorize(my.fcn), -10, 10)  # this code never terminate

I have seen in the ?integrate page it is clearly written:

If the function is approximately constant (in particular, zero) over
nearly all its range it is possible that the result and error estimate
may be seriously wrong.

But this doesn't help in solving the problem.
Thanks,
Santanu



JPSM, 1218J Lefrak Hall
University of Maryland, College Park
Phone: 301-314-9916



 [[alternative HTML version deleted]]

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

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


Re: [R] Moving data from one workspace to another

2007-08-01 Thread apjaworski
Walter,

Here is what I do in similar situations.  I am on WinXP but this should be
similar on other systems (I hope).

1.  I start R with the new .RData workspace (usually by double-clicking on
it).
2.  I go to File  Change Dir menu item.
3.  I change the directory to where the old .RData is.
4.  I do attach(.RData)

The old .RData is no in position 2 of the search path.  You can see what is
there by doing ls(2).  Then you can copy anything, say a data frame named
dd, by just doing dd - dd.

Cheers,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Walter R.
 Paczkowski   
 [EMAIL PROTECTED]  To 
 rthlink.net  r-help@stat.math.ethz.ch
 Sent by:   cc 
 [EMAIL PROTECTED] 
 at.math.ethz.ch   Subject 
   [R] Moving data from one workspace  
   to another  
 08/01/2007 04:27  
 PM
   
   
   
   





   Hi,
   Suppose  I have a dataframe in one workspace (a .RData file) dedicated
   to one project.  I then create a new workspace (a new .RData file) for
   another  project  but  I want to move or copy the dataframe to the new
   workspace.   How can I do this efficiently?  Just do a dump and then a
   source?  Is there another way?
   Thanks,
   Walt Paczkowski

   _
   Walter R. Paczkowski, Ph.D.
   Data Analytics Corp.
   44 Hamilton Lane
   Plainsboro, NJ  08536
   (V) 609-936-8999
   (F) 609-936-3733
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] beta regressions in R

2007-07-30 Thread apjaworski
Walter,

There is a betareg package in CRAN.

Cheers,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Walter R.
 Paczkowski   
 [EMAIL PROTECTED]  To 
 rthlink.net  r-help@stat.math.ethz.ch
 Sent by:   cc 
 [EMAIL PROTECTED] 
 at.math.ethz.ch   Subject 
   [R] beta regressions in R   
   
 07/28/2007 11:09  
 AM
   
   
   





   Good morning,
   Does anyone know of a package or function to do a beta regression?
   Thanks,
   Walt Paczkowski

   _
   Walter R. Paczkowski, Ph.D.
   Data Analytics Corp.
   44 Hamilton Lane
   Plainsboro, NJ  08536
   (V) 609-936-8999
   (F) 609-936-3733
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Bad optimization solution

2007-05-07 Thread apjaworski
Paul,

I think the problem is the starting point.  I do not remember the details
of the BFGS method, but I am almost sure the (.5, .5) starting point is
suspect, since the abs function is not differentiable at 0.  If you perturb
the starting point even slightly you will have no problem.

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Paul Smith  
 [EMAIL PROTECTED] 
   To 
 Sent by:  R-help r-help@stat.math.ethz.ch   
 [EMAIL PROTECTED]  cc 
 at.math.ethz.ch   
   Subject 
   [R] Bad optimization solution   
 05/07/2007 04:30  
 PM
   
   
   
   




Dear All

I am trying to perform the below optimization problem, but getting
(0.5,0.5) as optimal solution, which is wrong; the correct solution
should be (1,0) or (0,1).

Am I doing something wrong? I am using R 2.5.0 on Fedora Core 6 (Linux).

Thanks in advance,

Paul

--
myfunc - function(x) {
  x1 - x[1]
  x2 - x[2]
  abs(x1-x2)
}

optim(c(0.5,0.5),myfunc,lower=c(0,0),upper=c(1,1),method=L-BFGS-B,control=list(fnscale=-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
and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] A problem with svIDE in Tinn-R?

2007-04-29 Thread apjaworski
Similar thing here.  Happens in 2.5.0 patched and 2.6.0 (both
April-25-2007) and svIDE 0.9-5

The only difference is that the warnings are:
1: '\A' is an unrecognized escape in a character string
2: unrecognized escape removed from ;for Options\AutoIndent: 0=Off,
1=follow language scoping and 2=copy from previous line\n

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Kenneth Cabrera   
 [EMAIL PROTECTED] 
 .co   To 
 Sent by:  r-help@stat.math.ethz.ch  
 [EMAIL PROTECTED] r-help@stat.math.ethz.ch  
 at.math.ethz.chcc 
   
   Subject 
 04/29/2007 09:38  [R] A problem with svIDE in Tinn-R? 
 PM
   
   
   
   
   




Hi R users:

I want to know if any one of you had
the problem with Tinn-R, when you
call the library svIDE on the new R 2.5.0,
(because in the old R 2.4.1 works with out
any problem).

I got this message:

 library(svIDE)
Loading required package: tcltk
Loading Tcl/Tk interface ... done
Warning messages:
1: '\A' is an unrecognized escape in a character string
2: no se reconoce el valor 'save'

Is it a critical warning? What would work and what not?
What is it new in the new version that
is not in the old version that makes this message appears?

Thank you for your help.

--
Kenneth Roy Cabrera Torres
Cel 315 504 9339

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

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


Re: [R] Computing the rank of a matrix.

2007-04-06 Thread apjaworski
How about

  qr(A)$rank

or perhaps

  qr(A, LAPACK=TRUE)$rank

Cheers,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 José Luis
 Aznarte M.   
 [EMAIL PROTECTED]  To 
 .ugr.es  r-help@stat.math.ethz.ch
 Sent by:   cc 
 [EMAIL PROTECTED] 
 at.math.ethz.ch   Subject 
   [R] Computing the rank of a matrix. 
   
 04/06/2007 06:39  
 AM
   
   
   




Hi! Maybe this is a silly question, but I need the column rank
(http://en.wikipedia.org/wiki/Rank_matrix) of a matrix and R function
'rank()' only gives me the ordering of the elements of my matrix.
How can I compute the column rank of a matrix? Is there not an R
equivalent to Matlab's 'rank()'?
I've been browsing for a time now and I can't find anything, so any
help will be greatly appreciated. Best regards!


--  --
Jose Luis Aznarte M.   http://decsai.ugr.es/~jlaznarte
Department of Computer Science and Artificial Intelligence
Universidad de Granada   Tel. +34 - 958 - 24 04 67
GRANADA (Spain)  Fax: +34 - 958 - 24 00 79

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

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


Re: [R] Integer Optimization

2007-03-21 Thread apjaworski
Dimitri,

I am assuming you mean integer linear optimization problem.  Try lpSolve.
I think you will find it much easier to use.

Cheers,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Mahieux Dimitri   
 dimitri.mahieux@ 
 student.uclouvain  To 
 .be  r-help@stat.math.ethz.ch
 Sent by:   cc 
 [EMAIL PROTECTED] 
 at.math.ethz.ch   Subject 
   [R] Integer Optimization
   
 03/21/2007 06:42  
 AM
   
   
   




Hello everybody,

I am looking for a function (or package) which can solve a integer
optimization problem.  I have found the glpk package but I don't known
very well how to use it.
Someone has another solution ?

thx

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

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


[R] mixture of 2 normals - starting values

2007-02-22 Thread apjaworski
Hi,

I have a problem of estimating a mixture of two normal distributions.  I
need to find the starting points automatically, since this is a part of a
larger piece of image processing code.

I found the mix2normal1 function in VGAM package that mentions a method of
finding starting values for mu1 and mu2 but refers the reader to a book by
Everitt and Hand.  Unfortunately, I do not have an easy access to this
book.  Could anybody point me to a description of the method that I could
use?

Any help will be appreciated.  Thanks in advance,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122

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


Re: [R] matrix - change values

2006-12-14 Thread apjaworski
Rob,

Try

a[a5]-0

Yup.  It works for matrices (and for arrays).  It also works with the
replacement value being a vector.  For example, try

b - array(1:24, dim=c(3, 4, 2))
b[(b8)  (b17)] - 101:108

I think the reason it works like this is that internally array are stored
as vectors.

Cheers,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 [EMAIL PROTECTED] 
 2.pl  
 Sent by:   To 
 [EMAIL PROTECTED] r-help@stat.math.ethz.ch
 at.math.ethz.chcc 
   
   Subject 
 12/14/2006 08:01  [R] matrix - change values  
 AM
   
   
   
   
   




Dear R Users,
I have a matrix A, and I want to change every value of this matrix if these
values are greater than an assuming value. For a vector it is simple, e.g.
a-c(1:10); a[a5]-0.
Of course, I can change matrix to vector, assign a value then change vector
to matrix. But does there exist simpler way?
Any suggestion are appreciate.
Rob

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

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


Re: [R] Gantt chart problem after upgrade to R 2.4.0

2006-11-17 Thread apjaworski
This is interesting.  I am on Win2000 running R version 2.4.0 Patched
(2006-11-15 r39915) and plotrix 2.1.5.  I get the plot that scaled a little
differently that the 2.3.1 example but the dates look fine.  I ran the
original code posted by John cane with no changes (copy and paste).  I used
the windows device and did Save As... to save the PDF file.

Here is the code:

require(plotrix)
Ymd.format - %Y/%m/%d
Ymd - function(x){ as.POSIXct(strptime(x, format=Ymd.format))}
gantt.info - list(
  labels=c(Dickens,   Doyle,Kipling,  Poe),
  starts=Ymd(c(1824/01/01, 1850/01/01, 1865/01/01, 1815/11/01)),
  ends=Ymd(c(1901/01/01, 1922/01/01, 1935/01/01, 1867/01/01)),
  priorities =c(1,2,2,4))
gantt.chart(gantt.info,main=Writers,
  xlim=as.POSIXct(c(1810/01/01,1940/01/01)))

Here is the result:

(See attached file: plot.pdf)

Cheers,

Andy



__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 No No   
 [EMAIL PROTECTED] 
 omTo 
 Sent by:  John Kane [EMAIL PROTECTED]
 [EMAIL PROTECTED]  cc 
 at.math.ethz.ch   R R-help r-help@stat.math.ethz.ch 
   Subject 
   Re: [R] Gantt chart problem after   
 11/17/2006 03:35  upgrade to R 2.4.0  
 PM
   
   
   
   
   




I am on ubuntu linux with R 2.4.0 compiled and I get the same picture
as with yours with R 2.4.0.

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



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


Re: [R] Query about using table

2006-10-26 Thread apjaworski
Lalitha,

Try something like

with(data, table(cut(age, n), member_FLAG))

where data is a data frame with columns named age and member_FLAG and n is
the number of age categories (bins) you want.  This will give you the
number of Ys and Ns in each bin, that you will need to convert to
percentages.

Also, you might want to check the help pages for table and cut.

Cheers,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 lalitha viswanath 
 lalithaviswanath 
 @yahoo.comTo 
 Sent by:  r-help@stat.math.ethz.ch
 [EMAIL PROTECTED]  cc 
 at.math.ethz.ch   
   Subject 
   [R] Query about using table 
 10/26/2006 01:44  
 PM
   
   
   
   




Hi
I have data of the following form
ID  age  member_FLAG
125  Y
236.75   N
375.5N
.
.

I want to get a histogram of this data showing
distribution of member_flag in each age-bin i.e. how
many values in each age bin have a member_flag of 'Y'
and how many have 'N'.
I was able to do the same using barplot2.

However I also need similar information in a tabular
form using percentages.
i.e in each age bin, what is the PERCENTAGE of IDs
with a member_flag of 'Y'

I am trying to work with table for the same, but would
appreciate some guidance regarding the above.

Thanks
Lalitha

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

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


Re: [R] compiling rgdal package on windows / macos

2006-10-04 Thread apjaworski
I just tried the PackagesInstall package(s)..  menu item on my fresh
R-2.4.0-patched and rgdal just shows up on the list of packages to install,
so I am not sure what the problem is.  Alternatively, you can download the
Windows *.zip file from any CRAN repository and install it from your hard
drive.

Hope this helps,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Dylan Beaudette   
 dylan.beaudette@ 
 gmail.com To 
 Sent by:  r-help@stat.math.ethz.ch
 [EMAIL PROTECTED]  cc 
 at.math.ethz.ch   
   Subject 
   [R] compiling rgdal package on  
 10/04/2006 05:46  windows / macos 
 PM
   
   
 Please respond to 
 [EMAIL PROTECTED] 
 mail.com  
   
   




Greetings:

As I am not a windows user, I cannot try this: is it possible to install
rgdal
on windows without having to compile it from source ?

Compilation on MacOS is within my abilities, however each time i try and
install the rgdal package it dies complaining that it cannot find
gdal-config --- which was recently installed with GRASS. I have updated my
PATH environment variable, logged out, but R still cannot find the
gdal-config program.

any tips on getting the rgdal package up and running on MacOS or Windows
would
be greatly appreciated.

Cheers,


--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341

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

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


Re: [R] Anybody ever notice...

2006-06-12 Thread apjaworski
I am guessing you are starting Rcmdr using

 library(Rcmdr).

If this is the case, repeating the library command does nothing, since
Rcmdr package is already attached.  Try

 Commander()

instead.  Make sure you use capital C.

Cheers,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 AKA 
 [EMAIL PROTECTED] 
 com   To 
 Sent by:  r-help@stat.math.ethz.ch  
 [EMAIL PROTECTED]  cc 
 at.math.ethz.ch   
   Subject 
   [R] Anybody ever notice...  
 06/12/2006 05:21  
 PM
   
   
   
   




It could be a little bug or a fault in my setup but I notice that after I
end an Rcmdr session I can't restart it without restarting Rgui (Windows)
Do I need to add something to my environment variables? Is it an issue with
Tcl/Tk or it's settings? Or what?
It is not a big deal but if someone has a fix for this I would give it a
shot I usually start Rcmd from the console library(Rcmdr) that have
anything
to do with it?

__
R-help@stat.math.ethz.ch 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] find position to last number in a vector

2006-05-26 Thread apjaworski
I am sure there are several ways of doing this but how about something like
this:

y - c(NA,NA,10,NA,2,NA,NA,1,NA,NA)
x - c(10,20,30,40,50,60,70,80,85,100)

tail(x[!is.na(y)], 1)

or

rev(x[!is.na(y)])[1]

Rudimentary checks indicate that the second expression is much faster than
the first.  Also, if y is contains NAs only, the first expression returns
numeric(0) and the second one NA.

Hope this helps,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Anders
 Bjørgesæter   
 anders.bjorgesat  To 
 [EMAIL PROTECTED]r-help@stat.math.ethz.ch
 Sent by:   cc 
 [EMAIL PROTECTED] 
 at.math.ethz.ch   Subject 
   [R] find position to last number in 
   a vector
 05/26/2006 01:30  
 PM
   
   
   
   




Hello

Is there a function to extract the position (i.e. row number or more
desirable the value from another column with the same rownumber ) of
last number in a vector? This is done in a loop with 1000s of columns.

e.g.

vector/column.n: na,na,10,na,2,na,na,1,na,na
fixed column:10,20,30,40,50,60,70,80,85,100

result: 8 and/or 80

Thanks...

Best Regards
Anders

__
R-help@stat.math.ethz.ch 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 crashes during 'eigen'

2006-03-28 Thread apjaworski
It looks like there might be a bug in the symmetry detection routine of
eigen.   When I do

eigen(M, symmetric=FALSE)

it works fine.  Eigenvalues (after omitting their imaginary parts, which
are essentially zeros) are the same as the ones obtained with EISPACK to
within a small multiple of machine epsilon.

However, the eigenvector matrices seem different !  This happens on
R-2.2.1-patched and R-2.3.0 (both compiled from daily snapshots).

Andy

PS.  My system is Windows 2000 on a Xeon CPU.  I use precompiled Pentium 4
Rblas DLL from CRAN, but the same thing happens with standard Rblas.

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 C.J.Albers  
 [EMAIL PROTECTED] 
 ac.uk To 
 Sent by:  r-help@stat.math.ethz.ch  
 [EMAIL PROTECTED]  cc 
 at.math.ethz.ch   
   Subject 
   [R] R crashes during 'eigen'
 03/28/2006 10:01  
 AM
   
   
   
   




Hi all,

Hi,

When I want to compute the eigenvalues  eigenvectors of a specific
matrix, R crashes (i.e. it stops responding to any input). I've tried it
with different versions of R (2.1.1, 2.2.0, 2.2.1) - all with crashing
as result.

What I did before the crash was:

M - as.matrix(read.table(thematrix,header=T))
eigen(M)

If, instead of eigen(M), I use eigen(M, EISPACK=T), R doesn't crash. So,
I know a workaround my problem, but still don't understand why R
crashes. Could anyone explain this?
In case someone wants to download my matrix to see where it goes wrong,
it can be downloaded from http://mcs.open.ac.uk/cja235/thematrix
(warning: obviously, R might crash so save your unsaved work first).

thanks,
Casper Albers


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


Re: [R] bivariate normal distribution

2006-02-13 Thread apjaworski
Check out the mvtnorm package.

Cheers,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 He, Yulei   
 [EMAIL PROTECTED] 
 rd.eduTo 
 Sent by:  r-help@stat.math.ethz.ch  
 [EMAIL PROTECTED]  cc 
 at.math.ethz.ch   
   Subject 
   [R] bivariate normal distribution   
 02/13/2006 04:11  
 PM
   
   
   
   




Hi, there.



Does anyone know the R function for calculating the cdf of bivariate
normal distribution function?



Thanks.



Yulei




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


Re: [R] nls() fit to Kahnemann/ Tversky function

2005-10-31 Thread apjaworski
Mark,

The parameter of your model (gamma) should not be a part of the dataframe.
In addition, the start argument should be a named list.

Something like this works

nls.dataframe - data.frame(p.kum,felt.prob.kum)
nls.kurve - nls( formula = felt.prob.kum ~
p.kum^gamma/(p.kum^gamma+(1-p.kum)^gamma)^(1/gamma), data=nls.dataframe,
start=list(gamma=.5), trace=TRUE) # trace shows convergence of the
algorithm.

but the fit is not very good as the fitted gamma is essentially 1.

Hope this helps,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Mark Hempelmann   
 [EMAIL PROTECTED] 
 e To 
 Sent by:  r-help@stat.math.ethz.ch
 [EMAIL PROTECTED]  cc 
 at.math.ethz.ch   
   Subject 
   [R] nls() fit to Kahnemann/ Tversky 
 10/31/2005 04:14  function
 PM
   
   
   
   
   




Dear WizaRds,

 I would like to fit a curve to ten points with nls() for one
unknown parameter gamma in the Kahnemann/ Tversky function, but somehow
it won't work and I am unable to locate my mistake.

p.kum - seq(0.1,1, by=0.1)
felt.prob.kum - c(0.16, 0.23, 0.36, 0.49, 0.61, 0.71, 0.85, 0.89, 0.95,
1) ## how to find a function that fits these points nicely?
plot(p.kum, felt.prob.kum) ## looks a little like an S

gamma - rep(0.5, 10)
nls.dataframe - data.frame(p.kum,felt.prob.kum, gamma)

nls.kurve - nls( formula = felt.prob.kum ~
p.kum^gamma/(p.kum^gamma+(1-p.kum)^gamma)^(1/gamma), data=nls.dataframe,
start=c(gamma=gamma), algorithm=plinear )

summary(nls.kurve)

gives: Error in La.chol2inv(x, size) : 'size' cannot exceed nrow(x) = 10

 If I go with the Gauss-Newton algorithm I get an singular gradient
matrix error, so I tried the Golub-Pereyra algorithm for partially
linear least-squares.

 It also seems the nls model tries to find ten different gammas, but
I want only one single gamma parameter for the function. I appreciate
your help and support. Thank you.

sol lucet omnibus
Mark Hempelmann

__
R-help@stat.math.ethz.ch 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] does column exist?

2005-05-19 Thread apjaworski





There may be a simpler way, but this

is.na(match(X, names(df)))

should return TRUE if the column name exists and FALSE otherwise.

Cheers,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Omar Lakkis   
 [EMAIL PROTECTED] 
 m To 
 Sent by:  r-help@stat.math.ethz.ch
 [EMAIL PROTECTED]  cc 
 at.math.ethz.ch   
   Subject 
   [R] does column exist?  
 05/19/2005 12:42  
 PM
   
   
 Please respond to 
Omar Lakkis
 [EMAIL PROTECTED] 
m 
   
   




How do I test if a data.frame has a column named X?
exists(o) checks if the object exists or not, I want to test if a
data.frame object (df) has a column names(X), something like:
exists(df$X)

__
R-help@stat.math.ethz.ch 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] slowness of plot(x, type='l')

2005-05-09 Thread apjaworski





Thanks for the quick response and apologies for my sloppy post (nor
mentioning the device) and sloppy example (the use of date()).

Indeed, I was using the windows device.  There is no timing problem with
the postscript device.

I just installed the R-devel May-9 and the problem went away.  Here is an
example:

 n - 15000
 system.time(plot(rnorm(n), type='l'))
[1] 0.07 0.41 0.48   NA   NA

An interesting footnote is the fact that the slowdown of the windows device
did not happen for plot(*, type='c').  The 'c' option plots line segments
without points, so it probably used the bunches of lines anyway.

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Prof Brian Ripley 
 [EMAIL PROTECTED] 
 ac.uk To 
 Sent by:  [EMAIL PROTECTED]  
 [EMAIL PROTECTED]  cc 
 at.math.ethz.ch   r-help@stat.math.ethz.ch
   Subject 
   Re: [R] slowness of plot(x, 
 05/07/2005 12:36  type='l')   
 AM
   
   
   
   
   




Plotting times depend on the graphics device.  That is nowhere mentioned
here, which is unhelpful, and we have already seen a post saying it does
not happen on another unmentioned device (presumably X11).

Let us assume the unmentioned device was windows(), as that is the only
one I see any slowdown for.  (Others like win.metafile are windows() under
the skin.)

On Fri, 6 May 2005 [EMAIL PROTECTED] wrote:

 A couple of days ago a few messages indicated that something changed in
the
 basic plot routine that made plot(*, type='l') slow for large data sets.
 Some people even reported crashes for very large data sets.  As far as I
 remember, this was not reported as a formal bug.

Well, _is_ there a bug in R (as distinct from in Windows graphics
internals)?  I am almost certain there is not in R and this is a bug in
Windows.

 I am still not sure if this is a bug, so I report my findings here.
First
 of all, I think I see a slowdown of the plot function, although I do not
 have older versions of R installed, so I cannot do side-by-side
 comparisons.  Secondly, I noticed that the behavior of plot(*, type='l')
 differs.  Before R-2.1, the plotted lines would appear on the plot
 gradually.  Now, after the wait, the whole plot appears at once.

 Here are my timing results.  I am on Windows2000, IBM Intellistation with
 Xenon 2.8MHz with 1Gb of memory.  I checked May-06 versions of R-patched
 and R-devel built from sources.  I ran the following simple test:

 x - rnorm(n)
 date(); plot(x, type='l'); date()

Oh, PLEASE, use system.time() to time things.  Had you done so you might
have seen things like

 windows()
 n - 1
 system.time(plot(rnorm(n), type=l))
[1]  0.03 13.11 13.21NANA
 postscript()
 system.time(plot(rnorm(n), type=l))
[1] 0.07 0.00 0.08   NA   NA
 dev.off()
 system.time(plot(rnorm(n), type=p))
[1] 0.07 0.93 1.00   NA   NA

so the time is not being taken by R but by Windows.

I can tell you the reason: it is the support for mitred etc line ends
introduced in R 2.0.0 and only supported in windows() from 2.1.0.  This
has slowed solid lines down to the sort of times taken for dashed lines
previously.

Now, the best we can do to work around this is to follow what we did for
dashed lines, and not attempt to be accurate for very large numbers of
line segments.  By plotting in bunches of 1000 lines I get

 system.time(plot(rnorm(n), type=l))
[1] 0.03 0.36 0.42   NA   NA
 system.time(plot(rnorm(n), type=l, lty=3))
[1] 0.22 2.89 3.11   NA   NA

We have been here before, and as I recall this slowdown happens only in
NT-based versions of Windows which seem _de facto_ restricted to about
1000 line elements in a path: what we were not aware of was that it
happened for solid lines as well as dashed ones.

I've put the bunching into R-patched.

It is very regretable that this sort of thing was not tested for during
beta-testing.

--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  

[R] slowness of plot(x, type='l')

2005-05-06 Thread apjaworski




A couple of days ago a few messages indicated that something changed in the
basic plot routine that made plot(*, type='l') slow for large data sets.
Some people even reported crashes for very large data sets.  As far as I
remember, this was not reported as a formal bug.

I am still not sure if this is a bug, so I report my findings here.  First
of all, I think I see a slowdown of the plot function, although I do not
have older versions of R installed, so I cannot do side-by-side
comparisons.  Secondly, I noticed that the behavior of plot(*, type='l')
differs.  Before R-2.1, the plotted lines would appear on the plot
gradually.  Now, after the wait, the whole plot appears at once.

Here are my timing results.  I am on Windows2000, IBM Intellistation with
Xenon 2.8MHz with 1Gb of memory.  I checked May-06 versions of R-patched
and R-devel built from sources.  I ran the following simple test:

x - rnorm(n)
date(); plot(x, type='l'); date()

Here are the timings:

  n seconds
  5000  1
  6000  2
  7000  4
  8000  6
  9000  9
  1 13
  12000 22
  14000 36
  2 91

It looks like only type='l' and type='o' exhibit this behavior.  All other
types produce plots in approximately 1 second.  Also, the (long) wait and
plot at once behavior happens with the two types mentioned.  All others
(except 'n' of course) produce gradually appearing plots.

Hope this helps,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122

__
R-help@stat.math.ethz.ch 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] Unbundling gregmisc (was: loading gap package)

2005-05-04 Thread apjaworski





I have one comment, although it is a little off topic.

I have the gregmisc package installed (R-2.0.1 on Win2000).  Whenever I use
the help.search function it comes back with the following warning:

Warning message:
no Rd contents for package 'gregmisc' in 'C:/local/R/rw210/library' in:
help.search(bundle)

Apparently, the help.search function looks for the CONTENTS file in the
.../library/gregmisc directory.  I created an empty one and the warning
went away.  I know it is purely cosmetic, but if the gregmisc bundle is
kept intact, and I think it should, I would suggest adding the empty
CONTENTS file to its distribution.

Perhaps there is a better way of handling this.  For example, VR is a
bundle but it does not create its VR directory in .../library.

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Warnes, Gregory  
 R
 gregory.r.warnes  To 
 @pfizer.com  'Constantinos Antoniou'   
 Sent by:  [EMAIL PROTECTED], Prof Brian Ripley 
 [EMAIL PROTECTED] [EMAIL PROTECTED] 
 at.math.ethz.chcc 
   R-help@stat.math.ethz.ch, Uwe   
   Ligges  
 05/04/2005 09:56  [EMAIL PROTECTED]  
 AMSubject 
   [R] Unbundling gregmisc (was:   
   loading gap package)
   
   
   
   
   
   




Let me redirect the topic a bit.  I've been considering unbundling
gregmisc.
The pro would be that people would find the component packages (i.e. gdata)
more easily.  The con is that the packages have a number of
interdependencies, so you pretty much will need to get most of them anyway.

As the latest gregmisc bundle contains a gregmisc package that is just a
stub that depends on and loads the individual packages, there would still
be
a gregmisc object.

Comments?

-Greg

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Constantinos
 Antoniou
 Sent: Wednesday, May 04, 2005 6:36 AM
 To: Prof Brian Ripley
 Cc: R-help@stat.math.ethz.ch; Uwe Ligges
 Subject: Re: [R] loading gap package


 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 =-=-=-=-=
 !!! IMPORTANT NOTICE !!!
 This email was addressed to you from the Internet using a
 legacy E-Mail Domain address.


 This email domain will no longer be in service on the
 Internet after 15 July 2005.

 If this is legitimate business email, please inform the
 sender to address all future correspondence to your
 @pfizer.com address.

 The original text of this email appears below this notice.
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 =-=-=-=-=


 On 4  2005, at 12:06 , Prof Brian Ripley wrote:

  On Wed, 4 May 2005, Constantinos Antoniou wrote:
 
 
  On 4  2005, at 11:35 , Uwe Ligges wrote:
 
  Eduwin Pakpahan wrote:
  Dear R users, I did install R. 2.0.1, and try to load gap

  package. However, below is the message shown when I did load it.

  Can anybody
  please let me know my mistakes?
  
  library()
  library(gap)
  Loading required package: MASS Loading required package: genetics

  Loading required package: combinat Loading required
 package: gdata

  Error: package 'gdata' could not be loaded
  In addition: Warning message: There is no package called 'gdata'

  in: library(pkg, character.only =
  TRUE, logical = TRUE, lib.loc = lib.loc)
  
  Let me read the error message for you:
  There is no package 'gdata' simply means the package is not

  there...
  So what about installing it?
  Hint: it is part of the package bundle gregmisc.
 
  I have a similar problem with R 2.1.0 on Mac OSX 10.3.9.
 
  library(gregmisc)
  Loading required package: gdata
  Error: package 'gdata' could not be loaded
  In addition: Warning message:
  there is no package called 'gdata' in: library(pkg,
 character.only =

  TRUE, logical = TRUE, lib.loc = lib.loc)
 
  At first I tried 

Re: [R] multivariate Shapiro Wilks test

2005-05-03 Thread apjaworski





Anna,

It looks like the mshapiro.test wants its data in the row format, that is,
for a k-variate sample of size n you need the data in a k-by-n matrix.

Try

a - t(mvrnorm(1000, c(1,2,3,4,5), diag(5)))
mshapiro.test(a)

and it should work fine.

Cheers,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Anna Oganyan  
 [EMAIL PROTECTED] 
 g To 
 Sent by:  r-help@stat.math.ethz.ch
 [EMAIL PROTECTED]  cc 
 at.math.ethz.ch   
   Subject 
   [R] multivariate Shapiro Wilks test 
 05/03/2005 04:29  
 AM
   
   
   
   




Hello,
I have a question about multivariate Shapiro-Wilks test.
I tried to analyze if the data I have are multivariate normal, or how
far they are from being
multivariate normal. However, any time I did
 mshapiro.test(mydata)
I get the message:
Error in solve.default(R %*% t(R), tol = 1e-18) :
system is computationally singular: reciprocal condition number
= 5.38814e-021

I tried also to generate some multivariate normal data and to see how
the test would be working on it. So I did:
a - mvrnorm(1000, c(1,2,3,4,5), diag(5))
mshapiro.test(a)

But any time I get:
Error in solve.default(R %*% t(R), tol = 1e-18) :
system is computationally singular: reciprocal condition number
= small number


Could somebody help me what is wrong with this example?
Thank you very much in advance!
Anna

__
R-help@stat.math.ethz.ch 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] half-normal residual plots

2005-04-07 Thread apjaworski





There is a halfnorm function in the faraway package.

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 MJ Price, Social 
 Medicine 
 [EMAIL PROTECTED]  To 
 istol.ac.uk  r-help@stat.math.ethz.ch
 Sent by:   cc 
 [EMAIL PROTECTED] 
 at.math.ethz.ch   Subject 
   [R] half-normal residual plots  
   
 04/07/2005 08:43  
 AM
   
   
   




Hi all,

I am trying to produce a half-normal plot of residuals from a GLM. I have
found the qqnorm function for producing a normal plot but can't figure out
how to produce a half-normal. Can anyone help with this?

Thanks

Malcolm

--
MJ Price, Social Medicine
[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] looking for a plot function

2005-04-06 Thread apjaworski





I am not sure about the scaling, but doing simply

matplot(xa, t(dfr), type=b)

does most of what you want.

Andy


__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Doran, Harold   
 [EMAIL PROTECTED]  
 Sent by:   To 
 [EMAIL PROTECTED] bogdan romocea
 at.math.ethz.ch   [EMAIL PROTECTED],
   r-help@stat.math.ethz.ch  
cc 
 04/06/2005 03:24  
 PMSubject 
   RE: [R] looking for a plot function 
   
   
   
   
   
   




If your data were in the long format you could use interaction.plot.
But, I think trellis plots in lattice are much better than this
approach.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of bogdan romocea
Sent: Wednesday, April 06, 2005 4:19 PM
To: r-help@stat.math.ethz.ch
Subject: [R] looking for a plot function

Dear useRs,

I have a data frame and I want to plot all rows. Each row is represented
as a line that links the values in each column. The plot looks like
this:

dfr - data.frame(A=sample(1:50,10),B=sample(1:50,10),
 C=sample(1:50,10),D=sample(1:50,10))
xa - 10*1:4
plot(c(10,40),c(0,50))
for (i in 1:nrow(dfr)) {
 lines(xa,dfr[i,],pch=20,type=o)
 }

Things get more complicated because I want the columns to be rescaled so
as to fit nicely on a graph (for example if A has values between 0 and
100 but B has values between 100 and 1000, then rescale A or B), labels
etc. Is there a function that can do plots like this?

Thank you,
b.

__
R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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] plotmath question

2005-03-18 Thread apjaworski





Bert,

This works fine and and seems a little simpler:

x-seq(-3,to=3,by=.01)
y-dnorm(x)
plot(x,y,type='h',col='lightblue',axes=FALSE)
lines(x,y,col='darkblue')
axis(2)

ll - expression(mu-3*sigma, mu-2*sigma, mu-sigma, mu, mu+sigma,
mu+2*sigma, mu+3*sigma)
axis(1, at=-3:3, lab=ll)

box()

Cheers,

Andy


__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Berton Gunter 
 [EMAIL PROTECTED] 
 ne.comTo 
 Sent by:  'R-help'  
 [EMAIL PROTECTED] r-help@stat.math.ethz.ch  
 at.math.ethz.chcc 
   
   Subject 
 03/18/2005 03:41  [R] plotmath question   
 PM
   
   
   
   
   




R listers:

I have been foiled by plotmath!

(in R 2.01,Windows 2000)

The task: Plot a normal density and label the ticks as mu - 3 sigma, mu - 2
sigma, , mu + 3 sigma, where the mu's and sigmas appear as Greek
symbols, of course.

The following code does this:

x-seq(-3,to=3,by=.01)
y-dnorm(x)
plot(x,y,type='h',col='lightblue',axes=FALSE)
lines(x,y,col='darkblue')
axis(2)
for(i in seq(-3,to=3))
 axis(1,at=i, lab=switch(sign(i)+2,

eval(substitute(expression(mu-j*sigma),list(j=-i))),
 expression(mu),

eval(substitute(expression(mu+j*sigma),list(j=i)
box()

However, I think the code in the for loop is ugly and probably means that
I'm doing it wrong. In particular:

1) Is there a neat way to use one axis() call and a vector (of
expressions?)
for the lab=argument?

2) The plotmath Help state that expressions can be used for axis labels, so
I would have expected the above to work without the eval()call  -- but it
does not. Would someone kindly explain to me why not -- i.e., what I have
misunderstood. That is, to be clear, why does the following not work:

for(i in seq(-3,to=3))
 axis(1,at=i, lab=switch(sign(i)+2,

substitute(expression(mu-j*sigma),list(j=i)),
 expression(mu),

substitute(expression(mu+j*sigma),list(j=i

Any further ideas,insights, or pointers to reference materials would also
be
appreciated. Many thanks.


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


[R] A question about r-help-bounce

2005-01-11 Thread apjaworski





Could somebody please tell me what does the r-help-bounce address do?

When I try to respond to an r-help post, my mailer (Lotus Notes) generates
the r-help bounce return address automatically in addition to the original
sender address and the r-help address.  I responded to an r-help message
last night and I never saw my response posted.  Could this be due to the
r-help-bounce being there?

Thanks in advance,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122

__
R-help@stat.math.ethz.ch 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] Graphical table in R

2005-01-10 Thread apjaworski





The outer two lines could also be done more easily (?) by:

library(gplots)  #part of gregmisc bundle
textplot(txt)

Check ?textplot for additional options.

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Thomas Lumley 
 [EMAIL PROTECTED] 
 gton.edu  To 
 Sent by:  Peter Dalgaard  
 [EMAIL PROTECTED] [EMAIL PROTECTED]  
 at.math.ethz.chcc 
   [EMAIL PROTECTED], R list  
   r-help@stat.math.ethz.ch  
 01/10/2005 03:28  Subject 
 PMRe: [R] Graphical table in R
   
   
   
   
   
   




On Mon, 10 Jan 2005, Peter Dalgaard wrote:

 A screen shot of a ps file? That sounds ... weird. If you can view it,
 presumably you have Ghostscript and that can do png files.

 However, will textual output do?

  plot(0,type=n,axes=FALSE, xlab=, ylab=)
  con - textConnection(txt,w)
  sink(con); ftable(UCBAdmissions); sink()
  close(con)
  par(family=mono)
  text(1,0,paste(txt,collapse=\n))


and the middle three lines could also be done with

txt-capture.output(ftable(UCBAdmissions))


 -thomas

__
R-help@stat.math.ethz.ch 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] Make a table

2004-12-22 Thread apjaworski





Muhammad,

Try

tapply(prevRND.dat$Z, list(X=prevRND.dat$X, Y=prevRND.dat$Y), mean)

Cheers,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Muhammad Subianto 
 [EMAIL PROTECTED] 
 l To 
 Sent by:  [EMAIL PROTECTED]
 [EMAIL PROTECTED]  cc 
 at.math.ethz.ch   
   Subject 
   [R] Make a table
 12/22/2004 07:26  
 AM
   
   
   
   




Dear useR,

I have a dataset like this below,
  prevRND.dat   - read.table(C:\\workdir\\prevRND.txt,
+   header=FALSE,  # No header.
+   col.names = c(X,Y,Z),
+   sep = ,)
  prevRND.dat
   X YZ
1 A A 0.950933
2 A B 0.143600
3 A C 0.956133
4 B A 0.000533
5 B B 0.986467
6 B C 0.032066
7 C A 0.005333
8 C B 0.00
9 C C 0.009266

How can I make that data above as table,

 Y
XA  B C
A  0.950933 0.143600 0.956133
B  0.000533 0.986467 0.032066
C  0.005333 0.00 0.009266

I cannot use table() or ftable() functions because the 3rd column (Z) is
probability. Are there any function to make a table as I want?

Kind regards,
Muhammad Subianto

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

__
[EMAIL PROTECTED] 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] switching to Linux, suggestions?

2004-12-13 Thread apjaworski





The newest production release of Fedora is Core 3.  I would use this one
if I were you.

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Thomas Schönhoff  
 [EMAIL PROTECTED] 
 nfo.org   To 
 Sent by:  R User-Liste
 [EMAIL PROTECTED] [EMAIL PROTECTED]  
 at.math.ethz.chcc 
   
   Subject 
 12/13/2004 10:22  Re: [R] switching to Linux, 
 AMsuggestions?
   
   
   
   
   
   




Hello,

Thomas W Volscho schrieb:
 Dear List,
 I have acquired a new desktop and wanted to put a free OS on it.  I am
trying Fedora Core 1, but not sure what the best Linux OS is for using R
2.0.1?

R is developed on Linux, so there shouldn't be too much restrictions
on whatever distri you're going to use!
If running a new shiny Desktop you might consider other aspects than
using R, which should run with every Linux distribution.
If you're looking for something comfortable to install and maintain
you might give Quatian a try
(http://dirk.eddelbuettel.com/quantian.html). This is a somewhat
modified Knoppix trimmed to statistical analysis (not entirely, though)


regards

Thomas

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

__
[EMAIL PROTECTED] 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] Non-Linear Regression on a Matrix

2004-11-16 Thread apjaworski





If your non-linear function (A, B) is parametric nls should do it for
you.  If you have R version 2 (perhaps even 1.9) do ?nls to see the help
page.  Older versions of R require library(nls) first.

Hope this helps,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Diana Abdueva 
 [EMAIL PROTECTED] 
 ail.com   To 
 Sent by:  [EMAIL PROTECTED]
 [EMAIL PROTECTED]  cc 
 at.math.ethz.ch   
   Subject 
   [R] Non-Linear Regression on a  
 11/16/2004 08:33  Matrix  
 PM
   
   
 Please respond to 
   Diana Abdueva   
 [EMAIL PROTECTED] 
 ail.com  
   
   




Hi, I'm terribly sorry for submitting my primitive question, I'm a
beginner in R and was hoping to get some help re: non-linear fit.

I have a 2D data with the following structure:

A BC
1  1  111
1  2  121
1  3  131
2  1  141
2  2  151
2  3  161
3  1  171
3  2  181
3  3  191

I'm trying to fit C = non-linear function (A,B). I was wondering if
there's a package that would save my time of doing direct least square
estimation.

Thank you,
Diana

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

__
[EMAIL PROTECTED] 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] xyplot and for loops

2004-05-04 Thread apjaworski





Dave,

I think inside the loop you have to explicitly print a trellis object,
i.e.  say

print(yplot(tmp.df$y.tmp ~ tmp.df[,i]))

If you read the help page for xyplot, look under Value.

Hope this helps,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Dave Atkins   
 [EMAIL PROTECTED] 
 gton.edu  To 
 Sent by:  [EMAIL PROTECTED]
 [EMAIL PROTECTED]  cc 
 at.math.ethz.ch   
   Subject 
   [R] xyplot and for loops
 05/04/2004 05:40  
 PM
   
   
   
   





I'm attempting to use xyplot() within a for() loop to plot the relationship

between a DV and a series of predictor variables, split by 2 conditioning
variables.  However, xyplot() does not seem to be recognized within the
for()
loop; I don't receive any error message, but nothing is plotted and a
plotting
device is not opened.  When I use the generic function plot(), everything
works
as expected.  I'm using R v1.9.0 and lattice v0.9-11.

Here's a trivial example:

### create single outcome and two predictors
  y.tmp - rnorm(20) ; x1.tmp - rnorm(20) ; x2.tmp - rnorm(20)
### combine into data.frame
  tmp.df - data.frame(y.tmp, x1.tmp, x2.tmp)
  tmp.df
 y.tmp   x1.tmp  x2.tmp
1   1.5022759 -0.150326662 -1.36627981
[snip]
20  1.2667825 -0.070356651 -0.38433160

### simple loop calling the columns of tmp.df to specify x variables
  for (i in 2:3){
+ plot(tmp.df$y.tmp ~ tmp.df[,i])
+ }
### works fine for plot()

### try the same with xyplot()
  for (i in 2:3){
+ xyplot(tmp.df$y.tmp ~ tmp.df[,i])
+ }
### nothing happens; no error msg; no plotting device opened

  xyplot(tmp.df$y.tmp ~ tmp.df[,2])
### without loop works fine and plots relationship of x1.tmp and y.tmp

Can someone see what I'm missing?  Any directions/pointers appreciated.

cheers, Dave
[EMAIL PROTECTED]

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

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


Re: [R] Matrix question

2004-04-13 Thread apjaworski





Gideon,

Eigenvectors are normalized to unit length.  The first eigenvector
calculated by R is equal (ignoring the signs of course) to your stable
distribution vector divided by its length.

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


|-+
| |   GIDEON WASSERBERG|
| |   [EMAIL PROTECTED]|
| |   Sent by: |
| |   [EMAIL PROTECTED]|
| |   ath.ethz.ch  |
| ||
| ||
| |   04/13/2004 18:28 |
|-+
  
-|
  |
 |
  |  To:   [EMAIL PROTECTED] [EMAIL PROTECTED] 
 |
  |  cc:   
 |
  |  Subject:  [R] Matrix question 
 |
  
-|




Dear Friends

I am doing a simple matrix analysis to calculate the eigenvalue,
eigenvector using R for the below matrix, and comparing the result to those
obtained from a projection (using excel)

THE MATRIX:
 c
 [,1] [,2] [,3]
[1,]  0.0  2.02
[2,]  0.8  0.00
[3,]  0.0  0.80


The dominant eigenvalue comes out comparable to that calculated
numerically, but the eigenvectors do not( see below)!


EIGENVALUES (calculated by R):

 eigen(c)
$values
[1]  1.5564082+0.00i -0.7782041+0.465623i -0.7782041-0.465623i

EIGENVALUE numerically calculated: 1.556408145


EIGENVECTORS (calculated by R):
$vectors
  [,1]  [,2]  [,3]
[1,] -0.8658084+0i  0.6476861+0.000i  0.6476861+0.000i
[2,] -0.4450290+0i -0.4902997-0.2933611i -0.4902997+0.2933611i
[3,] -0.2287467+0i  0.2382837+0.4441499i  0.2382837-0.4441499i

Stable age distribution (calculated numerically):

0.562365145
0.289057934
0.148576921


My questions are:
1. Both eigenvalue and eigenvectors are associated with some imaginary
value (i). How should I relate to that information? 2. More importantly, a.
I presume the 1st eigenvector collumn [,1] should correspond to the
dominant eigenvalue. How come then that it comes out different from the one
calculated numerically? Is there some conversion I should do?

Many thanks

Gideon


Gideon Wasserberg (Ph.D.)
Wildlife research unit,
Department of wildlife ecology,
University of Wisconsin
218 Russell labs, 1630 Linden dr.,
Madison, Wisconsin 53706, USA.
Tel.:608 265 2130, Fax: 608 262 6099

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

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


[R] Xeon CPU and ATLAS

2004-03-12 Thread apjaworski




I am about to get a new machine at work - an IBM Intellistation with the
Xeon 2.8 GB processor.  It will run Windows 2000.  I would like to install
the proper ATLAS dll for this machine, but I am not sure if Xeon is P4?
Does anybody have any experience with Xeon?

Thanks in advance,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122

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


Re: [R] Xeon CPU and ATLAS

2004-03-12 Thread apjaworski





First of all thanks to Peter Dalgaard, Thomas Lumley and Prof Brian Ripley
for quick responses.

Indeed, I will be running Windows2000 on this machine (my company's
standard).  I will also install the full version of cygwin on it.

When I asked my original question I thought about just copying the P4 dll
from the ATLAS directory on CRAN.  As I understand from the three answers I
got, this should work, but perhaps not be the fastest BLAS possible.  When
I get the machine (beginning of April) I will try to configure and compile
ATLAS and Goto and compare the results.

Thanks again,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


|-+-
| |   Prof Brian Ripley |
| |   [EMAIL PROTECTED]|
| |   c.uk |
| | |
| |   03/12/2004 16:16  |
| | |
|-+-
  
-|
  |
 |
  |  To:   Peter Dalgaard [EMAIL PROTECTED]  
  |
  |  cc:   [EMAIL PROTECTED]   
|
  |[EMAIL PROTECTED] 
  |
  |  Subject:  Re: [R] Xeon CPU and ATLAS  
 |
  
-|




AFAIK all P4s are SSE2.

He wants a Windows ATLAS build, and that is not hard, but you have to do
that under Cygwin not MinGW.

We have a Xeon, but have found Athlons and now Opterons better value.
I don't have access to Windows Xeon machine: anyone who does could
contribute a Xeon version of Rblas.dll (to Uwe Ligges, please).

Note that for 1.9.0 you can use Goto's BLAS and he as a P4 version that
is faster than ATLAS (under Windows).  So I would start with that.

Although Thomas Lumley is right about cache sizes, using a P4 512kb ATLAS
or Goto BLAS is pretty good on a Xeon (only tested by me under Linux).
Using a BLAS for too large a cache is disastrous, but underestimating by a
factor of 2 is not bad at all. (I think most Xeons are 1Mb cache, with
Xeon MP being 4Mb.)

On 12 Mar 2004, Peter Dalgaard wrote:

 [EMAIL PROTECTED] writes:

  I am about to get a new machine at work - an IBM Intellistation with
the
  Xeon 2.8 GB processor.  It will run Windows 2000.  I would like to
install
  the proper ATLAS dll for this machine, but I am not sure if Xeon is P4?
  Does anybody have any experience with Xeon?

 Yes, we have a dual 2.8 Xeon running Linux. Very nice machine. We've
 had it for a bit more than a year and it's been of very good use. I
 can see that I did two ATLAS builds in feb 2003, one is called
 Linux_P4SSE2_2 and the other is Linux_Xeon_2. AFAIR (but it's been a
 while), the former is the preconfigured thing that came out of a
 quick-install and the other one is fully tuned version, and there was
 no difference worth speaking of between the two.

 I think the difference between P4 and Xeon is the SSE1 vs SSE2 thing,
 so you'd want the P4SSE2 DLL, but others may be able to speak more
 authoritatively.



--
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
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] numerical equation

2004-03-10 Thread apjaworski





Check out the uniroot function.  It will solve a single equation.

There is also a packge RMinpack.  It implements the original Fortran
Minpack library and will solve systems of nonlinear equations.  It is only
available in source form (search Google for it).

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


|-+
| |   Abdou Ali|
| |   [EMAIL PROTECTED]|
| |   Sent by: |
| |   [EMAIL PROTECTED]|
| |   ath.ethz.ch  |
| ||
| ||
| |   03/10/2004 10:11 |
| |   Please respond to|
| |   Abdou.Ali|
| ||
|-+
  
-|
  |
 |
  |  To:   [EMAIL PROTECTED]   
  |
  |  cc:   
 |
  |  Subject:  [R] numerical equation  
 |
  
-|




Hello,
Is there R command to solve a nonlinear numerical equation.
Thank you.

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

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


RE: [R] Statistical Quality Control

2004-03-08 Thread apjaworski





A new package named qcc just appeared on CRAN.  It has standard QC charts,
OC curves and process capability stuff.  It even has a Minitab-like process
capability sixpack.  It looks like it is pretty nicely done.

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


|-+
| |   Nick Drew  |
| |   [EMAIL PROTECTED]  |
| |   Sent by: |
| |   [EMAIL PROTECTED]|
| |   ath.ethz.ch  |
| ||
| ||
| |   03/05/2004 19:00 |
| |   Please respond to|
| |   ndrew|
| ||
|-+
  
-|
  |
 |
  |  To:   Holton, Blake [EMAIL PROTECTED] 
|
  |R-Help (E-mail) [EMAIL PROTECTED]   
  |
  |  cc:   
 |
  |  Subject:  RE: [R] Statistical Quality Control 
 |
  
-|




Just the other day I found this site, obtained the package, and tried some
of the examples.


http://www.cmis.csiro.au/S-PLUS/qtoolbox/index.html

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Holton, Blake
Sent: Tuesday, February 24, 2004 11:23 AM
To: R-Help (E-mail)
Subject: [R] Statistical Quality Control


Greetings,

I've been familiarizing myself with the features of R over the past few
days. I'm impressed with the quality and quantity of the features and
packages. One feature that I would be interested in would be a package for
statistical quality control. Does a package for statistical quality control
exist that I've been unable to locate?

If not, is anyone aware of efforts to develop a statistical quality control
package? It has been awhile since I've coded in C, but I would be willing
to
contribute.

Regards,

Blake


Blake Holton
Technical Service Representative
Dynea
475 28th Street
Springfield, OR 97477-5100

Desk: 541.744.7238
Toll Free: 800.547.9525
FAX: 541.744.7249
Cell: 541.954.2696

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

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

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


[R] test

2004-03-08 Thread apjaworski




I am trying to test whether I can post to the list.  I responded to a
couple of messages recently and I have not seen my response posted.

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122

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


Re: [R] Location of polr function

2004-03-03 Thread apjaworski

Peter,

These things can be a little mysterious at the beginning.  Lots of things
in R are arranged in groups called packages (or libraries).  Some basic
ones come preinstalled with R, some you have to install yourself.  If you
type

  library()

at your R prompt you should get a list of all packages installed on your
system.

In order to use the functionality of a package you have to load it by
specifying its name as an argument to the library call.  For example,

  library(nlme)

will load the package named nlme  (if it is installed on your system) and
give you the functionality of the nlme package, i.e. access to its
functions..  Typing

  search()

will show you what packages are already loaded on your system.

Search.help will allow you to find in which package your function resides
in.  Typing

  search.help(polr)

on my system returns

  polr(MASS)  Proportional Odds Logistic Regression

meaning that the polr function belongs to the package MASS which is
installed on your system.  The only thing remaining to do is typing

  library(MASS)

Of course, if MASS is not installed on your system you will get nothing in
response (actually you will get a message saying that nothing appropriate
was found).  Then, you would need to go to a CRAN site and use their search
engine to find things about polr function.

Hope this helps,

Andy


__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


|-+---
| |   Peter Flom [EMAIL PROTECTED]|
| |   Sent by:|
| |   [EMAIL PROTECTED]|
| |   ath.ethz.ch |
| |   |
| |   |
| |   03/03/2004 14:42|
| |   |
|-+---
  
-|
  |
 |
  |  To:   [EMAIL PROTECTED] 
  |
  |  cc:   
 |
  |  Subject:  [R] Location of polr function   
 |
  
-|




Hello

I am running R 1.8.1 on a  Windows platform

I am attempting to fit an ordinal logistic regression model, using the
polr function, as described in Venables and Ripley.  But when I try

model4 - polr(ypsxcat~committed + as.factor(sex)
 + as.factor(drugusey) + anycsw + as.factor(sex)*committed
  + as.factor(sex)*as.factor(drugusey)+as.factor(sex)*anycsw, data =
duhray)

I get a message that the polr function was not found.

Any help appreciated

thanks

Peter

Peter L. Flom, PhD
Assistant Director, Statistics and Data Analysis Core
Center for Drug Use and HIV Research
National Development and Research Institutes
71 W. 23rd St
www.peterflom.com
New York, NY 10010
(212) 845-4485 (voice)
(917) 438-0894 (fax)

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

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


[R] bug in as.POSIXct ?

2003-12-04 Thread apjaworski
I think that there is a bug in the as.POSIXct function on Windows.

 Here is what I get on Win2000, Pentium III machine in R 1.8.1.

 dd1 - ISOdatetime(2003, 10, 26, 0, 59, 59)
 dd2 - ISOdatetime(2003, 10, 26, 1, 0, 0)
 dd2 - dd1
Time difference of 1.000278 hours

Now, the 26th of October was the day that change to the standard time
occurred, so I suspect that this has something to do with that.  In fact

 dd1
[1] 2003-10-26 00:59:59 Central Daylight Time
 dd2
[1] 2003-10-26 01:00:00 Central Standard Time

so it looks like the switch from CDT to CST happens at 1:00 (instead of
2:00 ?).

Since the only thing the difftime function does is unclass the as.POSIXct
values of its two arguments, the error seems to be in the as.POSIXct code.
I looked at the C code of the as.POSIXct function but I do not know enough
about R code and C handling of the time structures to find an error there.
Perhaps, the error is actually in the C library handling of time structures
on Windows machines.


All this seems to work fine  in version 1.8.1 patched 11-24 on a Linux
machine, i.e. the above difference is 1second.  However, the swicth between
CDT and CSD also accurs at 1:00.


Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122

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


Re: [R] Parameter estimation in nls

2003-11-25 Thread apjaworski

Your starting values for the parameters are no even in the general
ballpark.  Here is what I got for the final fit:

Parameters:
Estimate Std. Error t value Pr(|t|)
a  3.806e+07  1.732e+06  21.971   2e-16 ***
k -3.391e-02  6.903e-02  -0.4910.628
b  9.000e-01  1.240e-02  72.612   2e-16 ***

As you can see only b has the same order of magnitude as your starting b
and a is different by 7 orders!

In general, an nls procedure needs starting values that are close.  The
same is true for any general nonlinear optimization algorithm.  Only in
special circumstances a nonlinear algorithm will converge from any starting
point - one I know of is the convexity of the objective function.

I do not think there is any nls program that will find starting values
automatically for an arbitrary nonlinear model.  It is possible for
specific models, but is very much model dependent.  Your model, for
example, can be easily linearized by taking logs of both sides, i.e.

mm - lm(log(y) ~ x + I(log(x)))

Then doing

aa - exp(coef(mm)[1])
bb - exp(coef(mm)[2])
kk - coef(mm)[3]
mm1 - nls(y ~ a * x^k * b^x, start=list(a=aa,k=kk,b=bb))

results in convergence with no problems in 7 iterations.

Hope this helps,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


|-+
| |   Dr Andrew Wilson |
| |   [EMAIL PROTECTED]|
| |   .uk |
| |   Sent by: |
| |   [EMAIL PROTECTED]|
| |   ath.ethz.ch  |
| ||
| ||
| |   11/25/2003 03:09 |
| ||
|-+
  
-|
  |
 |
  |  To:   [EMAIL PROTECTED]   
  |
  |  cc:   
 |
  |  Subject:  [R] Parameter estimation in nls 
 |
  
-|




I am trying to fit a rank-frequency distribution with 3 unknowns (a, b
and k) to a set of data.

This is my data set:

y - c(37047647,27083970,23944887,22536157,20133224,
20088720,18774883,18415648,17103717,13580739,12350767,
8682289,7496355,7248810,7022120,6396495,6262477,6005496,
5065887,4594147,2853307,2745322,454572,448397,275136,268771)

and this is the fit I'm trying to do:

nlsfit - nls(y ~ a * x^k * b^x, start=list(a=5,k=1,b=3))

(It's a Yule distribution.)

However, I keep getting:

Error in nls(y ~ a * x^k * b^x, start = list(a = 5, k = 1, b = 3)) :
singular gradient

I guess this has something to do with the parameter start values.

I was wondering, is there a fully automated way of estimating parameters
which doesn't need start values close to the final estimates?  I know
other programs do it, so is it possible in R?

Thanks,
Andrew Wilson

__
[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] USA map

2003-11-03 Thread apjaworski

I believe in R you need

library(maps)

before using usa().  Of course, the library has to be installed first.

Cheers,

Andy

__
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


|-+
| |   [EMAIL PROTECTED]   |
| |   Sent by: |
| |   [EMAIL PROTECTED]|
| |   ath.ethz.ch  |
| ||
| ||
| |   11/03/2003 13:56 |
| ||
|-+
  
-|
  |
 |
  |  To:   R-list [EMAIL PROTECTED]
  |
  |Martin Wegmann [EMAIL PROTECTED]  
   |
  |  cc:   Owen, Jason [EMAIL PROTECTED]   
|
  |  Subject:  Re: [R] USA map 
 |
  
-|




On 3 Nov 2003 at 16:33, Martin Wegmann wrote:

 On Monday 03 November 2003 15:46, Owen, Jason wrote:
  R users,
 
  In S, there was a function called usa() that
  would draw the map of the United States, plus
  it had other options for graphics.  I have looked
  but I can't find the equivalent in R.  Is there one?
 Description

 I don't know the usa() function in S but usa() in R gives a map of the US

Where did you find that function? In rw1080 on windows XP I get:

 usa()
Error: couldn't find function usa


(and help.search(usa) does'nt give anything usefull)

Kjetil Halvorsen


 that's the output of a usa  search, perhaps that is what you are
looking
 for:

 cheers Martin

 P.S.: www.freegis.org - GeoData is worth a look for more maps

 usa() {map}

  This database produces a map of the United States mainland generated
from US
 Department of the Census data (see the reference).


 Usage

 data(usaMapEnv)

 Format


  The data file is merely an assignment to a character string which
specifies
 the name of an environment variable which contains the base location of
the
 binary files used by the map drawing functions. This environment variable

 (R_MAP_DATA_DIR for the datasets in the maps package) is set at package
load
 time if it does not already exist. Hence setting the environment variable

 before loading the package can override the default location of the
binary
 datasets.


 References


  Richard A. Becker, and Allan R. Wilks, Maps in S, ATT Bell
Laboratories
 Statistics Research Report [93.2], 1993.


 Richard A. Becker, and Allan R. Wilks, Constructing a Geographical
Database,
 ATT Bell Laboratories Statistics Research Report [95.2], 1995.


 US Department of Commerce, Census Bureau, County Boundary File, computer
tape,
 available from Customer Services, Bureau of the Census, Washingdon DC
20233.

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

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


Re: [R] Generating Data Sets -- Each with a Different Name

2003-10-23 Thread apjaworski

You need paste and assign functions.  Paste will create a sequence of names
and assign will give values to the variables with these names.

This modification of your loop should work

for(i in 1:N)
{
assign(paste(Random.Data., i, sep=''), rnorm(10, 0, 1))
}

Cheers,

Andy

__
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


|-+
| |   Ken Kelley   |
| |   [EMAIL PROTECTED] |
| |   Sent by: |
| |   [EMAIL PROTECTED]|
| |   ath.ethz.ch  |
| ||
| ||
| |   10/23/2003 17:09 |
| ||
|-+
  
-|
  |
 |
  |  To:   [EMAIL PROTECTED]   
  |
  |  cc:   
 |
  |  Subject:  [R] Generating Data Sets -- Each with a Different Name  
 |
  
-|




Hello all.

I was wondering if anyone had insight into how I might generate a large
number of data sets/vectors, where each of the data sets/vectors have a
different name?

For example, suppose I wanted to generate N data sets/vectors, each with a
different name such as:

Random.Data.1 - rnorm(10, 0, 1)
Random.Data.2 - rnorm(10, 0, 1)
Random.Data.3 - rnorm(10, 0, 1)
 .   .
 .   .
 .   .
Random.Data.N - rnorm(10, 0, 1)

Because I don't want to name each data set/vector myself, I want some sort
of looping/automatic procedure to do it for me. However, I'm not sure how
to do this.

What I want is something conceptually analogous to the following:

for(i in 1:N)
{
Random.Data.i - rnorm(10, 0, 1)
}

Note the i in the Random.Data.i vector. This is the value I want to
change for each iteration of the loop, so that I can have N data
sets/vectors automatically generated for me with different names.

Does anyone know of a method where I can accomplish such a procedure.
Thanks for your thoughts,
Ken

P.S. For those of you wondering why I would ever want to do such a thing,
it is because I need a large number of data sets to use in a Monte Carlo
study with specialized software. If I could do the simulation all is R,
then obviously I could loop the whole procedure. The program I am using has

a limited Monte Carlo facility where each of the (say 10,000) data sets
must be generated elsewhere.

__
[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] upgrading R

2003-10-09 Thread apjaworski

I am not sure if this is a proper way, but here is what I did recently
installing consecutive alpha and beta releases of 1.8.0 on a Win2000
machine:
(1) I uninstalled previous version using the uninstall provided with R.
This leaves all the additional packages in the library folder
(2) I reinstalled the new version into the same folder structure.

The problem might be that some 1.7.1 packages might be different from
1.8.0, so it might be safer to reinstall them from CRAN.

Andy

__
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


|-+
| |   Weiming Zhang  |
| |   [EMAIL PROTECTED]|
| |   edu |
| |   Sent by: |
| |   [EMAIL PROTECTED]|
| |   ath.ethz.ch  |
| ||
| ||
| |   10/09/2003 10:38 |
| ||
|-+
  
-|
  |
 |
  |  To:   [EMAIL PROTECTED]   
  |
  |  cc:   
 |
  |  Subject:  [R] upgrading R 
 |
  
-|




Hi,

I have installed a lot of extra packages for R 1.7.1. If I install R
1.8.0, will I have to reinstall all those packages? Is there a way that
I can upgrading R without losing old packages?

Thank you.

wz

__
[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] bug in stack?

2003-09-23 Thread apjaworski
I am posting it here because I am not sure if the behavior described below
is actually a bug.

If I do something like this:

 x1 - 1:3
 x2 - 5:9
 x3 - 21:27
 ll - list(x1, x2, x3)
 stack(x1,x2,x3)

I get the following error:

Error in rep.int(names(x), lapply(x, length)) :
invalid number of copies in rep

The problem seems to be that the generic list ll is lacking the names
attribute.

The stack.default function (in frametools.R) looks like this:

 stack.default
function (x, ...)
{
x - as.list(x)
x - x[unlist(lapply(x, is.vector))]
data.frame(values = unlist(unname(x)), ind = factor(rep.int(names(x),
lapply(x, length
}

and the last statement generates an error if names(x) evaluates to NULL.
If we add the following line of code before the last statement

if(is.null(names(x))) names(x) - seq(along=x)

the stack function will work fine even for nameless lists.


Andy

__
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122

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


Re: [R] all possible samples

2003-09-17 Thread apjaworski

I am not sure if this is the easiest way, but you can do something like
this:

library(gregmisc)
combinations(N, n, x, repeats=TRUE)

where x is an atomic vector of size N.  The only restriction is that the x
vector has to have N unique elements.  The combinations function will
return a matrix with n columns containing the combinations.

The combinations function is defined recursively.  Even for moderate values
of N and n it will either take a long time or bomb out with the evaluation
is nested too deeply error.  For example, on my modest machine (PIII 1GHz
with 1/5 Gbyte of memory) it takes almost a minute to evaluate

combinations(30, 6, repeats=TRUE)   (1623160 combinations)

and

combinations(44, 2, repeats=TRUE)   (only 990 combinations)

bombs out.

If you need to work with larger numbers you will probably need a sequential
code.

Hope this helps,

Andy


__
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


|-+
| |   lamack lamack  |
| |   [EMAIL PROTECTED]|
| |   Sent by: |
| |   [EMAIL PROTECTED]|
| |   ath.ethz.ch  |
| ||
| ||
| |   09/17/2003 09:52 |
| ||
|-+
  
-|
  |
 |
  |  To:   [EMAIL PROTECTED]   
  |
  |  cc:   
 |
  |  Subject:  [R] all possible samples
 |
  
-|




Dear all, there is an R function that return all possible samples of size
n,
with replacement,  from a vector of length N ?

Best regards

__
[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] Transpose Data Frame Question

2003-09-17 Thread apjaworski

Here is a brute force way:

mm - NULL
for(i in unique(ID)){
   zz - data.frame[ID==i, 3]
   mm - rbind(mm, c(i, zz))
}

It will work as long as you have the same number of tests for each ID.  If
not, you would need to pad shorter zz vectors with NAs.

Cheers,

Andy

__
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


|-+
| |   Bruce Coate  |
| |   [EMAIL PROTECTED]|
| |   m   |
| |   Sent by: |
| |   [EMAIL PROTECTED]|
| |   ath.ethz.ch  |
| ||
| ||
| |   09/17/2003 12:30 |
| ||
|-+
  
-|
  |
 |
  |  To:   [EMAIL PROTECTED]   
  |
  |  cc:   
 |
  |  Subject:  [R] Transpose Data Frame Question   
 |
  
-|




Hi,

I have a data.frame that has 3 columns (ID, Test, Result) and looks like
this

1, Test1, 120
1, Test2, 34
2, Test1, 132
2, Test2, 28
etc

I would like to turn it around so that it looks like this

1, 120, 34
2, 132, 28
etc

I have played around some with t and reshape, but with no success.
Any suggestions or hints would be greatly appreciated.
Thanks,
Bruce


-


 [[alternative HTML version deleted]]

__
[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] Integer programming in R

2003-07-24 Thread apjaworski

Robin,

This is not a direct answer to your question, but there exists a pretty
good linear, mixted and integer programming package called lp_solve.  I
have used it successfully  on a couple of projects.  As far as I know it is
in the public domain and there is source code available.  There is also a
precompiled version available for Windows Visual Basic environment
containing a precompiled DLL and an interface module defining VB function
calls to the DLL.  I think, that having all that it should be possible to
get something going in R, at least in the Windows environment.

Hope this helps,

Andy

__
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


|-+
| |   Robin Naidoo   |
| |   [EMAIL PROTECTED]|
| |   Sent by: |
| |   [EMAIL PROTECTED]|
| |   ath.ethz.ch  |
| ||
| ||
| |   07/24/2003 12:18 |
| ||
|-+
  
-|
  |
 |
  |  To:   [EMAIL PROTECTED]   
  |
  |  cc:   
 |
  |  Subject:  [R] Integer programming in R
 |
  
-|




Dear all,

I am a relative newcomer to the R language, and am sussing out
the possibilities of using R to do integer programming (which I am
also new to).  Is there something along the lines of the NUOPT S-
PLUS package that is available, or on the way, for R?  Are there
other options for integer programming in R?

Thanks very much in advance,

Robin Naidoo
University of Alberta
Edmonton, AB, Canada

__
[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] matrix manipulations

2003-07-15 Thread apjaworski

David,

I am not sure if it can be done in a vectorized form, but this should work

y - NULL
for(i in 1:ncol(x)) y - c(y, cor(x[,i],apply(x[,-i],1,sum)))

Cheers,

Andy

__
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


|-+
| |   David Andel|
| |   [EMAIL PROTECTED] |
| |   Sent by: |
| |   [EMAIL PROTECTED]|
| |   ath.ethz.ch  |
| ||
| ||
| |   07/15/2003 11:51 |
| ||
|-+
  
-|
  |
 |
  |  To:   [EMAIL PROTECTED]   
  |
  |  cc:   
 |
  |  Subject:  [R] matrix manipulations
 |
  
-|




Hi

cor(x,apply(x,1,sum)) gives me the correlations of each column with the
sums of each row (correct me if I'm wrong, please).

What I need are the correlations of each column with the sums of each row
except the entry in the given column. It seems that for any one column i I
get it by doing:

cor(x[,i],apply(x[,-i],1,sum))

But I struggle to get it for all the columns. I was trying things like:

for(i in 1:ncol(x)) cor(x[,i],apply(x[,-i],1,sum))

which doesn't generate any output at all, and

 rbind(for(i in 1:ncol(x)) cor(x[,i],apply(x[,-i],1,sum)))
  [,1]
[1,] 0.1880237

outputs just the result of the very last column.

I know that it shouldn't be necessary to use for(), but I couldn't figure
out a way how to do the task using e.g. apply().

How do you get the results of all columns?

Thank you,
David

__
[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] lines and legend

2003-07-01 Thread apjaworski

Anna,

I found this quite useful in positioning a legend:

plot(1:10, 1:10)
legend(locator(1), A legend)

Now, go to the plot window and click your left mouse where you want the
upper left corner of the legend to appear.  Ithink, this should work no
matter what your coordinate system is.

Hope this helps,

Andy

__
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


|-+
| |   Anna  H. Pryor |
| |   [EMAIL PROTECTED]|
| |   a.gov   |
| |   Sent by: |
| |   [EMAIL PROTECTED]|
| |   ath.ethz.ch  |
| ||
| ||
| |   07/01/2003 12:45 |
| ||
|-+
  
-|
  |
 |
  |  To:   R-help mailing list [EMAIL PROTECTED] 
  |
  |  cc:   
 |
  |  Subject:  [R] lines and legend
 |
  
-|




When I am trying to put a legend on a plot where I am using lines, R just

ignores it.  I can do it with boxplot or plot, but just not with lines.  Am
I
doing something wrong?  Maybe I am just making a mistake?

Anna

__
[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] Rcmdr active data set

2003-06-24 Thread apjaworski
Hi,

This seems a very basic problem, but I cannot seem to find the solution to
it.

I am trying to use Rcmdr on a data frame I created in my current R session.
More specifically, I did

 x - data.frame(matrix(0, ncol=3, nrow=5))
library(Rcmdr)

Now I would like to be able to edit, view and perhaps analyze x, but I
cannot seem to figure out how to make it active.  Any hint will be welcome.

Andy

__
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122

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


Re: [R] Tukey's HSD

2003-03-19 Thread apjaworski

Simint is in the multcomp package.

Cheers,

Andy

__
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


|-+
| |   Thomas W Blackwell   |
| |   [EMAIL PROTECTED]  |
| |   Sent by: |
| |   [EMAIL PROTECTED]|
| |   ath.ethz.ch  |
| ||
| ||
| |   03/19/2003 12:20 |
| ||
|-+
  
-|
  |
 |
  |  To:   Peter B. Mandeville [EMAIL PROTECTED]   
 |
  |  cc:   [EMAIL PROTECTED]   
  |
  |  Subject:  Re: [R] Tukey's HSD 
 |
  
-|




What function simint() ?

At least using R 1.6.1 (Redhat linux), help.search(simint)
returns No help files found 

Also, it's no surprise that  na.omit()  might omit rows with NA's
but then NOT purge the levels attribute of each column that is a
factor for factor levels that are no longer used.  For a simple
example of this, try

table(def4$TP, def4$EL)

(or some such object names - I no longer have the body of the
original email).

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

__
[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] small error in regression tests

2003-03-13 Thread apjaworski
I just r-sync'ed the r-devel version of R-1.7.0 (2003-03-11), compiled it
under RH-8.0 and ran make check.  The reg-tests-2 fails at the very end
with the message stating that object cement was not found.  It looks like
this piece of the regression test is new to version 1.7.  The the piece of
code generating the error is:

if(require(MASS)) {
teststep - function(formula, data)
{
d2 - data
fit - lm(formula, data=d2)
step(fit)
}
teststep(formula(y ~ .), cement)
detach(package:MASS)
}

It seems that it requires
data(cement)
statement before the call to teststep.


Andy

__
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122

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


[R] lattice default theme

2003-01-08 Thread apjaworski
I have a feeling that this was already discussed here, but I cannot
remember the outcome of the discussion.

I would like to have the col.whitebg theme as a default and I cannot figure
out how to do it.  Functions like lset or trellis.par.set require that the
device be active, so how does one set a different default for all
invocations of trellis.device?

Thanks in advance,

Andy


__
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122

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



Re: [R] Probit Analysis

2002-12-31 Thread apjaworski

Jacqueline,

This should be a simple application of GLM.  Check the help pages for glm,
family and dose.p in library MASS.  Look at the example at the bottom of
the dose.p help page - it does almost exactly what you need.

Hope this helps,

Andy

__
Andy Jaworski
Engineering Systems Technology Center
3M Center, 518-1-01
St. Paul, MN 55144-1000
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


|-+--
| |   Ngayee J Law |
| |   Ngayee.Law@celeradiagn|
| |   ostics.com|
| |   Sent by:   |
| |   [EMAIL PROTECTED]|
| |   ethz.ch|
| |  |
| |  |
| |   12/31/2002 16:17   |
| |  |
|-+--
  
-|
  |
 |
  |  To:   [EMAIL PROTECTED]
 |
  |  cc:   
 |
  |  Subject:  [R] Probit Analysis 
 |
  
-|



Hello all,

I have a very simple set of data and I would like to analyze them with
probit analysis.
The data are:

XEvent  Trial
100  8 8
75   8 8
50   6 8
25   4 8
10   2 8
00 8

I want to estimate the value of X that will give a 95% hit rate
(Event/Trial) and the corresponding
95% CI. Anyone can offer some help? Thanks!!

- Jacqueline

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

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