Re: [R] help for code in jump diffusion

2008-11-22 Thread cruz
i tried to run your code, this is how/why you got NaN: mu-0.2 sig-0.2 S0-100 j-0.2 dt-1/252 int-0.1 i-0 is.nan function (x) .Primitive(is.nan) k-rnorm(1,0,1) k [1] 0.3214954 theta-ifelse((k(int*dt)),1,0) theta [1] 0 m-rnorm(1) m [1] -0.4525731 gam-qnorm(m,0,1) Warning

Re: [R] help for code in jump diffusion

2008-11-22 Thread Bernardo Rangel Tura
On Fri, 2008-11-21 at 22:37 -0800, subbudas wrote: hello everyone , i have written some code in R for jump diffusion model. the code generates answer as NaN There were 50 or more warnings (use warnings() to see the first 50) my code is mu-0.2 sig-0.2 S0-100 j-0.2 dt-1/252 int-0.1

[R] CRAN mirror for Taipeh vs Taipei

2008-11-22 Thread cruz
Hi, I am residing in Taipei, Taiwan. My windows has English R (2.7.2) installed. I noticed that the CRAN mirror for Taipei is Taiwan (Taipeh), Is Taipeh a Deutsch or English name? Thanks, cruz __ R-help@r-project.org mailing list

Re: [R] summary statistics into table/data base, many factors to analyse

2008-11-22 Thread Gabor Grothendieck
On Fri, Nov 21, 2008 at 5:50 AM, Gerit Offermann [EMAIL PROTECTED] wrote: Dear list, thanks to your help I managed to find means of analysing my data. However, the whole data set contains 264 variables. Of which some are factors, others are not. The factors tend to be grouped, e.g.

Re: [R] Error with lapply [addirional clarification needed]

2008-11-22 Thread megh
I need one more clarification here : Here I did : fn - function(i) return(list(i, i^2)) ss = sapply(1:4, fn) Here the object ss should be a matrix object : is.matrix(ss) However I feel it lacks some the matrix object properties. For example the syntax min(ss[1,]) generates an error : Error in

Re: [R] Error with lapply [addirional clarification needed]

2008-11-22 Thread Peter Dalgaard
megh wrote: I need one more clarification here : Here I did : fn - function(i) return(list(i, i^2)) ss = sapply(1:4, fn) Here the object ss should be a matrix object : is.matrix(ss) However I feel it lacks some the matrix object properties. For example the syntax min(ss[1,]) generates an

Re: [R] Error with lapply [addirional clarification needed]

2008-11-22 Thread Gabor Grothendieck
Try str(ss) to see what it really looks like. You probably want: fn - function(i) c(i, i^2) On Sat, Nov 22, 2008 at 4:54 AM, megh [EMAIL PROTECTED] wrote: I need one more clarification here : Here I did : fn - function(i) return(list(i, i^2)) ss = sapply(1:4, fn) Here the object ss

[R] How to draw following plot in R?

2008-11-22 Thread RON70
I want to draw following plot, given here http://www.2shared.com/file/4327128/830b82c4/pic.html for the following data : dat - cbind(rnorm(100), sample(c(1:4), 1000, T)) colnames(dat) - c(data,level) Here x-axis should be on data and y-axis is for level and z-axis should be to display the

[R] Brightness readings for part of an image

2008-11-22 Thread S. Messing
Hi R users, I am doing some image analysis and I'd like to know if anyone knows of: 1. a way to specify a rectangle (using xy coordinates) within an image to have R evaluate using xy pixel coordinates and 2. a way to get brightness readings for that part of the image. If there's some way to

[R] How to add the value on the barchart

2008-11-22 Thread Piya Kittipadakul
I have question: how can I put the value on the bar chart. This my code: barchart(Tuberize~Family|factor(Year)*factor(Hr),data=tuber) This's my data:    Year Hr Family Tuberize 1  2007 20  A 0.26 2  2007 20  B 6.08 3  2007 20  C 0.00 4  2007 20  D 0.27 5  2008 20   

[R] declaring constants in an Sweave / LaTeX document

2008-11-22 Thread Kyle Matoba
List, I would like to set a variable to hold, say, the size of my plots in a Sweave document. i.e. something like the following in my '.Rnw' file: == smallPlotSize = 4 fig1, echo=false, results=hide,

[R] Need some help in R programming code

2008-11-22 Thread saikat sarkar
Dear R guru, I am Saikat Sarkar working as a researcher of Economics in Tampere University, Finland. I am trying to estimate some Garch related tests with Bayesian analysis by R programme. I am not good in R but trying to survive. Anyway I have the coding but not working properly. I have tried

Re: [R] lsoda warning too much accuracy requested

2008-11-22 Thread Thomas Petzoldt
A short addendum, resulting from an off-list discussion: The reason why Colleen's code failed was raising a negative base to a fractional exponent in the third state equation for certain sets of parameters, esp. fractional values of beta. Old versions of odesolve broke down, and recent

Re: [R] [Rd] Re Bessel functions of complex argument

2008-11-22 Thread baptiste auguie
I thought I'd share a few workaround routes I've considered (my attempt at using Amos' Fortran routines failed miserably -- if anyone is interested i can explain what I tried), - Ryacas seems to provide a very simple way to evaluate bessel functions with complex argument,

Re: [R] How to draw following plot in R?

2008-11-22 Thread Barry Rowlingson
2008/11/22 RON70 [EMAIL PROTECTED]: I want to draw following plot, given here http://www.2shared.com/file/4327128/830b82c4/pic.html for the following data : dat - cbind(rnorm(100), sample(c(1:4), 1000, T)) colnames(dat) - c(data,level) Here x-axis should be on data and y-axis is for level

Re: [R] Bug in Kendall for n4?

2008-11-22 Thread Martin Maechler
SM == Stavros Macrakis [EMAIL PROTECTED] on Fri, 21 Nov 2008 14:44:37 -0500 writes: library(Kendall) Kendall(1:3,1:3) SM WARNING: Error exit, tauk2. IFAULT = 12 tau = 1, SM 2-sided pvalue =1 SM I believe Kendall tau is well-defined for this case and SM the reported

Re: [R] Need some help in R programming code

2008-11-22 Thread jim holtman
You need to also provide the data that your code is using since the error message indicates that the problem is probably in the way that the object 'a' is defined and there is no indication of what it looks like. You should either provide the output of str(a), or the output of 'dput(a)' so we

[R] Nested Clade Analysis

2008-11-22 Thread knussear
Hi Wondering if anyone knows of a package that does Nested Clade Analysis? Thanks -- View this message in context: http://www.nabble.com/Nested-Clade-Analysis-tp20637180p20637180.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Basic question on concatenating factors

2008-11-22 Thread jim holtman
Here is a function I have used. I got it from the list, and unfortunately don't remember who to credit: c.Factor - function (x, y) { newlevels = union(levels(x), levels(y)) m = match(levels(y), newlevels) ans = c(unclass(x), m[unclass(y)]) levels(ans) = newlevels class(ans)

Re: [R] rgl lighting question

2008-11-22 Thread Duncan Murdoch
On 21/11/2008 2:30 PM, Rajarshi Guha wrote: Hi, I'm using rgl to generate a 3D surface plot and I'm struggling to get the lighting correct. Currently the surface gets plotted, but is very 'shiny'. On rotating the view, I get to see parts of the surface - but overall I don't see much detail

Re: [R] different .Rprofile files for different projects

2008-11-22 Thread Gavin Simpson
On Thu, 2008-11-20 at 19:43 -0800, Andrew J. Rominger wrote: Dear list, First off, let me offer my apologies, I know this is a very basic question. After amassing a large number of objects (from multiple projects) in one working directory, I'd like to be able to start using different

Re: [R] Basic question on concatenating factors

2008-11-22 Thread Henrique Dallazuanna
You can try this also: unlist(list(f1, f2)) On Fri, Nov 21, 2008 at 3:15 PM, udi cohen [EMAIL PROTECTED] wrote: Hi all, I hope it's not too trivial for the list - I'm trying to concatenate two factor arrays, and obtain the following: f1-factor(c(a,a,b)) f1 [1] a a b Levels: a b

Re: [R] declaring constants in an Sweave / LaTeX document

2008-11-22 Thread Duncan Murdoch
On 22/11/2008 2:01 AM, Kyle Matoba wrote: List, I would like to set a variable to hold, say, the size of my plots in a Sweave document. i.e. something like the following in my '.Rnw' file: == smallPlotSize = 4 fig1,

Re: [R] How to add the value on the barchart

2008-11-22 Thread John Kane
Try something like the code below. Unfortunately I cannot remember who wrote the code. === my.values=10:15 x - barplot(my.values, ylim=c(0,11)) text(x, my.values, wibble, pos=3) # always does what you want #

Re: [R] rgl lighting question

2008-11-22 Thread Rajarshi Guha
Thanks a lot for the pointer to rgl.pop() - that works (as does looking at the examples!) On Nov 22, 2008, at 10:28 AM, Duncan Murdoch wrote: On 21/11/2008 2:30 PM, Rajarshi Guha wrote: Hi, I'm using rgl to generate a 3D surface plot and I'm struggling to get the lighting correct.

Re: [R] How to add the value on the barchart

2008-11-22 Thread David Winsemius
Following the example in https://stat.ethz.ch/pipermail/r-help/2006-January/086985.html You might want to try something like: barchart(Tuberize~Family|factor(Year)*factor(Hr),data=tuber, + panel = function(y,x,...){ + panel.barchart(x,y,...) +

Re: [R] How to add the value on the barchart

2008-11-22 Thread David Winsemius
On second look I see that although values appear in every panel, they are the same in every panel as well. Some sort of use of the subscripting facility probably needs to be employed. -- David Winsemius On Nov 22, 2008, at 1:05 PM, David Winsemius wrote: Following the example in

Re: [R] Fitting a sine wave using solver

2008-11-22 Thread Carl Witthoft
To follow Dieter's comment, You can in fact fit a data to a sine in Excel using LINEST. I've done it. I don't recommend it :-) . What I did was create columns containing sin(x) and cos(x) , roughly speaking, and fit using LINEST([y=values],{sines, cosines},...) Ya need the cosines or

Re: [R] How to add the value on the barchart

2008-11-22 Thread David Winsemius
No, it only needed closer attention to the example: This gets you to the point where you need to fix the y scale settings but the values are properly cycled through. barchart(Tuberize~Family|factor(Year)*factor(Hr),data=tuber, panel = function(y,x,...){

Re: [R] Bug in Kendall for n4?

2008-11-22 Thread Stavros Macrakis
On Sat, Nov 22, 2008 at 9:04 AM, Martin Maechler [EMAIL PROTECTED] wrote: SM I believe Kendall tau is well-defined for this case... The real question is *WHY* there needs to be a separate package 'Kendall' when R itself does everything you want and does not show any problems? Thanks for

[R] applying an operation for several dataframes

2008-11-22 Thread Georg Ehret
Dear R community, I am trying to apply a simple operation to several dataframes (e.g. nrow) and cannot get the looping to work. My objective is to get an output that indicates me the number of rows for every dataframe. c V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 1 1 11 21 31 41 51 61 71 81 91 2 2

Re: [R] applying an operation for several dataframes

2008-11-22 Thread jim holtman
?get names - c('c', 'cc') for (i in names){ print(nrow(get(i))) } On Sat, Nov 22, 2008 at 4:06 PM, Georg Ehret [EMAIL PROTECTED] wrote: Dear R community, I am trying to apply a simple operation to several dataframes (e.g. nrow) and cannot get the looping to work. My objective is to

Re: [R] syntax and package for generalized linear mixed models

2008-11-22 Thread David Winsemius
On Nov 21, 2008, at 11:28 AM, Douglas Bates wrote: As tempting as it may be to want to have several dials and knobs on statistical models to tune their behavior, we still need to be careful to specify a mathematical model that is consistent. -- Douglas Bates Yet another

[R] unique columns in a matrix and number of each

2008-11-22 Thread Salas, Andria Kay
I need help determining the unique columns of a matrix and the numbers of each unique column. For example, let's say I have a matrix with 6 columns, 2 of these are filled with the value of 1 and the other 4 are filled with the value of 0. I would then like to have a command that tells me what

[R] Where is Hong Kong in maps?

2008-11-22 Thread Wind2
It seems that there is no Hong Kong in maps' world cities. world.cities[substr(world.cities$name,1,3)==Hon,] namecountry.etcpop latlong capital 14623 Honami Japan 26040 33.61 130.68 0 14624 Honaz Turkey 8073 37.75

[R] What's the BEST way in R to adapt this vector?

2008-11-22 Thread zerfetzen
Goal: Suppose you have a vector that is a discrete variable with values ranging from 1 to 3, and length of 10. We'll use this as the example: y - c(1,2,3,1,2,3,1,2,3,1) ...and suppose you want your new vector (y.new) to be equal in length to the possible discrete values (3) times the length

Re: [R] What's the BEST way in R to adapt this vector?

2008-11-22 Thread hadley wickham
On Sat, Nov 22, 2008 at 12:00 PM, zerfetzen [EMAIL PROTECTED] wrote: Goal: Suppose you have a vector that is a discrete variable with values ranging from 1 to 3, and length of 10. We'll use this as the example: y - c(1,2,3,1,2,3,1,2,3,1) ...and suppose you want your new vector (y.new) to

Re: [R] What's the BEST way in R to adapt this vector?

2008-11-22 Thread Gabor Grothendieck
Try this: outer(y, sort(unique(y)), ==)+0 On Sat, Nov 22, 2008 at 3:37 PM, zerfetzen [EMAIL PROTECTED] wrote: Goal: Suppose you have a vector that is a discrete variable with values ranging from 1 to 3, and length of 10. We'll use this as the example: y - c(1,2,3,1,2,3,1,2,3,1) ...and

Re: [R] What's the BEST way in R to adapt this vector?

2008-11-22 Thread Berwin A Turlach
On Sat, 22 Nov 2008 10:00:18 -0800 (PST) zerfetzen [EMAIL PROTECTED] wrote: Goal: Suppose you have a vector that is a discrete variable with values ranging from 1 to 3, and length of 10. We'll use this as the example: y - c(1,2,3,1,2,3,1,2,3,1) ...and suppose you want your new vector

Re: [R] Basic question on concatenating factors

2008-11-22 Thread Stavros Macrakis
On Sat, Nov 22, 2008 at 10:20 AM, jim holtman [EMAIL PROTECTED] wrote: c.Factor - function (x, y) { newlevels = union(levels(x), levels(y)) m = match(levels(y), newlevels) ans = c(unclass(x), m[unclass(y)]) levels(ans) = newlevels class(ans) = factor ans } This

Re: [R] Basic question on concatenating factors

2008-11-22 Thread jim holtman
You are right. union used 'unique(c(x,y))' and I am not sure if 'unique' preserves the order, but the help page seems to indicate that an element is omitted if it is identical to any previous element ; this might mean that the order is preserved. On Sat, Nov 22, 2008 at 11:43 PM, Stavros

Re: [R] unique columns in a matrix and number of each

2008-11-22 Thread jim holtman
One way is to 'paste' together the values in a column and then use 'table' to count them. 'duplicated' can probably do the same thing with the MARGIN option to find the duplicated one. You still them have to find the original ones. On Sat, Nov 22, 2008 at 3:42 PM, Salas, Andria Kay [EMAIL

Re: [R] Basic question on concatenating factors

2008-11-22 Thread Prof Brian Ripley
On Sun, 23 Nov 2008, jim holtman wrote: You are right. union used 'unique(c(x,y))' and I am not sure if 'unique' preserves the order, but the help page seems to indicate that an element is omitted if it is identical to any previous element ; this might mean that the order is preserved. It