Learn R Programming

pheno (version 1.0)

pheno.ddm: Dense design matrix for phenological data

Description

Creation of dense two-way classification design matrix for usage in robust parameter estimation with rq.fit.sfn (package nprq). The sum of the second factor is constrained to be zero. No general mean.

Usage

pheno.ddm(D)

Arguments

D
Data frame with three columns: (observations, factor 1, factor 2).

Value

  • ddmDense roworder matrix, matrix.csr format (see matrix.csr in package SparseM)
  • DInput data frame D sorted first by f2 then by f1.

Details

In phenological applications observations should be the julian day of observation of a certain phase, factor 1 should be the observation year and factor 2 should be a station-id. Usually this is much easier created by: y <- factor(f1) s <- factor(f2) ddm <- as.matrix.csr(model.matrix(~ y + s -1, contrasts=list(s=("contr.sum")))). However, this procedure can be quite memory demanding and might exceed storage capacity for large problems. This procedure here is much less memory comsuming.

See Also

model.matrix matrix.csr

Examples

Run this code
data(DWD)
	ddm1 <- pheno.ddm(DWD)
	attach(DWD)
	y <- factor(DWD[[2]])
	s <- factor(DWD[[3]])
	ddm2 <- as.matrix.csr(model.matrix(~ y + s -1, contrasts=list(s=("contr.sum"))))
	identical(ddm1$ddm,ddm2)

Run the code above in your browser using DataLab