[R] Fwd: Error survreg: Density function returned an an invalid matrix

2015-11-16 Thread Israel Ortiz
I don´t know how to write a pareto distribution in that form, I want a pareto function for time because I have a time variable that fits that distribution. For a weibull and lognormal it is very easy because they are particular cases from a extreme value and gaussian distributions. I think it is po

Re: [R] {non} linear model solving

2015-11-16 Thread Ragia Ibrahim
appreciate replying.. I'll go through these packages documentation. Regards > Subject: Re: [R] {non} linear model solving > From: dwinsem...@comcast.net > Date: Mon, 16 Nov 2015 16:39:31 -0800 > CC: r.tur...@auckland.ac.nz; r-help@r-project.org > To: ragi..

Re: [R] {non} linear model solving

2015-11-16 Thread David Winsemius
> On Nov 16, 2015, at 4:01 PM, Ragia Ibrahim wrote: > > thanks for replying. > > the question about non linear model, I formed it incorrectly, I have a single > objective multi constrain non linear model..I searched some R library to > solve it, is there any tutorial step by step for such pro

Re: [R] Why does a custom function called is.numeric.factor break lattice?

2015-11-16 Thread sbihorel
Thanks David, I never seem to get my intention clear when I post to the R-help list... I am not sure why... Anyways, my issue was not with the test (I came up with something similar). It was actually with the name of the function which I had to create, given that this test needed to be used

Re: [R] R runtime performance and memory usage

2015-11-16 Thread Sasikumar Kandhasamy
Thanks a lot Bill & Bert. Hi Bill, Sorry i was wrong on number of records, actually, i am using two dimensional data of 250K records each. And regarding CPU usage, it was the elapsed time. Infact, i have pined one core to run R. Thanks & Regards Sasi On Mon, Nov 16, 2015 at 2:04 PM, William Dun

Re: [R] Error in mkRespMod(fr, family = family) : response must be numeric

2015-11-16 Thread William Dunlap
You should look at the data that you imported to R from somewhere else with the str() or summary() function. Since you think the data should have nice column names but seems to have the names V1, ..., Vn, I think that you may may have read a file with column names at the top into R with read.table

Re: [R] R runtime performance and memory usage

2015-11-16 Thread William Dunlap
If a quick running time is important and your models involve only numeric data with no missing values and you are willing to spend more programming time setting things up, the lsfit() function may work better for you. Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Nov 16, 2015 at 3:25 PM, S

Re: [R] how to eliminate ggplot warning frrom "knitted" document

2015-11-16 Thread Thierry Onkelinx
Add warning = FALSE to the chunk options Op 17-nov.-2015 00:07 schreef "Daniel Nordlund" : > I have the following data. > > sumry <- structure(list(group = structure(c(1L, 1L, 1L, 2L, 2L, 2L), > .Label = c("A", > "B"), class = "factor"), level = c(0.5, 1, 2, 0.5, 1, 2), n = c(10, > 10, 10, 10, 10,

Re: [R] Error in mkRespMod(fr, family = family) : response must be numeric

2015-11-16 Thread John Kane
Welcome to R-help. We probably need some more code and sample data. Please have a look at http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and/or http://adv-r.had.co.nz/Reproducibility.html for some suggestions. John Kane Kingston ON Canada > -Original

[R] how to eliminate ggplot warning frrom "knitted" document

2015-11-16 Thread Daniel Nordlund
I have the following data. sumry <- structure(list(group = structure(c(1L, 1L, 1L, 2L, 2L, 2L), .Label = c("A", "B"), class = "factor"), level = c(0.5, 1, 2, 0.5, 1, 2), n = c(10, 10, 10, 10, 10, 10), mean = c(13.23, 22.7, 26.06, 7.98, 16.77, 26.14), sd = c(4.45, 3.91, 2.65, 2.74, 2.51, 4.79),

Re: [R] R runtime performance and memory usage

2015-11-16 Thread William Dunlap
You cannot do a linear regression with one column of data - there must be at least one response column and one predictor. By default, lm throws in a constant term which gives you a second predictor. If your predictor is categorical, you get a new column for all but the first unique value in it.

Re: [R] Converting daily time series to monthly?

2015-11-16 Thread Jeff Newmiller
There are several ways to do this in R. You can get useful suggestions if you follow the recommendations in the Posting Guide, including: Send your email using pain text format since HTML tends to mangle code samples. Provide a sample of data that represents your actual data. See [1] for sugges

Re: [R] R runtime performance and memory usage

2015-11-16 Thread Bert Gunter
Do your own homework. Google on "memory usage in R." etc. You should have no trouble finding what you need there. Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Mon, Nov 16, 2015 at 12:25 PM, S

[R] R runtime performance and memory usage

2015-11-16 Thread Sasikumar Kandhasamy
Hi All, I have couple of clarifications on R run-time performance. I have R-3.2.2 package compiled for MIPS64 and am running it on my linux machine with mips64 processor (core speed 1.5GHz) and observing the following behaviors, 1. Applying "linear regression model" (lm) on 1MB of data (contains

Re: [R] Problem with the port algorithm in nls function

2015-11-16 Thread ProfJCNash
You might try functions in the nlmrt package, but there are some differences in the call -- you must have a well-defined dataframe for example. And with only 1 parameter, I'm not sure of the behaviour. JN On 15-11-16 02:41 PM, Bert Gunter wrote: > from ?nls ... > > "The algorithm = "port" code a

[R] Converting daily time series to monthly?

2015-11-16 Thread Chattopadhyay, Somsubhra
Hi all, I have daily time series of rainfall for sufficiently long period of time (70 years). I want to aggregate the data series into monthly, seasonal and annual basis. I know excel can handle this with the pivot table functionality. However, I have too many data points so, it's not a very smart

Re: [R] Problem with the port algorithm in nls function

2015-11-16 Thread Bert Gunter
from ?nls ... "The algorithm = "port" code appears unfinished, and does not even check that the starting value is within the bounds. Use with caution, especially where bounds are supplied." So it appears that you may have gotten what you paid for. Cheers, Bert Bert Gunter "Data is not informati

[R] Problem with the port algorithm in nls function

2015-11-16 Thread roberto marrone
Dear all, using the following code I have find a problem with the port algorithm. If I use the nls function without lower bound for my parameter it compute the parameter's value but I want the parameter positive. Running the following code I had this error. Thanks at all. optim <- nls(Prezzo

Re: [R] Error in mkRespMod(fr, family = family) : response must be numeric

2015-11-16 Thread David Winsemius
> On Nov 15, 2015, at 1:58 PM, Tania Pollak wrote: > > Hi -- > > I am new to R, and not much more advanced in stats, but am trying to learn > my way through the program to finish my master's thesis. I am trying to > run tests using glmer, and am getting the above error message. > > My code is

Re: [R] Why does a custom function called is.numeric.factor break lattice?

2015-11-16 Thread David Winsemius
> On Nov 16, 2015, at 9:35 AM, sbihorel > wrote: > > Hi, > > Thanks everyone for all your insights... > > I feel that the discussion is getting way deeper and more technical and it > needs to be from the point of view of what I was trying to achieve with my > little "is.numeric.factor" func

Re: [R] Optim() and Instability

2015-11-16 Thread Gabor Grothendieck
Since some questioned the scaling idea, here are runs first with scaling and then without scaling. Note how much better the solution is in the first run (see arrows). It is also evident from the data > head(data, 3) y x1 x2 x3 1 0.660 20 7.0 1680 2 0.165 5 1.7 350 3 0.660 20 7.0 1

Re: [R] variance of repeated measurements

2015-11-16 Thread Jeff Newmiller
I think your imprecise use of statistical methods is getting you into trouble. A literal interpretation of your question would lead to var(my.data$fluo), but whether that number would be meaningful would depend on what you did with it (I doubt much good would come from using it directly). Unfort

Re: [R] Error in mkRespMod(fr, family = family) : response must be numeric

2015-11-16 Thread David L Carlson
The error message is straightforward. V12 is not a numeric variable and probably not a variable at all. Why would R assume that V12 is a column? A column in what? Read the manual page for glmer() and a basic tutorial on R. Don't assume that R can read your mind. Without knowing something about

Re: [R] Clustered Standard Errors?

2015-11-16 Thread Achim Zeileis
On Mon, 16 Nov 2015, Ignacio Martinez wrote: Hi, I found this post from 2011 for doing clustered standard errors in R. Is there any update to the lm package that allows to do this without having to write your own fun

Re: [R] Problem with nls function

2015-11-16 Thread William Dunlap
Instead of giving nls() start=0.01, give it a named vector of parameters, start=c(theta=0.01). Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Nov 16, 2015 at 6:19 AM, roberto marrone wrote: > Dear all, > > I have a problem using the R finction nls. I am trying to perform an > optimisation

Re: [R] Why does a custom function called is.numeric.factor break lattice?

2015-11-16 Thread sbihorel
Hi, Thanks everyone for all your insights... I feel that the discussion is getting way deeper and more technical and it needs to be from the point of view of what I was trying to achieve with my little "is.numeric.factor" function (ie, checking if an object is a factor and if all levels of th

[R] kalman forecast with msm

2015-11-16 Thread Andrea Primo
how can i implement the kalmanforecast code with R after fitted a Markov Switching model ? Can i have an exmple for the function: Kalman.Forecst(n.ahead, mod, update) thank you for your attention Andrea Primo [[alternative HTML version deleted]]

Re: [R] Why does a custom function called is.numeric.factor break lattice?

2015-11-16 Thread Bert Gunter
Thanks, Martin. You have clearly stated the issue that concerned me. I am sorry that it cannot be (easily) resolved. Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Mon, Nov 16, 2015 at 8:43 AM,

[R] Problem with nls function

2015-11-16 Thread roberto marrone
Dear all, I have a problem using the R finction nls. I am trying to perform an optimisation of the volatility parameter in the Black and Scholes formula. In the function nls I wrote as a formula the call option price with the only unknown parameter the volatility that I called theta. The code

[R] Error in mkRespMod(fr, family = family) : response must be numeric

2015-11-16 Thread Tania Pollak
Hi -- I am new to R, and not much more advanced in stats, but am trying to learn my way through the program to finish my master's thesis. I am trying to run tests using glmer, and am getting the above error message. My code is: > test1=glmer(V12~V10+(1|V4),family=poisson) Error in mkRespMod(fr,

[R] variance of repeated measurements

2015-11-16 Thread Luigi Marongiu
Dear all, how can I calculate the global variance of repeated measurements? can I simply use the var() function or shall i use more sophisticated tools such as aov()? and in the latter case, how can i extract the variance value? I am providing an example. Thank you. best regards luigi >>> samp <-

Re: [R] Why does a custom function called is.numeric.factor break lattice?

2015-11-16 Thread Martin Maechler
> Bert Gunter > on Mon, 16 Nov 2015 08:21:09 -0800 writes: > Thanks Duncan. You are right; I missed this. > Namespaces and full qualification seems the only reliable solution to > the general issue though -- right? Not in this case; full qualification is very very rarel

Re: [R] Why does a custom function called is.numeric.factor break lattice?

2015-11-16 Thread Bert Gunter
Thanks Duncan. You are right; I missed this. Namespaces and full qualification seems the only reliable solution to the general issue though -- right? Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll

Re: [R] Clustered Standard Errors?

2015-11-16 Thread David L Carlson
Updates to lm() would be documented in the manual page for the function. Reading the link it appears that you do not have to write your own function, Mahmood Ara in Stockholm University has already done it for you. You just have to learn how to copy a function from a web site and paste it into a

Re: [R] Why does a custom function called is.numeric.factor break lattice?

2015-11-16 Thread Duncan Murdoch
On 16/11/2015 10:22 AM, Bert Gunter wrote: There is no multiple dispatch; just multiple misunderstanding. The generic function is "is.numeric" . Your method for factors is "is.numeric.factor". You need to re-study. I think the problem is with S3. "is.numeric.factor" could be a "numeric.fac

[R] Clustered Standard Errors?

2015-11-16 Thread Ignacio Martinez
Hi, I found this post from 2011 for doing clustered standard errors in R. Is there any update to the lm package that allows to do this without having to write your own function? In STATA is as simple as adding cluster to

Re: [R] Why does a custom function called is.numeric.factor break lattice?

2015-11-16 Thread Bert Gunter
There is no multiple dispatch; just multiple misunderstanding. The generic function is "is.numeric" . Your method for factors is "is.numeric.factor". You need to re-study. Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom."

Re: [R] Error survreg: Density function returned an an invalid matrix

2015-11-16 Thread Israel Ortiz
Thanks Terry, I use the following formula for density: [image: f_X(x)= \begin{cases} \frac{\alpha x_\mathrm{m}^\alpha}{x^{\alpha+1}} & x \ge x_\mathrm{m}, \\ 0 & x < x_\mathrm{m}. \end{cases}] Where *x*m is the minimum value for x. I get this fórmula in https://en.wikipedia.org/wiki/Pareto_distri

Re: [R] Error survreg: Density function returned an an invalid matrix

2015-11-16 Thread Therneau, Terry M., Ph.D.
The error message states that there is an invalid value for the density. A long stretch of code is not very helpful in understanding this. What we need are the definition of your density -- as it would be written in a textbook. This formula needs to give a valid response for the range -infini

Re: [R] Why does a custom function called is.numeric.factor break lattice?

2015-11-16 Thread sbihorel
Hi, Interesting, based upon my understanding of S3 methods, I would have assumed that my function would be applied to objects of class "numeric.factor". I was not aware of this multiple "dispatch". Thanks for pointing this out. On 11/15/2015 9:42 PM, Bert Gunter wrote: Think about it. I s

Re: [R] linear model solving

2015-11-16 Thread Rolf Turner
On 16/11/15 20:49, Ragia Ibrahim wrote: Dear group IF I had an objective function and some constrains formed in linear model form. is there a way,..library in R that helps me to solve such amodel and find the unknown variable in it? This is a very ill-posed question and is unlikely to provoke