[R] what is Non-numeric argument to mathematical function in prediction ?

2012-05-05 Thread kiinalist
Hi,

I tried to use naivebayes in package 'e1071'.
when I use following parameter, only one predictor, there is an error.

  m - naiveBayes(iris[,1], iris[,5])
  table(predict(m, iris[,1]), iris[,5])
Error in log(sapply(attribs, function(v) { :
   Non-numeric argument to mathematical function


However, when I use two predictors, there is not error any more.

  m - naiveBayes(iris[,1:2], iris[,5])
  table(predict(m, iris[,1:2]), iris[,5])

  setosa versicolor virginica
   setosa 49  0 0
   versicolor  1 3719
   virginica   0 1331

Do you know what is the problem?

Br,
Luffy

[[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] Breaking up a Row in R (transpose)

2012-05-05 Thread Rui Barradas
Ok, I think I've got it this time.

The problem was that you have two different types of data in the same data
structure,
the first row are the result's column names, then the actual numeric data.

First, in what follows I've called your data.frame 'df1',

df1 - structure(list(A2 = structure(c(9L, 4L,  ...etc...

Now the code.



dat - apply(df1[-1, ], 2, as.numeric)

nr - nrow(dat)
nc - ncol(dat)
names1 - colnames(df1)[rep(c(TRUE, FALSE), nc/2)]
names2 - unique(unname(apply(df1, 2, function(x) as.character(x[1]

res - matrix(nrow=nc/2, ncol=2)
inx - as.matrix(rev(expand.grid(1:2, 1:(nc/2

res - do.call(cbind, lapply(seq.int(nr), function(i){res[inx] - dat[i, ];
matrix(res, ncol=2)}))
res - data.frame(res)
rownames(res) - names1
colnames(res) - paste(names2, rep(seq.int(nr), each=2), sep=.)
res

I hope this is, finally, it.

Rui Barradas


marc212 wrote
 
 Short snippet- 
 
 structure(list(A2 = structure(c(9L, 4L, 4L, 3L, 5L, 7L, 5L, 7L, 
 6L, 1L, 1L, 1L, 3L, 4L, 5L, 5L, 2L, 5L, 3L, 4L, 4L, 8L, 4L, 3L, 
 4L, 5L, 4L, 3L), .Label = c(4.957, 4.958, 4.959, 4.96, 
 4.961, 4.962, 4.963, 4.964, x), class = factor), 
 A2.1 = structure(c(6L, 2L, 2L, 2L, 2L, 3L, 3L, 2L, 4L, 2L, 
 4L, 2L, 5L, 4L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 2L, 2L, 2L, 
 2L, 2L, 2L), .Label = c(6.156, 6.157, 6.158, 6.159, 
 6.161, y), class = factor), A3 = structure(c(9L, 2L, 
 2L, 5L, 5L, 5L, 5L, 4L, 5L, 3L, 6L, 1L, 8L, 2L, 7L, 2L, 2L, 
 6L, 3L, 1L, 2L, 2L, 2L, 5L, 3L, 4L, 8L, 3L), .Label = c(5.114, 
 5.115, 5.116, 5.117, 5.118, 5.119, 5.12, 5.121, 
 x), class = factor), A3.1 = structure(c(2L, 1L, 1L, 1L, 
 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c(4.227, 
 y), class = factor), A4 = structure(c(14L, 5L, 5L, 3L, 
 7L, 6L, 7L, 1L, 5L, 4L, 2L, 9L, 5L, 12L, 7L, 11L, 11L, 4L, 
 11L, 3L, 8L, 6L, 10L, 6L, 9L, 3L, 13L, 3L), .Label = c(5.204, 
 5.207, 5.209, 5.21, 5.211, 5.212, 5.213, 5.214, 
 5.215, 5.216, 5.218, 5.219, 5.221, x), class = factor), 
 A4.1 = structure(c(9L, 4L, 4L, 2L, 6L, 8L, 5L, 6L, 1L, 4L, 
 4L, 2L, 6L, 3L, 2L, 4L, 4L, 6L, 4L, 8L, 4L, 3L, 6L, 4L, 2L, 
 7L, 3L, 6L), .Label = c(2.564, 2.565, 2.566, 2.567, 
 2.569, 2.57, 2.571, 2.572, y), class = factor), 
 B1 = structure(c(8L, 4L, 4L, 3L, 3L, 5L, 7L, 5L, 3L, 4L, 
 2L, 4L, 2L, 3L, 4L, 4L, 5L, 4L, 4L, 6L, 4L, 2L, 2L, 5L, 5L, 
 4L, 4L, 1L), .Label = c(7.273, 7.274, 7.275, 7.276, 
 7.277, 7.278, 7.279, x), class = factor), B1.1 =
 structure(c(8L, 
 1L, 1L, 5L, 3L, 4L, 4L, 2L, 3L, 4L, 3L, 3L, 4L, 2L, 3L, 3L, 
 3L, 3L, 3L, 3L, 5L, 4L, 7L, 4L, 3L, 5L, 5L, 6L), .Label = c(8.067, 
 8.068, 8.069, 8.07, 8.071, 8.072, 8.073, y), class =
 factor), 
 A1 = structure(c(6L, 5L, 5L, 3L, 3L, 1L, 4L, 4L, 3L, 1L, 
 2L, 3L, 2L, 1L, 4L, 3L, 3L, 3L, 3L, 4L, 4L, 3L, 3L, 3L, 3L, 
 2L, 3L, 5L), .Label = c(4.918, 4.919, 4.92, 4.921, 
 4.922, x), class = factor), A1.1 = structure(c(6L, 
 3L, 3L, 2L, 4L, 5L, 3L, 1L, 3L, 3L, 3L, 3L, 5L, 5L, 3L, 3L, 
 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 1L, 3L, 4L), .Label = c(8.297, 
 8.298, 8.299, 8.3, 8.301, y), class = factor), 
 B2 = structure(c(10L, 5L, 5L, 5L, 7L, 7L, 7L, 9L, 8L, 5L, 
 2L, 8L, 5L, 4L, 2L, 6L, 3L, 2L, 9L, 5L, 4L, 2L, 5L, 5L, 1L, 
 8L, 9L, 5L), .Label = c(7.272, 7.273, 7.274, 7.275, 
 7.276, 7.277, 7.278, 7.279, 7.28, x), class = factor), 
 B2.1 = structure(c(6L, 4L, 4L, 3L, 3L, 2L, 2L, 2L, 4L, 3L, 
 4L, 3L, 2L, 4L, 3L, 4L, 4L, 5L, 1L, 4L, 3L, 4L, 4L, 4L, 5L, 
 3L, 3L, 5L), .Label = c(6.056, 6.058, 6.059, 6.06, 
 6.061, y), class = factor), B3 = structure(c(10L, 1L, 
 1L, 4L, 5L, 2L, 4L, 7L, 7L, 7L, 2L, 3L, 7L, 4L, 4L, 9L, 8L, 
 7L, 6L, 7L, 5L, 4L, 6L, 9L, 7L, 8L, 6L, 4L), .Label = c(7.411, 
 7.412, 7.413, 7.414, 7.415, 7.416, 7.417, 7.418, 
 7.419, x), class = factor), B3.1 = structure(c(7L, 
 3L, 3L, 3L, 5L, 4L, 4L, 2L, 5L, 3L, 4L, 4L, 4L, 3L, 1L, 3L, 
 4L, 3L, 3L, 4L, 2L, 3L, 4L, 6L, 4L, 3L, 4L, 3L), .Label = c(4.05, 
 4.052, 4.053, 4.054, 4.055, 4.056, y), class = factor), 
 B4 = structure(c(10L, 2L, 2L, 3L, 4L, 5L, 9L, 8L, 4L, 4L, 
 6L, 4L, 3L, 5L, 4L, 5L, 8L, 7L, 4L, 4L, 4L, 6L, 4L, 6L, 2L, 
 3L, 1L, 3L), .Label = c(7.468, 7.469, 7.47, 7.471, 
 7.472, 7.473, 7.474, 7.475, 7.476, x), class = factor), 
 B4.1 = structure(c(6L, 4L, 4L, 3L, 4L, 4L, 1L, 3L, 4L, 5L, 
 4L, 2L, 3L, 4L, 3L, 5L, 3L, 3L, 4L, 4L, 5L, 4L, 4L, 4L, 5L, 
 2L, 5L, 4L), .Label = c(2.274, 2.275, 2.276, 2.277, 
 2.278, y), class = factor), C1 = structure(c(6L, 4L, 
 4L, 4L, 4L, 5L, 3L, 3L, 3L, 1L, 2L, 2L, 4L, 2L, 4L, 4L, 5L, 
 4L, 4L, 4L, 4L, 4L, 5L, 4L, 4L, 3L, 3L, 1L), .Label = c(9.744, 
 9.745, 9.746, 9.747, 9.748, x), class = factor), 
 C1.1 = structure(c(2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
 1L, 1L, 1L), 

Re: [R] Can't import this 4GB DATASET

2012-05-05 Thread iliketurtles
Your code works!

strangelines.txt was created, and it's a text file with just spacebars ...
Seems like a few thousand lines of complete blanks (not 1 non-blank entry).

One thing, when I ran your code there was an error message;

 setwd(C:/Users/admin/Desktop/hons/Thesis)
 con - file(dataset.txt, rt)
 out - file(strangelines.txt, wt)
 # skip first 5 lines
 lines - readLines(con, n=5)
 # read the rest in blocks of 100.000 lines
 while (TRUE) {
+ lines - readLines(con, n=1E5)
+ if (length(lines) == 0) break;
+ strangelines - lines[nchar(lines) != 97]
+ writeLines(strangelines, con=out)
+ }
Warning message:
In readLines(con, n = 1e+05) : incomplete final line found on 'dataset.txt'




I'm really not sure where to go from here. This has gone way out of my
depth. 

-


Isaac
Research Assistant
Quantitative Finance Faculty, UTS
--
View this message in context: 
http://r.789695.n4.nabble.com/Can-t-import-this-4GB-DATASET-tp4607862p4610446.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.


[R] Weired location of points on MA plot?

2012-05-05 Thread ali_protocol
Dear all,

 I have a MA plot for replicate single channnel arrays, the loess curve is
aligned to M=0. However,  I expect that M values be as close as possible to
M=0 for replicate arrays, which is not the case. How may I obtain a measure
that indicates the average distance of points to M=0?

Thanks indeed.

--
View this message in context: 
http://r.789695.n4.nabble.com/Weired-location-of-points-on-MA-plot-tp4610624.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] France Model

2012-05-05 Thread Sven Garbade
Given your starting values, there is nothing to optimize:

 f - function(x, A=10, b=152, T=100, c=100) A*(1-exp(-b*(x-T) -
c*(sqrt(x) - sqrt(T
 f(time)
 [1] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf
-Inf -Inf
[16] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf
-Inf -Inf
[31] -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf -Inf
-Inf -Inf
[46] -Inf -Inf -Inf

same with A = 500

So try to find a better model, or more sensible starting values.

Regards, Sven


On 05/04/2012 03:41 PM, Silvano wrote:
 Hi,

 I need fit the France model :

 y = A{1 - exp[-b(t-T) - c(sqrt(t) - sqrt(T))]}

 parameters: A, b, T, c
 variable: t (time)
 resp: y


 I tried:
 time = 1:48
 resp = rnorm(48, 200, 10)

 dados = data.frame(resp, time)
 attach(dados)

 f = function(x, A, b, T, c)
  A*(1-exp(-b*(x-T) - c*(sqrt(x) - sqrt(T

 (mod1 = nls(resp~f(time, A, b, c, T), data=dados,
   start=c(A=500, b=152, c=100, T=100)))

 but isn't work. The error is:

 (mod1 = nls(resp~f(tempo,A,b,c,T), data=dados,
 +start=c(A=10, b=152, c=10, T=10)))
 Erro em numericDeriv(form[[3L]], names(ind), env) :
  Obtido valor faltante ou infinito quando avaliando o modelo

 Somebody knows some package?

 Thanks,


__
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] Correct use of ddply with own function

2012-05-05 Thread Johannes Radinger
Hi,

I am really confused how ddply work, so maybe you can help me.

I created a function that sorts a vector etc.

fn - function(x){
x1 - sort(x)
x2 - seq(length(x))
x3 - x2/max(x2)
df - data.frame(x1,x2,x3)
df
}

Probably this is not the best form of the function, but at least it produces 
what I want (data to plot a cumulative count curve).
This function works on a single vector but I have a melted dataframe like:

var1 - rep(c(a,b),c(100,100))
var2 - runif(200,1,50)
df.test - data.frame(var1,var2)

..and I want to apply that function on var2 but splitted by the variable var1. 
I think this might be a case for ddply...

anything like: ddply(df.test,.(var1),fn(var2))...
maybe someone know how to do that (modifying my function and applying it on a 
splitted dataframe).

Best regards,

Johannes

__
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] what is Non-numeric argument to mathematical function in prediction ?

2012-05-05 Thread Petr Savicky
On Sat, May 05, 2012 at 09:21:10AM +0300, kiinalist wrote:
 Hi,
 
 I tried to use naivebayes in package 'e1071'.
 when I use following parameter, only one predictor, there is an error.
 
   m - naiveBayes(iris[,1], iris[,5])
   table(predict(m, iris[,1]), iris[,5])
 Error in log(sapply(attribs, function(v) { :
Non-numeric argument to mathematical function
 
 
 However, when I use two predictors, there is not error any more.
 
   m - naiveBayes(iris[,1:2], iris[,5])
   table(predict(m, iris[,1:2]), iris[,5])
 
   setosa versicolor virginica
setosa 49  0 0
versicolor  1 3719
virginica   0 1331

Hi.

A untested suggestion is to try

  m - naiveBayes(iris[,1, drop=FALSE], iris[,5])

The difference is that iris[,1] is not a dataframe, while
both iris[,1:2] and iris[,1, drop=FALSE] are.

Hope this helps.

Petr Savicky.

__
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] Correct use of ddply with own function

2012-05-05 Thread Tal Galili
Hi Johannes ,

Try this:

var1 - rep(c(a,b),c(100,100))
var2 - runif(200,1,50)
df.test - data.frame(var1,var2)

fn - function(x){
x - x$var2
   x1 - sort(x)
   x2 - seq(length(x))
   x3 - x2/max(x2)
   df - data.frame(x1,x2,x3)
   df
}

require(plyr)
ddply(df.test,.(var1),fn)



I think it should do what you've asked.



Contact
Details:---
Contact me: tal.gal...@gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
--




On Sat, May 5, 2012 at 12:51 PM, Johannes Radinger jradin...@gmx.at wrote:

 Hi,

 I am really confused how ddply work, so maybe you can help me.

 I created a function that sorts a vector etc.

 fn - function(x){
x1 - sort(x)
x2 - seq(length(x))
x3 - x2/max(x2)
df - data.frame(x1,x2,x3)
df
 }

 Probably this is not the best form of the function, but at least it
 produces what I want (data to plot a cumulative count curve).
 This function works on a single vector but I have a melted dataframe like:

 var1 - rep(c(a,b),c(100,100))
 var2 - runif(200,1,50)
 df.test - data.frame(var1,var2)

 ..and I want to apply that function on var2 but splitted by the variable
 var1. I think this might be a case for ddply...

 anything like: ddply(df.test,.(var1),fn(var2))...
 maybe someone know how to do that (modifying my function and applying it
 on a splitted dataframe).

 Best regards,

 Johannes

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


[[alternative HTML version deleted]]

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


[R] Luis Miguel Delgado Gomez/BBK está ausente de la oficina.

2012-05-05 Thread Luis Miguel Delgado Gomez

   Estaré ausente de la oficina desde el 04/05/2012 y no volveré hasta el
   14/05/2012.
   Responderé a su mensaje cuando regrese.
__
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] Panel MNP

2012-05-05 Thread Rajesh Paleti
Hi All,

Can the MNP package available in R be used to analyze panel data as well?

*i.e., *if there are 3 observed discrete choices for three time periods for
the same individual , can i estimate a panel multinomial probit model which
allows correlated errors across time periods and individual heterogeneity
(random coefficients) using the MNP package?

In the case that it doesn't work, is there any other Bayesian inference
based R package for estimating panel MNP models?

Thanks,
Rajesh

[[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] Can't import this 4GB DATASET

2012-05-05 Thread Jan van der Laan


Perhaps you could contact the persons that supplied/created the file and 
ask them what the format of the file exactly is. That is probably the 
safest thing to do.


If you are sure that the lines containing only whitespace are 
meaningless, then you could alter the previous code to make a copy of 
the file containing only lines with a length equal to 97 characters (you 
can do this by changing the '!=' to '==').


Since all lines are then of equal length, I suspect you have fixed width 
file. You could open and read this file using the LaF package 
(http://cran.r-project.org/web/packages/LaF/index.html; see the manual 
vignette for more information). In the package ffbase 
(http://cran.r-project.org/web/packages/ffbase/index.html) is a function 
to convert from LaF to ff (laf_to_ffdf). I do not known if packages such 
as rsqlite or bigmemory can import fixed width files.


The warning message indicates that the last line does not end with a new 
line character which could indicate an incomplete file but often doesn't 
mean anything. You could check the last line of the file to be sure.


HTH,

Jan



On 05/05/2012 05:21 AM, iliketurtles wrote:

Your code works!

strangelines.txt was created, and it's a text file with just spacebars ...
Seems like a few thousand lines of complete blanks (not 1 non-blank entry).

One thing, when I ran your code there was an error message;


setwd(C:/Users/admin/Desktop/hons/Thesis)
con- file(dataset.txt, rt)
out- file(strangelines.txt, wt)
# skip first 5 lines
lines- readLines(con, n=5)
# read the rest in blocks of 100.000 lines
while (TRUE) {

+ lines- readLines(con, n=1E5)
+ if (length(lines) == 0) break;
+ strangelines- lines[nchar(lines) != 97]
+ writeLines(strangelines, con=out)
+ }
Warning message:
In readLines(con, n = 1e+05) : incomplete final line found on 'dataset.txt'




I'm really not sure where to go from here. This has gone way out of my
depth.

-


Isaac
Research Assistant
Quantitative Finance Faculty, UTS
--
View this message in context: 
http://r.789695.n4.nabble.com/Can-t-import-this-4GB-DATASET-tp4607862p4610446.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.


__
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] lme or lmer for unbalance data

2012-05-05 Thread Ben Bolker
agent dunham crosspide at hotmail.com writes:

 I'd like to fix a mixed model. I have unbalance data, what should i use: 
 lme in nlme package , or lmer in lme4.
 
 Thanks, user at host.com as user at host.com
 

  More advanced mixed model questions belong on r-sig-mixed-models at
r-project.org , but the answer to this one is: either should be fine,
unless you want one of the features that only lme has (reported denominator
df/p values, R-side effects such as correlation and heteroscedasticity 
models) or one of the features that only lmer has (efficient fitting of
crossed random effects, GLMMs).

  Ben Bolker

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


Re: [R] R crash when i'm using lme function

2012-05-05 Thread Ben Bolker
gaiarrido gaiarrido at usal.es writes:

 When I try to adjust a mixed model with random effects I can make this order
 without problem
 
  lm.FA-lme(absFA~trait*condition,random=~1|individual)
 
 But if I try to fit a model in which the response (absFA) is not the same in
 all individuals at different levels of trait factor , but varies randomly
 from each. That is, this order
 
  lm.FA2-lme(absFA~rasgo*condicion,random=~rasgo|individuo)
 
 R hangs and crashes, I've tried both with R 2.13 and with  R 2.15.
 

  This is not reproducible ... and would be better on the
r-sig-mixed-models at r-project.org list.  If/when you repost,
more details would be useful:

 * how big is your data set (number of individuals, total
number of observations)?
 * are you including a data= argument in your calls?  It is
generally considered good practice.
 * your predictor variables are different in the two calls --
are you using different data sets, or different predictors,
(i.e. 'condicion' vs 'condition', 'individual' vs 'individuo',
'rasgo' vs 'trait'), or is this a typo?
 * have you checked to see that all variables are of the type
you think they should be (numeric vs factor)?
 * do you actually have multiple observations with different
trait values within at least some individuals?
 * see http://tinyurl.com/reproducible-000, or the posting
guide, for information about reproducible examples ...

__
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] Textwrangler Languages Folder

2012-05-05 Thread David Winsemius


On Dec 10, 2010, at 9:27 AM, Scott Chamberlain wrote:


Dear R Community,

I recently switched to a Mac (10.6.5), and have installed  
Textwrangler to
run code to R. However, I can't install the syntax highlighting file  
because

I can't find the directory: ~Users/username/Library/Application
Support/TextWrangler/Language Modules/. Is there a different  
location I can

place the syntax highlighting file?


This is not the right place for posting Mac-specific questions. There  
is a separate mailing list. The directory specification you offered  
doesn't really make sense, because on the Mac the tilde is generally a  
synonym for /Users/username, so one of these is likely to be more  
successful:


~/Library/Application Support/TextWrangler/Language Modules/

Users/username/Library/Application Support/TextWrangler/Language  
Modules/


If there is documentation that you were following that suggested the  
form you used, you should contact the authors and suggest they fix it.




[[alternative HTML version deleted]]


And you need to find the place in your mail-client that switches to  
plain text.


--
David Winsemius, MD
West Hartford, CT

__
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] Finding local maxima on a loess surface

2012-05-05 Thread David Winsemius


On May 4, 2012, at 3:00 PM, Diego Rojas wrote:

Thanks, I know about it but i wat to find several local maxima, so  
in other words I need a way to identify the places in the surface  
where both slopes are equal to 0 and the second derivative is  
negative.


There is no way that I know that will produce a mathematical function  
that would support symbolic manipulations of that sort for the results  
obtainable from a loess-object. I was expecting that you would be  
approaching this numerically and doing evaluations on a grid. Testing  
for equality to 0 is not a good practice if following that route. Sign  
reversal would be a more sensible criterion. ( And you _would_ be  
using predict.loess(). )


Still no data example or code offered, so not pursuing further efforts  
at illustration.




On Fri, May 4, 2012 at 9:28 AM, David Winsemius dwinsem...@comcast.net 
 wrote:


On May 3, 2012, at 6:09 PM, Diego Rojas wrote:

If a run a LOESS model and then produce a smoothed surface: Is there  
any

way to determine the coordinates of the local maxima on the surface?

?predict# it has a loess method.

   [[alternative HTML version deleted]]



David Winsemius, MD
West Hartford, CT

__
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] Cannot read or write to file in Linux Ubuntu

2012-05-05 Thread John Kane
Relative paths are not a mystery nor are they solely an aspect of linux.
 They are in fact the norm in DOS and Windows as well as in Linux or
 any other file system that use a tree structure.

Oh, is that all!   I just never thought of that behaviour as 'relative paths' 
just as something that one had to take into account in DOS.

I may take a look at R Studio but so far  I have been comfortable with a text 
editor and either RGUI or a terminal.

thanks

John Kane
Kingston ON Canada


 -Original Message-
 From: j...@surewest.net
 Sent: Fri, 4 May 2012 18:35:31 -0700
 To: r-help@r-project.org
 Subject: Re: [R] Cannot read or write to file in Linux Ubuntu
 
 On Thu, 3 May 2012 10:50:46 -0800
 John Kane jrkrid...@inbox.com wrote:
 
 Thanks Jeff and Sarah.
 
 I was thinking mainly of using the base path and paste routine which
 is something I do in Windows
 
 It will take me a while to figrue out relative paths.
 
 Relative paths are not a mystery nor are they solely an aspect of linux.
 They are in fact the norm in DOS and Windows as well as in Linux or
 any other file system that use a tree structure. Since Windows
 constrains you to a graphic interface, when using the file manager, you
 see the default use of relative paths without recognizing the
 behaviour.
 
 When opening or saving a file in Windows, the system will often offer
 you the choice of 'save, or 'save as' and if you mistakenly use 'save'
 from the wrong working directory, you may well have a files written
 other than where you thought it was.  This problem is so common that
 Windows users tend to take it in stride and have developed habits that
 limit the aggravation.  You do not have those habits for Linux yet.
 
 Until you are more comfortable in Linux you might want to run RStudio
 while using R.  The learning curve of a new OS as well as
 different details in simply using the computer interface is quite
 challenging.
 
 JWDougherty
 
 __
 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.


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
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] Off-Topic: Crime Statistics Don't Pay

2012-05-05 Thread John Kane
And you don't want to know about some of the other problems with the FBI’s 
Uniform Crime Reports.  IRRC, they are fine for what the FBI intended but a lot 
of reseachers don't read the data descriptions as closely as they should.

John Kane
Kingston ON Canada


 -Original Message-
 From: gunter.ber...@gene.com
 Sent: Fri, 4 May 2012 09:49:15 -0700
 To: r-help@r-project.org
 Subject: [R] Off-Topic: Crime Statistics Don't Pay
 
 WARNING: COMPLETELY OFF TOPIC -- Nothing to do with R.
 
 I thought readers of this list might enjoy the following. The link to
 the full article is at the bottom. I hope this is not too
 inappropriate.
 
 ---
 Overconfidence in crime statistics doesn’t pay. In a new study, a team
 of criminologists makes the case that reported crime rates should
 acknowledge uncertainty in the data. The research demonstrates that
 rankings of cities as safer or more dangerous — which can influence
 tourism and tax spending — can be highly misleading.
 
 “If you look at crime rates from year to year and you see a change,
 there’s a fundamental ambiguity in whether that change is caused by a
 real change in crime, a change in reporting or some of both,” says
 criminologist Robert Brame of the University of North Carolina at
 Charlotte, a coauthor of the new study. “Our position is we should own
 that. There’s ambiguity here and we should learn to deal with it.”
 ---
 
 Aside from, Well, duhhh..., my reaction was:  what other misleading
 data are being thrown around in the public domain whose uncertainty
 has been blithely ignored Don't answer that!
 
 http://www.sciencenews.org/view/generic/id/340450/title/Crime_numbers_may_mislead_
 
 Cheers,
 Bert
 
 --
 
 Bert Gunter
 Genentech Nonclinical Biostatistics
 
 Internal Contact Info:
 Phone: 467-7374
 Website:
 http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
 
 __
 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.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks  orcas on your 
desktop!

__
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] Off-Topic: Crime Statistics Don't Pay

2012-05-05 Thread John Kane
And you don't want to know about some of the other problems with the FBI’s 
Uniform Crime Reports.  IRRC, they are fine for what the FBI intended but a lot 
of reseachers don't read the data descriptions as closely as they should.

John Kane
Kingston ON Canada


 -Original Message-
 From: gunter.ber...@gene.com
 Sent: Fri, 4 May 2012 09:49:15 -0700
 To: r-help@r-project.org
 Subject: [R] Off-Topic: Crime Statistics Don't Pay
 
 WARNING: COMPLETELY OFF TOPIC -- Nothing to do with R.
 
 I thought readers of this list might enjoy the following. The link to
 the full article is at the bottom. I hope this is not too
 inappropriate.
 
 ---
 Overconfidence in crime statistics doesn’t pay. In a new study, a team
 of criminologists makes the case that reported crime rates should
 acknowledge uncertainty in the data. The research demonstrates that
 rankings of cities as safer or more dangerous — which can influence
 tourism and tax spending — can be highly misleading.
 
 “If you look at crime rates from year to year and you see a change,
 there’s a fundamental ambiguity in whether that change is caused by a
 real change in crime, a change in reporting or some of both,” says
 criminologist Robert Brame of the University of North Carolina at
 Charlotte, a coauthor of the new study. “Our position is we should own
 that. There’s ambiguity here and we should learn to deal with it.”
 ---
 
 Aside from, Well, duhhh..., my reaction was:  what other misleading
 data are being thrown around in the public domain whose uncertainty
 has been blithely ignored Don't answer that!
 
 http://www.sciencenews.org/view/generic/id/340450/title/Crime_numbers_may_mislead_
 
 Cheers,
 Bert
 
 --
 
 Bert Gunter
 Genentech Nonclinical Biostatistics
 
 Internal Contact Info:
 Phone: 467-7374
 Website:
 http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
 
 __
 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.


GET FREE SMILEYS FOR YOUR IM  EMAIL - Learn more at 
http://www.inbox.com/smileys
Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most 
webmails

__
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] estimation problem

2012-05-05 Thread David Winsemius


On May 4, 2012, at 4:22 PM, Petr Savicky wrote:


On Fri, May 04, 2012 at 07:43:32PM +0200, Kehl Dániel wrote:

Dear Petr,

thank you for your input.
I tried to experiment with (probably somewhat biased) truncated means
like in the following code.
How I got the 225 as a truncation limit is a good question. :)

REPS1 - REPS2 - 1000
N1 - 10
N2 - 3
N - N1+N2
x1 - rep(0,N1)
x2 - rnorm(N2,300,100)
x - c(x1,x2)

n - 1000

for (i in 1:REPS1){
 x_sample - sort(sample(x,n,replace=FALSE),TRUE)
 x_trunc - x_sample[1:225]
 REPS1[i] - mean(x_sample)*N
 REPS2[i] - sum(x_trunc)/n*N
 }

sum(x2)
mean(REPS1)
mean(REPS2)
sd(REPS1)
sd(REPS2)
sd(REPS2)/sd(REPS1)


Dear Daniel.

Thank you for your reply.

In the original question, you used the parameters

 N1 - 10
 N2 - 3000

and now the parameters

 N1 - 10
 N2 - 3

My remark was that with the original parameters, there are only 29.1
nonzero elements on average. Now, there are 230.8 nonzero elements on
average, which is significantly better.

Discussion of the use of the truncated mean is probably a question to
other members of the list. I do not feel to be an expert on this.

Best, Petr.


My experience is that Petr is better than I at much of R, but so far  
in this thread I have not seen mention of methods that are designed to  
examine data situations with large numbers of zeros. There is a very  
informative review of R techniques and packages to such efforts by  
Achim Zeileis and others. The same material was published in the  
Journal of Statistical Software and as a vignette in one of the  
contributed packages:


www.jstatsoft.org/v27/i08/paper
cran.r-project.org/web/packages/pscl/vignettes/countreg.pdf

I don't have this information memorized, but generally find a Google- 
search with count r zeileis to be highly effective. I've just  
noticed that the second author Kleiber also has put up useful material  
on that topic for web-searchers to use.


David Winsemius, MD
West Hartford, CT

__
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] weird predict function error when I use naive bayes

2012-05-05 Thread Uwe Ligges



On 04.05.2012 13:54, kiinalist wrote:

Hi,

I tried to use naivebayes in package 'e1071'.
when I use following parameter, only one predictor, there is an error.


m- naiveBayes(iris[,1], iris[,5])
table(predict(m, iris[,1]), iris[,5])

Error in log(sapply(attribs, function(v) { :
Non-numeric argument to mathematical function


Either use the more convninient formula notation:

m - naiveBayes(Species ~ Sepal.Length, data = iris)
table(predict(m, iris), iris$Species)


or provide data.frames rather than vectors, hence:


m - naiveBayes(iris[,1,drop=FALSE], iris[,5])
table(predict(m, iris[,1,drop=FALSE]), iris[,5])

Uwe Ligges





However, when I use two predictors, there is not error any more.


m- naiveBayes(iris[,1:2], iris[,5])
table(predict(m, iris[,1:2]), iris[,5])


setosa versicolor virginica
setosa 49 0 0
versicolor 1 37 19
virginica 0 13 31

Do you know what is the problem?

Br,
Luffy

__
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] Absolute cumulative curve with ecdf/stepfun?

2012-05-05 Thread Uwe Ligges



On 04.05.2012 14:34, Johannes Radinger wrote:

Hi,

I have two variables ranging both from 0 to 1 (n=500 each).
Now I am interested in plotting them both in one plot (using ggplot2).

So far I used ecdf() (from an example I found with google) to get
values for the cumulatice distribution function which gives a relative
curve. I also want to do the same plot but using absolute cumulative
values instead of relative. Can that be done with ecdf or with stepfun()
to get values I can use to plot the curves?

Here a small example that shows the result with ecdf:

library(ggplot2)
library(reshape)

dftest1- data.frame(value=runif(1000,0,1),variable=rep(c(a,b),c(500,500)))
dftest2- ddply(dftest1,.(variable),transform, ecd = ecdf(value)(value))

ggplot(dftest2,aes(x = value, y = ecd)) +
geom_line(aes(group = variable,colour = variable))

I'd like to replace the ecdf-function in ddply with a function that gives 
cumulative counts resp. the cumulative position of each observation, so that I 
get an absolute cumulative curve as a result? Is that understandable?

Thank you very much,

Johannes


What about using stepfun() and providing the data cummulated via cumsum?

Uwe Ligges

__
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] Help with getting values from string

2012-05-05 Thread Uwe Ligges



On 03.05.2012 12:39, renu.s7 wrote:

Hi All,

I have a doubt. I used macros and i try to pass a value to a macro by
concatenating a bunch of strings. But it does not seem to work. Please help.
I have written down my code and the error message please tell me how to pass
the value that a string points to. Thanks in advance

#macro defined


R defmacro
Error: object 'defmacro' not found

...

So 1. provide full reproducible code and 2. format it in a more readable 
form and use R syntax.


Uwe Ligges




machist_occ_kgfs-defmacro(a,qnu_occ,b,qnl_occ,expr={with(subset(an_ind_data_fin,income_source==a
  region_id==b  normalised_incomeqnl_occ
normalised_incomeqnu_occ),hist(normalised_income,main=paste(a,b,sep=
)))})
#macro called
machist_occ_kgfs(occ,paste(qnu,ri,occ,collapse=,sep=),ri,paste(qnl,ri,occ,collapse=,sep=))

Error in hist.default(normalised_income, main = paste(occ, ri, sep =  ),
:
   hist.default: pretty() error, breaks=
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf

The thing is paste(qnu,ri,occ,collapse=,sep=) returns the value
qnu1Business__Others but the variable - qnu1Business__Others contains an
integer value which i need to be passed on to the macro. Hope i have made
myself clear. Thanks in advance for your help

--
View this message in context: 
http://r.789695.n4.nabble.com/Help-with-getting-values-from-string-tp4605632.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.


__
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] Getting predicted values from a zero-inflated negative binomial using zeroinfl()

2012-05-05 Thread Christopher Desjardins
Hi,
I am a little confused at the output from predict() for a zeroinfl object.

Here's my confusion:

## From zeroinfl package
fm_zinb2 - zeroinfl(art ~ . | ., data = bioChemists, dist = negbin)


## The raw zero-inflated overdispersed data
 table(bioChemists$art)

  0   1   2   3   4   5   6   7   8   9  10  11  12  16  19
275 246 178  84  67  27  17  12   1   2   1   1   2   1   1

## The default output from predict. It looks like it is doing a horrible
job. Does it really predict 7 zeros?
 table(round(predict(fm_zinb2)))

  0   1   2   3   4   5   6  10
  7 354 487  45  12   6   3   1

##  The output from predict using count
 table(round(predict(fm_zinb2,type=count)))

  1   2   3   4   5   6  10
312 536  45  12   6   3   1

## The output from predict using zero, but here it predicts 24
structural zeros?
 table(round(predict(fm_zinb2,type=zero)))

  0   1
891  24


So my question is how do I interpret these different outputs from the
zeroinf object? What are the differences? The help page just left me
confused. I would expect that table(round(predict(fm_zinb2))) would be E(Y)
and would most accurately track table(bioChemists$art) but I am wrong. How
can I find the E(Y) that would most closely track the raw data?

Please cc me if you reply.
Thanks,
Chris

[[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] alarm() doesn't beep

2012-05-05 Thread Liviu Andronic
Dear all
I'd like to make a beeping sound in R, but alarm() doesn't beep? I
checked ?alarm but I couldn't find any pointers to system
configuration. Any ideas?

Regards
Liviu

 sessionInfo()
R version 2.14.2 (2012-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] plyr_1.7.1 Defaults_1.1-1 fortunes_1.5-0 sos_1.3-1  brew_1.0-6


-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

__
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] alarm() doesn't beep

2012-05-05 Thread R. Michael Weylandt
It doesn't seem to be super robust and might depend on how you are
running R: for me (OS X 10.6), I get the beep at the terminal and in
the R.app GUI, but not within RStudio.

Michael

On Sat, May 5, 2012 at 2:12 PM, Liviu Andronic landronim...@gmail.com wrote:
 Dear all
 I'd like to make a beeping sound in R, but alarm() doesn't beep? I
 checked ?alarm but I couldn't find any pointers to system
 configuration. Any ideas?

 Regards
 Liviu

 sessionInfo()
 R version 2.14.2 (2012-02-29)
 Platform: x86_64-pc-linux-gnu (64-bit)

 locale:
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=C                 LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C
 [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

 attached base packages:
 [1] stats     graphics  grDevices utils     datasets  methods   base

 other attached packages:
 [1] plyr_1.7.1     Defaults_1.1-1 fortunes_1.5-0 sos_1.3-1      brew_1.0-6


 --
 Do you know how to read?
 http://www.alienetworks.com/srtest.cfm
 http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
 Do you know how to write?
 http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

 __
 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] alarm() doesn't beep

2012-05-05 Thread David Winsemius

Liviu;

Is there a command you could call with system()?

--  
David.

On May 5, 2012, at 2:12 PM, Liviu Andronic wrote:


Dear all
I'd like to make a beeping sound in R, but alarm() doesn't beep? I
checked ?alarm but I couldn't find any pointers to system
configuration. Any ideas?

Regards
Liviu


sessionInfo()

R version 2.14.2 (2012-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
[1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] plyr_1.7.1 Defaults_1.1-1 fortunes_1.5-0 sos_1.3-1   
brew_1.0-6



--
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

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


David Winsemius, MD
West Hartford, CT

__
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] something weird in integration (pracma library)

2012-05-05 Thread casperyc
Hi,

library(pracma)

k=20
mu=4.5
casigma=17000

myint=function(j) {
quadinf(function(x)
(1/(1+exp(-x)))^j*(1-1/(1+exp(-x)))^(k-j)*dnorm(x,mu,casigma),-Inf,Inf)
}
sapply(0:k,myint)


works fine

casigma=50500
sapply(0:k,myint)

 casigma too large!

so try change of variable, y= (x-mu)/sigma

myint3=function(j) {
quadinf(function(y)
(1/(1+exp(-y*casigma-mu)))^j*(1-1/(1+exp(-y*casigma-mu)))^(k-j)*dnorm(y),-Inf,Inf)
}
sapply(0:k,myint3)

works again, but maybe precision is reduced??

HOWEVER, the problem now is

casigma=101
sapply(0:k,myint3)
casigma=100
sapply(0:k,myint3)
casigma=99
sapply(0:k,myint3)
casigma=98
sapply(0:k,myint3)
casigma=97
sapply(0:k,myint3)


does NOT work when casigma is 99 or 100. (when casigma is 'small')

I wonder if there are 'many' other small values of casigma that have the
same problem???

and why???

Casper





-
##
PhD candidate in Statistics
Big R Fan
Big LEGO Fan
Big sTaTs Fan
##

--
View this message in context: 
http://r.789695.n4.nabble.com/something-weird-in-integration-pracma-library-tp4611381.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.


[R] [R-pkgs] ROCR source code now available on github

2012-05-05 Thread Tobias Sing
Dear all,

the commented source code for the ROCR package
(http://cran.r-project.org/web/packages/ROCR) is now available on
github -- feel free to fork, add improvements, and contribute back!
https://github.com/ipa-tys/ROCR

Kind regards,
  Tobias

___
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] No error message no display output

2012-05-05 Thread Trying To learn again
Hi all,

I´m re-starting (as my name indicates) my little knowlegde of CRAN R.

I made this function time before but I don´t know where is the error
because nothing appears as an error but the histogram plot doesn´t appear.
Should I install some special library to run sapply?


pru-function(){

randz-matrix(rnorm(20),100,2000)

H-matrix(0,100,2000)


for (j in 2:2000){
for (i in 2:100){
H[1,]-randz[1,]
H[i,j]-H[i-1,j]+randz[i,j]


}}

hy-nrow(H)-1

estima-H[2:nrow(H),]

estima2-H[1:hy,]


a-estima
b-estima2


mycoef - function(x, y) coefficients( lm(y ~ x-1) )

rest - sapply(2:2000, function(i){
   y - a[,i]
   x - b[,i]
  mycoef(x,y)
   }
)



print(summary(rest))

hist(rest,col=blue,breaks=seq(0.6,1.05,0.01),prob=TRUE)
lines(density(rest,bw=0.03))
rug(rest)



}

Many Thanks¡¡¡

[[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] No error message no display output

2012-05-05 Thread Trying To learn again
I´m using this version of R

R version 2.13.2 (2011-09-30)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-pc-mingw32/i386 (32-bit)


2012/5/5 Trying To learn again tryingtolearnag...@gmail.com

 Hi all,

 I´m re-starting (as my name indicates) my little knowlegde of CRAN R.

 I made this function time before but I don´t know where is the error
 because nothing appears as an error but the histogram plot doesn´t appear.
 Should I install some special library to run sapply?


 pru-function(){

 randz-matrix(rnorm(20),100,2000)

 H-matrix(0,100,2000)


 for (j in 2:2000){
 for (i in 2:100){
 H[1,]-randz[1,]
 H[i,j]-H[i-1,j]+randz[i,j]


 }}

 hy-nrow(H)-1

 estima-H[2:nrow(H),]

 estima2-H[1:hy,]


 a-estima
 b-estima2


 mycoef - function(x, y) coefficients( lm(y ~ x-1) )

 rest - sapply(2:2000, function(i){
y - a[,i]
x - b[,i]
   mycoef(x,y)
}
 )



 print(summary(rest))

 hist(rest,col=blue,breaks=seq(0.6,1.05,0.01),prob=TRUE)
 lines(density(rest,bw=0.03))
 rug(rest)



 }

 Many Thanks¡¡¡



[[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] alarm() doesn't beep

2012-05-05 Thread Liviu Andronic
On Sat, May 5, 2012 at 8:34 PM, David Winsemius dwinsem...@comcast.net wrote:
 Is there a command you could call with system()?

Yes. Something like:
system(play /tmp/02Canon.mp3)

works jsut fine. But I was curious about alarm().

Liviu

__
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] Editor to program with CRAN R

2012-05-05 Thread Trying To learn again
Hi all,

I´m using the windows writting pad (not Notepad the simplest version). I
think there should be greater and helping note pads to help programming.

Can you suggest one?

Many thanks

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

2012-05-05 Thread Jin Choi
Dear users of metafor,

I am working on a meta-analysis using the metafor package. I have a
excel csv database that I am working with. I am interested in pooling
the effect measures for a particular subgroup (European women) in this
csv database. I am conducting both sub-group and meta-regression.

In subgroup-analyses, I have stratified the database to create a
separate csv file just for European women from the original database
and conducted the following:

women_west-read.csv(women_west.csv)
print(women_west)
dat-escalc(measure=ZCOR,ri=Pearson,ni=N,data=women_west,append=TRUE)
res-rma(yi,vi,data=dat)
is.factor(dat$year)
forest(res,transf=transf.ztor)

In meta-regression, I used the original database, but used categorical
moderators for sex (=women), and ethnicity (=european) to find the
effect specifically in European women.
adult-read.csv(adult.csv)
print(adult)
dat-escalc(measure=ZCOR,ri=Pearson,ni=N,data=adult,append=TRUE)
res-rma(yi,vi,data=dat)
res-rma(yi,vi,mods=cbind(sex,race),data=dat)
predict(res,transf=transf.ztor,newmods=cbind(seq(from=0,to=1,by=1),1),addx=TRUE)

I am getting different results between the forest function from
subgroup analyses, and the predict function from the meta-regression.
I thought they should have been the same - can I get help to explain
why there are differences? In both cases, I am transforming raw
Pearson coefficients to z-transformed coefficients, then
back-transforming to raw r after pooling.

Thank you very much.

Jin Choi
MSc (Epidemiology) Student
McGill University, Montreal CANADA

__
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] Editor to program with CRAN R

2012-05-05 Thread R. Michael Weylandt
There's a huge spectrum -- all the way from Vim / Emacs to notepad:
one that's designed with R in mind (though much heavier than notepad)
is RStudio, which is proving pretty popular in the R community:
http://rstudio.org/ If you get into more programming, it might be
worth it to adopt a general IDE / text editor and learn to use an
R-mode on that.

Michael

On Sat, May 5, 2012 at 11:34 AM, Trying To learn again
tryingtolearnag...@gmail.com wrote:
 Hi all,

 I磎 using the windows writting pad (not Notepad the simplest version). I
 think there should be greater and helping note pads to help programming.

 Can you suggest one?

 Many thanks

         [[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] Pasting with Quotes

2012-05-05 Thread Josh Browning
Hello useRs!

So, I have a random question.  I'm trying to build a character string, then
evaluate it.  I think an example would be the easiest way to explain:


kern.vec = c(rbfdot,polydot)
for( j in 1:length( kern.vec ) )
{
  formula= paste(ksvm( ind ~ . ,
data=d.temp[,c(ind_col,dep_cols)], kernel =,kern.vec[j],, prob.model=T ))
  svm= eval( parse( text=formula ) )
 ...
}


The problem I always seem to have is that in the formula, I need to have
quotes around rbfdot (for example).  But, when I paste the expression
together, it removes the quotes.  Is there a better way to do this (or at
least a way around this problem)?  My method seems a bit kludgy :)

Thanks for all your help!

Josh

[[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] Editor to program with CRAN R

2012-05-05 Thread Joshua Wiley
There are many, off the top of my head:

--Emacs + ESS (what I use).  You can get them separately or combined
from: http://vgoulet.act.ulaval.ca/en/emacs/
--RStudio
--Vim
--Eclipse + StatEt

Most of those work on different (all?) platforms.

Cheers,

Josh

On Sat, May 5, 2012 at 8:34 AM, Trying To learn again
tryingtolearnag...@gmail.com wrote:
 Hi all,

 I磎 using the windows writting pad (not Notepad the simplest version). I
 think there should be greater and helping note pads to help programming.

 Can you suggest one?

 Many thanks

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




-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.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] No error message no display output

2012-05-05 Thread Uwe Ligges

1. You need to call the function

pru()

after defining it.


2. Next excercise will be to get rid of all those loops.

3. Next excercide will be to reutn something useful from your function 
(rather than printing).


4. Upgrade to a recent version of R.

Uwe Ligges



On 05.05.2012 17:31, Trying To learn again wrote:

I´m using this version of R

R version 2.13.2 (2011-09-30)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-pc-mingw32/i386 (32-bit)


2012/5/5 Trying To learn againtryingtolearnag...@gmail.com


Hi all,

I´m re-starting (as my name indicates) my little knowlegde of CRAN R.

I made this function time before but I don´t know where is the error
because nothing appears as an error but the histogram plot doesn´t appear.
Should I install some special library to run sapply?


pru-function(){

randz-matrix(rnorm(20),100,2000)

H-matrix(0,100,2000)


for (j in 2:2000){
for (i in 2:100){
H[1,]-randz[1,]
H[i,j]-H[i-1,j]+randz[i,j]


}}

hy-nrow(H)-1

estima-H[2:nrow(H),]

estima2-H[1:hy,]


a-estima
b-estima2


mycoef- function(x, y) coefficients( lm(y ~ x-1) )

rest- sapply(2:2000, function(i){
y- a[,i]
x- b[,i]
   mycoef(x,y)
}
 )



print(summary(rest))

hist(rest,col=blue,breaks=seq(0.6,1.05,0.01),prob=TRUE)
lines(density(rest,bw=0.03))
rug(rest)



}

Many Thanks¡¡¡




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


Re: [R] Editor to program with CRAN R

2012-05-05 Thread Uwe Ligges

Or more generally, see the overview page at:

http://www.sciviews.org/_rgui/projects/Editors.html

Uwe Ligges


On 05.05.2012 20:44, R. Michael Weylandt wrote:

There's a huge spectrum -- all the way from Vim / Emacs to notepad:
one that's designed with R in mind (though much heavier than notepad)
is RStudio, which is proving pretty popular in the R community:
http://rstudio.org/ If you get into more programming, it might be
worth it to adopt a general IDE / text editor and learn to use an
R-mode on that.

Michael

On Sat, May 5, 2012 at 11:34 AM, Trying To learn again
tryingtolearnag...@gmail.com  wrote:

Hi all,

I磎 using the windows writting pad (not Notepad the simplest version). I
think there should be greater and helping note pads to help programming.

Can you suggest one?

Many thanks

    [[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-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] Pasting with Quotes

2012-05-05 Thread R. Michael Weylandt
What's the big picture of what you're trying to do? eval(parse(text
= )) is often a less than optimal idea.

Some guesses:

Are you trying to construct a formula object (in the strict sense of
something that you pass to a modeling function)?

Maybe lazy evaluation of the deparse(substitute(x)) flavor might help here?

Michael

On Sat, May 5, 2012 at 2:42 PM, Josh Browning
rockclimber112...@gmail.com wrote:
 Hello useRs!

 So, I have a random question.  I'm trying to build a character string, then
 evaluate it.  I think an example would be the easiest way to explain:


    kern.vec = c(rbfdot,polydot)
    for( j in 1:length( kern.vec ) )
    {
      formula    = paste(ksvm( ind ~ . ,
 data=d.temp[,c(ind_col,dep_cols)], kernel =,kern.vec[j],, prob.model=T ))
      svm    = eval( parse( text=formula ) )
     ...
    }


 The problem I always seem to have is that in the formula, I need to have
 quotes around rbfdot (for example).  But, when I paste the expression
 together, it removes the quotes.  Is there a better way to do this (or at
 least a way around this problem)?  My method seems a bit kludgy :)

 Thanks for all your help!

 Josh

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


Re: [R] Editor to program with CRAN R

2012-05-05 Thread Leandro Marino
 I think that if you're not familiar with emacs or vim I suggest you to
use RStudio. If you're a programmer that knows how to use eclipse I think
eclipse with statet it will be the best solution. Another option that you
have is the notepad + + with NppToR plugin

 Best,


Att,
Leandro Marino

-- Enviado do meu dispositivo móvel.
Em 05/05/2012 15:49, Joshua Wiley jwiley.ps...@gmail.com escreveu:

 There are many, off the top of my head:

 --Emacs + ESS (what I use).  You can get them separately or combined
 from: http://vgoulet.act.ulaval.ca/en/emacs/
 --RStudio
 --Vim
 --Eclipse + StatEt

 Most of those work on different (all?) platforms.

 Cheers,

 Josh

 On Sat, May 5, 2012 at 8:34 AM, Trying To learn again
 tryingtolearnag...@gmail.com wrote:
  Hi all,
 
  I磎 using the windows writting pad (not Notepad the simplest version). I
  think there should be greater and helping note pads to help programming.
 
  Can you suggest one?
 
  Many thanks
 
[[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.
 



 --
 Joshua Wiley
 Ph.D. Student, Health Psychology
 Programmer Analyst II, Statistical Consulting Group
 University of California, Los Angeles
 https://joshuawiley.com/

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


[[alternative HTML version deleted]]

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


Re: [R] alarm() doesn't beep

2012-05-05 Thread Jeff Newmiller
The alarm() function just sends a ctrl-g (ASCII BEL character) to the console 
terminal. If the terminal type recognizes this byte according to that 
interpretation, and it is not locally configured to disable sound, then you 
should hear an audible alert. Linux consoles typically do handle this. In X 
Windows, you have many possible terminal emulators, so you will have to read 
the documentation for the emulator you are using.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Liviu Andronic landronim...@gmail.com wrote:

Dear all
I'd like to make a beeping sound in R, but alarm() doesn't beep? I
checked ?alarm but I couldn't find any pointers to system
configuration. Any ideas?

Regards
Liviu

 sessionInfo()
R version 2.14.2 (2012-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] plyr_1.7.1 Defaults_1.1-1 fortunes_1.5-0 sos_1.3-1 
brew_1.0-6


-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

__
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] Pasting with Quotes

2012-05-05 Thread David Winsemius


On May 5, 2012, at 2:42 PM, Josh Browning wrote:


Hello useRs!

So, I have a random question.  I'm trying to build a character  
string, then

evaluate it.


Actually you are trying to build a language object , a call or an  
expression. You might have gotten further with:


do.call(ksvm, list(  ... named arguments ...)


 I think an example would be the easiest way to explain:


   kern.vec = c(rbfdot,polydot)
   for( j in 1:length( kern.vec ) )
   {
 formula= paste(ksvm( ind ~ . ,
data=d.temp[,c(ind_col,dep_cols)], kernel =,kern.vec[j],,  
prob.model=T ))

 svm= eval( parse( text=formula ) )
...
   }


The problem I always seem to have is that in the formula, I need to  
have
quotes around rbfdot (for example).  But, when I paste the  
expression
together, it removes the quotes.  Is there a better way to do this  
(or at

least a way around this problem)?  My method seems a bit kludgy :)


Perhaps looking at either:

?substitute
?bquote

kern.vec = c(rbfdot,polydot)
   for( j in 1:length( kern.vec ) )
   {
 formula= bquote(expression( ksvm( ind ~ . ,  
data=d.temp[,c(ind_col,dep_cols)], kernel =.(kern.vec[j] ) ,  
prob.model=T ) ))

 print(formula)
   }

expression(ksvm(ind ~ ., data = d.temp[, c(ind_col, dep_cols)],
kernel = rbfdot, prob.model = T))
expression(ksvm(ind ~ ., data = d.temp[, c(ind_col, dep_cols)],
kernel = polydot, prob.model = T))

Notice that the values for kern.vec are 'character' which is what you  
passed them (and what you seem to be requesting. If you wanted the  
values of those named objects you might try get(name). (I'm not a  
user of whatever package has `ksvm` in it, so I'm not aware of whether  
'rbfdot' is supposed to be a character value as a parameter or if  
those are named objects, and I'm not running out to identify the  
package and then to locate a working example to test the eval-result.  
Those are details you should have provided.)





--

David Winsemius, MD
West Hartford, CT

__
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] penalized quantile regression (rq.fit.lasso)

2012-05-05 Thread Yuanyuan Tang
Dear all:

I have a question about how to get the optimal estimate of coefficients
using the penalized quantile regression (LASSO penalty in quantile
regression defined in Koenker 2005).
In R, I found both
rq(y ~ x, method=lasso,lambda = 30) and
rq.fit.lasso(x, y, tau = 0.5, lambda = 1, beta = .9995, eps = 1e-06)
can give the estimates. But, I didn't find a way using either of these
command to get the optimal estimates. Is there any way to specify the
optimal lambda (the value of penalty parameter) and then get the optimal
estimates? Thanks a lot. Any comment will be appreciated.

sophie

[[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] Query about memory used in list and dataframe

2012-05-05 Thread Shivam
Hi,

I had a query regarding which object, a list or a dataframe, consumes more
R memory. Let me clarify this:

For example, I have a df of 6 rows and 12 columns, say 'test'. I do
object.size() and find it uses 3.3 KB of memory.

I run a loop and make a list, say 'testlist', of 6 elements, each element
being the above mentioned df 'test'. The size of this list is 19.9 KB,
understandably.

Now I combine this list into a dataframe using rbind. The df formed has 12
cols and 36 rows. The size of this df is just 5.8 KB, almost a 75%
reduction in memory.

I had to work with a much larger list, and I thought of using the same
method to convert my bigger list (62 dataframes, each having 4 cols and
close to 200,000 rows) into a single dataframe. The big list, sat LIST A,
had a size of 571 MB. But when I convert it into a dataframe, say DF A,
using rbind, the object size increases to 1.35 GB. This was in
contradiction to the earlier result.

What am I missing? Why a 75% reduction in size in one case and double size
in other? Anyone with any explanation?

Sorry for the verbose email, just wanted to make my case clear.

Thanks in advance,
Regards
Shivam

[[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] download extremely slow

2012-05-05 Thread Hillary Sardiñas
I have been trying to download the latest version to my Macbook X version
10.6.8 from my institutions mirror http://cran.cnr.Berkeley.edu
Usually is only takes minutes, but regardless of the browser or where I
connect to the internet I have been unable to download because it would
take upwards 2 days according to the download dialogue box.
I'd really like to get the newest version to run some new packages that
don't seem to work well in what I have currently (2.12.1)
I had the same problem last time I tried to update ~ 3 weeks ago.
Who should I contact/what should I do?
Thanks!

-- 
Hillary Sardiñas
PhD Candidate
Environmental Science, Policy  Management
University of California, Berkeley
http://nature.berkeley.edu/kremenlab/hillary.html

There is only one question: how to love this world. ~ Mary Oliver

[[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] No Data in randomForest predict

2012-05-05 Thread Jennifer Corcoran
I would like to ask a general question about the randomForest predict
function and how it handles No Data values.  I understand that you can omit
No Data values while developing the randomForest object, but how does it
handle No Data in the prediction phase?  I would like the output to be NA
if any (not just all) of the input data have an NA value. It is not clear
to me if this is the default or if I need to add an argument in the predict
function.

[[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] c() in Mac does not work

2012-05-05 Thread E Kim
I recently changed to Mac OS X 10.7.3 from Windows and this simple function
is giving errors.

 c(4,7,7)
Error in c(4, 7, 7) : unused argument(s) (7)

 c(1,7:9)

Error in d[i, ] : incorrect number of dimensions


 c(1:5, 10.5, next)
Error in c(1:5, 10.5, next) : unused argument(s) (next)

 c(1,2)

Error in d[i, ] : incorrect number of dimensions



I removed R and reinstalled, but I get the same problem.

Could you please help?


Thank you.

[[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] creating a new column assigning values of other columns

2012-05-05 Thread R. Michael Weylandt
Ba -- far too much work to recreate (and I don't think you sent us
the file act.lig): here's a much better route:

Go to the step immediately before you're in trouble and use dput() on
your data. R will print out a nice plaintext representation that we
can copy and paste and reproduce *exactly* without having to do all
that you show below.

Incidentally, your warning message suggests you should be using
ifelse() instead of if.

To compare:

x - seq(-3, 3)
abs.x.wrong - if(x  0) -x else x # Warning message gives some hint
abs.x.right - ifelse(x  0, -x, x)

Hope this helps,

Michael

On Sat, May 5, 2012 at 5:09 PM, Santiago Guallar sgual...@yahoo.com wrote:
 Hello,

 I have to create a new column from the values of other columns of a data 
 frame. The new column (y$n) is created imposing a condition (using a third 
 variable y$h) that assigns the values of two time variables (y$b and 
 y$timepos). Here's the piece of code to get there (using the attached files):

 xact - read.table(act.lig, sep = ',', 
 col.names=c(ok,time,secs,act))
 xlig - read.table(lig.txt, sep = ',', 
 col.names=c(ok,time,secs,lig))
 w- merge(xact, xlig, by = c(time ,secs), all = TRUE, sort=F)
 require(reshape)
 z - cbind(w, colsplit(w$time, split= , names=c(date, clock)))
 zh-cbind(z, colsplit(z$clock, split=:, names=c(h,m,s)))
 zhd- cbind(zh, colsplit(zh$date, split=/, names=c(d,mo,y)))
 night - subset(zhd, zh$lig6  zhd$h9 | zh$lig6  zhd$h21)
 night$timepos-as.POSIXct(night$time, tz=GMT, format=%d/%m/%y %H:%M:%S)
 a=night$timepos - as.difftime( 1, units=days )
 nighta-cbind(night,a)
 y- cbind(nighta, b=as.character(a, tz= GMT, format= %Y-%m-%d))
 y$n-with(y, if (h=0  h9) {b} else {timepos}) ## Missing warnings
 In
  if (h = 0  h  9) { :
 condition
  has length  1 and only the first element will be used

 How can I go around this problem and get the new column?

 Thank you,

 Santi
 __
 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] c() in Mac does not work

2012-05-05 Thread Joshua Wiley
Hi,

My best guess is that the c() you want to be calling is not the c()
you are calling.  This can happen if it is masked by a function
definition in you global environment or in a package you load.  What
happens when you type:

c

at the console?  Also, from one of your sessions where it , c(), does
not behave as you expect, can you report the output of:

sessionInfo()

as the posting guide requests?

Cheers,

Josh

On Sat, May 5, 2012 at 2:17 PM, E Kim emkim1...@gmail.com wrote:
 I recently changed to Mac OS X 10.7.3 from Windows and this simple function
 is giving errors.

 c(4,7,7)
 Error in c(4, 7, 7) : unused argument(s) (7)

 c(1,7:9)

 Error in d[i, ] : incorrect number of dimensions


 c(1:5, 10.5, next)
 Error in c(1:5, 10.5, next) : unused argument(s) (next)

 c(1,2)

 Error in d[i, ] : incorrect number of dimensions



 I removed R and reinstalled, but I get the same problem.

 Could you please help?


 Thank you.

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



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.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] download extremely slow

2012-05-05 Thread R. Michael Weylandt
Hmmm, I know it might seem counterintuitive, but try a different
mirror -- I seem to remember some complaints about the Berkeley mirror
being slow a few weeks back (though I don't have physical evidence
thereof so I apologize for any accidental slander to the Berkeley
mirrorers) -- perhaps UCLA?

http://cran.stat.ucla.edu

It just took me 2 minutes and I'm on the East Coast.

Michael

On Sat, May 5, 2012 at 5:10 PM, Hillary Sardiñas herongr...@gmail.com wrote:
 I have been trying to download the latest version to my Macbook X version
 10.6.8 from my institutions mirror http://cran.cnr.Berkeley.edu
 Usually is only takes minutes, but regardless of the browser or where I
 connect to the internet I have been unable to download because it would
 take upwards 2 days according to the download dialogue box.
 I'd really like to get the newest version to run some new packages that
 don't seem to work well in what I have currently (2.12.1)
 I had the same problem last time I tried to update ~ 3 weeks ago.
 Who should I contact/what should I do?
 Thanks!

 --
 Hillary Sardiñas
 PhD Candidate
 Environmental Science, Policy  Management
 University of California, Berkeley
 http://nature.berkeley.edu/kremenlab/hillary.html

 There is only one question: how to love this world. ~ Mary Oliver

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


Re: [R] download extremely slow

2012-05-05 Thread Henrik Bengtsson
On Sat, May 5, 2012 at 2:10 PM, Hillary Sardiñas herongr...@gmail.com wrote:
 I have been trying to download the latest version to my Macbook X version
 10.6.8 from my institutions mirror http://cran.cnr.Berkeley.edu
 Usually is only takes minutes, but regardless of the browser or where I
 connect to the internet I have been unable to download because it would
 take upwards 2 days according to the download dialogue box.
 I'd really like to get the newest version to run some new packages that
 don't seem to work well in what I have currently (2.12.1)
 I had the same problem last time I tried to update ~ 3 weeks ago.
 Who should I contact/what should I do?

You can always try another CRAN mirror.  But it doesn't look like a
problem with the Berkeley CRAN server:

wget http://cran.cnr.berkeley.edu/bin/macosx/leopard/base/R-latest.pkg
  % Total% Received % Xferd  Average Speed   TimeTime Time  Current
 Dload  Upload   Total   SpentLeft  Speed
100 64.1M  100 64.1M0 0  11.1M  0  0:00:05  0:00:05 --:--:-- 11.1M

Most likely something with your computer.

/Henrik

 Thanks!

 --
 Hillary Sardiñas
 PhD Candidate
 Environmental Science, Policy  Management
 University of California, Berkeley
 http://nature.berkeley.edu/kremenlab/hillary.html

 There is only one question: how to love this world. ~ Mary Oliver

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


Re: [R] c() in Mac does not work

2012-05-05 Thread R. Michael Weylandt
My guess is that somewhere you've accidentally redefined c to be
another function. Try this:

Open the Terminal and type

R --vanilla

this will start R totally clean and then try

c(4,7,7)

c(1, 7:9)

I bet your issues go away. If that's the case, you can probably fix
things by clearing your old R session (which is probably being
auto-loaded each time) or by simply trying

rm(c)

to delete whatever you called c which overrode (is that the right
spelling?) the real c()

Hope this helps,
Michael

On Sat, May 5, 2012 at 5:17 PM, E Kim emkim1...@gmail.com wrote:
 I recently changed to Mac OS X 10.7.3 from Windows and this simple function
 is giving errors.

 c(4,7,7)
 Error in c(4, 7, 7) : unused argument(s) (7)

 c(1,7:9)

 Error in d[i, ] : incorrect number of dimensions


 c(1:5, 10.5, next)
 Error in c(1:5, 10.5, next) : unused argument(s) (next)

 c(1,2)

 Error in d[i, ] : incorrect number of dimensions



 I removed R and reinstalled, but I get the same problem.

 Could you please help?


 Thank you.

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


Re: [R] download extremely slow

2012-05-05 Thread Joshua Wiley
Does CNR ring any bells as a department at Berkeley?The UCLA
mirror is hosted by the statistics department (cran.stat.ucla.edu) so
I am guessing your local mirror is hosted by the CNR department, and
they are probably the people to inform their system is running very
slowly.  Maybe the server downsized due to budget cuts ;)

Josh

On Sat, May 5, 2012 at 2:10 PM, Hillary Sardiñas herongr...@gmail.com wrote:
 I have been trying to download the latest version to my Macbook X version
 10.6.8 from my institutions mirror http://cran.cnr.Berkeley.edu
 Usually is only takes minutes, but regardless of the browser or where I
 connect to the internet I have been unable to download because it would
 take upwards 2 days according to the download dialogue box.
 I'd really like to get the newest version to run some new packages that
 don't seem to work well in what I have currently (2.12.1)
 I had the same problem last time I tried to update ~ 3 weeks ago.
 Who should I contact/what should I do?
 Thanks!

 --
 Hillary Sardiñas
 PhD Candidate
 Environmental Science, Policy  Management
 University of California, Berkeley
 http://nature.berkeley.edu/kremenlab/hillary.html

 There is only one question: how to love this world. ~ Mary Oliver

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




-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.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.


[R] correlation between XY coordinates

2012-05-05 Thread Christopher Kurby
Hello r world,

Does anyone know a function or package that can compute correlations between 
sets of XY coordinates?

Thanks in advance for your help,
Chris

__
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] c() in Mac does not work

2012-05-05 Thread Richard M. Heiberger
almost certainly you restored an old workspace with a conflicting
definition of the c function.

type

c

to confirm,

also type

conflicts(detail=TRUE)

The repair is to remove the conflicting definition

rm(c)


The long term solution is to adopt the recommended practice of not saving
your workspace at
the end of an R session.  When R asks about saving when you type q(), say
no.

You can get rid of the .RData you have by finding out what directory it is
in with
getwd()

and then closing R and removing the .RData from outside R.



On Sat, May 5, 2012 at 5:17 PM, E Kim emkim1...@gmail.com wrote:

 I recently changed to Mac OS X 10.7.3 from Windows and this simple function
 is giving errors.

  c(4,7,7)
 Error in c(4, 7, 7) : unused argument(s) (7)

  c(1,7:9)

 Error in d[i, ] : incorrect number of dimensions


  c(1:5, 10.5, next)
 Error in c(1:5, 10.5, next) : unused argument(s) (next)

  c(1,2)

 Error in d[i, ] : incorrect number of dimensions



 I removed R and reinstalled, but I get the same problem.

 Could you please help?


 Thank you.

[[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.htmlhttp://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

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


Re: [R] Query about memory used in list and dataframe

2012-05-05 Thread jim holtman
I think you really have to show use your exact code that you did along
with an 'str' of each intermediate data structure since my quick test
does not bear out what you were saying:

 test.df - data.frame(a1= 1:6, a2= 1:6, a3 = 1:6, a4 = 1:6, a5 = 1:6, a6 = 1:6
+ , a7=1:6, a8 = 1:6, a9 = 1:6, a10 = 1:6, a11 = 1:6, a12 = 1:6)
 test.df
  a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12
1  1  1  1  1  1  1  1  1  1   1   1   1
2  2  2  2  2  2  2  2  2  2   2   2   2
3  3  3  3  3  3  3  3  3  3   3   3   3
4  4  4  4  4  4  4  4  4  4   4   4   4
5  5  5  5  5  5  5  5  5  5   5   5   5
6  6  6  6  6  6  6  6  6  6   6   6   6
 object.size(test.df)
2264 bytes
 x - 1:6
 test.df1 - data.frame(x,x,x,x,x,x,x,x,x,x,x,x)
 object.size(test.df1)
2264 bytes
 list.1 - list(x,x,x,x,x,x,x,x,x,x,x,x)
 object.size(list.1)
1032 bytes
 list.2 - NULL
 for (i in 1:12) list.2[[i]] - x
 object.size(list.2)
1032 bytes
 test.df3 - as.data.frame(do.call(cbind, list.2))
 object.size(test.df3)
2264 bytes





On Sat, May 5, 2012 at 5:50 PM, Shivam shivamsi...@gmail.com wrote:
 Hi,

 I had a query regarding which object, a list or a dataframe, consumes more
 R memory. Let me clarify this:

 For example, I have a df of 6 rows and 12 columns, say 'test'. I do
 object.size() and find it uses 3.3 KB of memory.

 I run a loop and make a list, say 'testlist', of 6 elements, each element
 being the above mentioned df 'test'. The size of this list is 19.9 KB,
 understandably.

 Now I combine this list into a dataframe using rbind. The df formed has 12
 cols and 36 rows. The size of this df is just 5.8 KB, almost a 75%
 reduction in memory.

 I had to work with a much larger list, and I thought of using the same
 method to convert my bigger list (62 dataframes, each having 4 cols and
 close to 200,000 rows) into a single dataframe. The big list, sat LIST A,
 had a size of 571 MB. But when I convert it into a dataframe, say DF A,
 using rbind, the object size increases to 1.35 GB. This was in
 contradiction to the earlier result.

 What am I missing? Why a 75% reduction in size in one case and double size
 in other? Anyone with any explanation?

 Sorry for the verbose email, just wanted to make my case clear.

 Thanks in advance,
 Regards
 Shivam

        [[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
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

__
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] download extremely slow

2012-05-05 Thread Jeff Newmiller
I have been having problems getting recent packages from Berkeley for Windows 
and Linux, so I have had to change to UCLA anyway.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Henrik Bengtsson h...@biostat.ucsf.edu wrote:

On Sat, May 5, 2012 at 2:10 PM, Hillary Sardiñas herongr...@gmail.com
wrote:
 I have been trying to download the latest version to my Macbook X
version
 10.6.8 from my institutions mirror http://cran.cnr.Berkeley.edu
 Usually is only takes minutes, but regardless of the browser or where
I
 connect to the internet I have been unable to download because it
would
 take upwards 2 days according to the download dialogue box.
 I'd really like to get the newest version to run some new packages
that
 don't seem to work well in what I have currently (2.12.1)
 I had the same problem last time I tried to update ~ 3 weeks ago.
 Who should I contact/what should I do?

You can always try another CRAN mirror.  But it doesn't look like a
problem with the Berkeley CRAN server:

wget http://cran.cnr.berkeley.edu/bin/macosx/leopard/base/R-latest.pkg
% Total% Received % Xferd  Average Speed   TimeTime Time 
Current
   Dload  Upload   Total   SpentLeft  Speed
100 64.1M  100 64.1M0 0  11.1M  0  0:00:05  0:00:05
--:--:-- 11.1M

Most likely something with your computer.

/Henrik

 Thanks!

 --
 Hillary Sardiñas
 PhD Candidate
 Environmental Science, Policy  Management
 University of California, Berkeley
 http://nature.berkeley.edu/kremenlab/hillary.html

 There is only one question: how to love this world. ~ Mary Oliver

        [[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-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] correlation between XY coordinates

2012-05-05 Thread Jeff Newmiller
Isn't that one of the main things base R is used for?

Maybe your question is not specific enough. Can you provide some sample data 
and your best estimate of what the result should look like?
The Posting Guide mentioned below could help you elicit more effective answers.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Christopher Kurby kur...@gvsu.edu wrote:

Hello r world,

Does anyone know a function or package that can compute correlations
between sets of XY coordinates?

Thanks in advance for your help,
Chris

__
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] correlation between XY coordinates

2012-05-05 Thread Joshua Wiley
Hi Chris,

As Jeff mentioned, it is hard to tell what you want (correlations
between sets of coordinates could mean many things it seems like to
me), but here is something that perhaps helps:

## some data (usually nice if you provide this rather than us having
to make something up)
d1 - cbind(x - rnorm(100), y - rnorm(100))
d2 - cbind(x2 = x + rnorm(100), y2 = y + rnorm(100))

## canonical correlation of the two matrices
cancor(d1, d2)

## simple correlation matrix of each dataset
cor(d1)
cor(d2)

Cheers,

Josh

On Sat, May 5, 2012 at 5:32 PM, Christopher Kurby kur...@gvsu.edu wrote:
 Hello r world,

 Does anyone know a function or package that can compute correlations between 
 sets of XY coordinates?

 Thanks in advance for your help,
 Chris

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



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.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.