Re: [R] Google, hard disc drives and R

2007-02-19 Thread Dieter Menne
Tim Churches tchur at optushome.com.au writes:

 
 A recent paper from Google Labs, interesting in many respects, not the
 least the exclusive use of R for data analysis and graphics (alas not
 cited in the approved manner):
 
 http://labs.google.com/papers/disk_failures.pdf
 
...
For all of you who noted that the first author is E. Pinheiro: This is not the
first half of D Bates, who's first name is José.

Dieter

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


[R] Urgent: How to obtain the Consistent Standard Errors after apply 2SLS through tsls() from sem or systemfit(2SLS) without this error message !!!!!!!!!!!!!

2007-02-19 Thread Guillermo Julián San Martín
Hi,



I am trying to obtain the heteroskedasticity consitent standard errors
(HCSE) after apply 2SLS. I obtain 2SLS through tsls from package sem or
systemfit:



 tsls 

library (sem)

Reg2SLS -tsls(LnP~Sc+Ag+Ag2+Var+R+D,~I2+Ag+Ag2+Var+R+D)

summary (Reg2SLS)



 systemfit 

library (systemfit)

RS - LnP~Sc+Ag+Ag2+Var+R+D

Inst - ~I2+Ag+Ag2+Var+R+D

labels -list(RS)

system -list(RS)

Reg2SLS - systemfit(2SLS, system, labels, Inst, saveMemory=TRUE)

summary (Reg2SLS)



If I try to obtain the HCSE with robcov I obtain the following error message
in both cases:



Error in rep.default(1, p) : rep() incorrect type for second argument



If I tried to apply vcovHAC or vcovHC in the systemfit output of 2SLS I
receive the following messages of errors respectively:



Error in estfun(x) : no applicable method for estfun (for vcovHAC)



Error in terms.default(object) : no terms component (for vcovHC)



If somebody can help me to solve this problem I will thank you a lot.



Best regards



Guillermo

[[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] Data frame: how to create list of row max?

2007-02-19 Thread Johannes Graumann
Dear all,

Can anyone please shed some light onto how to do this?

This will give me all intensity columsn in my data frame:
intensityindeces - grep(^Intensity,names(dataframe),value=TRUE)

This will give me the maximum intensity for the first row:
intensityone - max(dataframe[1,intensityindeces])

What I'm now looking for is how to dfo this for the whole data frame. Should
yield a list of maximum intensities of all rows.
Can't figure it out ... please nudge me where I need to go.

Thanks, Joh

__
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] Data frame: how to create list of row max?

2007-02-19 Thread Chuck Cleland
Johannes Graumann wrote:
 Dear all,
 
 Can anyone please shed some light onto how to do this?
 
 This will give me all intensity columsn in my data frame:
 intensityindeces - grep(^Intensity,names(dataframe),value=TRUE)
 
 This will give me the maximum intensity for the first row:
 intensityone - max(dataframe[1,intensityindeces])
 
 What I'm now looking for is how to dfo this for the whole data frame. Should
 yield a list of maximum intensities of all rows.
 Can't figure it out ... please nudge me where I need to go.

  If you want the values themselves:

apply(dataframe[,intensityindeces], 1, max)

  If you want the column in which the max appears:

apply(dataframe[,intensityindeces], 1, which.max)

?apply

 Thanks, Joh
 
 __
 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.

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
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] Data frame: how to create list of row max?

2007-02-19 Thread Prof Brian Ripley
do.call(pmax, dataframe[,intensityindeces])

if I understand you aright.

On Mon, 19 Feb 2007, Johannes Graumann wrote:

 Dear all,

 Can anyone please shed some light onto how to do this?

 This will give me all intensity columsn in my data frame:
 intensityindeces - grep(^Intensity,names(dataframe),value=TRUE)

 This will give me the maximum intensity for the first row:
 intensityone - max(dataframe[1,intensityindeces])

 What I'm now looking for is how to dfo this for the whole data frame. Should
 yield a list of maximum intensities of all rows.
 Can't figure it out ... please nudge me where I need to go.


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

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


Re: [R] printing intermediate lines while in a function

2007-02-19 Thread Bart Joosen
I've read the Windows FAQ, I tried flush.console(), but then it continious 
with the calculations, while I didn't select a range for the graphics.

Is there a possibility to wait for user input or something?


Thanks

Bart



From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
CC: r-help@stat.math.ethz.ch
Subject: Re: [R] printing intermediate lines while in a function
Date: Sun, 18 Feb 2007 17:04:21 -0400 (AST)

You're using Windoze, aren't you?  You didn't say.

See the Windoze-specific FAQ, 7.1.

 cheers,

 Rolf Turner
 [EMAIL PROTECTED]

===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===
Original message:

  snip
 
  But unfortunately R will do first the calculations and then
  afterwards return the strings.
 
  Is there a way around?

__
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] help with loop over data frame

2007-02-19 Thread Gabor Grothendieck
Try this:

   DF[c(FALSE, tail(DF$Open, -1)  head(DF$High, -1)), ]

or using zoo objects just compare the Open to the reverse lag of the High.

Lines - Date   Open   HighLowClose
1/15/2000   10  11  8 10
1/16/2000   12  12 10 11
1/17/2000   12  12 10 11

library(zoo)
z - read.zoo(textConnection(Lines), header = TRUE, format = %m/%d/%Y)
z[ z[, Open]  lag(z[, High],-1), ]



On 2/18/07, Dr Remo Sammassimo [EMAIL PROTECTED] wrote:
 Dear List,

 This may be the fifth time Ive tried to send this to the list so apologies
 if there are multiple emails.

 I need some help getting started with this problem. I have a data frame
 containing a year of daily stock prices in the following format:

 Date   Open   HighLowClose
 1/15/2000   10  11  8 10
 1/16/2000   12  12 10 11
 etc..


 I want to create a new data frame which shows only the rows where the column
 value Open for 'today' is higher than the column value High for the
 previous day (previous row). How do I loop over each day accessing values
 from different rows and columns, as is needed here?

 I have tried 'if' statements but none have worked.

 Any help appreciated.

 Regards,
 Alf Sammassimo
 Melbourne,Australia

 __
 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] Rcpp

2007-02-19 Thread jacinthe
Hello all,

using GNU WinGW under Windows, I have experimented with the Rcpp package. 
Powerful package. Many thanks to Dominick Samperi.

Now I have tried to modify the RccpExample.cpp file in order to calculate two 
different moving averages, a simple moving average and an exponential moving 
average.

I call the function in R with:

params - list(nobs=10,matype=2)
tempC - .Call(Test_fun,x,params,PACKAGE = RcppTemplate)

where nobs are the number of observation to calculate the moving average and 
matype could be 1 for a simple moving average and 2 for an exponential moving 
average. x is a dataframe containing the relevant data in the column labeled 
Close.

For matype=1 it works fine and the output looks like:
$mab
  [1]0.0000.0000.0000.0000.0000.0000.0000.000   
 0.000 1450.710 1453.658 1459.822 1467.564
 [14] 1477.226 1487.114 1495.231 1496.560 1499.667 1498.295 1488.754 1478.958 
1469.565 1460.120 1445.006 1429.891 1417.258
 [27] 1405.487 1393.141 1384.933 1382.347 1379.085 1370.778 1363.517 1359.175 
1364.777 1365.676 1368.880 1370.997 1369.357
 [40] 1368.533 1368.512 1374.000 1379.464 1387.269 1387.010 1389.155 1393.638 
1400.011 1407.004 1413.114 1421.691 1432.297
 [53] 1441.165 1450.033 1456.677 1467.145 1480.899 1495.727 1509.590 1522.596 
1534.066 1545.307 1554.237 1561.848 1567.405
 [66] 1565.960 1561.789 1557.102 1559.802 1561.216 1563.193 1559.656 1560.993 
1558.660 1562.106 1567.487 1569.686 1570.313
 [79] 1562.673 1556.586 1548.386 1543.358 1536.041 1532.702 1527.327 1524.134 
1526.599 1529.143 1536.038 1542.074 1548.256
 [92] 1552.895 1559.588 1567.022 1574.884 1581.358 1585.991 1590.170 1591.420 
1590.616

$nobs
[1] 10

$n
[1] 100

But for matype=2 it seems not to work. The output is
$mab
  [1] 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 
1483.36 1483.36 1483.36 1483.36 1483.36 1483.36
 [16] 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 
1483.36 1483.36 1483.36 1483.36 1483.36 1483.36
 [31] 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 
1483.36 1483.36 1483.36 1483.36 1483.36 1483.36
 [46] 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 
1483.36 1483.36 1483.36 1483.36 1483.36 1483.36
 [61] 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 
1483.36 1483.36 1483.36 1483.36 1483.36 1483.36
 [76] 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 
1483.36 1483.36 1483.36 1483.36 1483.36 1483.36
 [91] 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 1483.36 
1483.36

$nobs
[1] 10

$n
[1] 100


The modified RcppExpamle.cpp file looks like:

#include Rcpp.hpp
// simple moving average
vectordouble SMAVG(vectordouble data, int nobs, int n) {
  int i,j;
  double sum;
  vectordouble mab(n);

  for (i=0;i(n-nobs+1);i++)
  {
sum=0.0;
for (j=i;j(i+nobs);j++)
{
  sum += data[j];
}
  mab[i+nobs-1]=sum/nobs;
  }
  return mab;
}

// exponential moving average
vectordouble EMAVG(vectordouble data, int nobs, int n) {
  int i;
  double optInK;
  optInK=2/(nobs+1);
  vectordouble mab(n);
  mab[0] = data[0];

  for (i=1;in;i++)
  {
mab[i] = ((data[i]-mab[i-1])*optInK) + mab[i-1];
  }
  return mab;
}

// choose between simple and exponential moving average
RcppExport SEXP Test_fun(SEXP data, SEXP params) {
  SEXP rl=R_NilValue;

  char* exceptionMesg=NULL;
  try{
int i=0;
RcppParams rparam(params);
  int nobs = rparam.getIntValue(nobs);
  int matype = rparam.getIntValue(matype);
RcppFrame datafm(data);
  vectorvectorColDatum  table = datafm.getTableData();
  int nrow = table.size();
RcppVectordouble close(nrow);
  for(int row=0; row  nrow; row++) {
 close(row)= table[row][4].getDoubleValue();
  }

vectordouble stlvec(close.stlVector());
vectordouble res(nrow);

if (matype==1)
{
   res = SMAVG(stlvec,nobs,nrow);
}
if (matype==2)
{
  res = EMAVG(stlvec,nobs,nrow);
}

RcppVectordouble mab(nrow);
for (i=0; inrow; i++) {
  mab(i)=res[i];
}

RcppResultSet rs;

rs.add(mab,mab);
rs.add(nobs,nobs);
rs.add(n,nrow);
rl = rs.getReturnList();
  } catch(std::exception ex){
  exceptionMesg = copyMessageToR(ex.what());
  } catch(...){
  exceptionMesg = copyMessageToR(unknown reason);
  }
  if(exceptionMesg != NULL)
error(exceptionMesg);
  return rl;
}

It seems that the problem is in the EMAVG function. I am not an C++ expert, 
perhapes I have made a mistake there. Could someone with stonger C++ skills
check this function? Or have I made a mistake by calling the function in the 
Test_fun function, which is later called by R?
Besides, is there a more elegant way to access in the Test_fun the Close-Column 
of the dataframe data which contains the columns (Date, Open, High, Low, Close, 
Volume)?

Best regards
Jaci
-- 
Feel free - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt 

[R] problem in reading TOMS observed ASCII data file

2007-02-19 Thread Yogesh Tiwari
Hello R Users,

I have two data sets i) TOMS aerosol optical depth(AOD) and ii) TOMS
ozone(O3).

AOD data is on 1x1 grid and O3 data is on 5x5 grid.

First I want to read AOD and O3 as it is and then I want to regrid AOD on
5x5 grid as O3.

Reading is first problem.

FIRST PROBLEM READING AOD:

AOD data is in following format:

#
Latitute: 89.5
167 0 0 0 0 0 182 0 0 0 0 0 0 0 0 0 0 0 0 200 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 155 0 0 0 0 0 156  0 0 0 0 0 0

...

Latitude: 88.5
.


Lat.
.
...
..
Latitude: -88.5
 180 0 0 0 0 0 182 0 0 0 0 0 0 0 0 0 0 0 0 500 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 655 0 0 0 0 0 156  0 0 0 0 0 0
..
.
##

After each latitude header there is 360 AOD values (1x1 grid). This is
monthly mean data. I have many years of data file.

So the first problem is how to read the data by omiting latitude header,
also data is written along row not along column ?



 SECOND PROBLEM READING O3:

O3 data is in following format:

ozone(72,12,324)

72: Longitude -177.5,-172.5,...,177.5'

12: Latitude -27.5,-22.5,...,27.5'

324: Month Jan79,Feb79,,Dec05'

###

   Month index:0
  20.8  22.1  20.0  19.0  16.3  20.0  24.4  23.5  27.9  23.7   0.0  32.4
  21.6  23.8  20.4  17.9  16.0  22.2  25.3  25.1  31.1  27.4   0.0  30.3
  23.2  23.9  20.7  17.3  16.5  23.1  25.9  25.4  30.4  29.3   0.0  29.9
  26.1  24.7  21.3  15.9  16.8  22.8  25.3  25.8  29.8  30.1   0.0  31.6

--





  Month index:  323
   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0
   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0
   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0
   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0
   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0

-

-

#

12 columns and 72 rows (latitudexlongitude)





THIRD PROBLEM regriding AOD:
How to regrid 1x1 AOD data on 5x5 grid  as O3.


Many thanks for yours help.

Regards,
Yogesh

-- 
Dr. Yogesh K. Tiwari,
Scientist,
Indian Institute of Tropical Meteorology,
Homi Bhabha Road,
Pashan,
Pune-411008
INDIA

Phone: 0091-99 2273 9513 (Cell)
 : 0091-20-258 93 600 (O) (Ext.250)
Fax: 0091-20-258 93 825

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


Re: [R] Data frame: how to create list of row max?

2007-02-19 Thread Johannes Graumann
On Monday 19 February 2007 11:53, Prof Brian Ripley wrote:
 do.call(pmax, dataframe[,intensityindeces])
Thank you very much for your help!

Any idea why do.call(pmax,list(na.rm=TRUE),dataframe[,intensityindeces]) 
would give me 

Error in if (quote) { : argument is not interpretable as logical
In addition: Warning message:
the condition has length  1 and only the first element will be used in: if 
(quote) {

?

Thanks, Joh


pgpgfKKtY5smH.pgp
Description: PGP signature
__
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] need help in reading TOMS observed ASCII data file

2007-02-19 Thread Yogesh Tiwari
Hello R Users,

I am new to R.

I have two data sets i) TOMS aerosol optical depth(AOD) and ii) TOMS
ozone(O3).


 AOD data is on 1x1 grid and O3 data is on 5x5 grid.

 First I want to read AOD and O3 as it is and then I want to regrid AOD on
 5x5 grid as O3.

 Reading is first problem.

 FIRST PROBLEM READING AOD:

 AOD data is in following format:

 #
 Latitute: 89.5
 167 0 0 0 0 0 182 0 0 0 0 0 0 0 0 0 0 0 0 200 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 155 0 0 0 0 0 156  0 0 0 0 0 0
 
 ...

 Latitude: 88.5
 .
 

 Lat.
 .
 ...
 ..
 Latitude: -88.5
  180 0 0 0 0 0 182 0 0 0 0 0 0 0 0 0 0 0 0 500 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0 0 0 0 0 655 0 0 0 0 0 156  0 0 0 0 0 0
 ..
 .
 ##

 After each latitude header there is 360 AOD values (1x1 grid). This is
 monthly mean data. I have many years of data file.

 So the first problem is how to read the data by omiting latitude header,
 also data is written along row not along column ?



  SECOND PROBLEM READING O3:

 O3 data is in following format:

 ozone(72,12,324)

 72: Longitude -177.5,-172.5,...,177.5'

 12: Latitude -27.5,-22.5,...,27.5'

 324: Month Jan79,Feb79,,Dec05'

 ###

Month index:0
   20.8  22.1  20.0  19.0  16.3  20.0  24.4  23.5  27.9  23.7   0.0  32.4
   21.6  23.8  20.4  17.9  16.0  22.2  25.3  25.1  31.1  27.4   0.0  30.3
   23.2  23.9  20.7  17.3  16.5  23.1  25.9   25.4  30.4  29.3   0.0  29.9
   26.1  24.7  21.3  15.9  16.8  22.8  25.3  25.8  29.8  30.1   0.0  31.6

 --

 



   Month index:  323
0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0
0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0
0.0   0.0   0.0   0.0   0.0   0.0   0.00.0   0.0   0.0   0.0   0.0
0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0
0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0

 -

 -

 #

 12 columns and 72 rows (latitudexlongitude)





 THIRD PROBLEM regriding AOD:
 How to regrid 1x1 AOD data on 5x5 grid  as O3.


 Many thanks for yours help.

 Regards,
 Yogesh

 --
 Dr. Yogesh K. Tiwari,
 Scientist,
 Indian Institute of Tropical Meteorology,
 Homi Bhabha Road,
 Pashan,
 Pune-411008
 INDIA

 Phone: 0091-99 2273 9513 (Cell)
  : 0091-20-258 93 600 (O) ( Ext.250)
 Fax: 0091-20-258 93 825




-- 
Dr. Yogesh K. Tiwari,
Scientist 'B',
Indian Institute of Tropical Meteorology,
Homi Bhabha Road,
Pashan,
Pune-411008
INDIA

Phone: 0091-99 2273 9513 (Cell)
 : 0091-20-258 93 600 (O) (Ext.250)
Fax: 0091-20-258 93 825

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


Re: [R] Data frame: how to create list of row max?

2007-02-19 Thread Prof Brian Ripley
On Mon, 19 Feb 2007, Johannes Graumann wrote:

 On Monday 19 February 2007 11:53, Prof Brian Ripley wrote:
 do.call(pmax, dataframe[,intensityindeces])
 Thank you very much for your help!

 Any idea why do.call(pmax,list(na.rm=TRUE),dataframe[,intensityindeces])

You want something like

do.call(pmax, c(dataframe[,intensityindeces], list(na.rm=TRUE)))

See ?do.call

 would give me

 Error in if (quote) { : argument is not interpretable as logical
 In addition: Warning message:
 the condition has length  1 and only the first element will be used in: if
 (quote) {

 ?

 Thanks, Joh


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

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


Re: [R] Data frame: how to create list of row max?

2007-02-19 Thread David Barron
Try do.call(pmax,c(dataframe[,intensityindices],na.rm=TRUE))

This is like the second example in the help page for do.call

On 19/02/07, Johannes Graumann [EMAIL PROTECTED] wrote:
 On Monday 19 February 2007 11:53, Prof Brian Ripley wrote:
  do.call(pmax, dataframe[,intensityindeces])
 Thank you very much for your help!

 Any idea why do.call(pmax,list(na.rm=TRUE),dataframe[,intensityindeces])
 would give me

 Error in if (quote) { : argument is not interpretable as logical
 In addition: Warning message:
 the condition has length  1 and only the first element will be used in: if
 (quote) {

 ?

 Thanks, Joh

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





-- 
=
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP

__
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] Google, hard disc drives and R

2007-02-19 Thread Ben Bolker
Tim Churches tchur at optushome.com.au writes:

 
 A recent paper from Google Labs, interesting in many respects, not the
 least the exclusive use of R for data analysis and graphics (alas not
 cited in the approved manner):
 
 http://labs.google.com/papers/disk_failures.pdf
 
 Perhaps some of the eminences grises of the R Foundation could prevail
 upon Google to make some the data reported in the paper available for
 inclusion in an R library or two, for pedagogical purposes?
 
 Tim C
 

   After skimming the paper, I can't help wondering why
they used barplots with error bars instead of boxplots,
and why they broke the data into discrete age groups?
Given that they had a relatively large data set
(several percent of 100,000 disk drives), they could
have done some cool visualization stuff ...

  Ben Bolker

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


Re: [R] Google, hard disc drives and R

2007-02-19 Thread Roger Bivand
On Mon, 19 Feb 2007, Ben Bolker wrote:

 Tim Churches tchur at optushome.com.au writes:
 
  
  A recent paper from Google Labs, interesting in many respects, not the
  least the exclusive use of R for data analysis and graphics (alas not
  cited in the approved manner):
  
  http://labs.google.com/papers/disk_failures.pdf
  
  Perhaps some of the eminences grises of the R Foundation could prevail
  upon Google to make some the data reported in the paper available for
  inclusion in an R library or two, for pedagogical purposes?
  
  Tim C
  
 
After skimming the paper, I can't help wondering why
 they used barplots with error bars instead of boxplots,
 and why they broke the data into discrete age groups?
 Given that they had a relatively large data set
 (several percent of 100,000 disk drives), they could
 have done some cool visualization stuff ...

For example Mondrian via RServe?

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

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Ubuntu Linux and X11

2007-02-19 Thread Barry Rowlingson
Oleg Sklyar wrote:
 The problem occurs after updating from Dapper to Edgy. Dapper had font 
 paths: /usr/share/X11/fonts and Edgy, to make the whole font system 
 unified, moved X11 fonts to /usr/share/fonts/X11. Oleg

  I think I changed the font path in the X config file *and* added a 
symlink of /usr/share/X11/fonts to point to /usr/share/fonts/X11 in case 
any other package had this coded into it.

Barry

__
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] Data frame: how to create list of row max?

2007-02-19 Thread Johannes Graumann
Thanks to you and Brian Ripley. Quite confusing all this ...

Thanks again.

Joh

On Monday 19 February 2007 13:42, David Barron wrote:
 Try do.call(pmax,c(dataframe[,intensityindices],na.rm=TRUE))

 This is like the second example in the help page for do.call

 On 19/02/07, Johannes Graumann [EMAIL PROTECTED] wrote:
  On Monday 19 February 2007 11:53, Prof Brian Ripley wrote:
   do.call(pmax, dataframe[,intensityindeces])
 
  Thank you very much for your help!
 
  Any idea why
  do.call(pmax,list(na.rm=TRUE),dataframe[,intensityindeces]) would give
  me
 
  Error in if (quote) { : argument is not interpretable as logical
  In addition: Warning message:
  the condition has length  1 and only the first element will be used in:
  if (quote) {
 
  ?
 
  Thanks, Joh
 
  __
  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.


pgp4utFI3ZYyo.pgp
Description: PGP signature
__
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] categorical column to numeric column

2007-02-19 Thread Shubha Vishwanath Karanth
Hi R,

 

Let 'dd' be a data frame given as:

 

dd=data.frame(aa=c(a,a,b,a,b,b),bb=c(1,1,1,2,3,4))

 

Now I want to create a column 'g' such that if dd$aa=a then dd$g=1 else
dd$g= -1 .

 

So, I gave the below syntax:

 

if((dd$aa)==a) dd$g=1 else dd$g= -1

 

But I get the error message as:

Warning message: 

the condition has length  1 and only the first element will be used in:
if ((dd$aa) == a) dd$g = 1 else dd$g = -1 

 

and dd=

 

 dd

  aa bb g

1  a  1 1

2  a  1 1

3  b  1 1

4  a  2 1

5  b  3 1

6  b  4 1

 

 

Please let me know what is the error I am doing?

 

 

 

 


[[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] Calculating the Sharpe ratio

2007-02-19 Thread Bernd Dittmann
Hi useRs,

I am trying to calculate the Sharpe ratio with sharpe of the library 
tseries.

The documentation requires the univariate time series to be a 
portfolio's cumulated returns. In this case, the example given

data(EuStockMarkets)
dax - log(EuStockMarkets[,FTSE])

is however not the cumulated returns but rather the daily returns of the 
FTSE stock index.

Is this way of calculating the Sharpe ratio correct?

Here are my own data:

yearIndexPercentReturns
19851170.091
1986129.90.11
1987149.90.154
1988184.80.233
1989223.10.208
1990223.20
1991220.5-0.012
1992208.1-0.056
1993202.1-0.029
1994203.10.005
1995199.6-0.017
1996208.60.045
1997221.70.063
1998233.70.054
1999250.50.072
2000275.10.098
2001298.60.085
2002350.60.174
2003429.10.224
2004507.60.183
2005536.60.057
2006581.30.083


I calculated the Sharpe ratio in two different ways:
(1) using natural logs as approximation of % returns, using sharpe of 
tseries.
(2) using the % returns using a variation the sharpe function.

In both cases I used the risk free rate r=0 and scale=1 since I am using 
annual data already.

My results:

METHOD 1: sharpe:

  index - log(Index)
  sharpe(index, scale=1)
[1] 0.9614212



METHOD 2: my own %-based formula:

  mysharp
function(x, r=0, scale=sqrt(250))
{
if (NCOL(x)  1)
stop(x is not a vector or univariate time series)
if (any(is.na(x)))
stop(NAs in x)
if (NROW(x) ==1)
return(NA)
else{
return(scale * (mean(x) - r)/sd(x))
}
}



  mysharp(PercentReturns, scale=1)
[1] 0.982531


Both Sharp ratios differ only slightly since logs approximate percentage 
changes (returns).


Are both methods correct, esp. since I am NOT using cumulated returns as 
the manual says?

If cumulated returns were supposed to be used, could I cumulate the 
%-returns with cumsum(PercentReturns)?

Many thanks in advance!

Bernd

__
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] Start and Restart R over SSH

2007-02-19 Thread Nils Höller
Hi,
 
I have some big calculations in R to be done. 
Since I can use R on a server with ssh, i was wondering if I can reopen
a R Shell after exiting ssh.

I don't want to use the batch mode and nohup doesn't work.

I want to use something like
ssh [EMAIL PROTECTED]
R
---do something in R and start calculation ---
close ssh but let R remain on the server, doing the calculation

ssh [EMAIL PROTECTED]
open the existing R Shell / Process

Has anyone done something similiar?
Can you help me or suggest an other solution ? 

Thank you for your help

Nils

__
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] categorical column to numeric column

2007-02-19 Thread ONKELINX, Thierry
Maybe this isn't the most elegant way, but it should work.
dd$g - -1
dd$g[dd$aa == a] - 1

Cheers,

Thierry



ir. Thierry Onkelinx

Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature
and Forest

Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance

Gaverstraat 4

9500 Geraardsbergen

Belgium

tel. + 32 54/436 185

[EMAIL PROTECTED]

www.inbo.be 

 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt

A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

-Oorspronkelijk bericht-
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens Shubha Vishwanath
Karanth
Verzonden: maandag 19 februari 2007 14:36
Aan: r-help
Onderwerp: [R] categorical column to numeric column

Hi R,

 

Let 'dd' be a data frame given as:

 

dd=data.frame(aa=c(a,a,b,a,b,b),bb=c(1,1,1,2,3,4))

 

Now I want to create a column 'g' such that if dd$aa=a then dd$g=1 else
dd$g= -1 .

 

So, I gave the below syntax:

 

if((dd$aa)==a) dd$g=1 else dd$g= -1

 

But I get the error message as:

Warning message: 

the condition has length  1 and only the first element will be used in:
if ((dd$aa) == a) dd$g = 1 else dd$g = -1 

 

and dd=

 

 dd

  aa bb g

1  a  1 1

2  a  1 1

3  b  1 1

4  a  2 1

5  b  3 1

6  b  4 1

 

 

Please let me know what is the error I am doing?

 

 

 

 


[[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] categorical column to numeric column

2007-02-19 Thread Duncan Murdoch
On 2/19/2007 8:36 AM, Shubha Vishwanath Karanth wrote:
 Hi R,
 
  
 
 Let 'dd' be a data frame given as:
 
  
 
 dd=data.frame(aa=c(a,a,b,a,b,b),bb=c(1,1,1,2,3,4))
 
  
 
 Now I want to create a column 'g' such that if dd$aa=a then dd$g=1 else
 dd$g= -1 .
 
  
 
 So, I gave the below syntax:
 
  
 
 if((dd$aa)==a) dd$g=1 else dd$g= -1

if() looks at just the first entry; it's designed for flow of control 
rather than vectorized calculations.  You want ifelse():

ifelse( dd$aa == a, 1, -1)

Duncan Murdoch
  
 
 But I get the error message as:
 
 Warning message: 
 
 the condition has length  1 and only the first element will be used in:
 if ((dd$aa) == a) dd$g = 1 else dd$g = -1 
 
  
 
 and dd=
 
  
 
 dd
 
   aa bb g
 
 1  a  1 1
 
 2  a  1 1
 
 3  b  1 1
 
 4  a  2 1
 
 5  b  3 1
 
 6  b  4 1
 
 
 
  
 
 Please let me know what is the error I am doing?
 
  
 
  
 
  
 
  
 
 
   [[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] categorical column to numeric column

2007-02-19 Thread Stephen Tucker
try

dd$g - ifelse(dd$aa==a,1,-1)

and in general, you can convert categorical data (factors) into integers with
as.integer(), though the values will be positive:

dd$f - as.integer(factor(dd$aa))


--- Shubha Vishwanath Karanth [EMAIL PROTECTED] wrote:

 Hi R,
 
  
 
 Let 'dd' be a data frame given as:
 
  
 
 dd=data.frame(aa=c(a,a,b,a,b,b),bb=c(1,1,1,2,3,4))
 
  
 
 Now I want to create a column 'g' such that if dd$aa=a then dd$g=1 else
 dd$g= -1 .
 
  
 
 So, I gave the below syntax:
 
  
 
 if((dd$aa)==a) dd$g=1 else dd$g= -1
 
  
 
 But I get the error message as:
 
 Warning message: 
 
 the condition has length  1 and only the first element will be used in:
 if ((dd$aa) == a) dd$g = 1 else dd$g = -1 
 
  
 
 and dd=
 
  
 
  dd
 
   aa bb g
 
 1  a  1 1
 
 2  a  1 1
 
 3  b  1 1
 
 4  a  2 1
 
 5  b  3 1
 
 6  b  4 1
 
  
 
  
 
 Please let me know what is the error I am doing?
 
  
 
  
 
  
 
  
 
 
   [[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.
 




 

TV dinner still cooling? 
Check out Tonight's Picks on Yahoo! TV.

__
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] Documenting options specific to a package.

2007-02-19 Thread rolf
If one specifies new options in a package, using the options()
function, where does/should one document these new options?

E.g. suppose that I put the line

options(melvin=42)

in a file zzz.R in the R directory of the package source, where the
package contains functions foo(), bar(), clyde(), and irving() which
all query options(melvin) and take some action based on the value
of ``melvin''.  The user can of course change the value of ``melvin''
from its default value by doing, e.g.

options(melvin=99)

Are there any conventions or standards as to how and where the option
``melvin'' should be documented?  It seems somewhat redundant to
include docmentation about melvin in the help on all 4 of foo(),
bar(), clyde(), and irving().

Thanks for any insights.

cheers,

Rolf Turner
[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
and provide commented, minimal, self-contained, reproducible code.


[R] User defined split function in rpart

2007-02-19 Thread Tobias Guennel
Maybe I should explain my Problem a little bit more detailed.
The rpart package allows for user defined split functions. An example is
given in the source/test directory of the package as usersplits.R.
The comments say that three functions have to be supplied:
1. The 'evaluation' function.  Called once per node.
  Produce a label (1 or more elements long) for labeling each node,
  and a deviance. 
2. The split function, where most of the work occurs.
   Called once per split variable per node.
3. The init function:
   fix up y to deal with offsets
   return a dummy parms list
   numresp is the number of values produced by the eval routine's label.

I have altered the evaluation function and the split function for my needs.
Within those functions, I need to fit a proportional odds model to the data
of the current node. I am using the polr() routine from the MASS package to
fit the model. 
Now my problem is, how can I call the polr() function only with the data of
the current node. That's what I tried so far:

evalfunc - function(y,x,parms,data) {
   
pomnode-polr(data$y~data$x,data,weights=data$Freq)
parprobs-predict(pomnode,type=probs)
dev-0
K-dim(parprobs)[2]
N-dim(parprobs)[1]/K
for(i in 1:N){
tempsum-0
Ni-0
for(l in 1:K){
Ni-Ni+data$Freq[K*(i-1)+l]
}
for(j in 1:K){
tempsum-tempsum+data$Freq[K*(i-1)+j]/Ni*log(parprobs[i,j]*Ni/data$Freq[K*(i
-1)+j])
}
dev=dev+Ni*tempsum
}
dev=-2*dev
wmean-1
list(label= wmean, deviance=dev)

} 

I get the error: Error in eval(expr, envir, enclos) : argument data is
missing, with no default

How can I use the data of the current node?

Thank you
Tobias Guennel

__
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] Start and Restart R over SSH

2007-02-19 Thread Douglas Bates
On 2/19/07, Nils Höller [EMAIL PROTECTED] wrote:
 Hi,

 I have some big calculations in R to be done.
 Since I can use R on a server with ssh, i was wondering if I can reopen
 a R Shell after exiting ssh.

 I don't want to use the batch mode and nohup doesn't work.

 I want to use something like
 ssh [EMAIL PROTECTED]
 R
 ---do something in R and start calculation ---
 close ssh but let R remain on the server, doing the calculation

 ssh [EMAIL PROTECTED]
 open the existing R Shell / Process

 Has anyone done something similiar?
 Can you help me or suggest an other solution ?

I don't think it is possible to reattach to a process started in one
ssh session from another ssh session.  However, you can put a session
into the background with the -f flag to ssh.  You haven't told us what
operating system you are starting the ssh connection on and what
system will run the R process.  If I had an X server running on the
local system and the remote system provided X clients like xterm I
would do this by

ssh -X -f [EMAIL PROTECTED] xterm

This should spring up an autonomous xterm window on the local machine
after which you can run R in it.

I hope this helps.

__
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] Need to find most likely betas

2007-02-19 Thread Pierre Lapointe
Hello,

I have a particular situation where a single wrong observation is
impacting the results of a traditional regression to the point that
betas become unreliable.  I need a way to calculate the most likely
betas.  Here's an example:

set.seed(1)
unknownbeta - matrix(seq(100,500,100),25,5,byrow=TRUE)
x -matrix(runif(25*5),25)
y - rowSums(unknownbeta*x)
summary(lm(y~0+x)) #gets back the unknown betas.

#Now, let's introduce a single wrong data.

unknownbeta[25,5] -100
y - rowSums(unknownbeta*x)
summary(lm(y~0+x)) #every beta changes.

I need to find out what are the most likely betas in the second
example.  There is no obvious way to know that row 25 has wrong input.
I would even be happy if the conclusion was that x1:x4 are 100, 200,
300 and 400 and that x5 is zero.

Thanks

__
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] categorical column to numeric column

2007-02-19 Thread Philipp Pagel

 Let 'dd' be a data frame given as:
 
 dd=data.frame(aa=c(a,a,b,a,b,b),bb=c(1,1,1,2,3,4))
 
 Now I want to create a column 'g' such that if dd$aa=a then dd$g=1 else
 dd$g= -1 .

You need to use ifelse instead of the if ... else construction:

dd$g = ifelse(dd$a=='a', 1, -1)

cu
Philipp

-- 
Dr. Philipp PagelTel.  +49-8161-71 2131
Dept. of Genome Oriented Bioinformatics  Fax.  +49-8161-71 2186
Technical University of Munich
Science Center Weihenstephan
85350 Freising, Germany

 and

Institute for Bioinformatics / MIPS  Tel.  +49-89-3187 3675
GSF - National Research Center   Fax.  +49-89-3187 3585
  for Environment and Health
Ingolstädter Landstrasse 1
85764 Neuherberg, Germany
http://mips.gsf.de/staff/pagel

__
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] Start and Restart R over SSH

2007-02-19 Thread Rainer M Krug
Douglas Bates wrote:
 On 2/19/07, Nils Höller [EMAIL PROTECTED] wrote:
 Hi,

 I have some big calculations in R to be done.
 Since I can use R on a server with ssh, i was wondering if I can reopen
 a R Shell after exiting ssh.

 I don't want to use the batch mode and nohup doesn't work.

 I want to use something like
 ssh [EMAIL PROTECTED]
 R
 ---do something in R and start calculation ---
 close ssh but let R remain on the server, doing the calculation

 ssh [EMAIL PROTECTED]
 open the existing R Shell / Process

 Has anyone done something similiar?
 Can you help me or suggest an other solution ?
 
 I don't think it is possible to reattach to a process started in one
 ssh session from another ssh session.  However, you can put a session

No, it is. Check out the screen command - it is backgrounding your 
session, you can have several running at the same time and reattach and 
they persist between logouts (obviously, if you switch the computer of, 
it is gone...)

Rainer

 into the background with the -f flag to ssh.  You haven't told us what
 operating system you are starting the ssh connection on and what
 system will run the R process.  If I had an X server running on the
 local system and the remote system provided X clients like xterm I
 would do this by
 
 ssh -X -f [EMAIL PROTECTED] xterm
 
 This should spring up an autonomous xterm window on the local machine
 after which you can run R in it.
 
 I hope this helps.
 
 __
 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.


-- 
Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation
Biology (UCT)

Department of Conservation Ecology and Entomology
University of Stellenbosch
Matieland 7602
South Africa

Tel:+27 - (0)72 808 2975 (w)
Fax:+27 - (0)86 516 2782
Fax:+27 - (0)21 808 3304 (w)
Cell:   +27 - (0)83 9479 042

email:  [EMAIL PROTECTED]
[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
and provide commented, minimal, self-contained, reproducible code.


[R] Another subsetting enigma

2007-02-19 Thread Johannes Graumann
Hello again,

I'm trying to do the following:

subset(dataframe,list %in% strsplit(dataframe[[Field]],,))

But This returns always the complete dataframe, since the
strsplit(dataframe[[Field]],,) is evaluated as one big list for the whole
data frame rather than one list per row. How can I have this evaluated on a
per row basis?

After 1.5 h hitting head against wall - begging for insights ...

Joh

__
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] Start and Restart R over SSH

2007-02-19 Thread Benilton Carvalho
Hi Nils,

if the server you're using is *NIX, this is what you can do:

 example
ssh [EMAIL PROTECTED]
screen
R

 do what you need in R
 close the terminal without quitting R 

ssh [EMAIL PROTECTED]
screen -r
 continue working in R 
%% end example

the problem is if you need X... it works until you quit the  
terminal, but screen -r doesn't reconnect the X11.

b


On Feb 19, 2007, at 9:40 AM, Douglas Bates wrote:

 On 2/19/07, Nils Höller [EMAIL PROTECTED] wrote:
 Hi,

 I have some big calculations in R to be done.
 Since I can use R on a server with ssh, i was wondering if I can  
 reopen
 a R Shell after exiting ssh.

 I don't want to use the batch mode and nohup doesn't work.

 I want to use something like
 ssh [EMAIL PROTECTED]
 R
 ---do something in R and start calculation ---
 close ssh but let R remain on the server, doing the calculation

 ssh [EMAIL PROTECTED]
 open the existing R Shell / Process

 Has anyone done something similiar?
 Can you help me or suggest an other solution ?

 I don't think it is possible to reattach to a process started in one
 ssh session from another ssh session.  However, you can put a session
 into the background with the -f flag to ssh.  You haven't told us what
 operating system you are starting the ssh connection on and what
 system will run the R process.  If I had an X server running on the
 local system and the remote system provided X clients like xterm I
 would do this by

 ssh -X -f [EMAIL PROTECTED] xterm

 This should spring up an autonomous xterm window on the local machine
 after which you can run R in it.

 I hope this helps.

 __
 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] Start and Restart R over SSH

2007-02-19 Thread Andris Jankevics
Hi,
You can take a look at GNU screen programm:
http://www.gnu.org/software/screen/

Andris Jankevics

On Pirmdiena, 19. Februāris 2007 15:56, Nils Höller wrote:
 Hi,

 I have some big calculations in R to be done.
 Since I can use R on a server with ssh, i was wondering if I can reopen
 a R Shell after exiting ssh.

 I don't want to use the batch mode and nohup doesn't work.

 I want to use something like
 ssh [EMAIL PROTECTED]
 R
 ---do something in R and start calculation ---
 close ssh but let R remain on the server, doing the calculation

 ssh [EMAIL PROTECTED]
 open the existing R Shell / Process

 Has anyone done something similiar?
 Can you help me or suggest an other solution ?

 Thank you for your help

 Nils

 __
 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] Documenting options specific to a package.

2007-02-19 Thread Prof Brian Ripley
(An R-devel topic, I believe.)

I would have documentation for options() in the package that documented 
the additional options and linked to \code{\link[base]{options}}.
Users will be given a choice of which page to view on most systems, so 
just make sure the title makes clear that this is options for the package.

On Mon, 19 Feb 2007, [EMAIL PROTECTED] wrote:

 If one specifies new options in a package, using the options()
 function, where does/should one document these new options?

 E.g. suppose that I put the line

   options(melvin=42)

 in a file zzz.R in the R directory of the package source, where the
 package contains functions foo(), bar(), clyde(), and irving() which
 all query options(melvin) and take some action based on the value
 of ``melvin''.  The user can of course change the value of ``melvin''
 from its default value by doing, e.g.

options(melvin=99)

 Are there any conventions or standards as to how and where the option
 ``melvin'' should be documented?  It seems somewhat redundant to
 include docmentation about melvin in the help on all 4 of foo(),
 bar(), clyde(), and irving().

 Thanks for any insights.

cheers,

Rolf Turner
[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
 and provide commented, minimal, self-contained, reproducible code.


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

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


Re: [R] Start and Restart R over SSH

2007-02-19 Thread Mark Wardle
Nils Höller wrote:
 Hi,
  
 I have some big calculations in R to be done. 
 Since I can use R on a server with ssh, i was wondering if I can reopen
 a R Shell after exiting ssh.
 
 I don't want to use the batch mode and nohup doesn't work.
 
 I want to use something like
 ssh [EMAIL PROTECTED]
 R
 ---do something in R and start calculation ---
 close ssh but let R remain on the server, doing the calculation
 
 ssh [EMAIL PROTECTED]
 open the existing R Shell / Process
 
 Has anyone done something similiar?
 Can you help me or suggest an other solution ? 
 

Use screen http://www.gnu.org/software/screen/

1. Login to remote server
2. Run screen
3. Run R, and the long calculation
4. Detach screen (Ctrl-A, Ctrl-D)
5. Logout

Then you may login to server again, re-attach to the running screen and
carry on!

Best wishes,

Mark
-- 
Specialist Registrar and Clinical research fellow
Department of Neurology
Cardiff  Vale NHS Trust and Cardiff University

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


[R] summary polr

2007-02-19 Thread Paolo Accadia
Hi all,

I have a problem to estimate Std. Error and t-value by “polr” in library Mass.
They result from the summary of a polr object.

I can obtain them working in the R environment with the following statements:

 temp - polr(formula = formula1,  data = data1)
 coeff - summary(temp),

but when the above statements are enclosed in a function, summary reports the 
following error:

Error in eval(expr, envir, enclos) : object dat not found 

Someone knows how I can solve the problem?

Thanks for any help.
Paolo

__
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] Start and Restart R over SSH

2007-02-19 Thread David Forrest
On Mon, 19 Feb 2007, Benilton Carvalho wrote:

 Hi Nils,

 if the server you're using is *NIX, this is what you can do:

  example
 ssh [EMAIL PROTECTED]
 screen
 R

  do what you need in R
  close the terminal without quitting R 

 ssh [EMAIL PROTECTED]
 screen -r
  continue working in R 
 %% end example

 the problem is if you need X... it works until you quit the
 terminal, but screen -r doesn't reconnect the X11.

I find vnc sometimes helps with keeping a X active for an R session.

Also, if you take care to close your x11 devices, and if when you re-ssh 
you happen to get the same forwarded X DISPLAY=localhost:11.0 or whatever, 
the R session in screen will use the new forwarded connection.

It also seems like using Sys.putenv(DISPLAY='localhost:11.0')  overrides 
the DISPLAY that screen's child R session inherits from the initial 
invocation of screen.

Dave
-- 
  Dr. David Forrest
  [EMAIL PROTECTED](804)684-7900w
  [EMAIL PROTECTED] (804)642-0662h
http://maplepark.com/~drf5n/

__
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] need help in reading TOMS observed ASCII data file

2007-02-19 Thread jim holtman
Here is a script that will read in you O3 data.  It assumes that the data is
perfect.  You will have to either prescan the data for errors, or add code
to catch them.

 # setup to read your file
 # this procedure works if the data is 'perfect'; it does not catch errors
 # 'result' is a list of matrices of the data
 f.1 - file(/jph/r-help/TOMS_O3.txt, r)
 result - list()
 while(length(month - readLines(f.1, n=1))){
+ # read in 12*72 real numbers from the file after reading the 'month'
header
+ data.in - matrix(scan(f.1, what=0, n=12*72), ncol=12, byrow=TRUE)
+ # extract just the number and use it as the index into the list to
save the matrix
+ result[[gsub(.*(\\d file://d/+), \\1 file://0.0.0.1/, month,
perl=TRUE)]] - data.in
+ }
Read 864 items
Read 864 items
Read 864 items
Read 864 items
 str(result)
List of 4
 $ 0: num [1:72, 1:12] 20.8 21.6 23.2 26.1 26.2 29 22.2 18.5 19 20.5 ...
 $ 1: num [1:72, 1:12] 22.7 22.4 20.4 19.7 16.9 20.8 24 25.1 24.7 24.7 ...
 $ 2: num [1:72, 1:12] 25.4 24.6 27 28 29.9 33.3 32.4 28.2 24.5 21.6 ...
 $ 3: num [1:72, 1:12] 31 31 31 30 30.1 27.4 20.5 19 18.8 19.2 ...





On 2/19/07, Yogesh Tiwari [EMAIL PROTECTED] wrote:

 Hello R Users,

 I am new to R.

 I have two data sets i) TOMS aerosol optical depth(AOD) and ii) TOMS
 ozone(O3).

 
  AOD data is on 1x1 grid and O3 data is on 5x5 grid.
 
  First I want to read AOD and O3 as it is and then I want to regrid AOD
 on
  5x5 grid as O3.
 
  Reading is first problem.
 
  FIRST PROBLEM READING AOD:
 
  AOD data is in following format:
 
  #
  Latitute: 89.5
  167 0 0 0 0 0 182 0 0 0 0 0 0 0 0 0 0 0 0 200 0 0 0 0 0 0
  0 0 0 0 0 0 0 0 0 0 0 0 0 0 155 0 0 0 0 0 156  0 0 0 0 0 0
  
  ...
 
  Latitude: 88.5
  .
  
 
  Lat.
  .
  ...
  ..
  Latitude: -88.5
   180 0 0 0 0 0 182 0 0 0 0 0 0 0 0 0 0 0 0 500 0 0 0 0 0 0
  0 0 0 0 0 0 0 0 0 0 0 0 0 0 655 0 0 0 0 0 156  0 0 0 0 0 0
  ..
  .
  ##
 
  After each latitude header there is 360 AOD values (1x1 grid). This is
  monthly mean data. I have many years of data file.
 
  So the first problem is how to read the data by omiting latitude header,
  also data is written along row not along column ?
 
 
 
   SECOND PROBLEM READING O3:
 
  O3 data is in following format:
 
  ozone(72,12,324)
 
  72: Longitude -177.5,-172.5,...,177.5'
 
  12: Latitude -27.5,-22.5,...,27.5'
 
  324: Month Jan79,Feb79,,Dec05'
 
  ###
 
 Month index:0
20.8  22.1  20.0  19.0  16.3  20.0  24.4  23.5  27.9  23.7   0.0  32.4
21.6  23.8  20.4  17.9  16.0  22.2  25.3  25.1  31.1  27.4   0.0  30.3
23.2  23.9  20.7  17.3  16.5  23.1  25.9   25.4  30.4  29.3   0.0
 29.9
26.1  24.7  21.3  15.9  16.8  22.8  25.3  25.8  29.8  30.1   0.0  31.6
 
  --
 
  
 
 
 
Month index:  323
 0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0
 0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0
 0.0   0.0   0.0   0.0   0.0   0.0   0.00.0   0.0   0.0   0.0
 0.0
 0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0
 0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0   0.0
 
  -
 
  -
 
  #
 
  12 columns and 72 rows (latitudexlongitude)
 
 
 
 
 
  THIRD PROBLEM regriding AOD:
  How to regrid 1x1 AOD data on 5x5 grid  as O3.
 
 
  Many thanks for yours help.
 
  Regards,
  Yogesh
 
  --
  Dr. Yogesh K. Tiwari,
  Scientist,
  Indian Institute of Tropical Meteorology,
  Homi Bhabha Road,
  Pashan,
  Pune-411008
  INDIA
 
  Phone: 0091-99 2273 9513 (Cell)
   : 0091-20-258 93 600 (O) ( Ext.250)
  Fax: 0091-20-258 93 825
 



 --
 Dr. Yogesh K. Tiwari,
 Scientist 'B',
 Indian Institute of Tropical Meteorology,
 Homi Bhabha Road,
 Pashan,
 Pune-411008
 INDIA

 Phone: 0091-99 2273 9513 (Cell)
 : 0091-20-258 93 600 (O) (Ext.250)
 Fax: 0091-20-258 93 825

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




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

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


Re: [R] advanced plotting

2007-02-19 Thread Greg Snow
try:
 
 plot(..., type='p',pch='.',...)
 
you can also use the cex parameter to change the size of points.
 
Also, look at the hexbin package for an alternative.
 
Hope this helps,



From: [EMAIL PROTECTED] on behalf of downunder
Sent: Tue 11/21/2006 1:55 PM
To: r-help@stat.math.ethz.ch
Subject: [R] advanced plotting




Hi all. I need some help. I have to plot so many observation in a coordinate
system that you can't see really much. Is there any possiblilty in R to
reduce the size of a plotted point? In the plot command i could find a
solution.
 plot(,type = p ,..)

thanks in advance

lars
--
View this message in context: 
http://www.nabble.com/-R--advanced-plotting-tf2681625.html#a7479700
Sent from the R help mailing list archive at Nabble.com.

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



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


Re: [R] advanced plotting

2007-02-19 Thread jim holtman
Also try the 'hexbin' package which is a good way of showing the 'density'
of the points.

On 2/19/07, Greg Snow [EMAIL PROTECTED] wrote:

 try:

  plot(..., type='p',pch='.',...)

 you can also use the cex parameter to change the size of points.

 Also, look at the hexbin package for an alternative.

 Hope this helps,

 

 From: [EMAIL PROTECTED] on behalf of downunder
 Sent: Tue 11/21/2006 1:55 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] advanced plotting




 Hi all. I need some help. I have to plot so many observation in a
 coordinate
 system that you can't see really much. Is there any possiblilty in R to
 reduce the size of a plotted point? In the plot command i could find a
 solution.
 plot(,type = p ,..)

 thanks in advance

 lars
 --
 View this message in context:
 http://www.nabble.com/-R--advanced-plotting-tf2681625.html#a7479700
 Sent from the R help mailing list archive at Nabble.com.

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



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




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[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 for constrained linear regression

2007-02-19 Thread Mesomeris, Spyros [CIR]
Hello,

I am trying to run a constrained linear regression of a dependent
variable y on three explanatory variables x1, x2, and x3. However, I
need to constrain the coefficients of the explanatory variables as
follows:  b10, b20, and b30. 

Does anyone know how to do this within the lm/glm framework so that one
can still ask for statistics like the r-squared and t-ratios (I realize
that in this case t-stats may be harder to compute than usual and may
not be available from the lm/glm object)?

Any help would be greatly appreciated

Spyros

__
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] Another subsetting enigma

2007-02-19 Thread Marc Schwartz
On Mon, 2007-02-19 at 16:13 +0100, Johannes Graumann wrote:
 Hello again,
 
 I'm trying to do the following:
 
 subset(dataframe,list %in% strsplit(dataframe[[Field]],,))
 
 But This returns always the complete dataframe, since the
 strsplit(dataframe[[Field]],,) is evaluated as one big list for the whole
 data frame rather than one list per row. How can I have this evaluated on a
 per row basis?
 
 After 1.5 h hitting head against wall - begging for insights ...
 
 Joh


I may be misunderstanding your desired end result, but what about:

  subset(dataframe,list %in% strsplit(Field, ,))


This way 'Field' is evaluated within the data frame (default behavior
for 'subset') on a row-wise basis, rather than passing the entire
column.

This entire process also presumes that 'Field' has embedded commas,
delimiting component entries. If not, then strsplit() is not required.

HTH,

Marc Schwartz

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


Re: [R] Need to find most likely betas

2007-02-19 Thread Marc Schwartz
On Mon, 2007-02-19 at 09:58 -0500, Pierre Lapointe wrote:
 Hello,
 
 I have a particular situation where a single wrong observation is
 impacting the results of a traditional regression to the point that
 betas become unreliable.  I need a way to calculate the most likely
 betas.  Here's an example:
 
 set.seed(1)
 unknownbeta - matrix(seq(100,500,100),25,5,byrow=TRUE)
 x -matrix(runif(25*5),25)
 y - rowSums(unknownbeta*x)
 summary(lm(y~0+x)) #gets back the unknown betas.
 
 #Now, let's introduce a single wrong data.
 
 unknownbeta[25,5] -100
 y - rowSums(unknownbeta*x)
 summary(lm(y~0+x)) #every beta changes.
 
 I need to find out what are the most likely betas in the second
 example.  There is no obvious way to know that row 25 has wrong input.
 I would even be happy if the conclusion was that x1:x4 are 100, 200,
 300 and 400 and that x5 is zero.
 
 Thanks

It is not clear what you mean by a wrong observation.  Is the data
completely bad because it was improperly collected?  Is this an
observation that has correct data, but is an outlier relative to the
other observations? Is the observation missing data, where values can be
reasonably imputed?

Are you in a setting where the observation MUST be included in the
regression rather than be deleted? For example an Intent to Treat
analysis in a clinical trial?

Depending upon the context, your options may range from simply removing
the single observation from the regression, considering some form of
weighting of the observations, to perhaps considering a robust
regression methodology and others.

This is not strictly an R question, but one of methodology.
Clarification of which is potentially impacted upon by community
standards and prior work within your particular discipline.

HTH,

Marc Schwartz

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


Re: [R] Another subsetting enigma

2007-02-19 Thread Johannes Graumann
On Monday 19 February 2007 17:49, jim holtman wrote:
 have you tried 'unlist(strsplit())'?The 'unlist' will probably give
 you more values than you have rows, so it would be good if you could
 explain what it is you are trying to do.
I want to isolate a data frame containing all rows of 'dataframe' which 
contain a member of 'list' in the field 'Field', which itself is a comma 
separated list of entries.

Better this (know in brain ...)?

Joh

 On 2/19/07, Johannes Graumann [EMAIL PROTECTED] wrote:
  Hello again,
 
  I'm trying to do the following:
 
  subset(dataframe,list %in% strsplit(dataframe[[Field]],,))
 
  But This returns always the complete dataframe, since the
  strsplit(dataframe[[Field]],,) is evaluated as one big list for the
  whole
  data frame rather than one list per row. How can I have this evaluated on
  a
  per row basis?
 
  After 1.5 h hitting head against wall - begging for insights ...
 
  Joh
 
  __
  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.


pgp7XFEEUi9oM.pgp
Description: PGP signature
__
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] multiple comparisons

2007-02-19 Thread Petra Finkenbein
Dear R users,
I need a professional help:

i am a relatively new R user and I am just writing my diploma tesis where I 
have to conduct some multiple comparison.
I am searching a method which include interaction between fixed factors. The 
following is my model: 
lmer(Leaf~water*region+(1|pop)+(1|pop:sib)+(1|block)+(1|block:pool),data=datx,method=ML)
I want to compare: leaf dependent from water * region.

I would prefer to make a comparision according to tukey or student newman keuls 
if this is possible. 
I am looking forward to your reply, sincerely Petra:-)

__
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] Another subsetting enigma

2007-02-19 Thread jim holtman
try this:

 my.list - c(7,12,3)# set of matching numbers
 set.seed(1)
 result - character(40)   # create empty vector
 # create  some comma separated data
 for(i in 1:40) result[i] - paste(sample(1:20,6), collapse=',')
 # just leave it as a character vector for testing == you can convert your
data frame
 str(result)
 chr [1:40] 6,8,11,16,4,14 19,13,12,2,4,3 14,8,20,9,12,15
8,15,17,4,11,2 ...
 # find matching entries
 matches - sapply(result, function(x){
+ .comma - strsplit(x, ',')[[1]]  # get the fields
+ any(my.list %in% .comma)
+ })
 # print matching entries
 result[matches]
 [1] 19,13,12,2,4,3   14,8,20,9,12,15  6,8,1,7,14,20
10,12,9,4,14,11  16,3,14,7,18,10
 [6] 2,20,6,9,11,77,20,9,16,14,6   16,19,8,13,7,5
16,4,13,3,19,17  5,2,12,15,13,18
[11] 6,19,12,4,3,819,12,18,13,6,7  3,1,13,2,8,10
20,10,9,3,13,7   13,11,6,8,9,3
[16] 15,7,12,20,14,6  8,18,12,13,10,14 6,4,16,9,15,3
16,14,17,10,12,6 3,18,6,11,2,13
[21] 7,15,5,4,9,184,10,11,3,5,18   13,19,18,6,5,3
7,10,17,9,5,19,17,7,3,6,10
[26] 8,14,13,10,7,16




On 2/19/07, Johannes Graumann [EMAIL PROTECTED] wrote:

 On Monday 19 February 2007 17:49, jim holtman wrote:
  have you tried 'unlist(strsplit())'?The 'unlist' will probably
 give
  you more values than you have rows, so it would be good if you could
  explain what it is you are trying to do.
 I want to isolate a data frame containing all rows of 'dataframe' which
 contain a member of 'list' in the field 'Field', which itself is a comma
 separated list of entries.

 Better this (know in brain ...)?

 Joh

  On 2/19/07, Johannes Graumann [EMAIL PROTECTED] wrote:
   Hello again,
  
   I'm trying to do the following:
  
   subset(dataframe,list %in% strsplit(dataframe[[Field]],,))
  
   But This returns always the complete dataframe, since the
   strsplit(dataframe[[Field]],,) is evaluated as one big list for the
   whole
   data frame rather than one list per row. How can I have this evaluated
 on
   a
   per row basis?
  
   After 1.5 h hitting head against wall - begging for insights ...
  
   Joh
  
   __
   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.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[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] Lengend function and moving average plot

2007-02-19 Thread amna khan
Sir I am very new user of R. I am not understanding the how to write the
plot description in box outside the plot. And how we can plot the moving
averages on the plot having regression line and time series.

Please guide me in this regard

AMINA
GC University, Lahore

[[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] memory management uestion

2007-02-19 Thread Federico Calboli
Hi All,

I would like to ask the following.

I have an array of data in an objetct, let's say X.

I need to use a for loop on the elements of one or more columns of X and I am 
having a debate with a colleague about the best memory management.

I believe that if I do:

col1 = X[,1]
col2 = X[,2]
...
colx = X[,x]


and then

for(i in whatever){
do something using col1[i], col2[i] ... colx[i]
}

my memory management is better that doing:

for(i in whatever){
do something using X[i,1], X[i,2] ... X[,x]
}

BTW, here I *have to* use a for() loop an no nifty tapply, lapply and family.

Any comment is welcome.

Best,

Fede

-- 
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St Mary's Campus
Norfolk Place, London W2 1PG

Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

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


Re: [R] Need to find most likely betas

2007-02-19 Thread Pierre Lapointe
Hi Mark,

In my example, there has been a regime change at time 25 and I'd like
to find a way to discover 1- what has changed and 2- when it did.

The problem is all that is observed are the x and y values.
unknownbetas are... unknown. If you look at x and y, you can't really
tell something has changed.

It is not an outlier per se as it involves a change of one of the unknownbetas.

In other words, I'm trying to single out which unknownbetas vs. x
relationships still hold after time 25.

I know it's complicated, but I you have any pointers, it will be appreciated.

Thanks

On 2/19/07, Marc Schwartz [EMAIL PROTECTED] wrote:
 On Mon, 2007-02-19 at 09:58 -0500, Pierre Lapointe wrote:
  Hello,
 
  I have a particular situation where a single wrong observation is
  impacting the results of a traditional regression to the point that
  betas become unreliable.  I need a way to calculate the most likely
  betas.  Here's an example:
 
  set.seed(1)
  unknownbeta - matrix(seq(100,500,100),25,5,byrow=TRUE)
  x -matrix(runif(25*5),25)
  y - rowSums(unknownbeta*x)
  summary(lm(y~0+x)) #gets back the unknown betas.
 
  #Now, let's introduce a single wrong data.
 
  unknownbeta[25,5] -100
  y - rowSums(unknownbeta*x)
  summary(lm(y~0+x)) #every beta changes.
 
  I need to find out what are the most likely betas in the second
  example.  There is no obvious way to know that row 25 has wrong input.
  I would even be happy if the conclusion was that x1:x4 are 100, 200,
  300 and 400 and that x5 is zero.
 
  Thanks

 It is not clear what you mean by a wrong observation.  Is the data
 completely bad because it was improperly collected?  Is this an
 observation that has correct data, but is an outlier relative to the
 other observations? Is the observation missing data, where values can be
 reasonably imputed?

 Are you in a setting where the observation MUST be included in the
 regression rather than be deleted? For example an Intent to Treat
 analysis in a clinical trial?

 Depending upon the context, your options may range from simply removing
 the single observation from the regression, considering some form of
 weighting of the observations, to perhaps considering a robust
 regression methodology and others.

 This is not strictly an R question, but one of methodology.
 Clarification of which is potentially impacted upon by community
 standards and prior work within your particular discipline.

 HTH,

 Marc Schwartz




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


[R] Help on prediction intervals

2007-02-19 Thread Ricardo Bessa
I am trying to estimate prediction intervals for wind power production, it 
is a times series of wind power production. I’m using neural networks for 
prediction, but I need to estimate the uncertainly in the prediction. How 
can I do this in R if I have a probability distribution that is right 
skewness. One tip is to use bootstrap but I don’t know if is possible with 
this method to estimate those intervals.

Any help would be greatly appreciated

Ricardo Bessa

__
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] Need to find most likely betas

2007-02-19 Thread Marc Schwartz
Pierre,

Unfortunately, I don't have much in the way of hands on experience
with these, but conceptually, latent variable analysis/SEM methods seem
like they might be apropos. If so, John Fox' SEM package might be of
value here. More information here:

http://socserv.mcmaster.ca/jfox/Misc/sem/index.html


Since you mention time, if this is a repeated measures based approach,
then you might want to look at lmer(), for which there is a recently
created SIG list. More information is at:

https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models


Perhaps others will jump in with additional thoughts.

HTH,

Marc

On Mon, 2007-02-19 at 13:32 -0500, Pierre Lapointe wrote:
 Hi Mark,
 
 In my example, there has been a regime change at time 25 and I'd like
 to find a way to discover 1- what has changed and 2- when it did.
 
 The problem is all that is observed are the x and y values.
 unknownbetas are... unknown. If you look at x and y, you can't really
 tell something has changed.
 
 It is not an outlier per se as it involves a change of one of the 
 unknownbetas.
 
 In other words, I'm trying to single out which unknownbetas vs. x
 relationships still hold after time 25.
 
 I know it's complicated, but I you have any pointers, it will be appreciated.
 
 Thanks
 
 On 2/19/07, Marc Schwartz [EMAIL PROTECTED] wrote:
  On Mon, 2007-02-19 at 09:58 -0500, Pierre Lapointe wrote:
   Hello,
  
   I have a particular situation where a single wrong observation is
   impacting the results of a traditional regression to the point that
   betas become unreliable.  I need a way to calculate the most likely
   betas.  Here's an example:
  
   set.seed(1)
   unknownbeta - matrix(seq(100,500,100),25,5,byrow=TRUE)
   x -matrix(runif(25*5),25)
   y - rowSums(unknownbeta*x)
   summary(lm(y~0+x)) #gets back the unknown betas.
  
   #Now, let's introduce a single wrong data.
  
   unknownbeta[25,5] -100
   y - rowSums(unknownbeta*x)
   summary(lm(y~0+x)) #every beta changes.
  
   I need to find out what are the most likely betas in the second
   example.  There is no obvious way to know that row 25 has wrong input.
   I would even be happy if the conclusion was that x1:x4 are 100, 200,
   300 and 400 and that x5 is zero.
  
   Thanks
 
  It is not clear what you mean by a wrong observation.  Is the data
  completely bad because it was improperly collected?  Is this an
  observation that has correct data, but is an outlier relative to the
  other observations? Is the observation missing data, where values can be
  reasonably imputed?
 
  Are you in a setting where the observation MUST be included in the
  regression rather than be deleted? For example an Intent to Treat
  analysis in a clinical trial?
 
  Depending upon the context, your options may range from simply removing
  the single observation from the regression, considering some form of
  weighting of the observations, to perhaps considering a robust
  regression methodology and others.
 
  This is not strictly an R question, but one of methodology.
  Clarification of which is potentially impacted upon by community
  standards and prior work within your particular discipline.
 
  HTH,
 
  Marc Schwartz
 
 
 

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


[R] Installing Package rgl - Compilation Fails

2007-02-19 Thread Rick Bilonick
I'm running  R 2.4.1  (with the latest versions of all packages) on an
FC6 32-bit system. When I try to install the rgl package, compilation
fails:

 install.packages(rgl)
--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/rgl_0.70.tar.gz'
Content type 'application/x-gzip' length 705556 bytes
opened URL
==
downloaded 689Kb

* Installing *source* package 'rgl' ...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for X... libraries , headers 
checking for libpng-config... yes
configure: using libpng-config
configure: using libpng dynamic linkage
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -I/usr/lib/R/include -I/usr/lib/R/include -I -DHAVE_PNG_H
-I/usr/include/libpng12 -Iext -I/usr/local/include-fpic  -O2 -g
-pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables -c api.cpp -o api.o
In file included from glgui.hpp:9,
 from gui.hpp:11,
 from rglview.h:10,
 from Device.hpp:11,
 from DeviceManager.hpp:9,
 from api.cpp:14:
opengl.hpp:24:20: error: GL/glu.h: No such file or directory
Disposable.hpp:13: warning: ‘struct IDisposeListener’ has virtual
functions but non-virtual destructor
types.h:77: warning: ‘class DestroyHandler’ has virtual functions but
non-virtual destructor
gui.hpp:56: warning: ‘class gui::WindowImpl’ has virtual functions but
non-virtual destructor
gui.hpp:90: warning: ‘class gui::GUIFactory’ has virtual functions but
non-virtual destructor
pixmap.h:39: warning: ‘class PixmapFormat’ has virtual functions but
non-virtual destructor
api.cpp: In function ‘void rgl_user2window(int*, int*, double*, double*,
double*, double*, int*)’:
api.cpp:764: error: ‘gluProject’ was not declared in this scope
api.cpp: In function ‘void rgl_window2user(int*, int*, double*, double*,
double*, double*, int*)’:
api.cpp:792: error: ‘gluUnProject’ was not declared in this scope
make: *** [api.o] Error 1
chmod: cannot access `/usr/lib/R/library/rgl/libs/*': No such file or
directory
ERROR: compilation failed for package 'rgl'
** Removing '/usr/lib/R/library/rgl'

The downloaded packages are in
/tmp/RtmpJY8uNp/downloaded_packages
Warning message:
installation of package 'rgl' had non-zero exit status in:
install.packages(rgl) 

I was able to install this on an 64-bit system running FC4 and R 2.4.1.

Any ideas on why it fails on FC6?

Rick 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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Installing Package rgl - Compilation Fails

2007-02-19 Thread Oleg Sklyar
Check again your error message:

opengl.hpp:24:20: error: GL/glu.h: No such file or directory

you need to install

mesa-libGLU-devel FC6 version is 6.5.1-7

which will provide development files for glut3. Needless to say the 
above will probably pool some dependencies and (-devel) means it will 
install *.h files as well. Start your FC package manager and search for 
GLU, install the above and try again.

Best,
  Oleg

Rick Bilonick wrote:
 I'm running  R 2.4.1  (with the latest versions of all packages) on an
 FC6 32-bit system. When I try to install the rgl package, compilation
 fails:
 
 install.packages(rgl)
 --- Please select a CRAN mirror for use in this session ---
 Loading Tcl/Tk interface ... done
 trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/rgl_0.70.tar.gz'
 Content type 'application/x-gzip' length 705556 bytes
 opened URL
 ==
 downloaded 689Kb
 
 * Installing *source* package 'rgl' ...
 checking for gcc... gcc
 checking for C compiler default output file name... a.out
 checking whether the C compiler works... yes
 checking whether we are cross compiling... no
 checking for suffix of executables... 
 checking for suffix of object files... o
 checking whether we are using the GNU C compiler... yes
 checking whether gcc accepts -g... yes
 checking for gcc option to accept ANSI C... none needed
 checking how to run the C preprocessor... gcc -E
 checking for X... libraries , headers 
 checking for libpng-config... yes
 configure: using libpng-config
 configure: using libpng dynamic linkage
 configure: creating ./config.status
 config.status: creating src/Makevars
 ** libs
 g++ -I/usr/lib/R/include -I/usr/lib/R/include -I -DHAVE_PNG_H
 -I/usr/include/libpng12 -Iext -I/usr/local/include-fpic  -O2 -g
 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
 --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
 -fasynchronous-unwind-tables -c api.cpp -o api.o
 In file included from glgui.hpp:9,
  from gui.hpp:11,
  from rglview.h:10,
  from Device.hpp:11,
  from DeviceManager.hpp:9,
  from api.cpp:14:
 opengl.hpp:24:20: error: GL/glu.h: No such file or directory
 Disposable.hpp:13: warning: ‘struct IDisposeListener’ has virtual
 functions but non-virtual destructor
 types.h:77: warning: ‘class DestroyHandler’ has virtual functions but
 non-virtual destructor
 gui.hpp:56: warning: ‘class gui::WindowImpl’ has virtual functions but
 non-virtual destructor
 gui.hpp:90: warning: ‘class gui::GUIFactory’ has virtual functions but
 non-virtual destructor
 pixmap.h:39: warning: ‘class PixmapFormat’ has virtual functions but
 non-virtual destructor
 api.cpp: In function ‘void rgl_user2window(int*, int*, double*, double*,
 double*, double*, int*)’:
 api.cpp:764: error: ‘gluProject’ was not declared in this scope
 api.cpp: In function ‘void rgl_window2user(int*, int*, double*, double*,
 double*, double*, int*)’:
 api.cpp:792: error: ‘gluUnProject’ was not declared in this scope
 make: *** [api.o] Error 1
 chmod: cannot access `/usr/lib/R/library/rgl/libs/*': No such file or
 directory
 ERROR: compilation failed for package 'rgl'
 ** Removing '/usr/lib/R/library/rgl'
 
 The downloaded packages are in
 /tmp/RtmpJY8uNp/downloaded_packages
 Warning message:
 installation of package 'rgl' had non-zero exit status in:
 install.packages(rgl) 
 
 I was able to install this on an 64-bit system running FC4 and R 2.4.1.
 
 Any ideas on why it fails on FC6?
 
 Rick 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
 and provide commented, minimal, self-contained, reproducible code.

-- 
Dr Oleg Sklyar | EBI-EMBL, Cambridge CB10 1SD, UK | +44-1223-494466

__
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] Installing Package rgl - Compilation Fails

2007-02-19 Thread Ranjan Maitra
As the error message indicates, there is no GL/glu.h file installed in the 
system. If it is, the path is not properly set.

% yum provides GL/glu.h

on FC6 should give you some clues and tell you what to install, and also 
whether it should be installed.

Ranjan


On Mon, 19 Feb 2007 14:35:29 -0500 Rick Bilonick [EMAIL PROTECTED] wrote:

 I'm running  R 2.4.1  (with the latest versions of all packages) on an
 FC6 32-bit system. When I try to install the rgl package, compilation
 fails:
 
  install.packages(rgl)
 --- Please select a CRAN mirror for use in this session ---
 Loading Tcl/Tk interface ... done
 trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/rgl_0.70.tar.gz'
 Content type 'application/x-gzip' length 705556 bytes
 opened URL
 ==
 downloaded 689Kb
 
 * Installing *source* package 'rgl' ...
 checking for gcc... gcc
 checking for C compiler default output file name... a.out
 checking whether the C compiler works... yes
 checking whether we are cross compiling... no
 checking for suffix of executables... 
 checking for suffix of object files... o
 checking whether we are using the GNU C compiler... yes
 checking whether gcc accepts -g... yes
 checking for gcc option to accept ANSI C... none needed
 checking how to run the C preprocessor... gcc -E
 checking for X... libraries , headers 
 checking for libpng-config... yes
 configure: using libpng-config
 configure: using libpng dynamic linkage
 configure: creating ./config.status
 config.status: creating src/Makevars
 ** libs
 g++ -I/usr/lib/R/include -I/usr/lib/R/include -I -DHAVE_PNG_H
 -I/usr/include/libpng12 -Iext -I/usr/local/include-fpic  -O2 -g
 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
 --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
 -fasynchronous-unwind-tables -c api.cpp -o api.o
 In file included from glgui.hpp:9,
  from gui.hpp:11,
  from rglview.h:10,
  from Device.hpp:11,
  from DeviceManager.hpp:9,
  from api.cpp:14:
 opengl.hpp:24:20: error: GL/glu.h: No such file or directory
 Disposable.hpp:13: warning: ___struct IDisposeListener___ has virtual
 functions but non-virtual destructor
 types.h:77: warning: ___class DestroyHandler___ has virtual functions but
 non-virtual destructor
 gui.hpp:56: warning: ___class gui::WindowImpl___ has virtual functions but
 non-virtual destructor
 gui.hpp:90: warning: ___class gui::GUIFactory___ has virtual functions but
 non-virtual destructor
 pixmap.h:39: warning: ___class PixmapFormat___ has virtual functions but
 non-virtual destructor
 api.cpp: In function ___void rgl_user2window(int*, int*, double*, double*,
 double*, double*, int*)___:
 api.cpp:764: error: ___gluProject___ was not declared in this scope
 api.cpp: In function ___void rgl_window2user(int*, int*, double*, double*,
 double*, double*, int*)___:
 api.cpp:792: error: ___gluUnProject___ was not declared in this scope
 make: *** [api.o] Error 1
 chmod: cannot access `/usr/lib/R/library/rgl/libs/*': No such file or
 directory
 ERROR: compilation failed for package 'rgl'
 ** Removing '/usr/lib/R/library/rgl'
 
 The downloaded packages are in
 /tmp/RtmpJY8uNp/downloaded_packages
 Warning message:
 installation of package 'rgl' had non-zero exit status in:
 install.packages(rgl) 
 
 I was able to install this on an 64-bit system running FC4 and R 2.4.1.
 
 Any ideas on why it fails on FC6?
 
 Rick 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
 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] Installing Package rgl - Compilation Fails

2007-02-19 Thread Prof Brian Ripley

You are missing the OpenGLU headers.  On FC5 they are in mesa-libGLU-devel

From the README:


REQUIREMENTS

Windowing System (osx/carbon, unix/x11 or win32)
OpenGL Library
OpenGL Utility Library (GLU)


On Mon, 19 Feb 2007, Rick Bilonick wrote:


I'm running  R 2.4.1  (with the latest versions of all packages) on an
FC6 32-bit system. When I try to install the rgl package, compilation
fails:


install.packages(rgl)

--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/rgl_0.70.tar.gz'
Content type 'application/x-gzip' length 705556 bytes
opened URL
==
downloaded 689Kb

* Installing *source* package 'rgl' ...
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for X... libraries , headers
checking for libpng-config... yes
configure: using libpng-config
configure: using libpng dynamic linkage
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -I/usr/lib/R/include -I/usr/lib/R/include -I -DHAVE_PNG_H
-I/usr/include/libpng12 -Iext -I/usr/local/include-fpic  -O2 -g
-pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables -c api.cpp -o api.o
In file included from glgui.hpp:9,
from gui.hpp:11,
from rglview.h:10,
from Device.hpp:11,
from DeviceManager.hpp:9,
from api.cpp:14:
opengl.hpp:24:20: error: GL/glu.h: No such file or directory
Disposable.hpp:13: warning: ÿÿstruct IDisposeListenerÿÿ has virtual
functions but non-virtual destructor
types.h:77: warning: ÿÿclass DestroyHandlerÿÿ has virtual functions but
non-virtual destructor
gui.hpp:56: warning: ÿÿclass gui::WindowImplÿÿ has virtual functions but
non-virtual destructor
gui.hpp:90: warning: ÿÿclass gui::GUIFactoryÿÿ has virtual functions but
non-virtual destructor
pixmap.h:39: warning: ÿÿclass PixmapFormatÿÿ has virtual functions but
non-virtual destructor
api.cpp: In function ÿÿvoid rgl_user2window(int*, int*, double*, double*,
double*, double*, int*)ÿÿ:
api.cpp:764: error: ÿÿgluProjectÿÿ was not declared in this scope
api.cpp: In function ÿÿvoid rgl_window2user(int*, int*, double*, double*,
double*, double*, int*)ÿÿ:
api.cpp:792: error: ÿÿgluUnProjectÿÿ was not declared in this scope
make: *** [api.o] Error 1
chmod: cannot access `/usr/lib/R/library/rgl/libs/*': No such file or
directory
ERROR: compilation failed for package 'rgl'
** Removing '/usr/lib/R/library/rgl'

The downloaded packages are in
   /tmp/RtmpJY8uNp/downloaded_packages
Warning message:
installation of package 'rgl' had non-zero exit status in:
install.packages(rgl)

I was able to install this on an 64-bit system running FC4 and R 2.4.1.

Any ideas on why it fails on FC6?

Rick 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
and provide commented, minimal, self-contained, reproducible code.



--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] memory management uestion

2007-02-19 Thread Charles C. Berry
On Mon, 19 Feb 2007, Federico Calboli wrote:

 Hi All,

 I would like to ask the following.

 I have an array of data in an objetct, let's say X.

 I need to use a for loop on the elements of one or more columns of X and I am
 having a debate with a colleague about the best memory management.


Yez guys should take this fight out into the parking lot. ;-)

Armed with gc(), system.time(), and whatever memory monitoring tools your 
OS'es provide you can pound each other with memory usage and timing stats 
till one of you screams 'uncle' or you both have had enough and decide to 
shake hands and come back inside.



 I believe that if I do:

 col1 = X[,1]
 col2 = X[,2]
 ...
 colx = X[,x]


 and then

 for(i in whatever){
 do something using col1[i], col2[i] ... colx[i]
 }

 my memory management is better that doing:

 for(i in whatever){
 do something using X[i,1], X[i,2] ... X[,x]
 }


Whoa! You are accessing one ROW at a time.

Either way this will tangle up your cache if you have many rows and 
columns in your orignal data.

You might do better to do

Y - t( X ) ### use '-' !

for (i in whatever ){
do something using Y[ , i ]
}



 BTW, here I *have to* use a for() loop an no nifty tapply, lapply and family.

 Any comment is welcome.

 Best,

 Fede

 -- 
 Federico C. F. Calboli
 Department of Epidemiology and Public Health
 Imperial College, St Mary's Campus
 Norfolk Place, London W2 1PG

 Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193

 f.calboli [.a.t] imperial.ac.uk
 f.calboli [.a.t] gmail.com

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


Charles C. Berry(858) 534-2098
  Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]   UC San Diego
http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0901

__
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] Installing Package rgl - Compilation Fails

2007-02-19 Thread Rick Bilonick
On Mon, 2007-02-19 at 19:56 +, Oleg Sklyar wrote:
 Check again your error message:
 
 opengl.hpp:24:20: error: GL/glu.h: No such file or directory
 
 you need to install
 
 mesa-libGLU-devel FC6 version is 6.5.1-7
 
 which will provide development files for glut3. Needless to say the 
 above will probably pool some dependencies and (-devel) means it will 
 install *.h files as well. Start your FC package manager and search for 
 GLU, install the above and try again.
 
 Best,
   Oleg
 

I installed a slightly newer version (the one that yum found):

mesa-libGLU-devel-6.5.1-9.fc6

but it still fails (I'm installing as root):

 install.packages(rgl)
--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/rgl_0.70.tar.gz'
Content type 'application/x-gzip' length 705556 bytes
opened URL


Deleted a bunch of lines



Disposable.hpp:13: warning: ‘struct IDisposeListener’ has virtual
functions but non-virtual destructor
gui.hpp:56: warning: ‘class gui::WindowImpl’ has virtual functions but
non-virtual destructor
gui.hpp:90: warning: ‘class gui::GUIFactory’ has virtual functions but
non-virtual destructor
g++ -shared -L/usr/local/lib -o rgl.so api.o Background.o BBoxDeco.o
Color.o device.o devicemanager.o Disposable.o FaceSet.o fps.o geom.o
gl2ps.o glgui.o gui.o Light.o LineSet.o LineStripSet.o Material.o math.o
osxgui.o osxlib.o par3d.o pixmap.o PointSet.o PrimitiveSet.o QuadSet.o
RenderContext.o render.o rglview.o scene.o select.o Shape.o SphereMesh.o
SphereSet.o SpriteSet.o String.o Surface.o TextSet.o Texture.o
TriangleSet.o Viewpoint.o win32gui.o win32lib.o x11gui.o x11lib.o -L
-lX11 -lXext -lGL -lGLU -L/usr/lib -lpng12  -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -lXext
collect2: ld returned 1 exit status
make: *** [rgl.so] Error 1
chmod: cannot access `/usr/lib/R/library/rgl/libs/*': No such file or
directory
ERROR: compilation failed for package 'rgl'
** Removing '/usr/lib/R/library/rgl'

The downloaded packages are in
/tmp/RtmpMc94yC/downloaded_packages
Warning message:
installation of package 'rgl' had non-zero exit status in:
install.packages(rgl) 


Rick 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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] memory management uestion

2007-02-19 Thread Federico Calboli
Charles C. Berry wrote:

 Whoa! You are accessing one ROW at a time.
 
 Either way this will tangle up your cache if you have many rows and 
 columns in your orignal data.
 
 You might do better to do
 
 Y - t( X ) ### use '-' !
 
 for (i in whatever ){
 do something using Y[ , i ]
 }

My question is NOT how to write the fastest code, it is whether dummy variables 
(for lack of better words) make the memory management better, i.e. faster, or 
not.

Best,

Fede

-- 
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St Mary's Campus
Norfolk Place, London W2 1PG

Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

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


Re: [R] Installing Package rgl - Compilation Fails

2007-02-19 Thread Ranjan Maitra
The error is different now. It now cannot find Xext library. Do a yum search on 
this and install that.

yum provides libXext

which will give you the package Xext which needs to be installed.

You may also need to install the libXext-devel.i386 package.

HTH.
Ranjan



On Mon, 19 Feb 2007 16:02:09 -0500 Rick Bilonick [EMAIL PROTECTED] wrote:

 On Mon, 2007-02-19 at 19:56 +, Oleg Sklyar wrote:
  Check again your error message:
  
  opengl.hpp:24:20: error: GL/glu.h: No such file or directory
  
  you need to install
  
  mesa-libGLU-devel FC6 version is 6.5.1-7
  
  which will provide development files for glut3. Needless to say the 
  above will probably pool some dependencies and (-devel) means it will 
  install *.h files as well. Start your FC package manager and search for 
  GLU, install the above and try again.
  
  Best,
Oleg
  
 
 I installed a slightly newer version (the one that yum found):
 
 mesa-libGLU-devel-6.5.1-9.fc6
 
 but it still fails (I'm installing as root):
 
  install.packages(rgl)
 --- Please select a CRAN mirror for use in this session ---
 Loading Tcl/Tk interface ... done
 trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/rgl_0.70.tar.gz'
 Content type 'application/x-gzip' length 705556 bytes
 opened URL
 
 
 Deleted a bunch of lines
 
 
 
 Disposable.hpp:13: warning: ___struct IDisposeListener___ has virtual
 functions but non-virtual destructor
 gui.hpp:56: warning: ___class gui::WindowImpl___ has virtual functions but
 non-virtual destructor
 gui.hpp:90: warning: ___class gui::GUIFactory___ has virtual functions but
 non-virtual destructor
 g++ -shared -L/usr/local/lib -o rgl.so api.o Background.o BBoxDeco.o
 Color.o device.o devicemanager.o Disposable.o FaceSet.o fps.o geom.o
 gl2ps.o glgui.o gui.o Light.o LineSet.o LineStripSet.o Material.o math.o
 osxgui.o osxlib.o par3d.o pixmap.o PointSet.o PrimitiveSet.o QuadSet.o
 RenderContext.o render.o rglview.o scene.o select.o Shape.o SphereMesh.o
 SphereSet.o SpriteSet.o String.o Surface.o TextSet.o Texture.o
 TriangleSet.o Viewpoint.o win32gui.o win32lib.o x11gui.o x11lib.o -L
 -lX11 -lXext -lGL -lGLU -L/usr/lib -lpng12  -L/usr/lib/R/lib -lR
 /usr/bin/ld: cannot find -lXext
 collect2: ld returned 1 exit status
 make: *** [rgl.so] Error 1
 chmod: cannot access `/usr/lib/R/library/rgl/libs/*': No such file or
 directory
 ERROR: compilation failed for package 'rgl'
 ** Removing '/usr/lib/R/library/rgl'
 
 The downloaded packages are in
 /tmp/RtmpMc94yC/downloaded_packages
 Warning message:
 installation of package 'rgl' had non-zero exit status in:
 install.packages(rgl) 
 
 
 Rick 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
 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] Installing Rmpi on FC5 with lam

2007-02-19 Thread Thomas Mangold
After several trial and error attempts, I managed to install the Rmpi 
package without error on my Linux machine, running Fedora 5.
I installed lam-7.1.2, lam-devel-7.1.2 and R-2.4.1, R-devel-2.4.1
The Package Rmpi_5.0-3.tar.gz, I installed once from within R and once 
from the command line to make sure, I link the right libraries:
R CMD INSTALL Rmpi_5.0-3.tar.gz --configure-args=--with-mpi=/usr/lib/lam

Rmpi is correctly installed in $R_HOME/library/Rmpi.
However on compiling, I get strange warnings:

internal.c: In function ‘mystrcpy’:
internal.c:64: warning: operation on ‘i’ may be undefined
internal.c: In function ‘mpitype’:
internal.c:43: warning: ‘datatype’ may be used uninitialized in this 
function
Rmpi.c: In function ‘mpi_testany’:
Rmpi.c:1315: warning: unused variable ‘index’
Rmpi.c: In function ‘mpi_get_count’:
Rmpi.c:768: warning: ‘datatype’ may be used uninitialized in this function
Rmpi.c: In function ‘mpi_allreduce’:
Rmpi.c:672: warning: ‘op’ may be used uninitialized in this function
Rmpi.c:673: warning: ‘sexp_recv’ may be used uninitialized in this function
Rmpi.c: In function ‘mpi_reduce’:
Rmpi.c:586: warning: ‘op’ may be used uninitialized in this function
Rmpi.c:587: warning: ‘sexp_recv’ may be used uninitialized in this function
Rmpi.c: In function ‘mpi_scatterv’:
Rmpi.c:320: warning: ‘displs’ may be used uninitialized in this function
Rmpi.c: In function ‘mpi_gatherv’:
Rmpi.c:225: warning: ‘displs’ may be used uninitialized in this function

On loading the library occurs the following error:
  library(Rmpi)
Error in dyn.load(x, as.logical(local), as.logical(now)) :
unable to load shared library '/usr/lib/R/library/Rmpi/libs/Rmpi.so':
/usr/lib/R/library/Rmpi/libs/Rmpi.so: undefined symbol: lam_mpi_double
Error in library(Rmpi) : .First.lib failed for 'Rmpi'
Error in dyn.unload(x) : dynamic/shared library 
'/usr/lib/R/library/Rmpi/libs/Rmpi.so' was not loaded

I'm running kernel 2.6.18-1.2257.fc5smp on a i686 machine

Thank you for any ideas.

__
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] random effect nested within fixed effects (binomial lmer)

2007-02-19 Thread Daniel Ezra Johnson
I have a large dataset where each Subject answered seven similar  
Items, which are binary yes/no questions. So I've always used Subject  
and Item random effects in my models, fit with lmer(), e.g.:
model-lmer(Response~Race+Gender+...+(1|Subject_ID)+(1| 
Item_ID),data,binomial)

But I recently realized something. Most of the variables that I've  
tested as fixed effects are properties of the subject (e.g. Race,  
Gender, etc.). Is it correct to be using a random effect Subject that  
is nested within (partially-crossed) fixed effects like Gender and  
Race? - I hope I'm using the terminology correctly.

So today, I accidentally ran a model without the Subject random  
effect, and the fixed effect of Race was significant for the first  
time. With the Subject effect included, Race is not significant. This  
also happens if Race is treated as random, though the effect is  
smaller then. The following table shows the various pairs of model  
fits, from somers2(), and the p-values given by anova().

Somers' Dxy
p from anova()  random Subject term no 
Subject term
Somers' Dxy

no Race term0.8487  
0.4096
vs. 
0.300.00064
fixed Race   term   0.8483  
0.4332

no Race term0.8487  
0.4096
vs. 
0.960.0047
random Race term0.8486  
0.4334

Adding the Subject effect always highly improves the fit of the  
model, so I would certainly want to keep it. But if there is a real  
effect of Race, why does adding the Subject effect make it go away?

I thought the Subject random effect would be a sort of residual  
subject effect, once everything else was accounted for by other  
subject properties (some of which do remain significant with Subject  
in there as well).

This must be a common scenario, since people are interested in  
inherent properties of subjects, yet also try to model and 'factor  
out' the random individual variation between people. I'm simply not  
very familiar with the relevant literature, and I hope someone here  
can help.

Thank you,
Daniel

P.S. Also, why does treating Race as a random factor have (very  
slightly) more of an effect on the Somers' Dxy, while judging by anova 
() it's more significant as a fixed factor?
[[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.


Re: [R] Installing Rmpi on FC5 with lam

2007-02-19 Thread Prof Brian Ripley
Is /usr/lib/lam in your ld search path?  This sort of message usually 
means a shared library cannot be found.  You do need lam-libs as well 
according to yum.

R CMD ldd /usr/lib/R/library/Rmpi/libs/Rmpi.so
/sbin/ldconfig -p | grep /usr/lib/lam

might be illuminating.

There are various problems with the configure scripts in Rmpi for Fedora 
layouts that the maintainer is looking into: it fails completely on x86_64 
systems.  I don't understand how your line worked: that looks for -lmpi in
/usr/lib/lam/lib/libmpi.a and that is not where FC5 puts the libraries.


On Mon, 19 Feb 2007, Thomas Mangold wrote:

 After several trial and error attempts, I managed to install the Rmpi
 package without error on my Linux machine, running Fedora 5.
 I installed lam-7.1.2, lam-devel-7.1.2 and R-2.4.1, R-devel-2.4.1
 The Package Rmpi_5.0-3.tar.gz, I installed once from within R and once
 from the command line to make sure, I link the right libraries:
 R CMD INSTALL Rmpi_5.0-3.tar.gz --configure-args=--with-mpi=/usr/lib/lam

 Rmpi is correctly installed in $R_HOME/library/Rmpi.
 However on compiling, I get strange warnings:

 internal.c: In function ?mystrcpy?:
 internal.c:64: warning: operation on ?i? may be undefined
 internal.c: In function ?mpitype?:
 internal.c:43: warning: ?datatype? may be used uninitialized in this
 function
 Rmpi.c: In function ?mpi_testany?:
 Rmpi.c:1315: warning: unused variable ?index?
 Rmpi.c: In function ?mpi_get_count?:
 Rmpi.c:768: warning: ?datatype? may be used uninitialized in this function
 Rmpi.c: In function ?mpi_allreduce?:
 Rmpi.c:672: warning: ?op? may be used uninitialized in this function
 Rmpi.c:673: warning: ?sexp_recv? may be used uninitialized in this function
 Rmpi.c: In function ?mpi_reduce?:
 Rmpi.c:586: warning: ?op? may be used uninitialized in this function
 Rmpi.c:587: warning: ?sexp_recv? may be used uninitialized in this function
 Rmpi.c: In function ?mpi_scatterv?:
 Rmpi.c:320: warning: ?displs? may be used uninitialized in this function
 Rmpi.c: In function ?mpi_gatherv?:
 Rmpi.c:225: warning: ?displs? may be used uninitialized in this function

 On loading the library occurs the following error:
  library(Rmpi)
 Error in dyn.load(x, as.logical(local), as.logical(now)) :
 unable to load shared library '/usr/lib/R/library/Rmpi/libs/Rmpi.so':
 /usr/lib/R/library/Rmpi/libs/Rmpi.so: undefined symbol: lam_mpi_double
 Error in library(Rmpi) : .First.lib failed for 'Rmpi'
 Error in dyn.unload(x) : dynamic/shared library
 '/usr/lib/R/library/Rmpi/libs/Rmpi.so' was not loaded

 I'm running kernel 2.6.18-1.2257.fc5smp on a i686 machine

 Thank you for any ideas.

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


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

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


Re: [R] RSNPper SNPinfo and making it handle a vector

2007-02-19 Thread David Duffy
Farrel Buchinsky [EMAIL PROTECTED] wrote:

 I tried biomaRt
 
 library(biomaRt)
 ensnp = useMart(snp, dataset = hsapiens_snp)
 snp = getSNP(chromosome = 17, start = 73649033, end = 73679033, mart = 
 ensnp)
 show(snp)
 
 Gave me a nice table but it did not seem to permit starting from the point 
 of knowing the SNP and entering a list of rs##. I guess I could always 
 fudge around. But it does not provide the one-stop I was looking for.

Try, for example,

getBM(attributes=c(refsnp_id,chr_name,chrom_start,
ensembl_external_gene_id,allele,
validated),
   filter=refsnp,
   values=(refsnp=c(rs17166282,rs3897937)), mart=ensnp)


-- 
| David Duffy (MBBS PhD) ,-_|\
| email: [EMAIL PROTECTED]  ph: INT+61+7+3362-0217 fax: -0101  / *
| Epidemiology Unit, Queensland Institute of Medical Research   \_,-._/
| 300 Herston Rd, Brisbane, Queensland 4029, Australia  GPG 4D0B994A v

__
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] bootstrapping Levene's test

2007-02-19 Thread parsons
Hello all,

I am low down on the learning curve of R but so far I have had little  
trouble using most of the packages. However, recently I have run into  
a wall when it comes to bootstrapping a Levene's test (from the car  
package) and thought you might be able to help. I have not been able  
to find R examples for the boot package where the test statistic  
specifically uses a grouping variable (or at least a simple example  
with this condition). I would like to do a  non-parametric bootstrap  
to eventually get 95% confidence intervals using the boot.ci command.  
I have included the coding I have tried on a simple data set below. If  
anyone could provide some help, specifically with regards to how the  
statistic arguement should be set up in the boot package, it would  
be greatly appreciated.

 library(boot)
 library(car)
 data-c(2,45,555,1,77,1,2,1,2,1)
 group-c(1,1,1,1,1,2,2,2,2,2)
 levene.test(data,group)
Levene's Test for Homogeneity of Variance
   Df F value Pr(F)
group  1  1.6929 0.2294
8
 stat-function(a){levene.test(a,group)}
 trial1-boot(data,statistic,100)
Error in statistic(data, original, ...) : unused argument(s) ( ...)

Best regards,
Kevin

__
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] tree()

2007-02-19 Thread stephenc
Hi
 
I am trying to use tree() to classify movements in a futures contract.  My
data is like this:
 
 diff  dip  dim adx
1  0100.08650.100.0
2  0 93.185402044.5455 93.18540
3  0 90.309951549.1169 90.30995
4  1 85.22030 927.0419 85.22030
5  1 85.36084 785.6480 85.36084
6  0 85.72627 663.3814 85.72627
7  0 78.06721 500.1113 78.06721
8  1 69.59398 376.7558 69.59398
9  1 71.15429 307.4533 71.15429
10 1 71.81023 280.6238 71.81023
 
plus another 6000 lines
 
The cpus example works fine and I am trying this:
 
tree.model - tree(as.factor(indi$diff) ~ indi$dim + indi$dip + indi$adx,
indi[1:4000,])
tree.model
summary(tree.model)
plot(tree.model);  text(tree.model)
 
but I get this:
 tree.model - tree(as.factor(indi$diff) ~ indi$dim + indi$dip + indi$adx,
indi[1:4000,])
 tree.model
node), split, n, deviance, yval, (yprob)
  * denotes terminal node
1) root 6023 8346 0 ( 0.513 0.487 ) *
 summary(tree.model)
Classification tree:
tree(formula = as.factor(indi$diff) ~ indi$dim + indi$dip + indi$adx, 
data = indi[1:4000, ])
Variables actually used in tree construction:
character(0)
Number of terminal nodes:  1 
Residual mean deviance:  1.386 = 8346 / 6022 
Misclassification error rate: 0.487 = 2933 / 6023 
 plot(tree.model);  text(tree.model)
Error in plot.tree(tree.model) : cannot plot singlenode tree
 
I'm not getting any sort of tree formed.
I wondered if anyone could point me in the right direction.
Thanks.
Stephen Choularton
 
 
 
 
 
 
 
 

[[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] How to avoid sort of x values in dotplot?

2007-02-19 Thread Rene Braeckman
I am trying to avoid that dotplot sorts my x-values. They are in the correct
order in the data.frame and the connections between the x-y values follows
this order, but the placement of the x-values on the x-axis is re-ordered.
In the following example, the order should be d1, d8 and d15. However,
this script places d8 at the highest x position. Any help is appreciated.
 
Subj - rep(1:4,each=3)
Time - rep(c(d1,d8,d15),4)
Conc - 1:12
df - data.frame(Subj,Time,Conc)
dotplot(Conc ~ Time | Subj,
   data = df,
   layout = c(2,2),
   type=b)
 
Thanks,
-Rene
Irvine, CA, USA

__
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] How to avoid sort of x values in dotplot?

2007-02-19 Thread Bernd Weiss
Am 19 Feb 2007 um 20:28 hat Rene Braeckman geschrieben:

From:   Rene Braeckman [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Date sent:  Mon, 19 Feb 2007 20:28:01 -0800
Subject:[R] How to avoid sort of x values in dotplot?

 I am trying to avoid that dotplot sorts my x-values. They are in the
 correct order in the data.frame and the connections between the x-y
 values follows this order, but the placement of the x-values on the
 x-axis is re-ordered. In the following example, the order should be
 d1, d8 and d15. However, this script places d8 at the highest
 x position. Any help is appreciated.
 
 Subj - rep(1:4,each=3)
 Time - rep(c(d1,d8,d15),4)
 Conc - 1:12
 df - data.frame(Subj,Time,Conc)
 dotplot(Conc ~ Time | Subj,
data = df,
layout = c(2,2),
type=b)
 

library(lattice)
Subj - rep(1:4,each=3)
Time - rep(c(d1,d8,d15),4)
Conc - 1:12
df - data.frame(Subj,Time,Conc)
df$Time - factor(df$Time,levels=df$Time)
dotplot(Conc ~ Time | Subj,
   data = df,
   layout = c(2,2),
   type=b)

HTH,

Bernd

__
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] categorical column to numeric column

2007-02-19 Thread Petr Pikal
Hi

On 19 Feb 2007 at 9:11, Duncan Murdoch wrote:

Date sent:  Mon, 19 Feb 2007 09:11:52 -0500
From:   Duncan Murdoch [EMAIL PROTECTED]
To: Shubha Vishwanath Karanth [EMAIL PROTECTED]
Copies to:  r-help R-help@stat.math.ethz.ch
Subject:Re: [R] categorical column to numeric column

 On 2/19/2007 8:36 AM, Shubha Vishwanath Karanth wrote:
  Hi R,
  
   
  
  Let 'dd' be a data frame given as:
  
   
  
  dd=data.frame(aa=c(a,a,b,a,b,b),bb=c(1,1,1,2,3,4))
  
   
  
  Now I want to create a column 'g' such that if dd$aa=a then dd$g=1
  else dd$g= -1 .
  
   
  
  So, I gave the below syntax:
  
   
  
  if((dd$aa)==a) dd$g=1 else dd$g= -1
 
 if() looks at just the first entry; it's designed for flow of control
 rather than vectorized calculations.  You want ifelse():
 
 ifelse( dd$aa == a, 1, -1)

Another approach is to use the fact that logical vector can be 
interpreted as 1 and 0 vector

(dd$a==a)*2-1

HTH
Petr


 
 Duncan Murdoch
   
  
  But I get the error message as:
  
  Warning message: 
  
  the condition has length  1 and only the first element will be used
  in: if ((dd$aa) == a) dd$g = 1 else dd$g = -1 
  
   
  
  and dd=
  
   
  
  dd
  
aa bb g
  
  1  a  1 1
  
  2  a  1 1
  
  3  b  1 1
  
  4  a  2 1
  
  5  b  3 1
  
  6  b  4 1
  
  
  
   
  
  Please let me know what is the error I am doing?
  
   
  
   
  
   
  
   
  
  
  [[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.

Petr Pikal
[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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Any packages for conducting AHP( Analytic Hierarchy Process) data

2007-02-19 Thread Kum-Hoe Hwang
I have so far had the only return to my query from Steve Dutky.

I am familir with matrix eigen value and vector manipulation.
If you have anything to share with me, it would be good chance for me
to follow up the AHP-related thing. Furthermore, I am good at
statistics fairely.

Thanks for your comments,

Kum-Hoe Hwang, Ph.D.

On 2/19/07, Steve Dutky [EMAIL PROTECTED] wrote:
 Hi, Kum-Hoe Hwang,

 Did you get any help for your query?

 I have used R/Splus for a number of years, primarily for isolating anomalies
 with TCP/IP network traffic.

 I have become somewhat adept at importing data from a variety of sources and
 formats into R.

 I first became interested in AHP some time back, but have never gotten
 around to working with it under R.

 I probably cannot help you much with the analysis of AHP data.   If your
 main problem involves casting your AHP data into a data.frame, I will be
 happy to assist you as far my time and understanding allow.

 Have you reviewed the packages for handling eigen values/vectors?

 Thanks, Steve Dutky

 400 Domer Ave
 Takoma Park, MD 20912 US

 Message: 101
 Date: Wed, 14 Feb 2007 16:56:11 +0900
 From: Kum-Hoe Hwang [EMAIL PROTECTED]
 Subject: [R] Any packages for conducting AHP( Analytic Hierarchy
 Process) data
 To: R Help mail address r-help@stat.math.ethz.ch
 Message-ID:
 [EMAIL PROTECTED]
 Content-Type: text/plain

 Hi, R Lovers!

 I have some survey data. I'd like to run R or R packages for processing data
 inputted
 from AHP(Analytic Hierarchy Process) survey.

 Are there any R packages or subsititues for running data from AHP survey.

 Thanks in advance,



-- 
Kum-Hoe Hwang, Ph.D.Phone : 82-31-250-3516Email : [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
and provide commented, minimal, self-contained, reproducible code.