Re: [R] 3D Black-Scholes Graph Help!

2012-03-13 Thread ilai
On Tue, Mar 13, 2012 at 3:34 PM, David Winsemius dwinsem...@comcast.net wrote: When I got around to running it I was hampered by a lack of knowledge about what sort of data-object price might have been. I tried putting in a single number on hte theory that it would saitisfy the seq() call, and

Re: [R] Visualising multiple response contingency tables

2012-03-13 Thread ilai
Not sure I understand your question (or if there is one) and I am not familiar with vcd::mosaic. But if you are asking is there a simpler way ? than yes: 1. work with ?array and ?aperm 2. create the array directly in R from the original data - not excel 3. ?mosaicplot (no package required - it's

Re: [R] barplot and NA

2012-03-12 Thread ilai
d2 - as.matrix(c(2,NA,4)) barplot(d2,beside=T) barplot(c(d2)) barplot(na.omit(d2)) d2[2,] - 0 barplot(d2) # So barplot is not stopping at the first NA (first 2 plots). But what does stacking even mean when you have a missing group in the middle ? you can't expect barplot to know... if you

Re: [R] Use different panel functions with lattice

2012-03-10 Thread ilai
On Sat, Mar 10, 2012 at 9:33 AM, Balaitous balait...@mailoo.org wrote: Hi, I have a data.frame df with names(df) = c(Var1, Var2, Var3, Var4) and I plot data with xyplot(Var1+Var2~Var3|Var4, data=df) I want to use different panel functions for Var1 and Var2. How can I do ? You didn't

Re: [R] Use different panel functions with lattice

2012-03-10 Thread ilai
Inline On Sat, Mar 10, 2012 at 1:47 PM, Balaitous balait...@mailoo.org wrote: Le samedi 10 mars 2012 à 12:25 -0700, ilai a écrit : On Sat, Mar 10, 2012 at 9:33 AM, Balaitous balait...@mailoo.org wrote: Var1 and Var2 are 2 two different observed variables (with different scales) You might

Re: [R] layer plots.

2012-03-09 Thread ilai
It's hard to help if you keep changing the framework of your problem, first two matrices - now it's a data.frame and a list of subset row names in a plotting method from whatever package suprow comes from. Regardless, Michael's original answer already gave you a solution:

Re: [R] GLMing with all possible combinations (automatically)

2012-03-07 Thread ilai
Hi try glm(Response~ .^2, data=yourdata.frame) For all predictors (.) and 2-way interactions (^2). You might also want to see ?drop.terms and ?formula for automating the construction of all model combinations. Side note: R is not SAS (fortunately). Interaction is denoted :, X*Y is shorthand for

Re: [R] confidence intervals in dotplots in a for loop

2012-03-07 Thread ilai
On Tue, Mar 6, 2012 at 8:55 PM, Byerly, Mike M (DFG) mike.bye...@alaska.gov wrote: estimates - c(67.42,30.49,32.95,23.53,10.26,6.03,23.53,0.93,50.72,24.2,25.84,18.54, 7.16,3.6,9.35,0.33,87.28,37.25,40.16,28.59,13.77,8.92,40.74,1.68,48.28,23.09,

Re: [R] How to eliminate for next loops in this script

2012-03-07 Thread ilai
?by ?aggregate On Tue, Mar 6, 2012 at 4:14 PM, Walter Anderson wandrso...@gmail.com wrote: I needed to compute a complicated cross tabulation to show weighted means and standard deviations and the only method I could get that worked uses a series of nested for next loops.  I know that there

Re: [R] Grouped barchart confidence intervals in lattice

2012-03-04 Thread ilai
width of 1/6) groupS - (nv+1)/2 gives each bar's relative position to the central bar Am I interpreting these correctly? One thing I don't get is where 3/4 came from. Anyway, thanks for all of the help. Wouldn't have gotten it on my own Nathan On Mar 3, 2012, at 9:46 PM, ilai wrote

Re: [R] Grouped barchart confidence intervals in lattice

2012-03-03 Thread ilai
On Sat, Mar 3, 2012 at 5:48 PM, Nathan Lemoine lemoine.nat...@gmail.com wrote: It appears that the subscripts are only passing two values, the center of each group. There should be six values, one for the center of each bar (correct?), No. That's also why your code doesn't work.

Re: [R] Parameterization of Inverse Wishart distribution available in MCMCpack and bayesm libraries

2012-03-02 Thread ilai
On Fri, Mar 2, 2012 at 1:22 AM, peter dalgaard pda...@gmail.com wrote: Er, yes (scalar does not imply integer) Dough! awkward... Sorry Shantanu. I've added cat('###\n # ',substr(fortunes::fortune(90)$quote,1,146),'\n ### \n') To .First in my Rhelp directory. Hope that helps (me). As

Re: [R] Computing line= for mtext

2012-03-02 Thread ilai
On Fri, Mar 2, 2012 at 1:17 PM, Frank Harrell f.harr...@vanderbilt.edu wrote: Hi Rich and Peter, What I am trying to do is the right-justify a vector of numbers to the right of the y-axis so that the leftmost digit of all of the numbers is one character to the right of the axis line.  axis()

Re: [R] barplots of several variables with different number of categories

2012-03-01 Thread ilai
Jon, You could create new variables with the combined levels just for the purpose of plotting. Assume I have data.frame bpt str(bpt) 'data.frame': 12 obs. of 2 variables: $ V1: Factor w/ 3 levels low,med,high: 1 1 1 1 2 2 2 2 3 3 ... $ V2: Factor w/ 6 levels 1,2,3,4,..: 1 1 2 2 3 3 4 4 5 5

Re: [R] How to colorize the panel backgrounds of pairs()?

2012-03-01 Thread ilai
par('bg') is not what you are looking for - it will set the bg of the whole graphic device, not panels. I think you want: count - 0 mypanel - function(x, y, ...){ count - count+1 ll- par('usr') if(count %in% c(1,4,9,12)) bg- #FDFF65 else bg- 'transparent'

Re: [R] Parameterization of Inverse Wishart distribution available in MCMCpack and bayesm libraries

2012-03-01 Thread ilai
What do you make of the following from ?riwish riwish(v, S) snip v: Degrees of freedom (scalar). does a m/2 parameterization yield a scalar for, say, 3 dof ? On Thu, Mar 1, 2012 at 9:55 AM, Shantanu MULLICK b00295...@essec.edu wrote: Hello Everyone Both the MCMCpack and the

Re: [R] ts.plot and x axes customization

2012-02-29 Thread ilai
On Wed, Feb 29, 2012 at 1:56 AM, Jochem Schuster jochem.schus...@web.dewrote: Hello, thank you very much for your answer. In the following, I will provide my recent code and try to explain again: series1 = ts(x$france start=c(2000,1), frequency=4) series2 = ts(x$germany, start=c(2000,1),

Re: [R] Quantile scores as dependent variables.. an R and general method question

2012-02-29 Thread ilai
On Tue, Feb 28, 2012 at 3:54 PM, Rob James aetiolo...@gmail.com wrote: I have a dataset that does not include native scores, but only serial quantile rankings for a set of units. Clearly these observations are dependent (in that you can't alter one observation without also altering others).

Re: [R] Quantile scores as dependent variables.. an R and general method question

2012-02-29 Thread ilai
...@r-project.org] On Behalf Of ilai [ke...@math.montana.edu] Sent: Wednesday, February 29, 2012 1:30 PM To: Rob James Cc: r-help@r-project.org Subject: Re: [R] Quantile scores as dependent variables.. an R and general method question On Tue, Feb 28, 2012 at 3:54 PM, Rob James aetiolo

Re: [R] group calculations with other columns for the ride

2012-02-28 Thread ilai
aggregate(val~lvls+nm,data=x,FUN='median') On Tue, Feb 28, 2012 at 4:43 PM, Ben quant ccqu...@gmail.com wrote: Hello, I can get the median for each factor, but I'd like another column to go with each factor. The nm column is a long name for the lvls column. So unique work except for the

Re: [R] How to replace the values in a column

2012-02-28 Thread ilai
Hannah, If Gen is a factor you can simply build the new factor on top of it: dataframe$Gen- factor( c('Wynda' , 'A_2' , 'B_1' , 'Wynda' , 'Wynda' , 'OP1_5')[Gen] ) Just make sure the replacement labels are in the same order as levels(Gen). Cheers On Tue, Feb 28, 2012 at 8:39 PM, hannahmaohuang

Re: [R] ts.plot and x axes customization

2012-02-28 Thread ilai
On Tue, Feb 28, 2012 at 12:57 PM, Jochem Schuster jochem.schus...@web.de wrote:   ts.plot(series1, series2, main=main, xlab=xlab, ylab=ylab, col=c(green,   red, blue), lwd=2)   What I've tried before is deleting the X axes via gpars=list(xaxt=n) in   the ts.plot-code. But after that I was

Re: [R] Matrix problem to extract animal associations

2012-02-27 Thread ilai
set.seed(1) (DFid - data.frame( x = sample(1:20,10), y = sample(1:20,10), IDs = sapply(1:10,function(i) paste(ID,i,sep= require(spdep) coordinates(DFid) - ~x+y coords - coordinates(DFid) dnn4 - dnearneigh(DFid,0,4) summary(dnn4) plot(DFid) plot(dnn4,coords,add=T,col=2) nb2mat(dnn4,

Re: [R] Need advice on GLM

2012-02-27 Thread ilai
On Mon, Feb 27, 2012 at 1:44 AM, Christofer Bogaso bogaso.christo...@gmail.com wrote:  Here I was expecting those 2 approaches should give exactly same result (i.e. same estimates and same SE), which is not the case. Can somebody point me what I am missing here? The vector of weights as

Re: [R] Optim() package restriction

2012-02-25 Thread ilai
On Fri, Feb 24, 2012 at 4:03 PM, nserdar snes1...@hotmail.com wrote: I did it like above  but got an error message. estimate- optim(init.par,Linn,gr=NULL,method= L-BFGS-B, hessian=FALSE,control = list(trace=1),lower=c(0,-Inf,Inf,Inf),upper=c(1,Inf,Inf,Inf)) Your lower bound for parameters

Re: [R] Finding name of variable supplied as function argument

2012-02-25 Thread ilai
On Sat, Feb 25, 2012 at 12:53 PM, Ted Harding ted.hard...@wlandres.net wrote: I have defined a function med3x3() such that, given vectors X,Y, med3x3(X,Y) returns a 3x3 table ... But I'd like to simply be able to pick up, within the function, the names of the variables that were used as

Re: [R] Advice on exploration of sub-clusters in hierarchical dendrogram

2012-02-24 Thread ilai
Inline: On Thu, Feb 23, 2012 at 8:23 PM, R. Michael Weylandt michael.weyla...@gmail.com michael.weyla...@gmail.com wrote: Inline: On Feb 23, 2012, at 6:20 PM, kosmo7 dnico...@hotmail.com wrote: Dear Elai, thank you very much for your suggestion. I tried cutting the dendrogram instead of

Re: [R] help with winbugs glm

2012-02-24 Thread ilai
Ilai! Cheers Guillermo On Fri, Feb 24, 2012 at 12:16 AM, ilai ke...@math.montana.edu wrote: On Thu, Feb 23, 2012 at 8:32 PM, Adan Jordan-Garza ajordangarza2...@my.fit.edu wrote: Hello Ilai, thank you very much for your response, can I bother you a little further? What do you mean my

Re: [R] tcl tk command function with arguments ??

2012-02-24 Thread ilai
On Fri, Feb 24, 2012 at 12:58 AM, Alexander juschitz_alexan...@yahoo.de wrote: I would like to know if its possible to use a function with arguments as a command in tcl tk. Yes snip I think this is due to the fact that the PressedOK(3) was the last call of the function, but I don't

Re: [R] data frame manipulation with conditions

2012-02-24 Thread ilai
On Fri, Feb 24, 2012 at 8:11 AM, A2CT2 Trading trad...@a2ct2.com wrote: Dear list, n00b question, but still can't find any easy answer. Here is a df: df-data.frame(cbind(x=c(AA,BB,CC,AA),y=1:4)) # No, your y is a factor str(df) 'data.frame': 4 obs. of 2 variables: $ x: Factor w/ 3

Re: [R] data frame manipulation with conditions

2012-02-24 Thread ilai
Dunlap. Arnaud Gaboury A2CT2 Ltd. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of ilai Sent: vendredi 24 février 2012 20:14 To: A2CT2 Trading Cc: r-help@r-project.org Subject: Re: [R] data frame manipulation with conditions

Re: [R] Optim() package restriction

2012-02-24 Thread ilai
On Fri, Feb 24, 2012 at 12:18 PM, nserdar snes1...@hotmail.com wrote: Hi I need a phi restriction in my code. That is   0phi1 How can I do that ? init.par-c(1,1,1,1) estimate- optim(init.par,Linn,gr=NULL,method= BFGS, hessian=FALSE,control = list(trace=1)) You want method L-BFGS-B not

Re: [R] tcl tk command function with arguments ??

2012-02-24 Thread ilai
On Fri, Feb 24, 2012 at 5:03 PM, peter dalgaard pda...@gmail.com wrote: Now that's just weird... Firstly, it has nothing to do with sapply vs. for loops. It just works because you are inserting yet another function environment. Thank you Peter, that makes more sense. As you can probably

Re: [R] Advice on exploration of sub-clusters in hierarchical dendrogram

2012-02-23 Thread ilai
See inline On Thu, Feb 23, 2012 at 8:54 AM, kosmo7 dnico...@hotmail.com wrote: Dear R user, In other words, I am trying to obtain/read the sub-clusters of a specific cluster in the dendrogram, by isolating a specific node and exploring locally its lower hierarchy. To explore or zoom in on

Re: [R] help with winbugs glm

2012-02-23 Thread ilai
Adan, How many levels does Depth have? my wild guess: 3 and your bugs model is not identifiable. Second, I think you may have a critical error in the way you formatted the data for the bugs model. From your code it looks like you are just using the factor Depth and not a design matrix of dummy

Re: [R] cor() on sets of vectors

2012-02-23 Thread ilai
On Thu, Feb 23, 2012 at 3:24 PM, Bert Gunter gunter.ber...@gene.com wrote: Use 1:n as an index. e.g. sapply(1:n, function(i) cor(x[,i],y[,i])) ## sapply is a good solution (the only one I could think of too), but not always worth it: # for 100 x 1000 x -

Re: [R] Several densityplots in single figure

2012-02-22 Thread ilai
On Wed, Feb 22, 2012 at 8:49 AM, David Winsemius dwinsem...@comcast.net wrote: After going back and constructing a proper dataset, you should be passing 'groups' into the panel function and picking it up inside panel.abline. Close, but unfortunately things get more complicated when using

Re: [R] Installing rgl

2012-02-22 Thread ilai
On Wed, Feb 22, 2012 at 3:23 AM, aoife aoife.m.dohe...@gmail.com wrote: Hey guys,I'm working with R version 2.14.1 (2011-12-22) on a unix machine You may be missing some openGL libraries (mesa ? ) On Ubuntu, this solved my problem of installing rgl: sudo apt-get build-dep r-cran-rgl Can't vouch

Re: [R] line width in legend of interaction.plot

2012-02-22 Thread ilai
On Wed, Feb 22, 2012 at 11:37 AM, Matthias Gondan matthias-gon...@gmx.de wrote: Dear R developers, The following command produces an interaction plot with lwd=2. interaction.plot(c(1, 2, 1, 2), c(1, 1, 2, 2), 1:4, lwd=2) In the legend, however, lwd seems to be 1, which does not seem to be

Re: [R] tapply for enormous (2^31 row) matrices

2012-02-22 Thread ilai
On Tue, Feb 21, 2012 at 4:04 PM, Matthew Keller mckellerc...@gmail.com wrote: X - read.big.matrix(file.loc.X,sep= ,type=double) hap.indices - bigsplit(X,1:2) #this runs for too long to be useful on these matrices #I was then going to use foreach loop to sum across the splits identified by

Re: [R] Lattice and horizontally stacked density plots

2012-02-22 Thread ilai
The plot you referred to depends on packages flowViz and flowCore from R-bioconductor. With lattice alone you can easily get all curves on the same level: densityplot(~ val | factor(id2), groups=factor(id1),data=a_df,pch='|') But if that doesn't do it for you, you could write your own panel

Re: [R] Time taken to process a file after a socket connection was made

2012-02-21 Thread ilai
which is causing the delay? Please share your thought. Also do you think that instead of *socketConnection readLines*, *make.socket read.socket* would perform better? Thanks and regards. Aniruddha. From: ilai ke...@math.montana.edu To: Aniruddha Mukherjee aniruddha.mukher...@tcs.com

[R] Fwd: bigmemory not really parallel

2012-02-20 Thread ilai
The default nstart in ?bigkmeans is 1. Try ans-bigkmeans(data,k,nstart=8) Good luck On Mon, Feb 20, 2012 at 4:22 PM, Lishu Liu lishu...@gmail.com wrote: Hi, all, I have a really big matrix that I want to run k-means on. I tried: data -

Re: [R] World Heat/Rainbow Map

2012-02-19 Thread ilai
Figure 13.10 in Lattice: Multivariate Data Visualization with R might give you some ideas http://lmdvr.r-forge.r-project.org/figures/figures.html On Sun, Feb 19, 2012 at 9:05 AM, Lorenzo Isella lorenzo.ise...@gmail.com wrote: Dear All, I would like to do the following: make a plot of the world

Re: [R] barplot with more than 1 variable

2012-02-19 Thread ilai
You could have found the solution in http://had.co.nz/ggplot2/geom_bar.html yourself since all help pages for ggplot refer you to the web site. But to speed things up for you, try this for starters: TUSE2 - data.frame(country = rep(c(United States,Italy,Germany,Netherlands),each=2), year3 =

Re: [R] foreach %do% and %dopar%

2012-02-18 Thread ilai
Marcos, Untested because you didn't provide a reproducible example but my guess, the problem is in the local assignment of MCPVMP*. The %do% worked just because it operates in the same (local) environment for all threads. I'll try to clarify with a a self contained example of sourcing a script

Re: [R] lmer - error message

2012-02-17 Thread ilai
I think my problem is that I can't incorporate the 'lake' variable in a fixed-effect interaction because it is only has one binary observation.  But I don't know what to do to be able to fit this model.  Any help would be greatly appreciated! -Sean  In principle you should be able to fit

Re: [R] Neighbour List to Matrix

2012-02-17 Thread ilai
I think is good to know that list contain more than 60 rows with around 14000 nodes (participants). ?read.table may be unreliable for large matrices and with 14/600 you'll end up with many NA's. You might do better with nbrs- scan('nbrs.txt',skip=1,what=list('integer','integer',double(0)))

Re: [R] Defining a viewport scale in {Grid}

2012-02-16 Thread ilai
Read the Details section in ?viewport carefully. You are treating xscale/yscale as if they are xlim/ylim in base graphics. They are not. It may take some trial and error on your part to figure out how exactly this works, in general you are setting the size and location of each polygon relative to

Re: [R] Graphing lines of different lengths

2012-02-16 Thread ilai
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. On Thu, Feb 16, 2012 at 12:42 PM, Jordan Patricia Sinclair al8...@wayne.edu wrote: Hello all. I need to graph multiple lines of different lengths on

Re: [R] creating series of vectors

2012-02-16 Thread ilai
# All days in years 2006 to 2009 by month in 48 (12x4) files. days - seq(as.Date(2006/1/1), as.Date(2009/12/31),by=day) # one long vector out - paste(rep(format(days,'%d%m%y'),each=2),c('aaa','bbb'),sep='_') # reformat to style month - factor(rep(format(days,'%B%y'),each=2)) # group by

Re: [R] Plotting function image

2012-02-15 Thread ilai
Inline On Wed, Feb 15, 2012 at 3:04 AM, uday uday_143...@hotmail.com wrote: Hi , Thanks for reply My latitude and longitude contains 9-10 observations per file when I run coords - expand.grid(lat=1:5,long=1:5) then my computer You don't have to run this part. As your original post

Re: [R] Filling out a data frame row by row.... slow!

2012-02-15 Thread ilai
First, in R there is no need to declare the dimensions of your objects before they are populated so couldn't you reduce some run time by not going through the double data.frame step ? df- data.frame() df data frame with 0 columns and 0 rows for(i in 1:100) for(j in 1:3) df[i,j]- runif(1)

Re: [R] [newbie] separating plot output from debug output

2012-02-15 Thread ilai
If you don't dev.off(), all plots will be sent to the open graphical device. That usually doesn't impact behavior of other output types: pdf(file='fooout.pdf') hist(x - rnorm(100)) y - sin(x) print(str(y)) cat(y,file='fooout.txt') plot(x,y) dev.off() Hope this helps On Wed, Feb 15, 2012 at 3:43

Re: [R] passing an extra argument to an S3 generic

2012-02-14 Thread ilai
about that just remove the class. Had somewhat of a brain glitch when writing the E-mail and wasn't clear. Cheers On Tue, Feb 14, 2012 at 8:05 AM, Michael Friendly frien...@yorku.ca wrote: On 2/11/2012 12:00 PM, ilai wrote: You are setting a new class (inflmlm) at the end of mlm.influence

Re: [R] If (x 0)

2012-02-14 Thread ilai
in the environment from which they are called beforehand, just like the arguments. Cheers Elai. Thanks for that info. Take care Mike -Original Message- From: ila...@gmail.com [mailto:ila...@gmail.com] On Behalf Of ilai Sent: Monday, February 13, 2012 6:19 PM To: Schmidt, Michael Subject

Re: [R] different way for a for loop for several columns?

2012-02-14 Thread ilai
Inline On Tue, Feb 14, 2012 at 3:16 AM, Nerak T nera...@hotmail.com wrote: Dear Ilai, Thanks for your answer. I'm indeed kind of a beginner in R, starting to discover the endless possibilities in R. My goal for the moment is indeed to get rid of the use of loops and to see through

Re: [R] How to suppress the empty plots in xyplot (lattice)

2012-02-14 Thread ilai
read ?xyplot It takes a skip argument:          ‘skip’: logical vector (default ‘FALSE’), replicated to be as              long as the number of panels (spanning all pages).  For              elements that are ‘TRUE’, the corresponding panel              position is skipped; i.e., nothing is

Re: [R] best subset selection on random effects model

2012-02-14 Thread ilai
like to consider all the possible subsets. I hope to output a table, where each row of the table indicates a best subset of the fixed effects for a particular model size. Thank you, Tao 2012/2/13 ilai ke...@math.montana.edu The question is where do your models come from? Passing nested

Re: [R] Plotting function image

2012-02-14 Thread ilai
In the absence of data coords - expand.grid(lat=1:5,long=1:5) coords$z - rnorm(25) Coords- unstack(coords,z~long) image(as.matrix(Coords)) On Tue, Feb 14, 2012 at 10:36 AM, uday uday_143...@hotmail.com wrote: I have some data set which has latitude, longitude and Z values. I would like to

Re: [R] best subset selection on random effects model

2012-02-13 Thread ilai
The question is where do your models come from? Passing nested models to ?anova.lme in nlme package or lme4 results in a likelihood ratio test. Are you looking for something else/more ? On Sun, Feb 12, 2012 at 8:02 PM, Tao Zhang zt020...@gmail.com wrote: Hi,     I know leaps() computes the

Re: [R] only 0s may be mixed with negative subscripts

2012-02-13 Thread ilai
The function you posted runs without error (on these 6 lines), but does not return anything that looks remotely like a sum, or cumsum of anything. Can you clarify what you are trying to do? I assume by sum of every other row you don't mean summing Time, X and Y for rows 1,3,5,..., ? For the sum

Re: [R] only 0s may be mixed with negative subscripts

2012-02-13 Thread ilai
(more...). On Mon, Feb 13, 2012 at 4:04 PM, Hasan Diwan hasan.di...@gmail.com wrote: On 13 February 2012 14:46, ilai ke...@math.montana.edu wrote: The function you posted runs without error (on these 6 lines), but does not return anything that looks remotely like a sum, or cumsum of anything

Re: [R] Writing R-scripts

2012-02-13 Thread ilai
It seems all you are doing in the if statements is defining functions. You need to actually apply them to some arguments, then you can pass results. i.e. f- function(x,type,...){ a- function(...){ 2* x } b- function(...) { x^2 } if(type==1){ ret- a(x) } if(type==2){ ret- b(x) } ret } You may

Re: [R] multiple histograms from a dataframe

2012-02-12 Thread ilai
On Sat, Feb 11, 2012 at 9:10 PM, David Winsemius dwinsem...@comcast.net wrote: On Feb 11, 2012, at 6:25 PM, Adel ESSAFI wrote: Le 11 février 2012 02:33, David Winsemius dwinsem...@comcast.net a écrit : On Feb 10, 2012, at 7:05 PM, Adel ESSAFI wrote: what can I do to draw to figures

Re: [R] Longitudinal Factor Analysis

2012-02-12 Thread ilai
?factanal There is also package sem (structural equations model) by John Fox. I'm sure there are more (maybe more fitting your situation) but these two came to mind first... Cheers On Sun, Feb 12, 2012 at 6:51 AM, Gregory Gilbert g.eastham.gilb...@gmail.com wrote: I have a data set in the

Re: [R] object not found - Can not figure out why I get this error: Error in NROW(yCoordinatesOfLines) : object 'low' not found

2012-02-12 Thread ilai
Ah, scoping rules... Consider: f - function(x,...) plot(x,xlim=c(low,high),...) f(1:10,low=2,high=9) # Error ... object 'low' not found But: f - function(x,low,high,...) plot(x,xlim=c(low,high),...) f(1:10,2,9,col=2) # beautiful red points [low,high] Sorry I can't be more specific but never

Re: [R] passing an extra argument to an S3 generic

2012-02-11 Thread ilai
You are setting a new class (inflmlm) at the end of mlm.influence. Remove that second to last line and enjoy your new S3 method. I'm not sure, but I think it is just the new class inflmlm applied to inf in the formals of hatvalues.mlm confused the dispatch mechanism. You would think the error

Re: [R] Lattice 3d coordinate transformation

2012-02-11 Thread ilai
! On Sat, Feb 11, 2012 at 6:00 AM, Deepayan Sarkar deepayan.sar...@gmail.com wrote: On Fri, Feb 10, 2012 at 12:43 AM, ilai ke...@math.montana.edu wrote: Hello List! I asked this before (with no solution), but maybe this time... I'm trying to project a surface to the XY under a 3d cloud using

Re: [R] making multiple lines using qqplot

2012-02-10 Thread ilai
Melissa, par(new=T) works as many times as you use it. You don't provide data, but (assuming it is not NULL) more likely your n=500 qqplot was just obscuring the points of the n=50 plot. Reverse the order (i.e. qqplot 500 first, 50, 5 last) and see if all three are there (as there are more 500

Re: [R] Help needed please

2012-02-10 Thread ilai
Your script is rather inefficient with spurious cbind calls. Any particular reason not to use ?ar directly ? Call: ar.yw.default(x = simtimeseries, order.max = 4) Coefficients: 1234 1.9440 -1.9529 0.8450 -0.2154 Order selected 4 sigma^2 estimated as 15.29

Re: [R] Formatting Y axis.

2012-02-10 Thread ilai
yaxt='n' in ?par and ?axis are your friends. # A plot on log scale labeled with original: plot(x,log(y),yaxt='n') axis(2,at=pretty(log(y)),labels=round(exp(pretty(log(y) Works for qqnorm and boxplots, as well as other top level fun. By the way this is a FAQ. On Fri, Feb 10, 2012 at 9:43

Re: [R] Row-wise kronecker product with Matrix package

2012-02-09 Thread ilai
Maybe one of these will improve: help.search('kronecker') ... spam::kronecker Kronecker Products on Sparse Matrices spam::spam.classClass spam base::kronecker Kronecker Products on Arrays Matrix::kronecker-methods Methods for Function 'kronecker()'

[R] Lattice 3d coordinate transformation

2012-02-09 Thread ilai
Hello List! I asked this before (with no solution), but maybe this time... I'm trying to project a surface to the XY under a 3d cloud using lattice. I can project contour lines following the code for fig 13.7 in Deepayan Sarkar's Lattice, Multivariate Data Visualization with R, but it fails when I

Re: [R] Lattice 3d coordinate transformation

2012-02-09 Thread ilai
Oops. Obviously I mean A working example: require(lattice) ... On Thu, Feb 9, 2012 at 12:13 PM, ilai ke...@math.montana.edu wrote: Hello List! I asked this before (with no solution), but maybe this time... I'm trying to project a surface to the XY under a 3d cloud using lattice. I can

Re: [R] passing an extra argument to an S3 generic

2012-02-09 Thread ilai
You do not provide mlm.influence() so your code can't be reproduced. Or did you mean to put lm.influence() in the formals to your hatvalues.mlm ? If yes, then 1) you have a typo 2) lm.influence doesn't allow you to pass on arguments, maybe try influence.lm instead. Elai On Thu, Feb 9, 2012 at

Re: [R] Tukey HSD

2012-02-09 Thread ilai
Also you want for(i in 2:ncol(mydf)) { ... Your current setup of 1:ncol(mydf)-1 picks columns 0,1,2,...,ncol-1 (missing the last), which is not what you want... Setting i-2 in the first line was overridden by the call to loop. Cheers On Thu, Feb 9, 2012 at 2:33 PM, peter dalgaard

Re: [R] Apply pmax to dataframe with different args based on dataframe factor

2012-02-09 Thread ilai
Your attempt was just overly complicated. All you needed was threshold - c( .2 , .4 , .5 )[ df$track ] df$value - pmax(threshold, df$value) df # desired outcome Cheers On Thu, Feb 9, 2012 at 3:56 PM, Idris Raja idris.r...@gmail.com wrote: # I have a dataframe in the following form: track -

Re: [R] how to change x-axis ?

2012-02-09 Thread ilai
plot(1:10, xaxt='n') # Don't plot the x-axis axis(1,at=c(2,5,10)) # Construct your own See ?par ?axis On Thu, Feb 9, 2012 at 2:48 PM, summer summerwind...@hotmail.com wrote: Hi, I want to define the x-axis in plot as 2,4,6.100 instead of the default one. How to do that?

Re: [R] Setting up infile for R CMD BATCH

2012-02-08 Thread ilai
, 2012 at 12:50 AM, ilai ke...@math.montana.edu wrote: Ahh, I think I'm getting it now. Well, readlines() is not going to work for you. The help file ?readline clearly states In non-interactive use the result is as if the response was RETURN and the value is ‘’. The implication is you cannot use

Re: [R] Setting up infile for R CMD BATCH

2012-02-08 Thread ilai
with eval(), for example. However, is there an approach to keeping the original program so that the user could run both interactive and batch mode? That probably requires modifying the readline() part, but how? Thanks, Gang On Wed, Feb 8, 2012 at 2:08 PM, ilai ke...@math.montana.edu wrote

Re: [R] basic debugging

2012-02-08 Thread ilai
?debug will satisfy your curiosity regarding debug mode - strictly speaking it is not a mode, just another function. On Wed, Feb 8, 2012 at 7:30 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: What is your question? More interestingly, what is debug mode in R? I'd suggest you look

Re: [R] binomial vs quasibinomial

2012-02-07 Thread ilai
Not really an R question, now is it ? more like pure stats. I'm guessing you didn't get an answer because this list can't tell you how to analyze your data (or in your case, approve an incorrect analysis). Regarding the part of your question that is R related, I think you may be confused on what

Re: [R] Setting up infile for R CMD BATCH

2012-02-07 Thread ilai
You're not missing anything. In your output.Rout: the 1 right after the source('test') is the 1 inputed from answers.R. the [1] 1 is the result of test. Remove the second line from answers.R and see what happens (hint: script ends after the readline prompt). Just out of curiosity, why will you use

Re: [R] Setting up infile for R CMD BATCH

2012-02-07 Thread ilai
On Tue, Feb 7, 2012 at 10:50 PM, ilai ke...@math.montana.edu wrote: Ahh, I think I'm getting it now. Well, readlines() is not going to work for you. The help file ?readline clearly states In non-interactive use the result is as if the response was RETURN and the value is ‘’. The implication

Re: [R] Multi-page PDF using dev.copy2pdf(filename, onefile=TRUE)?

2012-02-06 Thread ilai
Doug, dev.copy2pdf closes the connection after it's done, so onefile is meaningless. To look at each plot before copy to a single pdf, you could open a pdf(...) but revert between it and your graphic device: graphics.off() plot(1:7, 1:7) x11c- dev.cur() # your current graphics device

Re: [R] I bet apply has a solution

2012-02-06 Thread ilai
duplicated(Data..) On Mon, Feb 6, 2012 at 11:34 AM, LCOG1 jr...@lcog.org wrote: Hi all For the data below, I would like to return a logical value indicating differences in the data. #Create data Data..-data.frame(a=rep(1,10),b=c(rep(1,9),2),c=c(rep(1,8),2,2))   a b c 1  1 1 1 2  1 1 1

Re: [R] how do I exort a list of numbers into csv file?

2012-02-05 Thread ilai
cat will wrap Josh's overkill approach in one line: mylist- list(1:3,3:9) lapply(mylist , cat , sep=',' , fill=T , append=T , file='foo.csv') Cheers On Sun, Feb 5, 2012 at 7:42 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: Hi Michael, Part of me imagines this is overkill, but this should be

[R] Lattice: correct use of ltransform3dto3d to plot a surface under a cloud ?

2012-02-04 Thread ilai
Hello list! I am trying to project the fitted surface to a 3d plot of the data, similar to figures 13.7 or 6.5 in Deepayan Sarkar's Lattice, Multivariate Data Visualization with R, but replace the contour/map lines with levelplot. Problem is I can't get the color regions to line up after the

Re: [R] lean text label below barplot table

2009-09-13 Thread Ilai
par(xpd=T) bp- barplot(matrix(1:50,5,10),names=F) text(bp,-2,c('these labels','are tooo','looong'),pos=2,srt=45) Xiaogang Yang wrote: Hi, everyone: I am plotting an graph with bar plot, but the label after every bar is too long, I wanna if I can draw the label lean to an angle thanks

<    1   2