[R] nls

2003-02-10 Thread Gregory BENMENZER
Hello,

I want to estimate parameters of the model y=a/x with x=1:10 and y=3/x.
I tested the NLS function.

Could you tell me why it doesn't converge ?

Regards,

Grégory Benmenzer

 x=1:10
 y=3/x
 nls(y~a/x, start=list(a=2), control=nls.control(maxiter=100))
Error in nls(y ~ a/x, start = list(a = 2), control = nls.control(maxiter = 100)) :
number of iterations exceeded maximum of 100


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



[R] DSC 2003: Workshop on Distributed Statistical Computing

2003-02-10 Thread Achim Zeileis
Dear R users,

the preliminary program for the 3rd international workshop on 
'Distributed Statistical Computing' (DSC 2003) is now available at
  http://www.ci.tuwien.ac.at/Conferences/DSC-2003/

The workshop will take place at the Technische Universität Wien in 
Vienna, Austria from March 20-22. The deadline for registrations is 
March 14, but the deadline for early registration ends on February 14. 
Further details can be found on the webpage.

This workshop will deal with future directions in (open source) 
statistical computing and graphics. Topics of particular interest 
include:
* Bioinformatics
* Database Connectivity
* Graphical Modeling
* User Interfaces and Office Integration
* Resample and Combine Methods
* Spatial Statistics
* Visualization

Emphasis will be given to the R, Omegahat and BioConductor projects. 

In addition to the conference program there will be several half-day 
tutorials on March 19 about:
  * An Introduction to BioConductor
  * Exploring Genomic Data Using R and BioConductor
  * Writing R Extensions
  * R Graphics

For the organization committee
Achim Zeileis



Achim Zeileis
Institut für Statistik
Technische Universität Wien
http://www.ci.tuwien.ac.at/~zeileis/

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



[R] shapiro.test

2003-02-10 Thread Ernesto Jardim
Hi

The shapiro.test function outputs a value of the W statistic, which
should be 1 if the distribution is normal, and a p-value for the test
(as the documentation states).

I'm a bit confused with some results. I'm getting a W=0.9977 and a
p-value=0.1889.

I was expecting that a W of 0.9977 would tell me that the distribution
is normal so p-value should be small ...

What am I missing ?

Thanks

EJ

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



Re: [R] shapiro.test

2003-02-10 Thread Richard A. Bilonick
Ernesto Jardim wrote:


Hi

The shapiro.test function outputs a value of the W statistic, which
should be 1 if the distribution is normal, and a p-value for the test
(as the documentation states).

I'm a bit confused with some results. I'm getting a W=0.9977 and a
p-value=0.1889.

I was expecting that a W of 0.9977 would tell me that the distribution
is normal so p-value should be small ...

What am I missing ?

Thanks

EJ

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


 

You have it backwards. The null hypothesis is that the distribution is 
Normal. You reject this null when the p-value is small. If the 
distribution is Normal, the p-value will tend to be large.

 shapiro.test(rnorm(100))

   Shapiro-Wilk normality test

data:  rnorm(100)
W = 0.9877, p-value = 0.4894


Rick B.

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


Re: [R] problems using lqs()

2003-02-10 Thread kjetil brinchmann halvorsen
On 10 Feb 2003 at 15:40, Luca Scrucca wrote:

I am not sure about this, but lqs have an extra argument `adjust'.
from the help page:

adjust:
should the intercept be optimized for each sample? Defaults to TRUE

When you use formula, the estimation algorithm knows 
the columns of 1's is the intercept, and can traet it accordingly. 

When yo make the matrix X with on regressor column being all1's, 
the estimation algorithm does'nt know it represents the 
intercept (you did'nt give it a name). Could this be the reason why 
the different results?

Testing this conjecture:

 mod4 - lqs(y ~ x1 + x2, method=lms, nsamp=exact, adjust=FALSE)
 coef(mod4)
(Intercept)  x1  x2 
 35.4217275   0.4276641  -1.2834731 
 coef(mod1)
(Intercept)  x1  x2 
 35.5293489   0.4422742  -1.2944534 
 coef(mod2)
   x1 x2 
35.4217275  0.4276641 -1.2834731 

so this might be the explanation.

By the way, for the last question, using debug()
and looking at the output gives:

Browse[1] n
debug: subset - eval(substitute(subset), data, env)
Browse[1] n
debug: data - .Internal(model.frame(formula, rownames, variables, 
varnames, 
extras, extranames, subset, na.action))
Browse[1] n
Error in model.frame(formula, rownames, variables, varnames, extras, 
extranames,  : 
variable lengths differ

so the error occurs in model.frame. You could continue 
the debugging yourself. (don't have time now).

Kjetil Halvorsen

 Dear List-members,
 
 I found a strange behaviour in the lqs function.
 Suppose I have the following data:
 
 y -  c(7.6, 7.7, 4.3, 5.9, 5.0, 6.5, 8.3, 8.2, 13.2, 12.6, 10.4, 10.8,
 13.1, 12.3, 10.4, 10.5, 7.7, 9.5, 12.0, 12.6, 13.6, 14.1, 13.5, 11.5,
 12.0, 13.0, 14.1, 15.1)
 x1 - c(8.2, 7.6,, 4.6, 4.3, 5.9, 5.0, 6.5, 8.3, 10.1, 13.2, 12.6, 10.4,
 10.8, 13.1, 13.3, 10.4, 10.5, 7.7, 10.0, 12.0, 12.1, 13.6, 15.0, 13.5,
 11.5, 12.0, 13.0, 14.1)
 x2 - c(23.005, 23.873, 26.417, 24.868, 29.895, 24.200, 23.215, 21.862,
 22.274, 23.830, 25.144, 22.430, 21.785, 22.380, 23.927, 33.443, 24.859,
 22.686, 21.789, 22.041, 21.033, 21.005, 25.865, 26.290, 22.932, 21.313,
 20.769, 21.393)
 
 and I would like to fit the following model:
 
 mod1 - lqs(y ~ x1 + x2, method=lms, nsamp=exact)
 mod1$coefficients
 (Intercept)  x1  x2
  35.5293489   0.4422742  -1.2944534
 mod1$bestone
 [1] 12 17 27
 
 Now, instead of using the formula, I want to provide the design matrix and
 the response, then:
 
 X - cbind(1, x1, x2)
 mod2 - lqs.default(X, y, intercept=F, method=lms, nsamp=exact)
 mod2$coefficients
x1 x2
 35.4217275  0.4276641 -1.2834731
 mod2$bestone
 [1]  6 14 15
 
 The results are not the same (?!). Furthermore, if I create the design
 matrix without the column of 1's for the intercept:
 
 X - cbind(x1, x2)
 mod3 - lqs.default(X, y, intercept=T, method=lms, nsamp=exact)
  mod3$coefficients
 (Intercept)  x1  x2
  35.5293489   0.4422742  -1.2944534
  mod3$bestone
 [1] 12 17 27
 
 I get the same result I had using the formula (see mod1).
 This is confusing me!
 
 Another small problem appears if I re-fit the first model using the
 formula and asking to return the x-matrix and the response:
 
 lqs(y ~ x1 + x2, method=lms, nsamp=exact, x.ret=T, y.ret=T)
 
 Error in model.frame(formula, rownames, variables, varnames, extras,
 extranames,  :
   variable lengths differ
 
 Does anyone know what's going on?
 
 Regards, with thanks in advance,
 
 Luca Scrucca
 
 
 +---+
 | Dr. Luca Scrucca  |
 | Dipartimento di Scienze Statistiche  tel. +39 - 075 - 5855278 |
 | Universita' degli Studi di Perugia   fax. +39 - 075 - 43242   |
 | Via Pascoli - C.P. 1315 Succ. 1   |
 | 06100 PERUGIA  (ITALY)|
 |   |
 | E-mail:   [EMAIL PROTECTED]  |
 | Web page: http://www.stat.unipg.it/luca   |
 +---+
 
 __
 [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



Re: [R] Zero rows/cols in the hessian matrix

2003-02-10 Thread Ott Toomet
Hi,

 | From: Timur Elzhov [EMAIL PROTECTED]
 | Date: Mon, 10 Feb 2003 19:06:18 +0300
 | 
 | Dear R experts!
 | 
 | I try to minimize a function with external C fitting function.
 | I get the hessian matrix. Here it is:
 | 
 | [,1] [,2]  [,3] [,4]
 |   [1,] 1.88166310 0.88598030
 |   [2,] 0.0000 0.0000
 |   [3,] 0.88598030 0.48599830
 |   [4,] 0.0000 0.0000

First, are you sure that your fitting (minimisation?) routine handles
the problem correctly?  Not all of the optimising routines are able to
deal with constant parameters.

 | Second and fourth rows/columns have zero values only. That's OK,
 | because that ones related to parameters were not included in fitting
 | expression (but *were* passed to minimization function as arguments),
 | so dF/dp == 0 for them.  It of course doesn't make sense to calculate
 | the standard errors for the mentioned fitting-independent
 | parameters, but I want to do that for others! I read in R-intro, that
 | I have to calculate the inverse of hessian at first.
 | solve(hessian) logs:
 | 
 |   Error in solve.default(hessian) : singular matrix `a' in solve

The matrix is definitely singular.  In the example above, you have in
fact fitted a 2-parameter model and made a hessian which includes 2
extra rows and columns (of course, it depends on your fitting
algorithm, but I guess it handles the problem in this way).  Then you
have to exclude those rows and columns when you invert the hessian.  I
use to do so:

ind - c(1, 3) # indices you need
varcov - matrix(0, 4, 4)
varcovar[ind,ind] - solve(hessian[ind,ind])

I.e. invert only parameter-depending part of the hessian and put it
into the corresponding elements in the full varcovar matrix (if you
need that).

Be sure how your fitting algorithm handles constant parameters!

Best wishes,

Ott

 | So, the question is:
 |   How can I calculate the errors of remaining parameters (without
 |   removing fitting-independent parameters from arguments)?
 | 
 | Thanks!
 | 
 | 
 | --
 | WBR,
 | Timur

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



Re: [R] lda

2003-02-10 Thread ripley
R per se does not have lda() function.  Package MASS does, and MASS (the
book) describes it in detail.

If you use a package supporting a book (there are several) do expect to 
read the book for the fine details 

On Mon, 10 Feb 2003, Luis Silva wrote:

 There are some versions of lda. I would like to know which one 
 is behind R's lda function.

-- 
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
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



Re: [R] problems using lqs()

2003-02-10 Thread Luca Scrucca
Many thanks to Kjetil Halvorsen for explaining me the reason I got
different results.
Regarding the second point, Both Kjetil and Brian Ripley suggest to go
through debugging and see what the reason for the message.
I'm not so expert to fully understand why, but I have found a patch that
makes the function works. It is based on the behaviour of the lm function.

The original function is:

lqs.formula - function (formula, data, ..., method = c(lts, lqs,
lms, S, model.frame), subset, na.action = na.fail, model = TRUE,
x.ret = FALSE, y.ret = FALSE, contrasts = NULL)
{
method - match.arg(method)
...
if (x.ret)
fit$x - x
if (y.ret)
fit$y - y
fit
}

I only changed the name of the arguments (x.ret to x, y.ret to y) as in
lm():

lqs.formula - function (formula, data, ..., method = c(lts, lqs,
lms, S, model.frame), subset, na.action = na.fail, model = TRUE, x =
FALSE, y = FALSE, contrasts = NULL)
{
ret.x - x
ret.y - y
method - match.arg(method)
...
if (ret.x)
fit$x - x
if (ret.y)
fit$y - y
fit
}

Note that we need also to replace the 'x' with something else in:

lqs - function(what, ...) UseMethod(lqs)

Now

mod - lqs(y ~ x1 + x2, x=T, y=T)

and mod$x and mod$y returns what expected. The x-matrix is without the
enventual column of 1's. Maybe we may want to add it if required.

I hope this may help to fix the problem.

Best,

Luca

+---+
| Dr. Luca Scrucca  |
| Dipartimento di Scienze Statistiche  tel. +39 - 075 - 5855278 |
| Universita' degli Studi di Perugia   fax. +39 - 075 - 43242   |
| Via Pascoli - C.P. 1315 Succ. 1   |
| 06100 PERUGIA  (ITALY)|
|   |
| E-mail:   [EMAIL PROTECTED]  |
| Web page: http://www.stat.unipg.it/luca   |
+---+

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



[R] (no subject)

2003-02-10 Thread Tomer Maymon
my name is Tomer Maimon,
and i'm a student in the israeli Institue for
science ( Technion) .i have some problem with the R program. i want
to write formula with two factors to predict(in rpart algorithm). i'll
be more then thankfull if you could send me an answer  internet link,
where can i find answers to this kind of problems.

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



[R] non-SQL sqlQuery error

2003-02-10 Thread Pijus Virketis
Dear all, 

I've encountered a curious problem. I am trying to run an SQL query
using sqlQuery() function in RODBC. 
The query works fine when run in a stand-alone SQL browser (Microsoft
Query Analyzer, in particular). 
However, when I use the exact same thing from sqlQuery() function, I get
the following error:

Error in [.data.frame(data, , ) : not all specified columns exist

Traceback() gives this:

5: stop(not all specified columns exist)
4: [.data.frame(data, , )
3: data[, ]
2: sqlGetResults(channel, errors = errors, ...)
1: sqlQuery(con.object,  ... long query here ... )

The puzzling thing is that the error does not seem to be like the usual
mispecified-SQL type that I normally 
get when using sqlQuery(). I am not sure how to debug this problem,
since I can't really see what's going on 
in the sqlQuery() internally. 

My query includes a SUM(ColumnName1) GROUP BY ColumnName2 construct,
and from trial and error, it seems 
that this is the cause of the failure (at least removing it makes the
error go away).

I am using R1.6.2 and the RODBC package from
http://cran.r-project.org/bin/windows/contrib/PACKAGES.

Can anyone offer any clues?

Thanks, 

Pijus

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



Re: [R] non-SQL sqlQuery error

2003-02-10 Thread ripley
On Mon, 10 Feb 2003, Pijus Virketis wrote:

 I've encountered a curious problem. I am trying to run an SQL query
 using sqlQuery() function in RODBC. 
 The query works fine when run in a stand-alone SQL browser (Microsoft
 Query Analyzer, in particular). 
 However, when I use the exact same thing from sqlQuery() function, I get
 the following error:
 
 Error in [.data.frame(data, , ) : not all specified columns exist
 
 Traceback() gives this:
 
 5: stop(not all specified columns exist)
 4: [.data.frame(data, , )
 3: data[, ]
 2: sqlGetResults(channel, errors = errors, ...)
 1: sqlQuery(con.object,  ... long query here ... )

There is no statement 3 in the released version of sqlGetResults ...

 The puzzling thing is that the error does not seem to be like the usual
 mispecified-SQL type that I normally 
 get when using sqlQuery(). I am not sure how to debug this problem,
 since I can't really see what's going on 
 in the sqlQuery() internally. 

You can.  R are RODBC and Open Source, so why not open it and read it?

-- 
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
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



[R] Type of multi-valued variable

2003-02-10 Thread Fan
Hi,

I've read in the past a thead in the R discussion list
about the multi-valued type variable (what was called checklist).
At the moment Gregory had intention to add some general code
in his gregmisc package.

I'm wondering if there's some general code / packages available ?

A general class for taking account this type of variable 
would be very useful in the domain of survey processings,
as multi-responses questions are often used. 
The simple operations applied to these variables are holecount, 
cross tabulations with others variables, transformation to single 
coded variables like number of responses, etc.

Thanks in advance for any help
--
Fan

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



Re: [R] multilm for simseg/acm

2003-02-10 Thread Prof Brian D Ripley
On Mon, 10 Feb 2003, Christian Schulz wrote:

 hi,
 for working with the simseg/acm approach i need multilm and it seems
 that the last version  is 0.1-4.tar ?
 What's wrong in the description file, if i attempt  install the package ?

 c:\DataMining\rw1062\binRcmd Install multilm
 Malformed DCF file (file multilm/DESCRIPTION, line 6)

 [R1.6.2 /W2K]
 P.S.
  ..hmm a solution might be import the functions from multilm
 in my .Rprofile, but i would like understand the package problem !

It appears to have an empty Depends: line, so delete it.
Also, the wrapping on the Description: line is wrong, and there is no
Maintainer field.

-- 
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 272860 (secr)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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



[R] geoR question from new R user

2003-02-10 Thread Sharon Lambert
Hi,

I'm a new R user. My goal is to do a variogram using geoR.
I started by trying to do the example in the geoR Illustrative Session 
using my own data.

I am able to read in my Ascii data using: D - matrix(scan(file.dat, 
n=530*3), 530,3, byrow=TRUE).

Then I use: as.geodata(D, coords.col=1:2, data.col=3) to make the 
object D geodata.

I check the descriptive statistics, and my data file appears to be in 
order.

But when I try the following command:  cloud1- variog(D, 
option=cloud, max.dist=1), I get this error:
Error in array(x, c(length(x), 1), if (!is.null(names(x))) list
(names(x),  : 
attempt to set an attribute on NULL

I get that same error message when I try different arguments with the 
variog command. 

Can someone help?

Thanks,

Sharon

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



Re: [R] installation on FreeBSD

2003-02-10 Thread Peng Zhang
Dr Mccarter and Dr Gentleman,

Thank you for your reply. I reinstalled the system and found out that you
can not install R on FreeBSD 5.0 (I mean in the default setting when
installing R and also I tried to open the --enable-R-shlib. I chose
installing full binary, kernel src,  X during the installation of
FreeBSD) but can install R on FreeBSD 4.7. I don't have ability to figure
out why. Just bring it out.

Best wishes,
Peng

***
Peng Zhang
Department of Biostatistics
Harvard School of Public Health
655 Huntington Avenue
Boston, Massachusetts 02115
***

I believe I can fly
I believe I can touch the sky

On Sun, 9 Feb 2003, loren mccarter wrote:

 I'm not sure what is causing it to dump core. I'm using FreeBSD 4.7 and
 I'm waiting for 5.1 before upgrading so I can't troubleshoot it on my
 end. Here are some things you may want to try: (1)~use /stand/sysinstall
 to add R as a binary package (R-1.5.1_1 is available this way), (2)~if
 you think it's X, try configuring R to install without X (I think there
 is a configure option for this, something like: configure --without-x).
 (3)~when you installed the FreeBSD packages, make sure that none of them
 had XFree86 3.3.6 as a dependency, which would cause it to overwrite the 4.2
 libraries (but, you'd really notice if this happened this b/c X would not
 work at all, not just R). (4)~if this is a brand new machine setup, you
 may want to use the more stable FreeBSD 4.7 until 5.1 comes out in a few
 months. Of course, none of those suggestions are ideal, but may help you
 to trouble shoot the issue.

 Loren


 On Sun, 9 Feb 2003, Peng Zhang wrote:

  Dear loren,
 
  Thank you for your reply! I did try to install directly from source code.
  However I got the following error information:
 
  ../../../../library/methods/libs/methods.so is unchanged
  dumping R code in package 'methods'
  Segmentation fault (core dumped)
  *** Error code 139
 
  Stop in /usr/home/pzhang/R-1.6.2/src/library/methods.
  *** Error code 1
 
  Whether is there something wrong with my X settings? Thank you for your
  help.
 
  Best wishes,
  Peng
 
  ***
  Peng Zhang
  Department of Biostatistics
  Harvard School of Public Health
  655 Huntington Avenue
  Boston, Massachusetts 02115
  ***
 
  I believe I can fly
  I believe I can touch the sky
 
  On Sun, 9 Feb 2003, loren mccarter wrote:
 
   I've been using R on FreeBSD for several years now so I can tell you it
   works fine. However I have not yet upgraded to FreeBSD 5.0 so perhaps it
   has something to do with the new version. Here's something you may want
   to try: Rather than using the old version of R from the FreeBSD ports
   collection, download the latest R source directly from CRAN then try to
   ./configure  make  make install it. I've found that R obeys the
   FreeBSD 'hier' and the sources on CRAN are always more up to date than the
   compliled FreeBSD packages or ports.
  
   Loren
  
  
  
  
   On Sat, 8 Feb 2003, Peng Zhang wrote:
  
Hello there,
   
I just changed to FreeBSD platform, and want to install R on it. I use
FreeBSD 5.0 and install nearly all packages on the machine. When I use
ports to install R, (cd /usr/ports/math/R-letter, and then type make) I
got the following error information.
../../../../library/methods/libs/methods.so is unchanged
dumping R code in package 'methods'
Fatal error: The X11 shared library could not be loaded.
  The error was /usr/ports/math/R-letter/work/R-1.6.0/modules/R_X11.so:
Undefined symbol R_GlobalEnv
Can somebody tell me why and how to fix this problem?
   
Thank you for your help!
   
Best wishes,
Peng
   
***
Peng Zhang
Department of Biostatistics
Harvard School of Public Health
655 Huntington Avenue
Boston, Massachusetts 02115
***
   
I believe I can fly
I believe I can touch the sky
   
__
[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
 



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



[R] RPgSQL W2K

2003-02-10 Thread Christian Schulz
Hi,

i found tis message in the archive  and have
got the same problems ?  
John, perhaps you have found now a way
install RPgSQL  for windows2000, or anybody other  ?

many thanks for advance
christian


[SNIP]
I wonder whether anyone has succeeded in building either the RPgSQL or the 
Rdbi.PGSQL and Rdbi packages for Windows. If so, would you be willing to 
share either the binary package(s) or instructions about how to set up the 
configure scripts? My preliminary efforts to get things going under Windows 
2000 haven't met with much success. 

Thanks, 
  John 
[SNIP]

[[alternate HTML version deleted]]

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