Date: Mon, 30 Apr 2012 15:20:04 +0200
From: lig...@statistik.tu-dortmund.de
To: antonio...@hotmail.com
CC: r-help@r-project.org
Subject: Re: [R] Error in if (nuhat< 2) stop("The degrees of freedom must be
greater than or equal to 2") : missing value where TRUE/FALSE needed
On 29.04.2012 16:28, Kyriakos Antoniou wrote:
Hi,
i am trying to run an ANCOVA and a bootstrapped ANCOVA analysis on a specific
data set. I am using the ancova and ancboot functions as in the following code:
setwd("C:/Users/User/Desktop/Rdatabilingualstudy2012")
bilingualismdata<-read.spss("bilingualdataforconferences2012.sav",
use.value.labels = TRUE, to.data.frame = TRUE)
bilingualismdata$TypeBiling<-factor(bilingualismdata$TypeBiling, levels = c(0:1), labels =
c("monolingual", "bilingual"))
cypriot<-subset(bilingualismdata, TypeBiling=="monolingual")
cypriotenglish<-subset(bilingualismdata, TypeBiling=="bilingual")
covGrp1<-cypriot$FAS
dvGrp1<-cypriot$Simon
covGrp2<-cypriotenglish$FAS
dvGrp2<-cypriotenglish$Simon
source("http://www-rcf.usc.edu/~rwilcox/Rallfun-v16")
ancova(covGrp1, dvGrp1, covGrp2, dvGrp2)
ancboot(covGrp1, dvGrp1, covGrp2, dvGrp2, nboot = 2000)
However, i always get the following errors (note that i get these errors when i
am running the analysis on a specific data set. The same code works fine with
other data sets):
ancova(covGrp1, dvGrp1, covGrp2, dvGrp2)
[1] "NOTE: Confidence intervals are adjusted to control the probability"
[1] "of at least one Type I error."
[1] "But p-values are not"
Error in if (nuhat< 2) stop("The degrees of freedom must be greater than or equal
to 2") :
missing value where TRUE/FALSE needed
Aleady the way the Note is printed shows the code is poorly written, the
non-working error message supports that.
Since we do not have the data, we cannot help, probably lm() is capable
of the ancova you have in mind.
Uwe Ligges
In addition: Warning messages:
1: In min(sub[vecn>= 12]) :
no non-missing arguments to min; returning Inf
2: In max(sub[vecn>= 12]) :
no non-missing arguments to max; returning -Inf
3: In near(x1, x1[isub[i]], fr1) : NAs introduced by coercion
4: In near(x2, x1[isub[i]], fr2) : NAs introduced by coercion
5: NAs introduced by coercion
ancboot(covGrp1, dvGrp1, covGrp2, dvGrp2, nboot = 2000)
[1] "Note: confidence intervals are adjusted to control FWE"
[1] "But p-values are not adjusted to control FWE"
[1] "Taking bootstrap samples. Please wait."
Error in if (nuhat< 2) stop("The degrees of freedom must be greater than or equal
to 2") :
missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In min(sub[vecn>= 12]) :
no non-missing arguments to min; returning Inf
2: In max(sub[vecn>= 12]) :
no non-missing arguments to max; returning -Inf
3: In near(x1, x1[isub[i]], fr1) : NAs introduced by coercion
4: In near(x2, x1[isub[i]], fr2) : NAs introduced by coercion
5: In near(x1, x1[isub[i]], fr1) : NAs introduced by coercion
6: In near(x2, x1[isub[i]], fr2) : NAs introduced by coercion
Any help with how i van solve this would be appreciated as i am really stack
and don't really know what to do.
Best,
Kyriakos
[irrelevant part 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.