[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

Kyriakos Antoniou antoniouky at hotmail.com
Mon Apr 30 16:17:59 CEST 2012


Dear Uwe,

really sorry about this.  

The code i use is the following (data attached again):

setwd("C:/Users/User/Desktop/Rdatabilingualstudy2012")

bilingualdataforconferences2012<-read.delim("bilingualdataforconferences2012.dat", header=TRUE)

bilingualdataforconferences2012$TypeBiling<-factor(bilingualdataforconferences2012$TypeBiling, levels = c(0:1), labels = c("monolingual", "bilingual"))

cypriot<-subset(bilingualdataforconferences2012, TypeBiling=="monolingual")
cypriotenglish<-subset(bilingualdataforconferences2012, 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)

I am trying to run an ANCOVA and a bootstrapped ANCOVA analysis on the data set attached, using the ancova and ancboot functions as above.  That is, i want to see what the effect of bilingualism (variable TypeBiling, 1=bilingual, 2=monolingual) is on the dependent variable Simon when partialling out the effect of the covariate FAS (socioeconomic status).  Since the data for the dependent variable Simon are not normally distributed i need to also analyse the data using a robust method of ANCOVA.

Kyriakos

> Date: Mon, 30 Apr 2012 15:58:34 +0200
> From: ligges at statistik.tu-dortmund.de
> To: antoniouky at hotmail.com
> CC: r-help at 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 30.04.2012 15:52, Kyriakos Antoniou wrote:
> >
> > Sorry!!  Data now attached.  Note that this is a .dat file while in the R code i import data directly from an SPSS file (.sav).
> 
> 
> Oh, come on, we do not have endless time to import your data, so 
> inlcuding code please.
> 
> Moreover, you have not really described which model yopu want to fit 
> exactly, we can only guess from your code not knowing those functions 
> you used.
> 
> Uwe Ligges
> 
> 
> 
> > Best,
> > Kyriakos
> >
> >> Date: Mon, 30 Apr 2012 15:20:04 +0200
> >> From: ligges at statistik.tu-dortmund.de
> >> To: antoniouky at hotmail.com
> >> CC: r-help at 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 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.
> >   		 	   		
 		 	   		  


More information about the R-help mailing list