[R] Polynomial fitting

2007-08-15 Thread Shiazy Fuzzy
Hi everybody! I'm looking some way to do in R a polynomial fit, say like polyfit function of Octave/MATLAB. For who don't know, c = polyfit(x,y,m) finds the coefficients of a polynomial p(x) of degree m that fits the data, p(x[i]) to y[i], in a least squares sense. The result c is a vector of

[R] Got Unexpected ELSE error

2007-06-20 Thread Shiazy Fuzzy
Dear R-users, I have a problem with the IF-ELSE syntax. Please look at the folllowing code and tell me what's wrong: a - TRUE if ( a ) { cat(TRUE,\n) } else { cat(FALSE,\n) } If I try to execute with R I get: Error: syntax error, unexpected ELSE in else The strange thing is

Re: [R] Got Unexpected ELSE error

2007-06-20 Thread Shiazy Fuzzy
: Shiazy Fuzzy [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Wednesday, June 20, 2007 11:41 AM Subject: [R] Got Unexpected ELSE error Dear R-users, I have a problem with the IF-ELSE syntax. Please look at the folllowing code and tell me what's wrong: a - TRUE

[R] What ECDF function?

2007-06-09 Thread Shiazy Fuzzy
Hello! I want to plot a P-P plot. So I've implemented this function: ppplot - function(x,dist,...) { pdf - get(paste(p,dist,sep=),mode=function); x - sort(x); plot( pdf(x,...), ecdf(x)(x)); } I have two questions: 1. Is it right to draw as reference line the following: xx -

Re: [R] What ECDF function?

2007-06-09 Thread Shiazy Fuzzy
On 6/9/07, Robert A LaBudde [EMAIL PROTECTED] wrote: At 12:57 PM 6/9/2007, Marco wrote: snip 2.I found various version of P-P plot where instead of using the ecdf function use ((1:n)-0.5)/n After investigation I found there're different definition of ECDF (note i is the rank): *

Re: [R] inverse cumulative distribution

2007-06-04 Thread Shiazy Fuzzy
On 6/4/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: hi all: ecdf() is the empirical cumulative distribution function, but I need the INVERSE cumulative distribution. how can I calculate it? Two ways: 1. eccdf - function(x) { return( 1 - ecdf(x)(x) ) } This returns an array of element,

Re: [R] inverse cumulative distribution

2007-06-04 Thread Shiazy Fuzzy
Yes!! sorry I've confused Inverse CDF with Complementary CDF. -- Marco On 6/4/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Doesn't quantile() do what you want? HTH, Ranjan hi all: ecdf() is the empirical cumulative distribution function, but I need the INVERSE cumulative

[R] Empirical Complementary CDF

2007-05-30 Thread Shiazy Fuzzy
Hi all, I'd like to plot an empirical LLCD (log-log-CCDF, where CCDF == 1-CDF). It seems ecdf() and plot(ecdf()) can't do it. I'd like to reuse some graphics features of ECDF plot. The fastest way I've found is to copypaste the ecdf code and writing this function: --- [R-code] --- eccdf -

Re: [R] Parametric bootstrapped Kolmogorov-Smirnov GoF: what's wrong

2007-05-28 Thread Shiazy Fuzzy
(... sorry! the first post was in HTML format ...) Dear R-users, I want to perform a One-Sample parametric bootstrapped Kolmogorov-Smirnov GoF test (note package Matching provides ks.boot which is a 2-sample non-parametric bootstrapped K-S version). So I wrote this code: ---[R Code] ---

[R] Parametric bootstrapped Kolmogorov-Smirnov GoF: what's wrong

2007-05-27 Thread Shiazy Fuzzy
Dear R-users, I want to perform a One-Sample parametric bootstrapped Kolmogorov-Smirnov GoF test (note package Matching provides ks.boot which is a 2-sample non-parametric bootstrapped K-S version). So I wrote this code: ---[R Code] --- ks.test.bootnp - function( x, dist, ...,

[R] Anderson-Darling GoF

2007-05-18 Thread Shiazy Fuzzy
Hi, I'm not a statistician so sorry for possible trivial questions ... I want to perform a GoF test on sample data against several distribution (like Extreme Value, Phase Type, Pareto, ...). Since I suspect a long-tailed behaviour on data I want to use Anderson-Darling (AD) GoF test because it's