Re: [R] how to recover a list structure

2009-02-21 Thread jim holtman
Here is one way that might work.

x <- list(a=runif(10), b=runif(30), c=runif(25))
# unlist and then construct a factor to put them back together
x.u <- unlist(x)
x.f <- unlist(mapply(rep, names(x), sapply(x, length)))
# find the lowest 5 values and set to -1
x.u[order(x.u)[1:5]] <- -1
# put back together
split(x.u, x.f)


On Sat, Feb 21, 2009 at 11:51 PM,   wrote:
> I am experiencing some problems at working with lists at high level.
> In the following "coef" contains the original DWT coefficients organized in a 
> list.
> Thorugh applying the following two commands:
>  coef.abs <- lapply(unlist(coef,recursive=FALSE,use.names =TRUE),abs)
>  coef.abs.sorted <- sort(unlist(coef.abs),decreasing=TRUE)
> I get vector "coef.abs.sorted" containing the coefficients absolute value 
> ordered by decreasing magnitude, whose first 10 elements I set to zero after 
> applying an iterative math formula (telling me how many coefficient values to 
> spare).
> My problem is setting to zero the correspondent coefficients in the original 
> "coef" list so as to reconstruct the signal from the depleted coefficients 
> set, given that the above operations have erased the list structure. I can 
> get the labels of the coefficients that have to be zeroed ... but the names 
> of vector  "coef.abs.sorted" elements differes from the original "coef" list 
> elements as shown in the following:
>  > names(coef.abs.sorted[1:10])
>  [1] "d6.d6(0)"  "d5.d5(2)"  "d5.d5(0)"  "d4.d4(2)"  "d5.d5(1)"  "d4.d4(1)"  
> "d4.d4(6)"  "d4.d4(5)"  "d4.d4(3)"
> [10] "d3.d3(12)"
> I wonder if there exists a high level command to set to zero respectively the 
> coefficients in list "coef":
> - Level=6, Oscillation-Number=0
> - Level=5, Oscillation-Number=0,1,2
> - Level=4, Oscillation-Number=1,2,3,5.6
> - Level=3, Oscillation-Number=12
>
>
>> coef
> $d1
>d1(0) d1(1) d1(2) d1(3) d1(4) 
> d1(5) d1(6) d1(7)
>  1.075111e-02 -4.777441e-03 -2.775026e-03  2.011722e-03 -2.376611e-02 
> -1.574422e-03 -2.810372e-02  8.542393e-03
>d1(8) d1(9)d1(10)d1(11)d1(12)
> d1(13)d1(14)d1(15)
> -1.754845e-02 -7.363856e-04  3.123922e-03  1.053743e-02 -1.014095e-02  
> 1.059210e-02 -4.152311e-03 -7.320749e-04
>   d1(16)d1(17)d1(18)d1(19)d1(20)
> d1(21)d1(22)d1(23)
> -3.680064e-03  5.620248e-03 -2.251741e-03 -1.454674e-02  1.891275e-02  
> 2.092009e-03 -1.286729e-02  9.037282e-03
>   d1(24)d1(25)d1(26)d1(27)d1(28)
> d1(29)d1(30)d1(31)
> -1.027137e-02  1.014230e-02 -2.175260e-03 -1.689383e-03 -2.016800e-03  
> 3.984632e-03 -1.563781e-03 -3.801979e-03
>   d1(32)d1(33)d1(34)d1(35)d1(36)
> d1(37)d1(38)d1(39)
>  6.976144e-04  1.048419e-03 -1.319865e-02 -8.368520e-04  6.618890e-03 
> -5.835673e-03  8.721318e-03  2.018621e-02
>   d1(40)d1(41)d1(42)d1(43)d1(44)
> d1(45)d1(46)d1(47)
> -3.329934e-03 -4.823901e-03  2.957486e-02 -2.887600e-02  2.500062e-02 
> -2.207839e-02  1.516034e-02  4.328945e-05
>   d1(48)d1(49)d1(50)d1(51)d1(52)
> d1(53)d1(54)d1(55)
>  1.605634e-02 -2.360298e-02  7.875788e-03 -4.129065e-03 -1.014460e-02 
> -2.676679e-03 -9.953614e-03 -8.844977e-03
>   d1(56)d1(57)d1(58)d1(59)
> -2.141513e-02 -7.405836e-03 -5.078857e-03  8.480675e-04
>
> $d2
>   d2(0)d2(1)d2(2)d2(3)d2(4)d2(5)  
>   d2(6)d2(7)d2(8)
>  0.033393680  0.015767682 -0.006008297  0.016899336  0.006661543  0.005297962 
> -0.005782728 -0.009358879 -0.012128449
>   d2(9)   d2(10)   d2(11)   d2(12)   d2(13)   d2(14)  
>  d2(15)   d2(16)   d2(17)
> -0.014097771  0.003439004 -0.010154074  0.031203264 -0.057290615  0.004552577 
>  0.061358997 -0.040730889  0.004064522
>  d2(18)   d2(19)   d2(20)   d2(21)   d2(22)   d2(23)  
>  d2(24)   d2(25)   d2(26)
> -0.007208508  0.010426952  0.003855540 -0.011492580  0.035028591  0.029604957 
> -0.020069126 -0.018983905 -0.033710992
>  d2(27)   d2(28)   d2(29)
>  0.035848240 -0.014716622  0.008372893
>
> $d3
>   d3(0)d3(1)d3(2)d3(3)d3(4)d3(5)  
>   d3(6)d3(7)d3(8)
>  0.020437693 -0.023658475  0.033448175  0.009689787  0.024750901  0.040022643 
>  0.016532575 -0.035730498 -0.048828011
>   d3(9)   d3(10)   d3(11)   d3(12)   d3(13)   d3(14)
> -0.012357469 -0.042282285  0.010908775 -0.061393069  0.058384786 -0.036842060
>
> $d4
>  d4(0)   d4(1)   d4(2)   d4(3)   d4(4)   d4(5)   
> d4(6)
>  0.05419644 -0.23596007  0.84412709  0.06639234  0.02718491  0.15101792 
> -0.18101631
>

Re: [R] How to reshape this data frame from long to wide ?

2009-02-21 Thread Gabor Grothendieck
Not completely clear what you want (it does not appear to be a
conventional reshape) but try this:

> m <- matrix(c("A", "A", "B", "1", "2", "3"), 3, 2)
> structure(do.call(cbind, lapply(tapply(m[,2], m[,1], c), ts)), tsp = NULL, 
> class = NULL)
 A   B
[1,] "1" "3"
[2,] "2" NA


On Sat, Feb 21, 2009 at 10:23 PM, Daren Tan  wrote:
> I tried cast and melt in reshape package, but still can't convert this data
> frame m
>
> m
> [,1] [,2]
> [1,] "A"  "1"
> [2,] "A"  "2"
> [3,] "B"  "3"
> to this form.
>
> m1
> [,1] [,2]
> [1,] "A"  "B"
> [2,] "1"  "3"
> [3,] "2"  NA
> Please help.
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


[R] how to recover a list structure

2009-02-21 Thread mauede
I am experiencing some problems at working with lists at high level. 
In the following "coef" contains the original DWT coefficients organized in a 
list. 
Thorugh applying the following two commands:
  coef.abs <- lapply(unlist(coef,recursive=FALSE,use.names =TRUE),abs)
  coef.abs.sorted <- sort(unlist(coef.abs),decreasing=TRUE)
I get vector "coef.abs.sorted" containing the coefficients absolute value 
ordered by decreasing magnitude, whose first 10 elements I set to zero after 
applying an iterative math formula (telling me how many coefficient values to 
spare).
My problem is setting to zero the correspondent coefficients in the original 
"coef" list so as to reconstruct the signal from the depleted coefficients set, 
given that the above operations have erased the list structure. I can get the 
labels of the coefficients that have to be zeroed ... but the names of vector  
"coef.abs.sorted" elements differes from the original "coef" list elements as 
shown in the following:
  > names(coef.abs.sorted[1:10]) 
 [1] "d6.d6(0)"  "d5.d5(2)"  "d5.d5(0)"  "d4.d4(2)"  "d5.d5(1)"  "d4.d4(1)"  
"d4.d4(6)"  "d4.d4(5)"  "d4.d4(3)" 
[10] "d3.d3(12)"
I wonder if there exists a high level command to set to zero respectively the 
coefficients in list "coef":
- Level=6, Oscillation-Number=0
- Level=5, Oscillation-Number=0,1,2
- Level=4, Oscillation-Number=1,2,3,5.6
- Level=3, Oscillation-Number=12
 
 
> coef
$d1
d1(0) d1(1) d1(2) d1(3) d1(4) 
d1(5) d1(6) d1(7) 
 1.075111e-02 -4.777441e-03 -2.775026e-03  2.011722e-03 -2.376611e-02 
-1.574422e-03 -2.810372e-02  8.542393e-03 
d1(8) d1(9)d1(10)d1(11)d1(12)
d1(13)d1(14)d1(15) 
-1.754845e-02 -7.363856e-04  3.123922e-03  1.053743e-02 -1.014095e-02  
1.059210e-02 -4.152311e-03 -7.320749e-04 
   d1(16)d1(17)d1(18)d1(19)d1(20)
d1(21)d1(22)d1(23) 
-3.680064e-03  5.620248e-03 -2.251741e-03 -1.454674e-02  1.891275e-02  
2.092009e-03 -1.286729e-02  9.037282e-03 
   d1(24)d1(25)d1(26)d1(27)d1(28)
d1(29)d1(30)d1(31) 
-1.027137e-02  1.014230e-02 -2.175260e-03 -1.689383e-03 -2.016800e-03  
3.984632e-03 -1.563781e-03 -3.801979e-03 
   d1(32)d1(33)d1(34)d1(35)d1(36)
d1(37)d1(38)d1(39) 
 6.976144e-04  1.048419e-03 -1.319865e-02 -8.368520e-04  6.618890e-03 
-5.835673e-03  8.721318e-03  2.018621e-02 
   d1(40)d1(41)d1(42)d1(43)d1(44)
d1(45)d1(46)d1(47) 
-3.329934e-03 -4.823901e-03  2.957486e-02 -2.887600e-02  2.500062e-02 
-2.207839e-02  1.516034e-02  4.328945e-05 
   d1(48)d1(49)d1(50)d1(51)d1(52)
d1(53)d1(54)d1(55) 
 1.605634e-02 -2.360298e-02  7.875788e-03 -4.129065e-03 -1.014460e-02 
-2.676679e-03 -9.953614e-03 -8.844977e-03 
   d1(56)d1(57)d1(58)d1(59) 
-2.141513e-02 -7.405836e-03 -5.078857e-03  8.480675e-04 

$d2
   d2(0)d2(1)d2(2)d2(3)d2(4)d2(5)   
 d2(6)d2(7)d2(8) 
 0.033393680  0.015767682 -0.006008297  0.016899336  0.006661543  0.005297962 
-0.005782728 -0.009358879 -0.012128449 
   d2(9)   d2(10)   d2(11)   d2(12)   d2(13)   d2(14)   
d2(15)   d2(16)   d2(17) 
-0.014097771  0.003439004 -0.010154074  0.031203264 -0.057290615  0.004552577  
0.061358997 -0.040730889  0.004064522 
  d2(18)   d2(19)   d2(20)   d2(21)   d2(22)   d2(23)   
d2(24)   d2(25)   d2(26) 
-0.007208508  0.010426952  0.003855540 -0.011492580  0.035028591  0.029604957 
-0.020069126 -0.018983905 -0.033710992 
  d2(27)   d2(28)   d2(29) 
 0.035848240 -0.014716622  0.008372893 

$d3
   d3(0)d3(1)d3(2)d3(3)d3(4)d3(5)   
 d3(6)d3(7)d3(8) 
 0.020437693 -0.023658475  0.033448175  0.009689787  0.024750901  0.040022643  
0.016532575 -0.035730498 -0.048828011 
   d3(9)   d3(10)   d3(11)   d3(12)   d3(13)   d3(14) 
-0.012357469 -0.042282285  0.010908775 -0.061393069  0.058384786 -0.036842060 

$d4
  d4(0)   d4(1)   d4(2)   d4(3)   d4(4)   d4(5)   
d4(6) 
 0.05419644 -0.23596007  0.84412709  0.06639234  0.02718491  0.15101792 
-0.18101631 

$d5
 d5(0)  d5(1)  d5(2) 
 2.3514158 -0.4952582 -2.5589658 

$d6
d6(0) 
-5.643476 


> coef.abs.sorted 
d6.d6(0) d5.d5(2) d5.d5(0) d4.d4(2) d5.d5(1) d4.d4(1)   
  d4.d4(6) d4.d4(5) d4.d4(3) 
0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 0.00e+00 
0.00e+00 0.00e+00 0.00e+00 
   d3.d3(12)d2.d2(15)d3.d3(13)d2.d2(13) d4.d4(0) d3.d3(8)   
 d3.d3(10)d2.d2(16) d3.d3(5) 
0.00e+00

Re: [R] How to reshape this data frame from long to wide ?

2009-02-21 Thread Berwin A Turlach
G'day Darren,

On Sun, 22 Feb 2009 11:23:27 +0800
Daren Tan  wrote:

> I tried cast and melt in reshape package, but still can't convert
> this data frame m
> 
> m
>  [,1] [,2]
> [1,] "A"  "1"
> [2,] "A"  "2"
> [3,] "B"  "3"

from the output, this does not look like a data frame to me but like a
matrix.

> to this form.
> 
> m1
>  [,1] [,2]
> [1,] "A"  "B"
> [2,] "1"  "3"
> [3,] "2"  NA

I don't think that this result can be achieved.  "A" and "B" would
become the column names in the newly created data frame but not be
entries in the data frame themselves.

I presume you are looking for something like:

R> m <- data.frame(var=c("A", "A", "B"), value=c("1", "2", "3"))
R> m
  var value
1   A 1
2   A 2
3   B 3
R> m$id <- c(1,2,1)
R> m
  var value id
1   A 1  1
2   A 2  2
3   B 3  1
R> library(reshape)
R> ( res <- cast(m, id~...) )
  id AB
1  1 13
2  2 2 
R> res[,  !(names(res) %in% "id")]
  AB
1 13
2 2 

HTH.

Cheers,

Berwin

=== Full address =
Berwin A TurlachTel.: +65 6516 4416 (secr)
Dept of Statistics and Applied Probability+65 6516 6650 (self)
Faculty of Science  FAX : +65 6872 3919   
National University of Singapore 
6 Science Drive 2, Blk S16, Level 7  e-mail: sta...@nus.edu.sg
Singapore 117546http://www.stat.nus.edu.sg/~statba

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


Re: [R] Convert a list to matrix

2009-02-21 Thread jim holtman
This should do what you want:

> m <- list()
> m[["A"]] <- 1
> m[["B"]] <- 2:3
> # get the maximum length
> maxLen <- max(sapply(m, length))
> # create a new list with elements padded out with NAs
> newM <- lapply(m, function(.ele){
+ c(.ele, rep(NA, maxLen))[1:maxLen]
+ })
> do.call(rbind, newM)
  [,1] [,2]
A1   NA
B23
>


On Sat, Feb 21, 2009 at 10:17 PM, Daren Tan  wrote:
> I would like to convert a list to matrix. This can be easily achieved via
> do.call. The only problem is each element of the list has different length,
> which causes the recycling of values. How can I have NA instead of recycled
> values ?
>
> m <- list()
> m[["A"]] <- 1
> m[["B"]] <- 2:3
> do.call(rbind, m)
>  [,1] [,2]
> A11
> B23
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

What is the problem that you are trying to solve?

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


[R] How to reshape this data frame from long to wide ?

2009-02-21 Thread Daren Tan
I tried cast and melt in reshape package, but still can't convert this data
frame m

m
 [,1] [,2]
[1,] "A"  "1"
[2,] "A"  "2"
[3,] "B"  "3"
to this form.

m1
 [,1] [,2]
[1,] "A"  "B"
[2,] "1"  "3"
[3,] "2"  NA
Please help.

[[alternative HTML version deleted]]

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


[R] Convert a list to matrix

2009-02-21 Thread Daren Tan
I would like to convert a list to matrix. This can be easily achieved via
do.call. The only problem is each element of the list has different length,
which causes the recycling of values. How can I have NA instead of recycled
values ?

m <- list()
m[["A"]] <- 1
m[["B"]] <- 2:3
do.call(rbind, m)
  [,1] [,2]
A11
B23

[[alternative HTML version deleted]]

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


[R] EM for Density Estimation

2009-02-21 Thread Lars Bishop
Hi,

Which package would you recommend for an implementation of EM for density
estimation (eg. mixture of Gaussian)?

Thanks!

Lars.

[[alternative HTML version deleted]]

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


Re: [R] Grouped bwplots?

2009-02-21 Thread hadley wickham
On Fri, Feb 20, 2009 at 3:57 PM, Fredrik Karlsson  wrote:
> Dear list,
>
> I am sorry for asking you this, but I am trying to do again what I
> thought I have done before, although this time it does not work.
>
> So, given the data set:
>
>> testdf <- data.frame(grfak=sample(c("One","Two"),size=100,replace=TRUE), 
>> panfak= sample(c("Yes","No"),size=100,replace=TRUE), xfak= 
>> sample(c("Yep","Nope"),size=100,replace=TRUE),  d=rnorm(100))
>
> I would like to do:
>
>> bwplot(d ~ xfak | panfak,data=testdf, groups= grfak)
>
> where the groups argument makes a difference (as in dividing each box
> into two by group).
> Is this possible to do? If so, what I am doing wrong?

An alternative approach is to use ggplot2:

install.packages("ggplot2")
library(ggplot2)
qplot(xfak, d, data=testdf, facets = ~panfak, fill = grfak, geom="boxplot")

Hadley
-- 
http://had.co.nz/

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


Re: [R] NOT an R problem: cannot install packages from distant repository

2009-02-21 Thread Renaud Lancelot
It turned out that the directory where I had installed contributed packages
(as defined by the environment variable R_LIB) was damaged, though it was
not revealed by the usual disk maintenance tools (chkdsk, etc). I deleted it
and created a new one, and everything looks fine now.

Renaud

2009/2/20 Renaud Lancelot 

> Still searching what's going on In fact, I can download manually any
> package and install it. The problem occurs when updating the html files. I
> can reproduce it with this:
>
> > link.html.help()
> Error in .readRDS(pfile) : unknown input format
> > traceback()
> 5: .readRDS(pfile)
> 4: .packages(all.available = TRUE, lib.loc = lib)
> 3: sort(.packages(all.available = TRUE, lib.loc = lib))
> 2: make.packages.html(lib.loc)
> 1: link.html.help()
>
> Any hint ?
>
> Renaud
>
>
> 2009/2/20 Renaud Lancelot 
>
> I met today a computer crash and our maintenance officer had to reinstall
>> some components of the OS (MS Windows XP Pro) as well as the Internet
>> browser (among other things). Now, I cannot install packages from a distant
>> repository:
>>
>> > utils:::menuInstallPkgs()
>> Error in .readRDS(pfile) : unknown input format
>> > traceback()
>> 5: .readRDS(pfile)
>> 4: .packages(all.available = TRUE)
>> 3: .install.winbinary(pkgs = pkgs, lib = lib, contriburl = contriburl,
>>method = method, available = available, destdir = destdir,
>>installWithVers = installWithVers, dependencies = dependencies,
>>...)
>> 2: install.packages(NULL, .libPaths()[1], dependencies = NA, type = type)
>> 1: utils:::menuInstallPkgs()
>> > sessionInfo()
>> R version 2.8.1 Patched (2009-02-17 r47956)
>> i386-pc-mingw32
>>
>> locale:
>>
>> LC_COLLATE=French_France.1252;LC_CTYPE=French_France.1252;LC_MONETARY=French_France.1252;LC_NUMERIC=C;LC_TIME=French_France.1252
>>
>> attached base packages:
>> [1] stats graphics  grDevices utils datasets  methods   base
>>
>> other attached packages:
>> [1] fortunes_1.3-6
>>
>> loaded via a namespace (and not attached):
>> [1] tools_2.8.1
>>
>> *
>>
>> My browser and e-mail client are working, and I can display the list of
>> packages when I run utils:::menuInstallPkgs().
>>
>> Did anybody meet the same problem, and how can I solve it ?
>>
>> Renaud
>> --
>> Renaud Lancelot
>> EDEN Project, coordinator
>> http://www.eden-fp6project.net/
>>
>> UMR CIRAD-INRA "Contrôle des maladies animales exotiques et émergentes"
>> Joint research unit "Control of emerging and exotic animal diseases"
>>
>> CIRAD
>> Campus International de Baillarguet TA A-DIR / B
>> F34398 Montpellier
>> http://www.cirad.fr  http://bluetongue.cirad.fr/
>>
>> Tel.  +33 4 67 59 37 17  -  Fax  +33 4 67 59 37 95
>> Secr. +33 4 67 59 37 37  - Cell. +33 6 77 52 08 69
>>
>>
>
>
> --
> Renaud Lancelot
> EDEN Project, coordinator
> http://www.eden-fp6project.net/
>
> UMR CIRAD-INRA "Contrôle des maladies animales exotiques et émergentes"
> Joint research unit "Control of emerging and exotic animal diseases"
>
> CIRAD
> Campus International de Baillarguet TA A-DIR / B
> F34398 Montpellier
> http://www.cirad.fr  http://bluetongue.cirad.fr/
>
> Tel.  +33 4 67 59 37 17  -  Fax  +33 4 67 59 37 95
> Secr. +33 4 67 59 37 37  - Cell. +33 6 77 52 08 69
>
>


-- 
Renaud Lancelot
EDEN Project, coordinator
http://www.eden-fp6project.net/

UMR CIRAD-INRA "Contrôle des maladies animales exotiques et émergentes"
Joint research unit "Control of emerging and exotic animal diseases"

CIRAD
Campus International de Baillarguet TA A-DIR / B
F34398 Montpellier
http://www.cirad.fr  http://bluetongue.cirad.fr/

Tel.  +33 4 67 59 37 17  -  Fax  +33 4 67 59 37 95
Secr. +33 4 67 59 37 37  - Cell. +33 6 77 52 08 69

[[alternative HTML version deleted]]

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


Re: [R] variable/model selction (step/stepAIC) for biglm ?

2009-02-21 Thread Tal Galili
Hi Chuck,

Thanks for the guidelines.

I was hoping someone in the group already experienced handling this
type of task and have some handy code to share.
I'll wait another day or two to see if someone responds with any more
ideas or experience, and if nothing will come up, I might try my hand
in your suggestion

Cheers,
Tal






On Sat, Feb 21, 2009 at 8:09 PM, Charles C. Berry  wrote:
> On Sat, 21 Feb 2009, Tal Galili wrote:
>
>> Hello dear R mailing list members.
>>
>> I have recently became curious of the possibility applying model
>> selection algorithms (even as simple as AIC) to regressions of large
>> datasets.
>
>
> Large in the sense of many observations, one assumes.
>
> But how large in terms of the number of variables??
>
> If not too many variables, then you can form the regression sums of squares
> for all 2^p combinations of regressors from a biglm() fit of all variables
> as biglm provides coef() and vcov() methods.
>
> If it is large, then you most likely will need to do subsampling to reduce
> the number to 'not too many' via lm() and friends then and apply the above
> strategy.
>
> I searched as best as I could, but couldn't find any
>>
>> reference or wrapper for using step or stepAIC to packages such as
>> biglm.
>
>
> Surely any direct implementation of step() would be hopelessly long in
> execution time.
>
>
> HTH,
>
> Chuck
>
>
>>
>> Any ideas or directions of how to implement such a concept ?
>>
>>
>> Best,
>> Tal
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> --
>>
>>
>> My contact information:
>> Tal Galili
>> Phone number: 972-50-3373767
>> FaceBook: Tal Galili
>> My Blogs:
>> www.talgalili.com
>> www.biostatistics.co.il
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> Charles C. Berry(858) 534-2098
>Dept of Family/Preventive
> Medicine
> E mailto:cbe...@tajo.ucsd.edu   UC San Diego
> http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901
>
>
>



-- 
--


My contact information:
Tal Galili
Phone number: 972-50-3373767
FaceBook: Tal Galili
My Blogs:
www.talgalili.com
www.biostatistics.co.il

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


Re: [R] variable/model selction (step/stepAIC) for biglm ?

2009-02-21 Thread Charles C. Berry

On Sat, 21 Feb 2009, Tal Galili wrote:


Hello dear R mailing list members.

I have recently became curious of the possibility applying model
selection algorithms (even as simple as AIC) to regressions of large
datasets.



Large in the sense of many observations, one assumes.

But how large in terms of the number of variables??

If not too many variables, then you can form the regression sums of 
squares for all 2^p combinations of regressors from a biglm() fit of all 
variables as biglm provides coef() and vcov() methods.


If it is large, then you most likely will need to do subsampling to reduce 
the number to 'not too many' via lm() and friends then and apply the above 
strategy.


I searched as best as I could, but couldn't find any

reference or wrapper for using step or stepAIC to packages such as
biglm.



Surely any direct implementation of step() would be hopelessly long in 
execution time.



HTH,

Chuck




Any ideas or directions of how to implement such a concept ?


Best,
Tal









--
--


My contact information:
Tal Galili
Phone number: 972-50-3373767
FaceBook: Tal Galili
My Blogs:
www.talgalili.com
www.biostatistics.co.il

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



Charles C. Berry(858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cbe...@tajo.ucsd.edu   UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

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


Re: [R] difference between assignment syntax <- vs =

2009-02-21 Thread Esmail Bonakdarian

Patrick Burns wrote:

'The R Inferno' page 78 is one source you can
look at.


Patrick Burns


wow .. nice! .. thanks for posting this reference.

Esmail

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


Re: [R] Python and R

2009-02-21 Thread Douglas Bates
Different methods of performing least squares calculations in R are discussed in

@Article{Rnews:Bates:2004,
  author   = {Douglas Bates},
  title= {Least Squares Calculations in {R}},
  journal  = {R News},
  year = 2004,
  volume   = 4,
  number   = 1,
  pages= {17--20},
  month= {June},
  url  = http,
  pdf  = Rnews2004-1
}

Some of the functions mentioned in that article have been modified.  A
more up-to-date version of the comparisons in that article is
available as the Comparisons vignette in the Matrix package.

On Fri, Feb 20, 2009 at 6:06 AM, Gabor Grothendieck
 wrote:
> Note that using solve can be numerically unstable for certain problems.
>
> On Fri, Feb 20, 2009 at 6:50 AM, Kenn Konstabel  wrote:
>> Decyphering formulas seems to be the most time consuming part of lm:
>>
>> mylm1 <- function(formula, data) {
>> # not perfect but works
>> F <- model.frame(formula,data)
>> y <- model.response(F)
>> mt <- attr(F, "terms")
>> x <- model.matrix(mt,F)
>> coefs <- solve(crossprod(x), crossprod(x,y))
>> coefs
>> }
>>
>> mylm2 <- function(x, y, intercept=TRUE) {
>> if(!is.matrix(x)) x <- as.matrix(x)
>> if(intercept) x <- cbind(1,x)
>> if(!is.matrix(y)) y <- as.matrix(y)
>> solve(crossprod(x), crossprod(x,y))
>> }
>>
>>> system.time(for(i in 1:1000) mylm2(EuStockMarkets[,-1],
>>> EuStockMarkets[,"DAX"]))
>>user  system elapsed
>>6.430.006.53
>>> system.time(for(i in 1:1000) mylm1(DAX~., EuStockMarkets))
>>user  system elapsed
>>   16.190.00   16.23
>>> system.time(for(i in 1:1000) lm(DAX~., EuStockMarkets))
>>user  system elapsed
>>   21.430.00   21.44
>>
>> So if you need to save time, I'd suggest something close to mylm2 rather
>> than mylm1.
>>
>> Kenn
>>
>>
>>
>> On Thu, Feb 19, 2009 at 8:04 PM, Gabor Grothendieck
>>  wrote:
>>>
>>> On Thu, Feb 19, 2009 at 8:30 AM, Esmail Bonakdarian 
>>> wrote:
>>>
>>> > Thanks for the suggestions, I'll have to see if I can figure out how to
>>> > convert the relatively simple call to lm with an equation and the data
>>> > file
>>> > to the functions you mention (or if that's even feasible).
>>>
>>> X <- model.matrix(formula, data)
>>>
>>> will calculate the X matrix for you.
>>>
>>> >
>>> > Not an expert in statistics myself, I am mostly concentrating on the
>>> > programming aspects of R. Problem is that I suspect my colleagues who
>>> > are providing some guidance with the stats end are not quite experts
>>> > themselves, and certainly new to R.
>>> >
>>> > Cheers,
>>> >
>>> > Esmail
>>> >
>>> > Kenn Konstabel wrote:
>>> >>
>>> >> lm does lots of computations, some of which you may never need. If
>>> >> speed
>>> >> really matters, you might want to compute only those things you will
>>> >> really
>>> >> use. If you only need coefficients, then using %*%, solve and crossprod
>>> >> will
>>> >> be remarkably faster than lm
>>> >>
>>> >> # repeating someone else's example
>>> >> # lm(DAX~., EuStockMarkets)
>>> >>
>>> >>  y <- EuStockMarkets[,"DAX"]
>>> >>  x <- EuStockMarkets
>>> >>  x[,1]<-1
>>> >> colnames(x)[1] <- "Intercept"
>>> >>
>>> >> lm(y ~ x-1)
>>> >> solve(crossprod(x), t(x))%*%y# probably this can be done more
>>> >> efficiently
>>> >>
>>> >> # and a naive timing
>>> >>
>>> >>  > system.time( for(i in 1:1000) lm(y ~ x-1))
>>> >>   user  system elapsed
>>> >>  14.640.33   32.69
>>> >>  > system.time(for(i in 1:1000) solve(crossprod(x), crossprod(x,y)) )
>>> >>   user  system elapsed
>>> >>   0.360.000.36
>>> >>
>>> >>
>>> >> Also lsfit() is a bit quicker than lm or lm.fit.
>>> >>
>>> >> Regards,
>>> >> Kenn
>>> >
>>> > __
>>> > R-help@r-project.org mailing list
>>> > https://stat.ethz.ch/mailman/listinfo/r-help
>>> > PLEASE do read the posting guide
>>> > http://www.R-project.org/posting-guide.html
>>> > and provide commented, minimal, self-contained, reproducible code.
>>> >
>>>
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] Debian Power PC Compile R

2009-02-21 Thread Dirk Eddelbuettel

On 20 February 2009 at 22:40, stephen sefick wrote:
| I have the libx11-dev package installed through the aptitude
| application.  This is on 5.0 power pc.  What can I provide to help
| with this?  I don't know where to begin.

Sorry, but what exactly is your question? "Provide help with what?"

If it is about building / using / extending / ... R on Debian/Ubuntu systems,
come to the r-sig-debian list.  Subscribe first before you can post.

If you wonder about what you need to build R on Debian, the current
Build-Depends entry in our debian/control file is 

Build-Depends: gcc (>= 4:4.1.0), g++ (>= 4:4.1.0), gfortran (>= 4:4.1.0), 
libblas-dev, liblapack-dev (>= 3.1.1), tcl8.5-dev, tk8.5-dev, bison, 
groff-base, libncurses5-dev, libreadline5-dev, debhelper (>= 5.0.0), texi2html, 
texinfo (>= 4.1-2), libbz2-dev, libpcre3-dev, xpdf-reader, zlib1g-dev, 
libpng12-dev, libjpeg62-dev, libx11-dev, libxt-dev, x11proto-core-dev, 
libpango1.0-dev, libcairo2-dev, libtiff4-dev, xvfb, xauth, xfonts-base, 
texlive-base, texlive-latex-base, texlive-generic-recommended, 
texlive-fonts-recommended, texlive-extra-utils, texlive-latex-recommended, 
texlive-latex-extra, texinfo, texi2html, openjdk-6-jdk [!arm !hppa 
!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386]

so you need a tad morethan libx11-dev.

Dirk

-- 
Three out of two people have difficulties with fractions.

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


[R] Bold fonts and greek characters in lattice plots

2009-02-21 Thread Christos Argyropoulos

Hi, 
I am trying to "convince" lattice to use bold face in an expression containing 
Greek characters without any luck.

Example code (without Greek characters, renders the expression in bold)

library(lattice)

data(Cars93,package=="MASS")
splom(~Cars93[,5:8]|Origin,data=Cars93,panel=function(x,y,...) {
panel.splom(x,y,...)
dum<-format(cor(x,y,use="complete",method="kendal"),dig=2)
panel.text(30,40,bquote(.(dum)),font=2)
},pscales=0,col="gray"
)


Example code (with Greek characters, no bold)

data(Cars93,package=="MASS")
splom(~Cars93[,5:8]|Origin,data=Cars93,panel=function(x,y,...) {
panel.splom(x,y,...)
dum<-format(cor(x,y,use="complete",method="kendal"),dig=2)
panel.text(30,40,bquote(tau == .(dum)),font=2)
},pscales=0,col="gray"
)


Any suggestions? 

Christos Argyropoulos

_

s. It's easy!

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


Re: [R] difference between assignment syntax <- vs =

2009-02-21 Thread Patrick Burns

'The R Inferno' page 78 is one source you can
look at.


Patrick Burns
patr...@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of "The R Inferno" and "A Guide for the Unwilling S User")

Thomas Mang wrote:

Hi,

Both operators <- and = can be used to make an assignment. My question 
is: Is there a semantic difference between these two? Some time ago, I 
remember I have read that because of some reason, one should be given 
preference over the other - but I cannot remember the source, nor the 
argument, nor which operator the preferred was.


What is the present state ?
Is still one version better than the other, or is it only a matter of 
taste what to use ?


thanks
Thomas

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

and provide commented, minimal, self-contained, reproducible code.




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


Re: [R] difference between assignment syntax <- vs =

2009-02-21 Thread Sundar Dorai-Raj
Read the help page as to their differences: ?"<-"

On Sat, Feb 21, 2009 at 7:30 AM, Thomas Mang  wrote:
> Hi,
>
> Both operators <- and = can be used to make an assignment. My question is:
> Is there a semantic difference between these two? Some time ago, I remember
> I have read that because of some reason, one should be given preference over
> the other - but I cannot remember the source, nor the argument, nor which
> operator the preferred was.
>
> What is the present state ?
> Is still one version better than the other, or is it only a matter of taste
> what to use ?
>
> thanks
> Thomas
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


[R] difference between assignment syntax <- vs =

2009-02-21 Thread Thomas Mang

Hi,

Both operators <- and = can be used to make an assignment. My question 
is: Is there a semantic difference between these two? Some time ago, I 
remember I have read that because of some reason, one should be given 
preference over the other - but I cannot remember the source, nor the 
argument, nor which operator the preferred was.


What is the present state ?
Is still one version better than the other, or is it only a matter of 
taste what to use ?


thanks
Thomas

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


Re: [R] How to connect R and WinBUGS/OpenBUGS/LinBUGS in Linux in Feb. 2009

2009-02-21 Thread Paul Heinrich Dietrich

I just wanted to post in conclusion to this thread that I have had success
running WinBUGS from R via R2WinBUGS, with the help of Gorjanc, Uwe, and Ben
by email outside of this thread.

I may have had a permissions problem, that was probably corrected by
entering this in the terminal:

m...@computer:~$ chmod -R u+w /home/me/.wine/drive_c/"Program
Files"/WinBUGS14/

>From here, I opened R, entered library(R2WinBUGS), then ?bugs, then
copy/pasted the example, and ran it exactly.

My mistake that prevented it all from running was that I started R as sudo
R, thinking that would give me more permissions, because I thought I was
having permissions-oriented problems.  But this is wrong.  When I started R
by merely entering R in the terminal, the example code ran perfectly. 
Success!  Winepaths did not have to be specified because WinBUGS was
installed in the usual place (c:/Program Files/WinBUGS14/").

Other people have emailed me, indicating that newer versions of WINE have
not worked for them, so I am back with WINE 1.0.  I hope this helps others
trying to run WinBUGS on Linux.
-- 
View this message in context: 
http://www.nabble.com/How-to-connect-R-and-WinBUGS-OpenBUGS-LinBUGS-in-Linux-in-Feb.-2009-tp22058716p22136577.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] importing data to SQLite database with sqldf

2009-02-21 Thread Gabor Grothendieck
WARNING!!!

Not a good idea to post code that deletes every object
in your workspace!   Other people may blindly copy
and paste your code.

I've added some verbiage to Example 12 on the home
page:
http://sqldf.googlecode.com
that hopefully clarifies it a bit.

On Sat, Feb 21, 2009 at 2:36 AM, Stephen Tucker  wrote:
> Thanks yet another time, Gabor -
> I think I am slowly understanding - particularly I was confused by 
> persistence of connections.
>
> So starting with some parts of your example 12,
>
> ##

... deleted code which clears workspace ...

> sqldf("attach 'mydb' as new")
> irishead <- file("irishead.dat")
> iristail <- file("iristail.dat")
>
> If I just wanted to merge the two files within SQL and return some part of 
> the result, I would do
>
> sqldf('select count(*) from (select * from irishead
> union
> select * from iristail)',dbname="mydb")
>
> and the tables exist in mydb only for the duration of the computation
>> sqldf("select * from sqlite_master",dbname="mydb")$name
> NULL
> (but why is the size of mydb > 0 afterwards, if it contains no tables...?)
>
> ...is the above the same as
> sqldf('select count(*) from (select * from irishead
> union
> select * from iristail)',dbname=tempfile())
>
> except that I don't create 'mydb'?

Yes.  The third possibility is to omit dbname= entirely and then it uses
a temporary "in memory" database.

>
> If I wanted to save the merged table (for use in a later session):
>
> sqldf('create table fulliris as select * from irishead
> union
> select * from iristail',dbname="mydb")
>
>> sqldf("select * from sqlite_master",dbname="mydb")$name
> [1] fulltable
> Levels: fulltable
>
> If I want copies of all three tables,
> sqldf(dbname="mydb")
> sqldf('create table fulltable as select * from irishead
> union
> select * from iristail')
> sqldf()
>
>> sqldf("select * from sqlite_master",dbname="mydb")$name
> [1] irishead  iristail  fulltable
> Levels: fulltable irishead iristail
>
> ? ...I'll try to go figure a few more things out in the in the meantime (like 
> using sep="\t" ?) and using connections with sqldf().
>
> But thanks for the help!
>
> Stephen
>
> - Original Message 
> From: Gabor Grothendieck 
> To: Stephen Tucker 
> Cc: R-help 
> Sent: Friday, February 20, 2009 5:22:09 AM
> Subject: Re: [R] importing data to SQLite database with sqldf
>
> Have just added an example 12 on the home page:
>
> http://sqldf.googlecode.com
>
> that shows an example.  Note use of notation
> main.mytable to refer to an existing table in the
> main database (as opposed to a data frame in R).
>
> On Thu, Feb 19, 2009 at 11:55 PM, Stephen Tucker  wrote:
>> Hi all,
>>
>> I am attempting to learn SQL through sqldf...
>>
>> One task I am particularly interested in is merging separate
>> (presumably large) files into a single table without loading these
>> files into R as an intermediate step (by loading them into SQLite and
>> merging them there).
>>
>> Taking a step back, I've considered these alternatives:
>>
>> 1) I know if I use straight SQLite commands I might use the 'IMPORT'
>> or 'INSERT INTO' command, which is not terribly flexible...  (I can
>> read large files line-by-line in Python and use the 'INSERT INTO'
>> command, which is reasonably fast; I could do this in R as well but my
>> experience with R's input/output is that it's much slower...? and
>> sometimes setting up the table column definitions can be tedious if
>> there are many variables).
>>
>> 2) dbWriteTable() with append=TRUE is very convenient except that it
>> requires I load the data into R first...
>>
>> 3) sqldf's capability to put data directly into a database is
>> something I'd like to work out.
>>
>> So in this case I have a series of tab-delimited text file with the
>> first line being a header.
>>
>> For some reason I cannot seem to get it working.  Combining examples 6
>> and 9 from the Google Code page (and R-help archives), I tried
>>
>> source("http://sqldf.googlecode.com/svn/trunk/R/sqldf.R";)
>> (do I need it for SQLite?)
>> ##
>> sqldf("attach 'mydb.db' as new")
>> f <- file("myexample.txt")
>> attr(f,"file.format") <- list(header=TRUE,sep="\t")
>> sqldf("create table myexample as select * from f",
>>  stringsAsFactors=FALSE,
>>  dbname="mydb.db")
>> ## or
>> f <- file(fi)
>> sqldf("create table myexample as select * from f",
>>  stringsAsFactors=FALSE,file.format=list(header=TRUE,sep="\t"),
>>  dbname="mydb.db")
>> ##
>> sqldf("select * from myexample",dbname="mydb.db")
>> gives me tables with 0 rows and 0 columns...
>>
>> So in any case I have a few questions:
>>
>> === 1 
>> Would this be scalable to files with few GBs of data in them (I guess
>> I am uncertain of the underlying mechanism for transporting data from
>> the .txt file to the .db file... I see there is a call the
>> dbWriteTable() internally in sqldf but through the connection)?  And
>> is there anything obviously doing wrong above?
>>
>> === 2 ===
>> Since I cannot 'append' rows to existing tables

[R] [R-pkgs] new RcmdrPlugin.survival package

2009-02-21 Thread John Fox
Dear R users,

I'd like to announce the RcmdrPlugin.survival package, which has just been
made available on CRAN. The package provides an R Commander plug-in for the
survival package, with dialogs for Cox models, parametric survival
regression models, estimation of survival curves, and testing for
differences in survival curves, along with data-management facilities and a
variety of tests, diagnostics and graphs. All of this is tightly integrated
with the standard R Commander menus. 

As does the Rcmdr, the package takes advantage of the R facilities for
translating messages into other languages. It comes with a translation into
Brazilian Portuguese, courtesy of Marilia Sá Carvalho of FIOCRUZ in Rio de
Janeiro, whose suggestions during the development of the package were
invaluable. Please contact me if you're interested in providing a
translation into another language.

Reports of bugs and other problems are welcome, as are suggestions for
extending the package.

Regards,
 John

--
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox

___
R-packages mailing list
r-packa...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages

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


[R] variable/model selction (step/stepAIC) for biglm ?

2009-02-21 Thread Tal Galili
Hello dear R mailing list members.

I have recently became curious of the possibility applying model
selection algorithms (even as simple as AIC) to regressions of large
datasets. I searched as best as I could, but couldn't find any
reference or wrapper for using step or stepAIC to packages such as
biglm.

Any ideas or directions of how to implement such a concept ?


Best,
Tal









-- 
--


My contact information:
Tal Galili
Phone number: 972-50-3373767
FaceBook: Tal Galili
My Blogs:
www.talgalili.com
www.biostatistics.co.il

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


[R] errors

2009-02-21 Thread Jonge de, HJM
Dear Sir/Madam,
 
I was trying to upload my data in BRB array tools (R version 2.8.0). The 
following errors occured:
 
Error: package/namespace load failed for 'affy'
 
Error occured while executing the following R command: try(library(affy)).
 
Could you please tell me what this means (and how to solve)?
 
Thank you in advance,
 
Henk-Marijn de Jonge


De inhoud van dit bericht is vertrouwelijk en alleen bestemd voor de 
geadresseerde(n). Anderen dan de geadresseerde(n) mogen geen gebruik maken van 
dit bericht, het niet openbaar maken of op enige wijze verspreiden of 
vermenigvuldigen. Het UMCG kan niet aansprakelijk gesteld worden voor een 
incomplete aankomst of vertraging van dit verzonden bericht.

The contents of this message are confidential and only intended for the eyes of 
the addressee(s). Others than the addressee(s) are not allowed to use this 
message, to make it public or to distribute or multiply this message in any 
way. The UMCG cannot be held responsible for incomplete reception or delay of 
this transferred message.

[[alternative HTML version deleted]]

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


Re: [R] 24 hour axis /time plots

2009-02-21 Thread Jim Lemon

somewhereondearth wrote:
Hi, 
i have a data with values against  time and date. for plotting against date

i used axis.Date() option. but I need a 24hr time plot as well. i have
extracted and plotted, but not being able to put the time ticks ( eg. 6am, 7
am etc) on the x-axis. Im new to R, any help would be appreciated!!
  

Hi somewhereondearth,
I would suggest that you convert your hours into military time 
(-2359) and then plot the data without an X axis (xaxt="n"). Then 
add the X axis with the appropriate 12 hour labels:


hr12labels<-c("12AM","2AM",...,"10PM")
axis(1,at=seq(0,2400,by=200),labels=hr12labels)

You can do this with date/time variables, but for a one-off, it may be 
easier to just define the labels you want yourself.


Jim

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


Re: [R] [package-car:Anova] extracting residuals from Anova for Type II/III Repeated Measures ?

2009-02-21 Thread Tal Galili
Dear John.

Thank you so much for the patience and time, you have just answered my question!

I was so used to the "mean ss" term from the aov table, that I didn't
stop to look and realize that the values you added in the "Error SS"
and "den Df" columns in the summary tables are actually the residuals
sum of squares Errors and there respective degrees of freedom (and to
that confusion also contributed, I guess, the fact that until your
last e-mail I couldn't reproduce the aov results with Anova for me to
experiment and compare).

I hope that the clarification evoked by this discussion might have
some use for future updates to the Anova (or aov) help files.  And
even if not - I personally feel to have gained a lot from this weeks
correspondents.  So again - thanks a lot John, for your patience and
help.

(p.s: I am adding " r-help@r-project.org" cc'd, so that other people
encountering my question could benefit from your help as well)


With regards,
Tal








On Sat, Feb 21, 2009 at 4:25 AM, John Fox  wrote:
> Dear Tal,
>
>> -Original Message-
>> From: Tal Galili [mailto:tal.gal...@gmail.com]
>> Sent: February-20-09 6:15 PM
>> To: John Fox
>> Subject: Re: [R] [package-car:Anova] extracting residuals from Anova for
> Type
>> II/III Repeated Measures ?
>>
>> Hello John, thanks for your reply and correction.
>>
>> I apologies for my crude mistake in applying the aov (now I have learned
>> better). I hope to get a hold of "Statistical Models in S", but I don't
>> predict it could easily happen in the near future.
>>
>> Also, I would be very happy if you could supply me with some more
> directions
>> as to how to obtain the "within" residuals (such as reported from the aov
>> summary), since I am not sure how to proceed with that.
>
> I'm not sure what it is that you're looking for. First, I'm pretty sure that
> you mean a residual sum of squares not residuals. But in any event, the sums
> of squares reported by aov(), when you formulate the model correctly, are
> exactly the same as those reported by Anova(). The "Error SS" given by
> Anova() correspond to the "Residuals" sums of square given by aov(); these
> are for the appropriate error term for testing each term.
>
> John
>
>>
>> With regards,
>> Tal
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Sat, Feb 21, 2009 at 12:41 AM, John Fox  wrote:
>>
>>
>>   Dear Tal,
>>
>>   I didn't have time to look at all this yesterday.
>>
>>   Since aov() doesn't do what I typically want to do, I guess I've not
>> paid
>>   much attention to it recently. I can see, however, that you appear
> to
>> have
>>   specified the error strata incorrectly, since (given your desire to
>> compare
>>   to Anova) the within-block factors are nested within blocks.
> Something
>> like
>>
>>   > npk.aovE <- aov(value ~  N*P*K + Error(block/N*P*K), npk.long)
>>
>>   should be closer to what you want, and in fact produces all of the
> sums
>> of
>>   squares, but doesn't put all of the error terms together with the
>>   corresponding terms; thus, you get, e.g., the test for N but not for
> P
>> and
>>   K, even though the SSs and error SSs for the latter are in the
> table.
>> By
>>   permuting N, P, and K, you can get the other F tests. I suspect that
>> this
>>   has to do with the sequential approach taken by aov() but someone
> else
>> more
>>   familiar with how it works will have to fill in the details. I
> wonder,
>>   though, whether you've read the sections in Statistical Models in S
> and
>> MASS
>>   referenced in the help file for aov.
>>
>>   > summary(npk.aovE)
>>
>>
>>   Error: block
>>Df  Sum Sq Mean Sq F value Pr(>F)
>>   Residuals  5 153.147  30.629
>>
>>
>>   Error: P
>>
>>Df Sum Sq Mean Sq
>>
>>   P  1 16.803  16.803
>>
>>   Error: K
>>
>>Df Sum Sq Mean Sq
>>
>>   K  1 190.40  190.40
>>
>>
>>   Error: block:N
>>
>>Df Sum Sq Mean Sq F value   Pr(>F)
>>
>>   N  1 378.56  378.56  38.614 0.001577 **
>>   Residuals  5  49.029.80
>>
>>   ---
>>   Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>>
>>
>>   Error: block:P
>>
>>Df  Sum Sq Mean Sq F value Pr(>F)
>>
>>   Residuals  5 19.1317  3.8263
>>
>>   Error: block:K
>>
>>Df  Sum Sq Mean Sq F value Pr(>F)
>>
>>   Residuals  5 24.4933  4.8987
>>
>>   Error: P:K
>>
>>  Df  Sum Sq Mean Sq
>>
>>   P:K  1 0.96333 0.96333
>>
>>   Error: block:N:P
>>
>>Df Sum Sq Mean Sq F value  Pr(>F)
>>
>>   N:P1 42.563  42.563  8.6888 0.03197 *
>>   Residuals  5 24.493   4.899
>>
>>   ---
>>   Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>>
>>
>>   Error: block:N:K
>>
>>Df Sum Sq Mean Sq F value  Pr(>F)
>>
>>   N:K1 66.270  66.270  17.320 0.00881 **
>>   Residuals  5 19.132   3.826
>>
>>   ---
>>   Sig

Re: [R] orthogonal/perpendicular distance from regression line

2009-02-21 Thread Mark Difford

Hi Jeff,

>> You could do this with [1], but if you are hoping to learn something
>> statistical by doing this you should probably reconsider, because the
>> regression line residuals are minimized along the dependent variable
>> axis,

It should be said that there are valid forms of linear regression where this
is not true and it is the orthogonal residuals that are wanted. Perhaps the
main case is where there are errors in x and y: indeed, this is how the
"lines" (i.e. principal components) are fitted in principal component
analysis.

Regards, Mark.


Jeff Newmiller wrote:
> 
> On Fri, 20 Feb 2009, GAF wrote:
> 
>>
>> Hi there,
>> I am trying to measure orthogonal/perpendicular distances from regression
>> lines (i.e. the shortest distance from a given point to my regression
>> line).
>> As it sounds rather easy (basically just an orthogonal/perpendicular
>> residual) I hoped that there was some function in R that can do that. All
>> efforts so far remained unsuccessful, however.
>> Does anybody know?
> 
> You could do this with [1], but if you are hoping to learn something
> statistical by doing this you should probably reconsider, because the
> regression line residuals are minimized along the dependent variable axis,
> and if the coordinate system is rotated (that is, you look at
> deviation from the regression line to the points along a different
> direction) then the residuals on that regression line will no longer be
> minimized.
> 
> [1] http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html
> 
> ---
> Jeff NewmillerThe .   .  Go
> Live...
> DCN:Basics: ##.#.   ##.#.  Live
> Go...
>   Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
> /Software/Embedded Controllers)   .OO#.   .OO#. 
> rocks...2k
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/orthogonal-perpendicular-distance-from-regression-line-tp22123179p22134025.html
Sent from the R help mailing list archive at Nabble.com.

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