Learn R Programming

trend (version 0.0.1)

partial.cor.trend.test: Partial correlation trend test

Description

Performs a partial correlation trend test with either the Pearson's or the Spearman's correlation coefficients ($r(tx.z)$).

Usage

partial.cor.trend.test(x, z, method = c("pearson", "spearman"))

Arguments

x
a "vector" or "ts" object that contains the variable, which is tested for trend (i.e. correlated with time)
z
a "vector" or "ts" object that contains the variable, which effect on "x" is partialled out
method
a character string indicating which correlation coefficient is to be computed. One of "pearson" (default) or "spearman", can be abbreviated.

Value

  • An object of class "htest"
  • methoda character string indicating the chosen test
  • data.namea character string giving the name(s) of the data
  • corthe correlation-matrix with t, x and z
  • statisticthe value of the test statistic
  • estimatethe partial correlation coefficient $r(tx.z)$
  • parameterthe degrees of freedom of the test statistic in the case that it follows a t distribution
  • alternativea character string describing the alternative hypothesis
  • p.valuethe p-value of the test

Warning

Current Version is for complete observations only.

Details

This function conducts a partial correlation trend test using either the "pearson" correlation coefficient, or the "spearman" rank correlation coefficient (Hipel and McLoed (2005), p. 882). The partial correlation coefficient for the response variable "x" with time "t", when the effect of the explanatory variable "z" is partialled out, is defined as: $$r_{tx.z} = \frac{r_{tx} - r_{tz}~r_{xz}}{\sqrt{1 - r_{tz}^2} ~ \sqrt{1-r_{xz}^2}}$$ The H0: $r_{tx.z} = 0$ (i.e. no trend for "x", when effect of "z" is partialled out) is tested against the alternate Hypothesis, that there is a trend for "x", when the effect of "z" is partialled out. The partial correlation coefficient is tested for significance with the student t distribution on $df = n -2$ degree of freedom.

References

Hipel, K.W. and McLeod, A.I., (2005). Time Series Modelling of Water Resources and Environmental Systems. http://www.stats.uwo.ca/faculty/aim/1994Book/. Bahrenberg, G., Giese, E. and Nipper, J., (1992): Statistische Methoden in der Geographie, Band 2 Multivariate Statistik, Teubner, Stuttgart.

See Also

cor, cor.test, partial.r, partial.mk.test,

Examples

Run this code
data(maxau)
a <- tsp(maxau) ; tt <- a[1]:a[2]
s <- maxau[,"s"] ; Q <- maxau[,"Q"]
maxau.df <- data.frame(Year = tt, s =s, Q = Q)
plot(maxau.df)

partial.cor.trend.test(s,Q, method="pearson")
partial.cor.trend.test(s,Q, method="spearman")

Run the code above in your browser using DataLab