Re: [R] QCQP Optimization

2014-10-07 Thread Weiner, Bryan J
I am trying to minimize a quadratic program with quadratic constraints but I am having trouble choosing the package to use. I have been reading the documentation and it seems like all the examples use equations instead of vector manipulation. All of my parameters are vectors and matrices and they c

[R] Finding Rainfall Amount

2014-10-07 Thread Hafizuddin Arshad
Dear R users, I have this kind of data set which is part of my data: structure(list(Year = c(1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1

Re: [R] lattice add a fit

2014-10-07 Thread Duncan Mackay
Hi Stephen if you want and uncomplicated graph you can do the following (data is from https://stat.ethz.ch/pipermail/r-help/2008-December/181887.html which has an example of smoothing with a panel function a (follow the thread)) May be un necessary for what you want dput(test) structure(list(x =

Re: [R] Conditional Data Manipulation -Cumulative Product

2014-10-07 Thread Pooya Lalehzari
Thank you very much!! I'll test it out some more and then study it to see how it does it. It is pretty awesome and thank you again! Pooya. > On Oct 7, 2014, at 11:55 PM, "David L Carlson" wrote: > > I think this works, at least for your example data. The function SSRuns gets > the index va

Re: [R] Conditional Data Manipulation -Cumulative Product

2014-10-07 Thread David L Carlson
I think this works, at least for your example data. The function SSRuns gets the index values of the starting points and then finds the first ending point that is greater or equal. Then we cycle through the starting points and print the index values from start to stop. Those are combined into a

Re: [R] standard deviation

2014-10-07 Thread Ben Bolker
eliza botto hotmail.com> writes: > > Dear useRs, > Is there a direct command in R to calculate standard deviation of BURR distribution in R? I know the direct > function in VBA and worksheet. but is there a similar function in R? > VBA > =BurrStdev(k,alpha,beta,[gamma]) > Worksheet: > =BurrS

[R] standard deviation

2014-10-07 Thread eliza botto
Dear useRs, Is there a direct command in R to calculate standard deviation of BURR distribution in R? I know the direct function in VBA and worksheet. but is there a similar function in R? VBA =BurrStdev(k,alpha,beta,[gamma]) Worksheet: =BurrStdev(k;alpha;beta;[gamma])=DistStdev("Burr(k;alpha

Re: [R] Conditional Data Manipulation -Cumulative Product

2014-10-07 Thread Pooya Lalehzari
Below is the sample output based on the sample input. Since the StopSignals are generated for all X1:X5 variables, some might not apply and not correspond to an OpenSignal for a variable so then it will be ignored (Like 1/3 for X1). If StopSignal is on the same date as the StartSignal, it will o

Re: [R] Conditional Data Manipulation -Cumulative Product

2014-10-07 Thread David L Carlson
More clear to read, but this is much easier to load into R. Then adding StartSignals$Date <- as.Date(StartSignals$Date, "%m/%d/%Y") MainData$Date <- as.Date(MainData$Date, "%m/%d/%Y") StopSignals$Date <- as.Date(StopSignals$Date, "%m/%d/%Y") Creates date objects out of the character strings. Bu

Re: [R] Find common two and three word phrases in a corpus

2014-10-07 Thread Ista Zahn
Hi Abraham, On Tue, Oct 7, 2014 at 10:51 AM, Abraham Mathew wrote: > Let's say I have a corpus and want to find the two, three, etc word phrases > that occur most frequently in the data. I normally do this in the following > manner but am getting an error message and am having some difficulty >

[R] quantreg crq function-incomplete taus fitted

2014-10-07 Thread daniel castro
Hello , I'm trying to fit a quantile regression model for rigth censoring data and I think I'm misunderstanding the behaviour of the function crq I've tried qreg1<-crq(Surv(TIME,EVENT,type="right")~VAR1+VAR2, data=DATA_TRAIN,method = "Portnoy",tau=-1) qreg1<-crq(Surv(TIME,EVENT,type=

Re: [R] Conditional Data Manipulation -Cumulative Product

2014-10-07 Thread David L Carlson
You need to use plain text, not html in your email. Your data are scrambled (see below). It is better to send your data using the R dput() function: dput(StartSignals) dput(MainData) dput(StopSignals) - David L Carlson Department of Anthropology Texas A&M Univ

Re: [R] How to extract table results from survival summary object

2014-10-07 Thread Rianna Morgan
Hi Juan, If you do: summaryMatrix <- res$surv that should get the last matrix in the summary call assigned to summaryMatrix. If you're not looking for the 'surv' matrix, entering: res$ into the console and tab-completing should allow you to select the element of the summary object that you'd

Re: [R] lattice add a fit

2014-10-07 Thread Bert Gunter
Fit your model in the panel function using lm and plot the fits using ?panel.points, ?panel.lines, etc. -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." Clifford Stoll On Tue

[R] Find common two and three word phrases in a corpus

2014-10-07 Thread Abraham Mathew
Let's say I have a corpus and want to find the two, three, etc word phrases that occur most frequently in the data. I normally do this in the following manner but am getting an error message and am having some difficulty diagnosing what is going wrong. Given the following data, I'd just want a coun

Re: [R] Conditional Data Manipulation -Cumulative Product

2014-10-07 Thread Pooya Lalehzari
I noticed the data samples did not come out legible in the original email. Here is the original email with data as plain text that should make it more legible. Hello, I have three datasets StartSignals, MainData, StopSignals and need to compound the data for each variable in

[R] Conditional Data Manipulation -Cumulative Product

2014-10-07 Thread Pooya Lalehzari
Hello, I have three datasets StartSignals, MainData, StopSignals and need to compound the data for each variable in MainData over dates that fall between the Start and Stop signals. (Stop signals are common and the same to all X1:X5 variables). Please see sample below: The one way I was thinking

Re: [R] lattice add a fit

2014-10-07 Thread Bert Gunter
Sorry, you do **NOT** need to pass the covariates if the data argument to lm is used. Or you can explicitly pass the covariates and subscript them in your panel function. -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge

Re: [R] How to extract table results from survival summary object

2014-10-07 Thread David L Carlson
This will create a data.frame containing the results of the summary(mod) object. You can find out what that is using the command ?summary.survfit. You have an error in your example since death is not a variable in lung: > library(survival) > data(lung) > mod <- with(lung, survfit(Surv(time, stat

Re: [R] lattice add a fit

2014-10-07 Thread Bert Gunter
You need to explicitly pass the subscripts arguments and your covariates. See ?xyplot for details. Your panel function call would then be something like: panel=function(x,y,subscripts,w,z, ...){ panel.xyplot(x,y,...) panel.loess(x,y,...,col.line="red" m

Re: [R] lattice add a fit

2014-10-07 Thread Bond, Stephen
Bert, Can you provide an example how to pass the conditioned data set? xyplot( x~y | z, data=mydata, panel=function(...){ mod=lm(x~ y+w +q, data=??) panel.lines(fitted(mod)) } If I use mydata in place of ?? I get a global fit, not a fit for each level of z, which is what I want. Stephen B

Re: [R] Evaluation of global variables in function definitions

2014-10-07 Thread Duncan Murdoch
On 07/10/2014 2:45 AM, H. Dieter Wilhelm wrote: Hello (), I'd like to do the following a <- 3 f1 <- function (x){ a*x^2 } a <- 5 f2 <- function (x){ a*x^2 } plotting f1, f2, ... but f1 and f2 are the same, how can I evaluated the variables in the function definition? Thank you Di

[R] How to extract table results from survival summary object

2014-10-07 Thread Juan Andres Hernandez
Hi. I need to extract the "matrix" or "data.frame" results from a survival object. library(survival) data(lung) mod=with(lung, survfit(Surv(time,death)~ 1)) res=summary(mod) res show in consola the "matrix" I am looking for, but I can't find the way to save or assign this table to an object. Anyo

[R] Find growth rate of a zoo (time series) object

2014-10-07 Thread jpm miao
Hi, Is there any way to find the growth rate of a quarterly/monthly time series? For example, I have a quarterly CPI level series, and I wonder how to find the CPI growth rate (inflation rate). Is there easier way to convert to another class and convert back? Thanks! > dput(dtz[1:16,"CPI"])

[R] maximum likelihood estimation

2014-10-07 Thread pari hesabi
HelloI am trying to estimate the parameter of a function by the Maximum Likelihood Estimation method.If the function is the difference between two integrals: C<-function(n){integrand3<-function(x) {((2-x)^n)*(exp(ax-2))}cc<- integrate (integrand3,0,2)print(cc)} D<-function(n){integrand4<-functi

[R] Time series Regression with lags

2014-10-07 Thread jpm miao
Hi, I am working on zoo (time series) objects. Is there any way to do a time series regression with a lag period? E.g., Y(t) = b1*X1(t)+b2*X(t-1)+b3*X2(t) Is "dynlm" the default one to use? Anything else Thanks! [[alternative HTML version deleted]] __

[R] Path Diagram from Mplus semPaths{semPlot}

2014-10-07 Thread Ariadna Angulo Brunet
Hi, I am working with an OUT file from Mplus. I want to plot a path diagram with my SEM results. semPaths does it automatically but I want to ignore some variables of my study (meaning I don't want them on the path diagram but I want the variables include in the sem analysis. Exactly I want to

[R] jfindClass class not found - Please Help

2014-10-07 Thread Rahul Gupta1
> library(RJDBC) Loading required package: DBI Loading required package: rJava > jcc = JDBC ("com/ibm/db2/jcc/DB2Driver","/opt/ibm/db2/java/lib/db2jcc4.jar") Error in .jfindClass(as.character(driverClass)[1]) : class not found [[alternative HTML version deleted]] _

Re: [R] par("plt") behaving inconsistely? bug?

2014-10-07 Thread Murat Tasan
6. iteratively downgrade to earlier versions of R until it's working again... then try to diff out the offending source code change. i can try this, but i probably won't get to it for at least a few weeks :-/ in the meantime, i'm tacking on box(lty = 0) to every par(plt = ...) call, e.g. > par("pl

[R] Evaluation of global variables in function definitions

2014-10-07 Thread H. Dieter Wilhelm
Hello (), I'd like to do the following a <- 3 f1 <- function (x){ a*x^2 } a <- 5 f2 <- function (x){ a*x^2 } plotting f1, f2, ... but f1 and f2 are the same, how can I evaluated the variables in the function definition? Thank you Dieter -- Best wishes H. Dieter Wilhelm Darmstadt, Ger

[R] lattice add a fit

2014-10-07 Thread Bond, Stephen
What is the way to add an arbitrary fit from a model to a lattice conditioning plot ? For example xyplot(v1 ~v2 | v3,data=mydata, panel=function(...){ panel.xyplot(...) panel.loess(...,col.line="red") } ) Will add a loess smoother. Instead, I want to put a

Re: [R] Changing date format

2014-10-07 Thread Frederic Ntirenganya
Thanks All. Your idea is useful!!! On Tue, Oct 7, 2014 at 1:01 PM, Jim Lemon wrote: > On Tue, 7 Oct 2014 11:51:34 AM Göran Broström wrote: > > On 2014-10-07 11:27, Jim Lemon wrote: > > > On Tue, 7 Oct 2014 10:32:42 AM Frederic Ntirenganya wrote: > > >> Dear All, > > >> > > >> How can I change th

Re: [R] a question about arimax, please

2014-10-07 Thread Jose Iparraguirre
Also, the package caschrono is very good for Arima-X. If you read French, the author, Yves Aragon, wrote an excellent book describing its use: "Series temporelles avec R" (Springer). Prof. José Iparraguirre Chief Economist Age UK Age UK Tavis House, 1- 6 Tavistock Square London, WC1H 9NB T 0

Re: [R] Changing date format

2014-10-07 Thread Jim Lemon
On Tue, 7 Oct 2014 11:51:34 AM Göran Broström wrote: > On 2014-10-07 11:27, Jim Lemon wrote: > > On Tue, 7 Oct 2014 10:32:42 AM Frederic Ntirenganya wrote: > >> Dear All, > >> > >> How can I change the format of date of day of the year ? for > > > > example r > > > >> (i.e. "17 Apr" rather than

Re: [R] Changing date format

2014-10-07 Thread Göran Broström
On 2014-10-07 11:27, Jim Lemon wrote: On Tue, 7 Oct 2014 10:32:42 AM Frederic Ntirenganya wrote: Dear All, How can I change the format of date of day of the year ? for example r (i.e. "17 Apr" rather than "108"). The following is the type of the dataset I have head(Samaru) Year Start E

Re: [R] Changing date format

2014-10-07 Thread Jim Lemon
On Tue, 7 Oct 2014 10:32:42 AM Frederic Ntirenganya wrote: > Dear All, > > How can I change the format of date of day of the year ? for example r > (i.e. "17 Apr" rather than "108"). > > The following is the type of the dataset I have > > head(Samaru) > Year Start End Length > 1 1930 108 28

[R] Changing date format

2014-10-07 Thread Frederic Ntirenganya
Dear All, How can I change the format of date of day of the year ? for example r (i.e. "17 Apr" rather than "108"). The following is the type of the dataset I have head(Samaru) Year Start End Length 1 1930 108 288180 2 1931 118 288170 3 1932 115 295180 4 1933 156 294138