[R] newbie problem using Design.rcs

sp to_rent_2000 at yahoo.com
Tue Dec 23 05:38:12 CET 2008


Hi,

I read data from a file. I'm trying to understand how to use Design.rcs by using simple test data first. I use 1000 integer values (1,...,1000) for x (the predictor) with some noise (x+.02*x) and I set the response variable y=x. Then, I try rcs and ols as follows:

m = ( sqrt(y1) ~ ( rcs(x1,3) ) ); #I tried without sqrt also
f = ols(m, data=data_train.df);
print(f);

[I plot original x1,y1 vectors and the regression as in 
y <- coef2[1] + coef2[2]*x1 + coef2[3]*x1*x1]

But this gives me a VERY bad fit:
"
Linear Regression Model

ols(formula = m, data = data_train.df)

         n Model L.R.       d.f.         R2      Sigma 
      1000       4573          2     0.9897       0.76 

Residuals:
      Min        1Q    Median        3Q       Max 
-4.850930 -0.414008 -0.009648  0.418537  3.212079 

Coefficients:
             Value Std. Error      t Pr(>|t|)
Intercept  5.90958  0.0672612  87.86        0
x1         0.03679  0.0002259 162.88        0
x1'       -0.01529  0.0002800 -54.60        0

Residual standard error: 0.76 on 997 degrees of freedom
Adjusted R-Squared: 0.9897 
"

I appreciate any and all help!

Sincerely,
sp



More information about the R-help mailing list