Dear all,

I am trying to use ssanova of the gss package but met some error that I
cannot figure out the answer for.

Here is the code I am using to explain the problem.
library(gss)
set.seed(5732)
x=(1:100)/100
y=1+3*sin(2*pi*x)+2*(x>0.7)+rnorm(x)
x1=rnorm(100)
x2=rnorm(100)
part.fit=ssanova(y~x, partial=~cbind(x1,x2))
summary(part.fit)
part.fit=ssanova(y~x, partial=~cbind(as.numeric(x1),x2))
summary(part.fit)



Basically this line of code "part.fit=ssanova(y~x, partial=~cbind(x1,x2))"
does not run correctly while
the following one "part.fit=ssanova(y~x,
partial=~cbind(as.numeric(x1),x2))" works.

I am not sure why I need to apply "as.numeric" to x1? I appreciate any help
you may provide.


At the end I copy and paste the error message I got after running the above
piece of code.


Best,

Chris




R version 2.14.1 (2011-12-22)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-redhat-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(gss)
>
> set.seed(5732)
> x=(1:100)/100
> y=1+3*sin(2*pi*x)+2*(x>0.7)+rnorm(x)
>
>
>
> x1=rnorm(100)
> x2=rnorm(100)
>
> part.fit=ssanova(y~x, partial=~cbind(x1,x2))
>
> summary(part.fit)
Error in cbind(s, matx.p[, label]) : subscript out of bounds
>
> part.fit=ssanova(y~x, partial=~cbind(as.numeric(x1),x2))
>
> summary(part.fit)

Call:
ssanova(formula = y ~ x, partial = ~cbind(as.numeric(x1), x2))

Estimate of error standard deviation: 1.138695

Residuals:
      Min        1Q    Median        3Q       Max
-2.459471 -0.894444  0.161822  0.772589  2.529363
Residual sum of squares: 123.6758
R square: 0.630952

Penalty associated with the fit: 12.70742

>

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to