[R] geotiff calculations

2007-11-14 Thread Laura Poggio
Dear list,
I have to compare two digital elevation models in raster format (geotiff).
I then have to calculate the differences in altitude for each cell and make
some statistics (basic as mean, median, std, range but also more advanced
as RMSE) on that.
I do not know very much how to proceed:
1) is it possible to import the geotiff in R? If so with which package? if
not which is the best way to import such files?
2) is it better to perform the calculations of the differences in a GIS
software and then to use R only for statistical analysis? or it is better to
do everything in R?
3) is there any specific package for doing this kind of analysis?

Thank you very much in advance

Laura

[[alternative HTML version deleted]]

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


[R] R function, sink() and empty file

2008-08-10 Thread Laura Poggio
Dear all,
I wrote a simple script in order to put together some functions and method
to be executed on various files
I am trying to have to possibility to call the script changing few
parameters in order to use the different files.
I succeeded partly using the function method.
However in my script I call the sink() function in order to output the
results to a .txt file. When using the function the file is empty, when
running the script manually the file is fine. How can I solve that?
Is there any other way to run a R script on different files with different
names?

Thank you very much in advance

Laura

=
EXAMPLE OF CODE
=
km = function(a,o) {

fld - system.file(G:/ALRPC/JRC/IMG/, package=rgdal)
filename = as.name(paste (a, -, o, sep=))
file - read.table(paste(R_out/, filename, .txt, sep=))

obj - kmenas(file, 5)

sink(paste(R_out/res, filename, .txt, sep=))
Kluster centers
obj$centers
Within size for clusters
obj$withinss
Cluster size
obj$size
sink()
}

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] cluster.stats

2008-06-13 Thread Laura Poggio
Dear list,
I just tried to use the function cluster.stat in the package fpc.
I just have a couple of questions about the syntax:

cluster.stats(d,clustering,alt.clustering=NULL,
silhouette=TRUE,G2=FALSE,G3=FALSE)

1) the distance object (d) is an object obtained by the function dist() on
my own original matrix?
2) clustering is the clusters vector as result of one of the many clustering
methods?

Thank you very much in advance and sorry for such basic question, but I did
not manage to clarify my mind.

Laura

[[alternative HTML version deleted]]

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


Re: [R] cluster.stats

2008-06-14 Thread Laura Poggio
Thank you very much for your answer.
I tried to run the function on my data and now I am getting this message of
error
Error in as.dist(dmat[clustering == i, clustering == i]) :  (subscript)
logical subscript too long

Below the code I am using (version2.7.0 of R with all packages updated):

data - - as(img, data.frame)[1:1]#(where img is a small image 256 px
x 256 px)
kl - kmeans(data, 5)
library(fpc)
cluster.stats(data, kl$cluster)

Thank you for any hints on the reasons and meaning of the error!

Laura





2008/6/13 Christian Hennig [EMAIL PROTECTED]:

 Dear Laura,

  Dear list,
 I just tried to use the function cluster.stat in the package fpc.
 I just have a couple of questions about the syntax:

 cluster.stats(d,clustering,alt.clustering=NULL,
 silhouette=TRUE,G2=FALSE,G3=FALSE)

 1) the distance object (d) is an object obtained by the function dist() on
 my own original matrix?


 d is allowed to be an object of class dist or a dissimilarity matrix.
 The answer to your question depends on what your original matrix is. If
 it is something on which you can compute a distance by dist(), you're right,
 at least if dist() delivers the distance you are interested in.

  2) clustering is the clusters vector as result of one of the many
 clustering
 methods?


 The help page tells you what clustering can be. So it could be the
 clustering/partition vector of a clustering method or it could be something
 else. Note that cluster.stats doesn't depend on any particular clustering
 method. It computes the statistics regardless of where the clustering vector
 comes from.

 Best regards,
 Christian


 Thank you very much in advance and sorry for such basic question, but I
 did
 not manage to clarify my mind.

 Laura

[[alternative HTML version deleted]]

 __
 R-help@r-project.org 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.


 *** --- ***
 Christian Hennig
 University College London, Department of Statistical Science
 Gower St., London WC1E 6BT, phone +44 207 679 1698
 [EMAIL PROTECTED], 
 www.homepages.ucl.ac.uk/~ucakchehttp://www.homepages.ucl.ac.uk/%7Eucakche


[[alternative HTML version deleted]]

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


Re: [R] cluster.stats

2008-06-14 Thread Laura Poggio
I am sorry I did not provide enough information.
I am not using img later, but data that is data.frame.
I wrote that img is a image just to explain what kind of data is coming
from, but the object I am using is data and it is a data.frame (checked many
times).

I am not using as.dist, but dist in order to calculate the distance matrix
among the data I have. Then the whole code I am using is:

data - - as(img, data.frame)[1:1]#(where img is an image 256x256 px)
kl - kmeans(data, 5)
library(fpc)
ddata - dist(data)
dcent - dist(kl$centers)

cluster.stats(ddata, kl$cluster)
cluster.stats(dcent, kl$cluster)

In both cases I got the same error:
Error in as.dist(dmat[clustering == i, clustering == i]) :  (subscript)
logical subscript too long

Below the structure of the different objects is detailed below:
data is 'data.frame':   262144 obs. of  1 variable
kl$centers is num [1:5, 1]
kl$cluster is Named int [1:262144]

I hope it is more informative. I am sorry but I did not find any explanation
for the error message I am getting.

Thank you very much in advance

Laura



2008/6/14 Christian Hennig [EMAIL PROTECTED]:

 The given information is not enough to tell you what's going on. as.dist
 doesn't appear in the given code and it's not clear to me what kind of
 object img is (a small image doesn't tell me what R makes of it).
 Also, try to read the help pages first and find out whether img is of the
 format that is required by the functions. And check (using str for example)
 whether data is what you expect it to be.

 Christian


 On Sat, 14 Jun 2008, Laura Poggio wrote:

  Thank you very much for your answer.
 I tried to run the function on my data and now I am getting this message
 of
 error
 Error in as.dist(dmat[clustering == i, clustering == i]) :  (subscript)
 logical subscript too long

 Below the code I am using (version2.7.0 of R with all packages updated):

 data - - as(img, data.frame)[1:1]#(where img is a small image 256
 px
 x 256 px)
 kl - kmeans(data, 5)
 library(fpc)
 cluster.stats(data, kl$cluster)

 Thank you for any hints on the reasons and meaning of the error!

 Laura





 2008/6/13 Christian Hennig [EMAIL PROTECTED]:

  Dear Laura,

  Dear list,

 I just tried to use the function cluster.stat in the package fpc.
 I just have a couple of questions about the syntax:

 cluster.stats(d,clustering,alt.clustering=NULL,
 silhouette=TRUE,G2=FALSE,G3=FALSE)

 1) the distance object (d) is an object obtained by the function dist()
 on
 my own original matrix?


 d is allowed to be an object of class dist or a dissimilarity matrix.
 The answer to your question depends on what your original matrix is. If
 it is something on which you can compute a distance by dist(), you're
 right,
 at least if dist() delivers the distance you are interested in.

  2) clustering is the clusters vector as result of one of the many

 clustering
 methods?


 The help page tells you what clustering can be. So it could be the
 clustering/partition vector of a clustering method or it could be
 something
 else. Note that cluster.stats doesn't depend on any particular clustering
 method. It computes the statistics regardless of where the clustering
 vector
 comes from.

 Best regards,
 Christian


  Thank you very much in advance and sorry for such basic question, but I
 did
 not manage to clarify my mind.

 Laura

   [[alternative HTML version deleted]]

 __
 R-help@r-project.org 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.


  *** --- ***
 Christian Hennig
 University College London, Department of Statistical Science
 Gower St., London WC1E 6BT, phone +44 207 679 1698
 [EMAIL PROTECTED], 
 www.homepages.ucl.ac.uk/~ucakchehttp://www.homepages.ucl.ac.uk/%7Eucakche
 http://www.homepages.ucl.ac.uk/%7Eucakche



 *** --- ***
 Christian Hennig
 University College London, Department of Statistical Science
 Gower St., London WC1E 6BT, phone +44 207 679 1698
 [EMAIL PROTECTED], 
 www.homepages.ucl.ac.uk/~ucakchehttp://www.homepages.ucl.ac.uk/%7Eucakche


[[alternative HTML version deleted]]

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


Re: [R] cluster.stats

2008-06-14 Thread Laura Poggio
Thank. See below.

Laura

2008/6/14 Christian Hennig [EMAIL PROTECTED]:

 What does str(ddata) give?


Class 'dist'  atomic [1:130816]   69.2 117.1 145.6 179.9 195.6 ...



 dcent doesn't make sense as input for cluster.stats, because you need a
 dissimilarity matrix between all objects.


Yes I know ... I simply try to see if something was changing with different
structure of data




 Christian

 On Sat, 14 Jun 2008, Laura Poggio wrote:

  I am sorry I did not provide enough information.
 I am not using img later, but data that is data.frame.
 I wrote that img is a image just to explain what kind of data is coming
 from, but the object I am using is data and it is a data.frame (checked
 many
 times).

 I am not using as.dist, but dist in order to calculate the distance matrix
 among the data I have. Then the whole code I am using is:

 data - - as(img, data.frame)[1:1]#(where img is an image 256x256
 px)
 kl - kmeans(data, 5)
 library(fpc)
 ddata - dist(data)
 dcent - dist(kl$centers)

 cluster.stats(ddata, kl$cluster)
 cluster.stats(dcent, kl$cluster)

 In both cases I got the same error:
 Error in as.dist(dmat[clustering == i, clustering == i]) :  (subscript)
 logical subscript too long

 Below the structure of the different objects is detailed below:
 data is 'data.frame':   262144 obs. of  1 variable
 kl$centers is num [1:5, 1]
 kl$cluster is Named int [1:262144]

 I hope it is more informative. I am sorry but I did not find any
 explanation
 for the error message I am getting.

 Thank you very much in advance

 Laura



 2008/6/14 Christian Hennig [EMAIL PROTECTED]:

  The given information is not enough to tell you what's going on. as.dist
 doesn't appear in the given code and it's not clear to me what kind of
 object img is (a small image doesn't tell me what R makes of it).
 Also, try to read the help pages first and find out whether img is of the
 format that is required by the functions. And check (using str for
 example)
 whether data is what you expect it to be.

 Christian


 On Sat, 14 Jun 2008, Laura Poggio wrote:

  Thank you very much for your answer.

 I tried to run the function on my data and now I am getting this message
 of
 error
 Error in as.dist(dmat[clustering == i, clustering == i]) :  (subscript)
 logical subscript too long

 Below the code I am using (version2.7.0 of R with all packages updated):

 data - - as(img, data.frame)[1:1]#(where img is a small image
 256
 px
 x 256 px)
 kl - kmeans(data, 5)
 library(fpc)
 cluster.stats(data, kl$cluster)

 Thank you for any hints on the reasons and meaning of the error!

 Laura





 2008/6/13 Christian Hennig [EMAIL PROTECTED]:

  Dear Laura,


  Dear list,

  I just tried to use the function cluster.stat in the package fpc.
 I just have a couple of questions about the syntax:

 cluster.stats(d,clustering,alt.clustering=NULL,
 silhouette=TRUE,G2=FALSE,G3=FALSE)

 1) the distance object (d) is an object obtained by the function
 dist()
 on
 my own original matrix?


  d is allowed to be an object of class dist or a dissimilarity matrix.
 The answer to your question depends on what your original matrix is.
 If
 it is something on which you can compute a distance by dist(), you're
 right,
 at least if dist() delivers the distance you are interested in.

  2) clustering is the clusters vector as result of one of the many

  clustering
 methods?


  The help page tells you what clustering can be. So it could be the
 clustering/partition vector of a clustering method or it could be
 something
 else. Note that cluster.stats doesn't depend on any particular
 clustering
 method. It computes the statistics regardless of where the clustering
 vector
 comes from.

 Best regards,
 Christian


  Thank you very much in advance and sorry for such basic question, but
 I

 did
 not manage to clarify my mind.

 Laura

  [[alternative HTML version deleted]]

 __
 R-help@r-project.org 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.


  *** --- ***

 Christian Hennig
 University College London, Department of Statistical Science
 Gower St., London WC1E 6BT, phone +44 207 679 1698
 [EMAIL PROTECTED], 
 www.homepages.ucl.ac.uk/~ucakchehttp://www.homepages.ucl.ac.uk/%7Eucakche
 http://www.homepages.ucl.ac.uk/%7Eucakche
 http://www.homepages.ucl.ac.uk/%7Eucakche



  *** --- ***
 Christian Hennig
 University College London, Department of Statistical Science
 Gower St., London WC1E 6BT, phone +44 207 679 1698
 [EMAIL PROTECTED], 
 www.homepages.ucl.ac.uk/~ucakchehttp://www.homepages.ucl.ac.uk/%7Eucakche
 http://www.homepages.ucl.ac.uk/%7Eucakche



 *** --- ***
 Christian Hennig
 University College London, Department of Statistical Science
 Gower St., London WC1E 6BT, phone +44 207 679 1698
 [EMAIL PROTECTED], 
 www.homepages.ucl.ac.uk/~ucakchehttp

Re: [R] cluster.stats

2008-06-14 Thread Laura Poggio
Thank you very much for all the info and support.
Now I managed to make it working on a small subset of the original data set. 
I think that the first error message I got (Error in as.dist(dmat[clustering == 
i, clustering == i]) :  (subscript) logical subscript too long)
is generated when the 2 objects required by cluster.stats do not have the same 
length.

Thanks! 
Laura

--- Original message ---
Da: Christian Hennig  [EMAIL PROTECTED]
Inviato: 14.6.'08,  20:46

 Dear Laura,
 
 I have R 2.6.0. I tried dist on a vector of length 200,000 and it told me 
 that it is too long. Theoretically, if you have 260,000 observations, the 
 length of the dist object should be 260,000*259,999/2, which is too large 
 for our computers, I guess. Which means that unfortunately cluster.stats 
 won't work for such a large data set, because it needs the full casewise 
 dissimilarity information.
 
 I don't understand how you managed to produce a dist object of length 
 of only 130,000 out of your data, but it certainly doesn't give all 
 pairwise distance information for 260,000 points and therefore cannot be 
 used in cluster.stats with a clustering vector of length 260,000 or so.
 
 Sorry,
 Christian
 
 On Sat, 14 Jun 2008, Laura Poggio wrote:
 
  Thank. See below.
 
  Laura
 
  2008/6/14 Christian Hennig [EMAIL PROTECTED]:
 
  What does str(ddata) give?
 
 
  Class 'dist'  atomic [1:130816]   69.2 117.1 145.6 179.9 195.6 ...
 
 
 
  dcent doesn't make sense as input for cluster.stats, because you need a
  dissimilarity matrix between all objects.
 
 
  Yes I know ... I simply try to see if something was changing with different
  structure of data
 
 
 
 
  Christian
 
  On Sat, 14 Jun 2008, Laura Poggio wrote:
 
   I am sorry I did not provide enough information.
  I am not using img later, but data that is data.frame.
  I wrote that img is a image just to explain what kind of data is coming
  from, but the object I am using is data and it is a data.frame (checked
  many
  times).
 
  I am not using as.dist, but dist in order to calculate the distance matrix
  among the data I have. Then the whole code I am using is:
 
  data - - as(img, data.frame)[1:1]#(where img is an image 256x256
  px)
  kl - kmeans(data, 5)
  library(fpc)
  ddata - dist(data)
  dcent - dist(kl$centers)
 
  cluster.stats(ddata, kl$cluster)
  cluster.stats(dcent, kl$cluster)
 
  In both cases I got the same error:
  Error in as.dist(dmat[clustering == i, clustering == i]) :  (subscript)
  logical subscript too long
 
  Below the structure of the different objects is detailed below:
  data is 'data.frame':   262144 obs. of  1 variable
  kl$centers is num [1:5, 1]
  kl$cluster is Named int [1:262144]
 
  I hope it is more informative. I am sorry but I did not find any
  explanation
  for the error message I am getting.
 
  Thank you very much in advance
 
  Laura
 
 
 
  2008/6/14 Christian Hennig [EMAIL PROTECTED]:
 
   The given information is not enough to tell you what's going on. as.dist
  doesn't appear in the given code and it's not clear to me what kind of
  object img is (a small image doesn't tell me what R makes of it).
  Also, try to read the help pages first and find out whether img is of the
  format that is required by the functions. And check (using str for
  example)
  whether data is what you expect it to be.
 
  Christian
 
 
  On Sat, 14 Jun 2008, Laura Poggio wrote:
 
   Thank you very much for your answer.
 
  I tried to run the function on my data and now I am getting this message
  of
  error
  Error in as.dist(dmat[clustering == i, clustering == i]) :  (subscript)
  logical subscript too long
 
  Below the code I am using (version2.7.0 of R with all packages updated):
 
  data - - as(img, data.frame)[1:1]#(where img is a small image
  256
  px
  x 256 px)
  kl - kmeans(data, 5)
  library(fpc)
  cluster.stats(data, kl$cluster)
 
  Thank you for any hints on the reasons and meaning of the error!
 
  Laura
 
 
 
 
 
  2008/6/13 Christian Hennig [EMAIL PROTECTED]:
 
   Dear Laura,
 
 
   Dear list,
 
   I just tried to use the function cluster.stat in the package fpc.
  I just have a couple of questions about the syntax:
 
  cluster.stats(d,clustering,alt.clustering=NULL,
  silhouette=TRUE,G2=FALSE,G3=FALSE)
 
  1) the distance object (d) is an object obtained by the function
  dist()
  on
  my own original matrix?
 
 
   d is allowed to be an object of class dist or a dissimilarity matrix.
  The answer to your question depends on what your original matrix is.
  If
  it is something on which you can compute a distance by dist(), you're
  right,
  at least if dist() delivers the distance you are interested in.
 
   2) clustering is the clusters vector as result of one of the many
 
   clustering
  methods?
 
 
   The help page tells you what clustering can be. So it could be the
  clustering/partition vector of a clustering method or it could be
  something
  else. Note that cluster.stats doesn't depend on any

[R] variable as part of file name

2008-07-02 Thread Laura Poggio
Dear all,
sorry for this very basic question, but I did not find any good example yet.

I would like to set up a variable that can be recall later to substitute a
part of a file name.
As example:

var_filename = as.name(aaa)

jpeg(var_filename.jpg)
plot()
dev.off()

It would be very useful in order to avoid to change manually many strings. I
guess it is possible, but I did not find a way.
I am using R 2.7.0 on a window machine.

Thank you very much in advance.

Laura

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] variable as part of file name

2008-07-02 Thread Laura Poggio
Thank you perfect! it worked also with the GDAL option.

Laura

2008/7/2 Richard Pearson [EMAIL PROTECTED]:

 Laura

 Does jpeg(paste(var_filename, jpg, sep=.)) do what you want?

 Regards

 Richard


 Laura Poggio wrote:

 Dear all,
 sorry for this very basic question, but I did not find any good example
 yet.

 I would like to set up a variable that can be recall later to substitute a
 part of a file name.
 As example:

 var_filename = as.name(aaa)

 jpeg(var_filename.jpg)
 plot()
 dev.off()

 It would be very useful in order to avoid to change manually many strings.
 I
 guess it is possible, but I did not find a way.
 I am using R 2.7.0 on a window machine.

 Thank you very much in advance.

 Laura

[[alternative HTML version deleted]]

 __
 R-help@r-project.org 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.


 --
 Richard D. Pearson [EMAIL PROTECTED]
 School of Computer Science,
 http://www.cs.man.ac.uk/~pearsonrhttp://www.cs.man.ac.uk/%7Epearsonr
 University of Manchester,  Tel: +44 161 275 6178
 Oxford Road,   Mob: +44 7971 221181
 Manchester M13 9PL, UK.Fax: +44 161 275 6204


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] x axe values

2008-11-07 Thread Laura Poggio
Dear list,
I have to draw a simple plot. On y axe some numerical values that correspond
to various categories on axe x.
The table I am reading looks like:

cat Obj1 Obj2 Obj3
max 23 27 34
ave 21 25 32
min 19 23 30

In order to avoid that the first column is reordered alphabetically I used:
(found here http://tolstoy.newcastle.edu.au/R/help/06/09/33808.html)

a - as.character(table$cat)
table$cat = factor(a, levels=a)

However if I use plot() I get thick lines instead of points because of the
reason explained in the link above. If I use plot.default() I get number on
the x axe instead of the name of the categories.

1) first question: any solution?

An alternative could be to use plot.default() and then to change the value
on the axe.

2) second question: how to chnage the value of the axes? not the label, but
the values themself?

Thank you very much in advance

Laura

[[alternative HTML version deleted]]

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


Re: [R] R-square in robust regression

2008-11-13 Thread Laura Poggio
yes thank you! it is perfect.
I was using lmrob in package robustbase and it did not have that option in
the summary.

Laura

2008/11/13 Mark Difford [EMAIL PROTECTED]


 Hi Laura,

  I was searching for a way to compute robust R-square in R in order to
 get
  an
  information similar to the Proportion of variation in response(s)
  explained
  by model(s) computed by S-Plus.

 There are several options. I have had good results using wle.lm() in
 package
 wle and lmRob() in package robust. The second option is perhaps closest to
 what you want.

 Regards, Mark.


 Laura POggio wrote:
 
  I was searching for a way to compute robust R-square in R in order to get
  an
  information similar to the Proportion of variation in response(s)
  explained
  by model(s) computed by S-Plus. This post is dealing with that. Would be
  possible to have some hints on how to calculate this parameter within R?
 
  Thank you very much in advance.
 
  Laura Poggio
 
 
 
 -
  Date: Mon, 20 Oct 2008 06:15:49 +0100 (BST)
  From: Prof Brian Ripley [EMAIL PROTECTED]
  Subject: Re: [R] R-square in robust regression
  To: PARKERSO [EMAIL PROTECTED]
  Cc: r-help@r-project.org
  Message-ID:
 [EMAIL PROTECTED]
  Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
 
  On Sun, 19 Oct 2008, PARKERSO wrote:
 
 
  Hi there,
  I have just started using the MASS package in R to run M-estimator
 robust
  regressions. The final output appears to only give coefficients, degrees
  of
  freedom and t-stats. Does anyone know why R doesn't compute R or
  R-squared
 
  These as only valid for least-squares fits -- they will include the
  possible outliers in the measure of fit.
 
  And BTW, it is not 'R', but the uncredited author of the package who made
  such design decisions.
 
  and why doesn't give you any other indices of goodness of fit?
 
  Which ones did you have in mind?  It does give a scale estimate of the
  residuals, and this determines the predition accuracy.
 
  Does anyone know how to compute these in R?
 
  Yes.
 
  Sophie
 
 
  --
  Brian D. Ripley,  [EMAIL PROTECTED]
  Professor of Applied Statistics,
  http://www.stats.ox.ac.uk/~ripley/http://www.stats.ox.ac.uk/%7Eripley/
 http://www.stats.ox.ac.uk/%7Eripley/
  University of Oxford, Tel:  +44 1865 272861 (self)
  1 South Parks Road, +44 1865 272866 (PA)
  Oxford OX1 3TG, UKFax:  +44 1865 272595
 
[[alternative HTML version deleted]]
 
  __
  R-help@r-project.org 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.
 
 

 --
 View this message in context:
 http://www.nabble.com/Re%3A-R-square-in-robust-regression-tp20478161p20478307.html
 Sent from the R help mailing list archive at Nabble.com.

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


[[alternative HTML version deleted]]

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


Re: [R] R-square in robust regression

2008-11-13 Thread Laura Poggio
I was searching for a way to compute robust R-square in R in order to get an
information similar to the Proportion of variation in response(s) explained
by model(s) computed by S-Plus. This post is dealing with that. Would be
possible to have some hints on how to calculate this parameter within R?

Thank you very much in advance.

Laura Poggio


-
Date: Mon, 20 Oct 2008 06:15:49 +0100 (BST)
From: Prof Brian Ripley [EMAIL PROTECTED]
Subject: Re: [R] R-square in robust regression
To: PARKERSO [EMAIL PROTECTED]
Cc: r-help@r-project.org
Message-ID:
   [EMAIL PROTECTED]
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

On Sun, 19 Oct 2008, PARKERSO wrote:


 Hi there,
 I have just started using the MASS package in R to run M-estimator robust
 regressions. The final output appears to only give coefficients, degrees
of
 freedom and t-stats. Does anyone know why R doesn't compute R or R-squared

These as only valid for least-squares fits -- they will include the
possible outliers in the measure of fit.

And BTW, it is not 'R', but the uncredited author of the package who made
such design decisions.

 and why doesn't give you any other indices of goodness of fit?

Which ones did you have in mind?  It does give a scale estimate of the
residuals, and this determines the predition accuracy.

 Does anyone know how to compute these in R?

Yes.

 Sophie


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

[[alternative HTML version deleted]]

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


Re: [R] R-square in robust regression

2008-11-13 Thread Laura Poggio
I am aware of the limits of the parameter R^2 in this case. However often it
is required for many different reasons. And it is helpful to have a function
that does it. The most important is to know the drawback of thenumber, I
think.

Laura


2008/11/13 Martin Maechler [EMAIL PROTECTED]

  LP == Laura Poggio [EMAIL PROTECTED]
  on Thu, 13 Nov 2008 10:43:14 + writes:

LP yes thank you! it is perfect.
LP I was using lmrob in package robustbase and it did not have that
 option in
LP the summary.

 Yes

 lmRob() from robust is from a company which -- often being excellent --
 has at times listened much more to its not-so-professional
 customers instead of its expert advisors.

 So, yes indeed, summary(lmRob(..)) happily reports
 something like
  Multiple R-Squared: 0.620538  (number: for the stack loss example)

 But the question is if the customer should get  R^2  even in
 casses where its definition is very doubtful and indeed
 somewhat *counter* to the purpose of using methods that are NOT
 least-squares based

 Martin Maechler, ETH Zurich

LP 2008/11/13 Mark Difford [EMAIL PROTECTED]


 Hi Laura,

  I was searching for a way to compute robust R-square in R in order
 to
 get
  an
  information similar to the Proportion of variation in response(s)
  explained
  by model(s) computed by S-Plus.

 There are several options. I have had good results using wle.lm() in
 package
 wle and lmRob() in package robust. The second option is perhaps
 closest to
 what you want.

 Regards, Mark.


 Laura POggio wrote:
 
  I was searching for a way to compute robust R-square in R in order
 to get
  an
  information similar to the Proportion of variation in response(s)
  explained
  by model(s) computed by S-Plus. This post is dealing with that.
 Would be
  possible to have some hints on how to calculate this parameter
 within R?
 
  Thank you very much in advance.
 
  Laura Poggio
 
 
 

 -
  Date: Mon, 20 Oct 2008 06:15:49 +0100 (BST)
  From: Prof Brian Ripley [EMAIL PROTECTED]
  Subject: Re: [R] R-square in robust regression
  To: PARKERSO [EMAIL PROTECTED]
  Cc: r-help@r-project.org
  Message-ID:
 [EMAIL PROTECTED]
  Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
 
  On Sun, 19 Oct 2008, PARKERSO wrote:
 
 
  Hi there,
  I have just started using the MASS package in R to run M-estimator
 robust
  regressions. The final output appears to only give coefficients,
 degrees
  of
  freedom and t-stats. Does anyone know why R doesn't compute R or
  R-squared
 
  These as only valid for least-squares fits -- they will include the
  possible outliers in the measure of fit.
 
  And BTW, it is not 'R', but the uncredited author of the package
 who made
  such design decisions.
 
  and why doesn't give you any other indices of goodness of fit?
 
  Which ones did you have in mind?  It does give a scale estimate of
 the
  residuals, and this determines the predition accuracy.
 
  Does anyone know how to compute these in R?
 
  Yes.
 
  Sophie
 
 
  --
  Brian D. Ripley,  [EMAIL PROTECTED]
  Professor of Applied Statistics,
  
 http://www.stats.ox.ac.uk/~ripley/http://www.stats.ox.ac.uk/%7Eripley/
 http://www.stats.ox.ac.uk/%7Eripley/
 http://www.stats.ox.ac.uk/%7Eripley/
  University of Oxford, Tel:  +44 1865 272861 (self)
  1 South Parks Road, +44 1865 272866 (PA)
  Oxford OX1 3TG, UKFax:  +44 1865 272595
 
[[alternative HTML version deleted]]
 
  __
  R-help@r-project.org 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.
 
 

 --
 View this message in context:

 http://www.nabble.com/Re%3A-R-square-in-robust-regression-tp20478161p20478307.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org 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.


 LP [[alternative HTML version deleted]]

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