Hi Stephen, Check the help for predict.glm(). The argument for passing new data is actually 'newdata', as in:
> pred = predict(glm.model, newdata=form[150001:200000,-1], > type="response") Cheers Joe -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, 16 October 2007 5:30 AM To: [EMAIL PROTECTED] Subject: [R] partitioning data I am trying to train on part of my data and test on another part: > glm.model = glm(as.factor(h_finished) ~ . , family=binomial, data=form[1:150000,]) > pred = predict(glm.model, data=form[150001:200000,-1], > type="response") t = table(pred, form[150001:200000,1]) Error in table(pred, form[150001:2e+05, 1]) : all arguments must have the same length but try as I might my pred has too many lines: > length(pred) [1] 150000 > length(form[150000:200000, 1]) [1] 50000 [150000:200000, 1] works in the table function and indeed immediately above. How can I make the [150000:200000, 1] work the predict function? ______________________________________________ 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. ------IMPORTANT - This message has been issued by The Department of Agriculture, Fisheries and Forestry (DAFF). The information transmitted is for the use of the intended recipient only and may contain confidential and/or legally privileged material. It is your responsibility to check any attachments for viruses and defects before opening or sending them on. Any reproduction, publication, communication, re-transmission, disclosure, dissemination or other use of the information contained in this e-mail by persons or entities other than the intended recipient is prohibited. The taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error please notify the sender and delete all copies of this transmission together with any attachments. If you have received this e-mail as part of a valid mailing list and no longer want to receive a message such as this one advise the sender by return e-mail accordingly. Only e-mail correspondence which includes this footer, has been authorised by DAFF ------ ______________________________________________ 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.