Re: [R] How to vectorize a function to handle two vectors

2011-08-26 Thread Jeff Newmiller
Isn't a vector of vectors usually considered a matrix? So if you want to vectorize a vector function you would normally rewrite it to operate on matrices. --- Jeff Newmiller The . . Go Live... DCN: Basics: ##.#. ##.#.

Re: [R] Sorting order of reorder with multiple variables

2011-08-26 Thread Deepayan Sarkar
On Thu, Aug 25, 2011 at 6:15 PM, markm0705 wrote: > I've been building a ranked dot plot for several days now and am sorting the > data using the reorder command.  What I don't understand is how reorder > works when mutiple varibles are plotted by grouping.  In the example below > I'm using re-ord

[R] Grouping variables in a data frame

2011-08-26 Thread Andra Isan
Hi All, I have a data frame as follow: user_id time age location gender . and I learn a logistic regression to learn the weights (glm with family= (link = logit))), my response value is either zero or one. I would like to group the users based on user_id and time and see the y values and

Re: [R] How to generate a random variate that is correlated with a given right-censored random variate?

2011-08-26 Thread Dimitris Rizopoulos
Perhaps it could help if you could assume a more flexible model for [T]; for instance, a PH model with a piecewise-constant baseline hazard, which you can simulate as a Poisson variable. Best, Dimitris On 8/26/2011 10:45 PM, Ravi Varadhan wrote: Hi, Here is an update. I implemented this bi

Re: [R] How to vectorize a function to handle two vectors

2011-08-26 Thread David Winsemius
On Aug 26, 2011, at 4:52 PM, Newbie wrote: Thank you for the quick response! I think you are on the right track - but is there any way of "calling" (is that the word for it) the function price_call in the mapply, so that this price_call function is changed to handle vectors. I believe that

[R] Mixture of Regressions

2011-08-26 Thread Andra Isan
Dear All, I have two hidden classes for my data set that I would like to learn them based on the Mixture of Binomial regression model. I was wondering if there is any package that I can use for that purpose. Has any one tried any package for the Mixture models? Thanks a lot, Andra __

[R] Rcmdr help

2011-08-26 Thread Andrés Aragón
Hi, please help me, I want to have a functional Rcmdr but after install as indicated in: http://socserv.mcmaster.ca/jfox/Misc/Rcmdr/installation-notes.html obtain the following: Loading Tcl/Tk interface ... done Loading required package: car Loading required package: MASS Loading required package

[R] Multiply Iterated Measurements and Pairwise Comparison

2011-08-26 Thread Leif Kirschenbaum
I am familiar with pairwise t-tests, corrections for multiple testing, etc. however I have a problem whose answer I have not found after extensive R-help archive and Google searching. What I have done in the past: I have N items which are measured, exposed to a condition, and then measured agai

Re: [R] Predictions from a logistic regression model with validation for ROCR

2011-08-26 Thread Jon Toledo
Thank you David. I was indeed looking at rms, DAAG and caret. I didn´t find a way to extract with predict the probabilities of the crossalidated model in rms, so I will try with DAAG. But DAAG only gives one set of crossvalidatet proabilities and I wanted the probabilities for all crossvalidate

Re: [R] How to vectorize a function to handle two vectors

2011-08-26 Thread Newbie
Thank you for the quick response! I think you are on the right track - but is there any way of "calling" (is that the word for it) the function price_call in the mapply, so that this price_call function is changed to handle vectors. I believe that this should, in theory if it is correct, make the r

[R] out of sample predictions using a probit model

2011-08-26 Thread BrysonHH
hello all, I am a beginner at R and not exactly a statistician either. I'm messing around with a probit model on an enconomic time series. I can get the model estimated but I have not been able to get it to give me predictions out of sample data. I'm using the predict function but getting errors.

[R] Make a function work on an environemnt

2011-08-26 Thread Tyler Rinker
In my R learning I've come across a situation in which a piece of code that works on the work space outside a function does not work inside the function. WARNING THIS EMAIL CONTAINES THE CODE:#rm(list=ls()) THIS WILL CLEAR ALL OBJECTS FROM YOUR WORKSPACE! When I use rm(list=ls()) and then l

Re: [R] R.oo data members / inheritance

2011-08-26 Thread Henrik Bengtsson
Hi. On Fri, Aug 26, 2011 at 8:58 AM, Ben qant wrote: > If someone is able, can you tell me if there is a better way to do this? > More specifically, do I have to rewrite all of the data members stuff  and > extend stuff of parent class in the child class? No. > See below. Thanks in > advance! >

[R] baseline cumulative hazard by basehaz()

2011-08-26 Thread array chip
Hi, basehaz() in survival package is said to estimate the baseline cumulative hazard from coxph(), but it actually calculate cumulative hazard by -log(survfit(coxph.object)). But survfit() calculate survival based on MEAN covariate value, not covariate value of 0. I thought baseline cumulativ

[R] R.oo inheritance with pass by reference

2011-08-26 Thread Ben qant
I thought I would post an example of using R.oo with inheritance and pass by reference for future searches. With PerMore I am inheriting Person. Then I am changing an object data memeber of an object of PerMore class using pass by reference ('mimiced' by R.oo) in an object of AgeMultiplier. I chang

Re: [R] Column of probabilities

2011-08-26 Thread David Winsemius
On Aug 26, 2011, at 4:58 PM, David Winsemius wrote: On Aug 26, 2011, at 2:35 PM, Jim Silverton wrote: H all, I have a 6 x 3 matrix. The last column is simply the sum of of the first two rows. x1 x2 x3 1 23 2 13 1 01 2 24 2 13 2 13 0

Re: [R] Comparing skewness of two distributions

2011-08-26 Thread Joshua Wiley
par(mfrow = c(2, 1)) plot(density(rnorm(100)^2)) plot(density(rnorm(100)^2)) ? On Fri, Aug 26, 2011 at 10:20 AM, Benjamin Polidore wrote: > I have two distributions.  Both are left skewed.  Is there a good > statistical approach to determining if the skew of distribution 1 is > statistically sim

Re: [R] Column of probabilities

2011-08-26 Thread David Winsemius
On Aug 26, 2011, at 2:35 PM, Jim Silverton wrote: H all, I have a 6 x 3 matrix. The last column is simply the sum of of the first two rows. x1 x2 x3 1 23 2 13 1 01 2 24 2 13 2 13 0 00 I want to create a column of probabilities p,

Re: [R] How to generate a random variate that is correlated with a given right-censored random variate?

2011-08-26 Thread Ravi Varadhan
Hi, Here is an update. I implemented this bivariate lognormal approach. It works well in simulations when I generated the marginal [T] from a lognormal distribution and independently censored it. It, however, does not do well when I generate from a marginal [T] that is Weibull or a distribut

Re: [R] How to vectorize a function to handle two vectors

2011-08-26 Thread David Winsemius
On Aug 26, 2011, at 2:43 PM, Newbie wrote: Dear R-users I am trying to "vectorize" a function so that it can handle two vectors of inputs. I want the function to use phi (a function), k[1] and t[1] for the first price, and so on for the second, third and fourth price. ? mapply I trie

Re: [R] rpart: plot without scientific notation

2011-08-26 Thread Stephen Milborrow
Jay wrote: While I'm very pleased with the results I get with rpart and rpart.plot, I would like to change the scientific notation of the dependent variable in the plots into integers. Right now all my 5 or more digit numbers are displayed using scientific notation. One way of getting rpart.pl

Re: [R] How to get the last modified time of a file from R

2011-08-26 Thread Henrique Dallazuanna
Try this: file.info("your_file")$mtime On Fri, Aug 26, 2011 at 4:48 PM, alan wu wrote: > Hi All, > > I want to add the last modified time of the dataset I used in the > analysis. Any idea about how to get it from R in windows XP system? > > Thanks > > > Alan > > _

[R] How to get the last modified time of a file from R

2011-08-26 Thread alan wu
Hi All, I want to add the last modified time of the dataset I used in the analysis. Any idea about how to get it from R in windows XP system? Thanks Alan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

[R] kernlab: ksvm() bug?

2011-08-26 Thread Immanuel
Hello all, I'm trying to run a gird parameter search for a svm. Therefore I'M using the ksvm function from the kernlab package. svp <- ksvm(Ktrain,ytrain,type="nu-svc",nu=C) The problem is that the optimization algorithm does not return for certain parameters. I tried to use setTimeL

Re: [R] ddply from plyr package - any alternatives?

2011-08-26 Thread AdamMarczak
No, it's not much faster. I'd say it's faster about 10-15% in my case. I dont want neither plyr or data.table package because our software on the server does not support R version over 2.10 and both of them have dependency for R >= 2.12. Also I do not want to use old archives because I did not ha

Re: [R] Fwd: Segment out of the Graph

2011-08-26 Thread Claudio Zanettini
Thanks I substituted points(inactT, inactR, pch="|") with rug(inactT, side=1, ticksize = 0.03) and now it is perfect Thanks again. Claudio 2011/8/26 David Winsemius > > On Aug 26, 2011, at 11:31 AM, heverkuhn wrote: > > >> No attachment. No code. >> >> I apology for that. I provided below t

Re: [R] integration

2011-08-26 Thread .
Hi Ravi, are you saying to apply the idea of a trapezoidal method "again", because I was expecting the integrate() already do it for me. Is not the case? I am also dealing with troubles related to integrate. Just to say, I tried to figure out the problem in Mathematica and it gives me the expecte

[R] Comparing skewness of two distributions

2011-08-26 Thread Benjamin Polidore
I have two distributions. Both are left skewed. Is there a good statistical approach to determining if the skew of distribution 1 is statistically similar to the skew of distribution 2? Thanks, bp [[alternative HTML version deleted]] __ R-hel

[R] How to vectorize a function to handle two vectors

2011-08-26 Thread Newbie
Dear R-users I am trying to "vectorize" a function so that it can handle two vectors of inputs. I want the function to use phi (a function), k[1] and t[1] for the first price, and so on for the second, third and fourth price. I tried to do the mapply, but I dont know how to specify to R what input

Re: [R] pooled hazard model with aftreg and time-dependent variables

2011-08-26 Thread Göran Broström
On Thu, Aug 25, 2011 at 4:45 AM, JPF wrote: > This is for coxph: > > The cluster term is used to compute a robust variance for the model. The > term + cluster(id) where each value of id is unique is equivalent to > specifying the robust=T argument, and produces an approximate jackknife > estimate

[R] How to generate a random variate that is correlated with a given right-censored random variate?

2011-08-26 Thread Ravi Varadhan
Hi, I have a right-censored (positive) random variable (e.g. failure times subject to right censoring) that is observed for N subjects: Y_i, I = 1, 2, ..., N. Note that Y_i = min(T_i, C_i), where T_i is the true failure time and C_i is the censored time. Let us assume that C_i is independen

Re: [R] Predictions from a logistic regression model with validation for ROCR

2011-08-26 Thread David Winsemius
On Aug 26, 2011, at 2:09 PM, Jon Toledo wrote: Dear experts, I am looking for a package that does logistic regression with corssvalidation and gives me the probabilites of all the corssvalidations so that I can plot them in ROCR. Would also like to know if the corssvalidate model would giv

Re: [R] Column of probabilities

2011-08-26 Thread Jim Silverton
H all, I have a 6 x 3 matrix. The last column is simply the sum of of the first two rows. x1 x2 x3 1 23 2 13 1 01 2 24 2 13 2 13 0 00 I want to create a column of probabilities p, such that for each row, I want to find the probability of

Re: [R] Synchronizing R libraries on N machines?

2011-08-26 Thread Hans Ekbrand
On Thu, Aug 25, 2011 at 08:25:02AM -0500, Giovanni Petris wrote: > Hello! > > I am using R on two different machines (under Ubuntu and OS X, but this > is probably irrelevant) and I would like to keep the two installations > 'synchronized', in particular in terms of installed packages. For > examp

[R] Predictions from a logistic regression model with validation for ROCR

2011-08-26 Thread Jon Toledo
Dear experts, I am looking for a package that does logistic regression with corssvalidation and gives me the probabilites of all the corssvalidations so that I can plot them in ROCR. Would also like to know if the corssvalidate model would give me a summary coefficient for the intercept and my

Re: [R] Sicherheitszertifikat für R-Pakete unter Windows [Security Certificates for R Packages in Windows]

2011-08-26 Thread R. Michael Weylandt
To save anyone else 30 seconds, here's how google translates the below: Ladies and Gentlemen, I would like to inform me whether there is the possibility of security certificates for R packages are. Sincerely, Christopher W. Weinberger 2011/8/26 Christoph W. Weinberger > Sehr geehrte Damen un

Re: [R] Setting up a State Space Model in dlm

2011-08-26 Thread Giovanni Petris
This was an example using package KFAS, which needs to be loaded before running the code ('kf' is the function that computes Kalman filter in package KFAS) Giovanni On Fri, 2011-08-26 at 07:11 -0700, quantguy wrote: > Thanks! However, I added the line of code and receive an error during the > opt

Re: [R] Extracting values in table

2011-08-26 Thread Bert Gunter
Ramnath: With my apologies if I'm wrong, it does not look like you have made much of an effort to learn R's basics, e.g. by working thru the "Introduction to R" tutorial distributed with R. If that is the case, why do you expect us to help? -- Bert On Fri, Aug 26, 2011 at 8:52 AM, Ramnath wrote

Re: [R] Add lines to xy plot with temporal x axis

2011-08-26 Thread David Winsemius
On Aug 26, 2011, at 11:35 AM, chirleu wrote: Hi. I'm trying to add some vertical lines to an xyplot in which x axis is a temporal variable (class=dates) and y axis a factor variable. This is my code: xyplot(factor(Abacus$Emisor)~Abacus$Dia,xlab="Date", ylab="Fish",pch=124, scales=list(x=

[R] R code for OptiGrid Clustering

2011-08-26 Thread Michael Pearmain
Hi All, Has anyone coded up the OptiGrid clustering algorithm for high dimensional space? If so is anyone willing to share? Many thanks in Advance Mike [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.eth

Re: [R] Fwd: Segment out of the Graph

2011-08-26 Thread David Winsemius
On Aug 26, 2011, at 11:31 AM, heverkuhn wrote: No attachment. No code. I apology for that. I provided below the code and the vectors, Whatever that mean. Perhaps it means "below"? Yes, below, I mean out of the axis... And I think, that as you suggested, the xpd is what I was looking for.

Re: [R] looping with paste

2011-08-26 Thread Juta Kawalerowicz
Dear Sarah and Rolf, Thanks for your suggestions, yes I was looking for something that'd execute strings eval(parse) was a solution. It's extremely helpful when you want to do something on variables generated with loops. Juta

Re: [R] Change color in forest.rma (metafor)

2011-08-26 Thread Paola Tellaroli
I lied, that was not my last question: how can I add two arrows at the bottom with the words "in favor of A / B"? This is not specified in the pdf and with "text" I have the impression that I can't add text below the x-axis. 2011/8/26 Paola Tellaroli > Dear Prof. Viechtbauer, > thank you so muc

[R] Extracting values in table

2011-08-26 Thread Ramnath
Hi All, I am a beginner in programming in r and please do forgive me if my question seems to be silly and sometimes not understandable. 1. we have a list of elements in a list say: ls<-list("N","E","E","N","P","E","M","Q","E","M") 2. We have an another list of tables in a list say: n <- list(

Re: [R] Save figure in pdf

2011-08-26 Thread Komine
Thank you for your answers. The problem persists always (without ".pdf" or using "print" or "plot"). The code runs, but the probem is to save the figure with pdf format in order to load it directly in word. Howerver, I will read the link indicated. -- View this message in context: http://r.789

Re: [R] Setting up a State Space Model in dlm

2011-08-26 Thread quantguy
Thanks! However, I added the line of code and receive an error during the optim() procedure: rror in fn(par, ...) : could not find function "kf" The update code is here: tmp <- ts(read.table("http://shazam.econ.ubc.ca/intro/P.txt";, header=T), start=c(1978,1), frequency=12) * 100 y <- tmp[,1:4

[R] Time Series data with data every half hour

2011-08-26 Thread Simmons, Ryan
I am working with data from the USGS with data every 30 minutes from 4/27/2011 to 8/25/2011. I am having trouble with setting the frequency. My R script is below: > shavers=read.csv("shavers.csv") > names(shavers) [1] "agency_cd""site_no" "datetime" "tz_cd""Temp"

Re: [R] loading gdata

2011-08-26 Thread Scott
i can't comment on gtools but to read in a data file (eg csv) these commands will help you and are provided in R without a need for extra packages. read.table read.csv to get help on these use this ?read.table if you type installed.packages() do gtools/gdata come up? please describe what steps

Re: [R] eRm/raschsampler error message

2011-08-26 Thread Scott
I'm not familiar with eRm but subscript out of bounds often occurs when the data isn't the structure you think it is. Perhaps your input is not what is expected - might not be as long/wide as required. Depending on how allb is stored, you might be flipping rows/columns around? try checking the dime

[R] How to use xmlFlatListTree?

2011-08-26 Thread Peter Higdon
Dear Forum, I haven't programmed in a while, and I'm new to R, so please keep your answers simple. I'm trying to analyse data in an xml file. I successfully loaded the data into lists using: doc <- xmlTreeParse("PSparsed.xml", getDTD = F) I was going to write a script to traverse the tree and flat

[R] Add lines to xy plot with temporal x axis

2011-08-26 Thread chirleu
Hi. I'm trying to add some vertical lines to an xyplot in which x axis is a temporal variable (class=dates) and y axis a factor variable. This is my code: xyplot(factor(Abacus$Emisor)~Abacus$Dia,xlab="Date", ylab="Fish",pch=124, scales=list(x=list(format="%b %Y",tick.number=30)) , panel=function(

[R] Sicherheitszertifikat für R-Pakete unter Windows

2011-08-26 Thread Christoph W. Weinberger
Sehr geehrte Damen und Herren, ich würde mich gerne informieren, ob es die Möglichkeit gibt Sicherheitszertifikate für R-Pakete gibt. Mit freundlichen Grüßen Christoph W. Weinberger __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/

Re: [R] Fwd: Segment out of the Graph

2011-08-26 Thread heverkuhn
No attachment. No code. I apology for that. I provided below the code and the vectors, Whatever that mean. Perhaps it means "below"? Yes, below, I mean out of the axis... And I think, that as you suggested, the xpd is what I was looking for. I need something like this http://www.springerima

[R] R.oo data members / inheritance

2011-08-26 Thread Ben qant
If someone is able, can you tell me if there is a better way to do this? More specifically, do I have to rewrite all of the data members stuff and extend stuff of parent class in the child class? See below. Thanks in advance! Example 1: setConstructorS3("ClassA", function(A,x) { if(missing(A))

Re: [R] Setting up a State Space Model in dlm

2011-08-26 Thread Giovanni Petris
I just saw this old post, but it seems that nobody replied, so let me try. If you can assume that also U[t] evelves as a random walk, I would build a DLM by taking the state vector to be x[t] = (U[t], UN[t], pi[t])' By plugging in the equation for pi[t] the random walk expressions for U[t] and

Re: [R] elegant way to check if 2 values are in 3 columns?

2011-08-26 Thread jim holtman
Slight change; forgot that 'all.equal' only accepts a single value: (and it is a little shorter f.x <- function(x) any(all.equal(x, 56.36) || all.equal(59.91)) mask <- with(vaslinks4, (yearsep < 1988) & (sapply(proc1, f.x) | sapply(proc2, f.x)

Re: [R] elegant way to check if 2 values are in 3 columns?

2011-08-26 Thread David Winsemius
On Aug 26, 2011, at 10:16 AM, Joanne Demmler wrote: Dear all, I'm trying to rerun some data linkage exercises in R (they are designed to be done in SPSS, SAS or STATA) The exercise in question is to relabel the column "treat" to "1", if "yearsep" is smaller than 1988 and columns "proc1"-"p

Re: [R] elegant way to check if 2 values are in 3 columns?

2011-08-26 Thread jim holtman
You solution is not bad since it tries to make use of vectorized operations, but there are some problems in it. 1) you should be using "&" instead of "&&" and "|" instead of "||" (look at the help page to understand the difference. 2) FAQ 7.31: You are checking against floating point values (...

Re: [R] Save figure in pdf

2011-08-26 Thread David Winsemius
On Aug 26, 2011, at 10:06 AM, Rainer M Krug wrote: On Fri, Aug 26, 2011 at 3:37 PM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: I don't have the FactoMineR library so I can't replicate, but it seems that your problem is that you never plot anything. Effectively, your code runs

[R] elegant way to check if 2 values are in 3 columns?

2011-08-26 Thread Joanne Demmler
Dear all, I'm trying to rerun some data linkage exercises in R (they are designed to be done in SPSS, SAS or STATA) The exercise in question is to relabel the column "treat" to "1", if "yearsep" is smaller than 1988 and columns "proc1"-"proc3" contain the values 56.36 or 59.81. My pathetic s

Re: [R] Save figure in pdf

2011-08-26 Thread Rainer M Krug
On Fri, Aug 26, 2011 at 3:37 PM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > I don't have the FactoMineR library so I can't replicate, but it seems that > your problem is that you never plot anything. > > Effectively, your code runs > > windows() > x = 1:5 > x > > and then wondering

Re: [R] Synchronizing R libraries on N machines?

2011-08-26 Thread Rainer M Krug
On Fri, Aug 26, 2011 at 3:45 PM, Iain Gallagher < iaingallag...@btopenworld.com> wrote: > Hi Giovanni > > Using Ubuntu and MacOSX may not be irrelevant. I use Ubuntu and if I carry > out a fresh install (e.g. after a new release - although I've stuck with > 10.04 so far) then I always have to mess

Re: [R] How to find the accuracy of the predicted glm model with family = binomial (link = logit)

2011-08-26 Thread Frank Harrell
That's not the way to use logistic regression. See http://stats.stackexchange.com/questions/14803/graphically-presenting-model-fits-of-logistic-regression for some other ideas. Frank Weidong Gu-2 wrote: > > Andra, > > You can transfer the probabilities into class membership by setting up > a cu

Re: [R] Synchronizing R libraries on N machines?

2011-08-26 Thread Iain Gallagher
Hi Giovanni Using Ubuntu and MacOSX may not be irrelevant. I use Ubuntu and if I carry out a fresh install (e.g. after a new release - although I've stuck with 10.04 so far) then I always have to mess around, check the web etc to install external packages that R libraries I want to use rely on.

Re: [R] Sharp turn in cdf?

2011-08-26 Thread David Winsemius
On Aug 26, 2011, at 9:12 AM, David Winsemius wrote: This arrived without a refers to in its headers and was a follow up to: On Aug 25, 2011, at 9:33 PM, Jim Silverton wrote: Hi all, I have some data. I want to fit a smooth cdf to the data. Then I want to find both the value of x and the

Re: [R] Setting up a State Space Model in dlm

2011-08-26 Thread Giovanni Petris
Oops.. You need to add the following line, right after the "m <- NCOL(y)" statement: k <- m * (m+1) / 2 'k' is the number of independent parameters in an m-by-m covariance matrix, and two such matrices are estimated (Ht and Qt, both time invariant). Hence the unknown parameter theta has length

Re: [R] Save figure in pdf

2011-08-26 Thread R. Michael Weylandt
I don't have the FactoMineR library so I can't replicate, but it seems that your problem is that you never plot anything. Effectively, your code runs windows() x = 1:5 x and then wondering where your graph is. Add plot(res.pca) and i think your problem will be solved. Michael Weylandt On Fri,

[R] Save figure in pdf

2011-08-26 Thread Komine
Hi, I created a figure with R and I want to save it in .pdf. I used this code: > pdf("res.pca.pdf",width=10,height=8) > library(FactoMineR) > res.pca<-PCA(acp) > res.pca > dev.off() When I go in my folder, I find an empty file ( 0 Ko). Do you know where is the problem. Thank you in advance

Re: [R] Synchronizing R libraries on N machines?

2011-08-26 Thread Rainer M Krug
On Fri, Aug 26, 2011 at 3:05 PM, Giovanni Petris wrote: > Hi Rainer, > > This certainly helps, but it still requires to do some work by hand. I > was hoping for something more automatic - but so far nobody has > suggested a better approach. > Well - you could define two scripts, one which is exe

Re: [R] Sharp turn in cdf?

2011-08-26 Thread David Winsemius
This arrived without a refers to in its headers and was a follow up to: On Aug 25, 2011, at 9:33 PM, Jim Silverton wrote: Hi all, I have some data. I want to fit a smooth cdf to the data. Then I want to find both the value of x and the % on the y axis for which the the slope is 1 ( or the p

Re: [R] Change color in forest.rma (metafor)

2011-08-26 Thread Paola Tellaroli
Dear Prof. Viechtbauer, thank you so much for your help and kindness. Clearly graphs are the minor problem in our work, and the parameters and options that can vary in R are so many that it is obvious that you can not expect to change everything you want! Your suggestions are very helpuf, but I h

Re: [R] cbind giving NA's?

2011-08-26 Thread R. Michael Weylandt
This seems to be the easiest way to handle the problem: > a = xts(coredata(a), time(a)) > b = xts(coredata(b), time(b)) > merge(a,b) ZWD.UGX SCHB.Close 2010-03-31 NA 28.02 2010-04-01 7.6343 NA 2010-04-02 7.6343 NA 2010-04-03 7.5458 NA 2010-04-04 7

Re: [R] Synchronizing R libraries on N machines?

2011-08-26 Thread Giovanni Petris
Hi Rainer, This certainly helps, but it still requires to do some work by hand. I was hoping for something more automatic - but so far nobody has suggested a better approach. Thank you, Giovanni On Thu, 2011-08-25 at 15:43 +0200, Rainer M Krug wrote: > > > On Thu, Aug 25, 2011 at 3:25 PM, Gio

Re: [R] string manipulation

2011-08-26 Thread Gabor Grothendieck
On Fri, Aug 26, 2011 at 7:27 AM, Jeff Newmiller wrote: > ".*" is greedy... might want regex "number[^0-9]*([0-9] {4})" to avoid > getting 1999 from "I want the number 2000, not the number 1999." If such inputs are possible we could also do this where we have added a ? after the * to make the repe

Re: [R] How to find the accuracy of the predicted glm model with family = binomial (link = logit)

2011-08-26 Thread Weidong Gu
Andra, You can transfer the probabilities into class membership by setting up a cut-off value, usually 0.5. set.seed(3) x<-rnorm(100) y<-rbinom(100,prob=1/(1+exp(x)),size=1) model<-glm(y~x,family=binomial(link=logit)) pred<-ifelse(predict(model,type='response')>0.5,1,0) table(pred,y) Weidong Gu

Re: [R] Syntax for a three-level logistic model

2011-08-26 Thread Ben Bolker
Diaz-Escamilla, Rafael E saclink.csus.edu> writes: > This question is really best for the r-sig-mixed-mod...@r-project.org mailing list: please direct any follow-ups there. > Data Collected My data consist of three levels: level 1 is four > setting for each student (setting nested within s

Re: [R] cbind giving NA's?

2011-08-26 Thread Petr PIKAL
I was rather too quick It has probably something to do with versions of zoo and xts after updating to zoo 1.7.4 and xts 0.8.2 I got with your examples > merge(a,b) ZWD.UGX SCHB.Close 2010-04-01 NA 28.02 2010-04-01 7.6343 NA 2010-04-02 7.6343 NA 2010-04-03

Re: [R] cbind giving NA's?

2011-08-26 Thread Dennis Murphy
Hi: Try this: require('xts') merge.zoo(zoo(a), zoo(b), all = c(TRUE, TRUE)) ZWD.UGX SCHB.Close 2010-03-31 NA 28.02 2010-04-01 7.6343 NA 2010-04-02 7.6343 NA 2010-04-03 7.5458 NA 2010-04-04 7.4532 28.30 2010-04-05 7.4040 28.38 2010-04-06

Re: [R] cbind giving NA's?

2011-08-26 Thread Petr PIKAL
Hi > > On 26 August 2011 03:37, R. Michael Weylandt wrote: > > If you could, dput() them so we can see everything about them. You also > > might see if merge() gives you more expected behavior > > Ok... > > dput(a) > structure(c(7.6343, 7.6343, 7.5458, 7.4532, 7.404, 7.3317), class = c("

[R] Generate 2 variables with normal distribution correlated betweenthem and with serial correlation

2011-08-26 Thread Soberon Velez, Alexandra Pilar
Hello, I want to create 2 variables with normal distribution that the correlation between them is equal to 0.8 and also each one has a serial correlation equal to 0.6. To generate variables with correlation between them I use: t1<-10 N<-45 sigma2<-matrix(c(1,0.8*sqrt(1),0.8*sqrt(1),1),

Re: [R] string manipulation

2011-08-26 Thread Jeff Newmiller
".*" is greedy... might want regex "number[^0-9]*([0-9] {4})" to avoid getting 1999 from "I want the number 2000, not the number 1999." --- Jeff Newmiller The . . Go Live... DCN: Basics: ##.#. ##.#. Live Go... Live: OO

Re: [R] ddply from plyr package - any alternatives?

2011-08-26 Thread Paul Hiemstra
On 08/26/2011 09:14 AM, AdamMarczak wrote: > Thank you all for suggestions, they were great and informative. > I will surely use data.tables in future when our server will be upgraded for > now this is solution that I used. This solution performs exactly same task > and produces exact same result

[R] Copula Value at Risk prediction

2011-08-26 Thread marisa
Hello all, I am currently writing a thesis in Value at Risk prediction and have to model a data set of four stocks. I want to simulate 1 times from the used D-vine and predict 300 new datapoints, but am not quiet sure how to do this correctly. The produced matrix should have dimension N x numb

Re: [R] ddply from plyr package - any alternatives?

2011-08-26 Thread AdamMarczak
Thank you all for suggestions, they were great and informative. I will surely use data.tables in future when our server will be upgraded for now this is solution that I used. This solution performs exactly same task and produces exact same results at ddply. s <- split(past, paste(past$"CNTRY_N

Re: [R] within-groups variance and between-groups variance

2011-08-26 Thread S Ellison
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Coghlan, Avril > Sent: 25 August 2011 16:02 > To: r-help@r-project.org > Cc: Coghlan, Avril > Subject: [R] within-groups variance and between-groups variance > > Hello, > > I ha

Re: [R] cbind giving NA's?

2011-08-26 Thread Hasan Diwan
On 26 August 2011 03:37, R. Michael Weylandt wrote: > If you could, dput() them so we can see everything about them. You also > might see if merge() gives you more expected behavior Ok... > dput(a) structure(c(7.6343, 7.6343, 7.5458, 7.4532, 7.404, 7.3317), class = c("xts", "zoo"), .indexCLAS

Re: [R] cbind giving NA's?

2011-08-26 Thread R. Michael Weylandt
Hmm, that's quite puzzling. I don't know but I'd willing to guess the time/date stamps on a,b are more different than the output is leading us to believe. My experience is that there's always more to a time/date object to trick us up than one would expect. If you could, dput() them so we can see e

[R] cbind giving NA's?

2011-08-26 Thread Hasan Diwan
I have two xts objects, call them "a" and "b", and am trying to merge them... > class(a) [1] "xts" "zoo" > class(b) [1] "xts" "zoo" > head(a) 2010-04-01 7.6343 2010-04-02 7.6343 2010-04-03 7.5458 2010-04-04 7.4532 2010-04-05 7.4040 2010-04-06 7.3317 > head(b) 2010-04-01 568.80 2010-04-05

Re: [R] Choropleth in R

2011-08-26 Thread Reza Salimi-Khorshidi
Thanks Jean. This is really helpful; it does the job (almost) at least for the initial analyses. However, I think I will need to do more research on the choropleth after my initial analyses. Best, Reza [[alternative HTML version deleted]] __ R-h

[R] [R-pkgs] New package ISOweek: Week of the year and weekday according to ISO 8601

2011-08-26 Thread Uwe Block
ISOweek is a small package which contains functions to substitute the %V and %u formats which are not implemented on Windows. In addition, the package offers functions to convert from standard calender format -mm-dd to ISO 8601 week format -Www-d and vice versa. Uwe Block [[altern

[R] eRm/raschsampler error message

2011-08-26 Thread KD
Hi, I am running the non-parametric rasch model tests using eRm. I have a reasonably large dataset for this type of exercise (110 items, 248 persons). I run: > allb2=as.matrix(allb) > rsample <- rsampler(allb2, ctr) > t102<-NPtest(rsample, method="T10") #global test, subgroup inv and receive erro

[R] Odp: Using write.table i have a table with two columns i would like to save it as an excel file

2011-08-26 Thread Petr PIKAL
Hi I use this kind of output to excel if the table is not too big write.table(tab, "clipboard", sep = "\t", row.names = F) In excel sheet I press ctrl - V to copy from clipboard Regards Petr > Using write.table i would like to save data as an excel file to a folder. I > am not too sure how

Re: [R] read.table truncated data?

2011-08-26 Thread Petr PIKAL
Hi > > Thanks, Jim. quote='' works. And then I found a single quote in each of > these lines: > 3262 > 10403 > 17544 > 24685 > 31826 > 38967 > > None of them near the position the table got truncated. Why is it? > > And read.table is a great function. Is it possible for it to give a warning >

Re: [R] string manipulation

2011-08-26 Thread Gabor Grothendieck
On Thu, Aug 25, 2011 at 9:51 PM, Lorenzo Cattarino wrote: > Apologies for confusion. What I meant was the following: > > mytext <- "I want the number 2000, not the number two thousand" > > and the problem is to select "2000" as the first four digits after the word > "number". The position of 2000

Re: [R] string manipulation

2011-08-26 Thread Janko Thyson
You might want to take a look at 'regexpr' and/or 'gregexpr': mytext <- "I want the number 2000, not the number two thousand" idx <- regexpr("\\d{4}", mytext) idx <- c(idx, (idx + attributes(idx)$match.length)-1) substr(start=idx[1], stop=idx[2], mytext) HTH, Janko On 26.08.2011 03:51, Lorenzo