mg332842
mg332842

Reputation: 11

I am trying to run a non parametric ANCOVA in R but I am running into issues with the code and my understanding

I am looking at the concentration of a protein in two areas over time and want to determine if their regression slopes are significantly different. In both areas the concentration of the protein is increasing linearly over time, however, for one area the data is not normally distributed and for the other area it does not possess homogeneity. Therefore, I am trying to run a non-parametric ANCOVA using the sm.ancova function but keep getting the error:

Error in optimise(f = get(fname), interval = log(c(start/8, start * 4)),  : 
  invalid 'xmin' value

I setup the equation:

nonpm<- sm.ancova(Area1, Area2, Age,  model="parallel")

where Area1 and Area2 is the concentration of the protein in each area respectively.

The data is as follows:

Area1 <- c(19.3875, 44.689546, 39.43958333, 45.22222222, 57.15703125, 34.9421875, 32.6390625, 62.50298507, 60.5515625, 61.5140625, 72.221875, 48.778125) 

Area2 <- c(60.56111111, 62.536733, 75.42638889, 73.02777778, 144.340625, 42.0578125, 49.7578125, 79.37565399, 126.946875, 92.1765625, 130.521875, 125.7265625) 

Age <- c(119, 154, 174, 176, 183, 188, 190, 194, 230, 232, 245, 247) 

Any help in both understanding the non-parametricc ANCOVA and the error here would be greatly appreciated. I am a newbie to non-parametricc analysis. Thanks!

I also tried using the loess.ancova but ran into similar problems

Upvotes: 0

Views: 235

Answers (1)

David Schneider
David Schneider

Reputation: 11

It is not clear how you evaluated the assumptions. Did you evaluate the assumptions by looking at the residuals? The assumptions for the general linear model (regression, ANOVA, ANCOVA, etc.) are that the residuals are homogeneous, normal, independent (Eisenhart, 1947; Seber, 1966; Neter et al., 1983, pp. 31, 49; Quinn and Keogh, 2002, pp. 110, 280).

The plot function in R is an easy way to evaluate normal error assumptions:

pMod <- lm(protein ~ age * area,  model = "parallel")
plot(pMod)

where area is the categorical variable (2 areas) and age is the regression variable. The interaction term measures the difference in slopes.

Violations of the normal error assumptions can often be addressed with a generalized linear model, fitted using glm().

Upvotes: 0

Related Questions