[R] problem with predict()
Czerminski, Ryszard
ryszard at arqule.com
Fri Jun 21 14:10:21 CEST 2002
> Does xs contain a variable called xr?
No - it does not.
I was expecting that if I use model built using
(yr,xr) data with 164 cases and 118 variables
to predict on a test data (xs) with 35 cases
> # dim(xr) = 164 118 ; dim(xs) = 35 118
I should get vector of 35 responses from predict(),
but I am getting instead 164 responses.
> # length(ys) = 35 ; length(ps) = 164
If I go through example provided with help(predict.lm)
I get expected number of responses (13).
This is however only 1D example.
I am sure I am missing something and probably not using
predict() correctly, but I am at loss what it is...
R
Ryszard Czerminski phone: (781)994-0479
ArQule, Inc. email:ryszard at arqule.com
19 Presidential Way http://www.arqule.com
Woburn, MA 01801 fax: (781)994-0679
-----Original Message-----
From: Peter Dalgaard BSA [mailto:p.dalgaard at biostat.ku.dk]
Sent: Thursday, June 20, 2002 5:10 PM
To: Czerminski, Ryszard
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] problem with predict()
"Czerminski, Ryszard" <ryszard at arqule.com> writes:
> pr <- predict(model, as.data.frame(xr))
> ps <- predict(model, xs)
>
> cat("length(yr) =", length(yr), "; length(pr) =", length(pr),"\n")
> cat("dim(xr) =", dim(xr), "; dim(xs) =", dim(xs),"\n")
> cat("length(ys) =", length(ys), "; length(ps) =", length(ps), "\n")
> cat("why length(ps) != length(ys) ???\n")
>
> # my output:
> #
> # length(yr) = 164 ; length(pr) = 164
> # dim(xr) = 164 118 ; dim(xs) = 35 118
> # length(ys) = 35 ; length(ps) = 164
> # why length(ps) != length(ys) ???
Does xs contain a variable called xr?
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list