[R] gafit() - specifying range for results
I have a problem regarding gafit() from gafit package. Is it possible to specify range of possible results of the function? I am using it for automated fitting if variogram model, which has 3 parameters. None of them can be negative, however some data samples lead to negative values. There are also restrictions regarding upper range of results. Thanks Zbynek JANOSKA -- View this message in context: http://r.789695.n4.nabble.com/gafit-specifying-range-for-results-tp3090522p3090522.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How can I draw a line in empirical distribution function?
I believe that functions yline {fields} xline {fields} are what you´re looking for try to type yline(c(.25,.75)) That shoud do that Best Regards Zbynek Janoska -- View this message in context: http://r.789695.n4.nabble.com/How-can-I-draw-a-line-in-empirical-distribution-function-tp3090675p3090711.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to optimize function parameters?
Hi, I have a dataset and I want to fit a function to it. The function is variogram model (http://en.wikipedia.org/wiki/Variogram) The variogram model is defined by three parameters and I want them to be automatically optimized for real time data. I tried to use gafit {gafit} for this, but there are some data configuration, where optimal results given by gafit() are negative, which is not correct and cannot be used for further calculating. gafit() does not enable me to set a range of possible results (at least I did not succeded in doing so), therefore I am looking for another solution (Powell´s gradient descent possibly?). Can anyone give me a hint where to look? Thanks Zbynek -- View this message in context: http://r.789695.n4.nabble.com/How-to-optimize-function-parameters-tp3095603p3095603.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to optimize function parameters?
Thanks for your suggestions, I will certainly look at that To answer your question... I can calculate root square error between empirical data a those predicted by model (I used this to optimize the parameters using gafit()). -- View this message in context: http://r.789695.n4.nabble.com/How-to-optimize-function-parameters-tp3095603p3095938.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to use lm() output for systemfit() 'Seemingly unrelated regression'
I am having problem using output of lm() function for further analysing using systemfit package. Basicaly, the problem s following - I generate several formulas using lm() > fo1 <- lm(r98[,2] ~ f98[,1] + f98[,2] + ... + f98[,43]) > fo2 <- lm(r98[,1] ~ f98[,1] + f98[,2] + ... + f98[,43]) and than I want to estimate a general model using package systemfit. > fitsur <- systemfit("SUR",list(as.formula(fo),as.formula(foo))) and I get following error: Error in systemfit("SUR", list(as.formula(fo), as.formula(foo))) : argument 'formula' must be an object of class 'formula' or a list of objects of class 'formula' and I am not able to find where the problem is. The problem remains even when I try: > fo1 <- r98[,2] ~ f98[,1] + f98[,2] + ... + f98[,43] > fo2 <- r98[,1] ~ f98[,1] + f98[,2] + ... + f98[,43] instead of using lm() Could someone give me a hand? I am quite new to R, so possibly the solutions is simple:) Thanks Zbynek Janoska -- View this message in context: http://r.789695.n4.nabble.com/How-to-use-lm-output-for-systemfit-Seemingly-unrelated-regression-tp2525418p2525418.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to use lm() output for systemfit() 'Seemingly unrelated regression'
Thanks, it works fine now. -- View this message in context: http://r.789695.n4.nabble.com/How-to-use-lm-output-for-systemfit-Seemingly-unrelated-regression-tp2525418p2527946.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Substituting inside expression
I am having following problem: I´m constructing model for calculation of area of triangle. I know sides a, b, and gamma angle. I wish to calculate the area using heron´s formula: S <- sqrt(s*(s-a)*(s-b)*(s-c)) where s <- (a+b+c)/2 and c is calculated using law of cosines: c <- sqrt(a^2 + b^2 -2*a*b*cos(gamma)) since i am calculating a regression model, i need derivation of this expression for area S. something like (D(expression.S,c("a","b"))) To write it all into a single expression, it is too complicated, so i would like to use some kind of substitution. however, if i try: s.e <- substitute(expression((a+b+c)/2), list(c = expression(sqrt(a^2+b^2-2*a*b*cos(gamma), I get >s.e expression((a + b + expression(sqrt(a^2 + b^2 - 2 * a * b * cos(gamma/2) which is not what I wanted Can someone point me to the right direction? -- View this message in context: http://r.789695.n4.nabble.com/Substituting-inside-expression-tp3324092p3324092.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Substituting inside expression
Thanks, but it is not exactly what i wanted to achieve. I need to calculate a derivation of this complex formula and I don´t think this would enable me to do so. But luckily, I have manages to built a "by-pass", so this is not necessary anymore zbynek -- View this message in context: http://r.789695.n4.nabble.com/Substituting-inside-expression-tp3324092p3327694.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Incorrectness of mean()
I have found following problem: I have a vector: > a <- c(1.04,1.04,1.05,1.04,1.04) I want a mean of this vector: > mean(a) [1] 1.042 which is correct, but: > mean(1.04,1.04,1.05,1.04,1.04) [1] 1.04 gives an incorrect value. how is this possible? thanks, zbynek -- View this message in context: http://r.789695.n4.nabble.com/Incorrectness-of-mean-tp3327701p3327701.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Substituting inside expression
Thanks, Your advice solved the problem for one substitution, but I needed to substitute twice: first s = (a+b+c)/2 and than c = sqrt(a^2 + b^2 -2*a*b*cos(gamma)) and I hoped I can do it simultaneously Luckily, I managed to go round the problem and this operation is not necessary anymore:) Thanks anyway zbynek -- View this message in context: http://r.789695.n4.nabble.com/Substituting-inside-expression-tp3324092p3327698.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Incorrectness of mean()
Oh, I see it now. I guess it confused me, when it did not give me warning and also the numbers were very much alike, so I expected wrong decimal places thanks zbynek -- View this message in context: http://r.789695.n4.nabble.com/Incorrectness-of-mean-tp3327701p3327714.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] applying random functions to multisets
Hi, I am solving following problem: Suppose I have some multiset: > multiset <- c("a","a","c","d","d") and rules, which operate with it (for simplicity not writen in R functions) > rule1: "a" -> c("a","b") > rule2: "a" -> c("a","c") > rule3: "c" -> c("c","c") ... > ruleX: ... I want to apply rules to multiset in maximaly parallel manner, but randomly (ie. rule1 and rule2 both work with object "a", but i want them to apply in non-deterministic way, so every time I run this procedure, I can get different result) Basically what I am looking for is some construct, which would enable me to do this: while (initial.multiset IS NOT empty){ apply(random rule, if possible) return(new.multiset) } I tried to organize rules into list, but i don't know how to select randomly function from a list and apply it Any help would be appreciated Thanks Zbynek -- View this message in context: http://r.789695.n4.nabble.com/applying-random-functions-to-multisets-tp3405203p3405203.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.