Here is a numerical application from Mrode (2005), example 10.1, concerning the calving ease scores from 28 male and female calves. Calving ease was scored as 1:normal birth, 2:slight difficulty, 3:extreme difficulty.
# pedigree
> s <- c(0,0,1,3)
> d <- c(0,0,0,0)
> Ainv <- quass(s,d)
>
# X matrix
> X <- matrix(c(rep(0,9), rep(1,11), 0,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,0,1,1,0 ), ncol=2, nrow=20)
>
> # Z matrix
> Z <- matrix(c(1,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0, 0,0,0,1,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,
+ 0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1), ncol=4, nrow=20 )
>
> # number of categories
> ncats <- 3
>
> # category of response
> cat <- matrix(c(1,1,1,0,1,3,1,0,1,2,1,0,1,1,0,0,0,1,2,2, 0,0,0,1,0,0,1,1,0,0,0,0,0,0,1,0,1,0,0,0,
+ 0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0), ncol=3)
>
> # initial values for solutions
> inits <- matrix(c(0.468, 1.080, rep(0, 6)))
>
> # variance components ratio
> ratio <- 1/(1/19)
>
> disp <- TRUE
The thr function gives:
> thr(Ainv, X, Z, ncats, cat, inits, ratio, disp)
iteration 1
[,1]
[1,] 0.44100858
[2,] 1.04479217
[3,] 0.28686921
[4,] -0.35832281
[5,] -0.04152769
[6,] 0.05785352
[7,] 0.03985081
[8,] -0.06517799
iteration 2
[,1]
[1,] 0.43750215
[2,] 1.06613002
[3,] 0.27630322
[4,] -0.35772771
[5,] -0.04305507
[6,] 0.05859682
[7,] 0.04097484
[8,] -0.06532759
iteration 3
[,1]
[1,] 0.43781529
[2,] 1.06746240
[3,] 0.27736820
[4,] -0.35891673
[5,] -0.04340028
[6,] 0.05917583
[7,] 0.04121130
[8,] -0.06596911
iteration 4
[,1]
[1,] 0.43777081
[2,] 1.06752821
[3,] 0.27735389
[4,] -0.35895477
[5,] -0.04342556
[6,] 0.05920580
[7,] 0.04123036
[8,] -0.06599831