Kyriakos Antoniou
2012-Apr-29 14:28 UTC
[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
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
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
> Subject: Welcome to the "R-help" mailing list
> From: r-help-request@r-project.org
> To: antoniouky@hotmail.com
> Date: Sun, 29 Apr 2012 16:14:02 +0200
>
> Welcome to the R-help@r-project.org mailing list!
>
> To post to this list, send your message to:
>
> r-help@r-project.org
>
> General information about the mailing list is at:
>
> https://stat.ethz.ch/mailman/listinfo/r-help
>
> If you ever want to unsubscribe or change your options (eg, switch to
> or from digest mode, change your password, etc.), visit your
> subscription page at:
>
> https://stat.ethz.ch/mailman/options/r-help/antoniouky%40hotmail.com
>
> You can also make such adjustments via email by sending a message to:
>
> R-help-request@r-project.org
>
> with the word `help' in the subject or body (don't include the
> quotes), and you will get back a message with instructions.
>
> You must know your password to change your options (including changing
> the password, itself) or to unsubscribe without confirmation. It is:
>
> an0r80s1s
>
> Normally, Mailman will remind you of your r-project.org mailing list
> passwords once every month, although you can disable this if you
> prefer. This reminder will also include instructions on how to
> unsubscribe or change your account options. There is also a button on
> your options page that will email your current password to you.
[[alternative HTML version deleted]]
Uwe Ligges
2012-Apr-30 13:20 UTC
[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 neededAleady 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 at 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.