Section 11c

11.4 Singular Value Decomposition: 11.4.1 Regression Calculations Using the SVD, 11.4.2 Computing the SVD, 11.5 Weighted Least Squares, 11.6 Adding and Deleting Cases and Variables: 11.6.1 Updating Formulas, 11.6.2 Connection with the Sweep Operator, 11.6.3 Adding and Deleting Cases and Variables Using QR, 11.7 Centering the Data, 11.8 Comparing Methods: 11.8.1 Resources, 11.8.2 Efficiency, 11.8.3 Accuracy, 11.8.4 Two Examples, 11.8.5 Summary

[3/0%]
LaTeX
Problem 11c.1

Prove that the condition number of Xw\mathbf{X}_{w} is given by (11.61).

?
Problem 11c.2

Repeat the calculations in Example 11.3 using the function f(t)=cos⁡4tf(t) = \cos 4 t in place of exp⁡(sin⁡4t)\exp (\sin 4 t). Does the ranking of the methods still hold good? Sample R-code is given after Exercise 3 below.

?
Problem 11c.3

Modify the code given below to count the number of flops that are required to execute each algorithm. How accurate are the formulas given in Table 11.2? ####################################################### # MGSA function: calculates Q and R^{-1} of QR decomp mgsa<-function(A){ n<-dim(A)[1] p<-dim(A)[2] GG<-diag(p) for(i in 1:(p-1)){ a<-A[,i] denom<-sum(aa) G<-numeric(p) for(j in (i+1):p){ num<-sum(A[,j]a) G[j]<- -num/denom A[,j]<-A[,j]+aG[j] } GG<-GG + outer(GG[,i],G) } list(W=A,G=GG) } ####################################################### #Householder function: calculates R of QR decomp of A house<-function(A){ n<-dim(A)[1] p<-dim(A)[2] for(j in 1:p){ indices<-j:n # construct Householder vector u<-numeric(n) u[indices]<-A[indices,j] unorm1<-sqrt(sum(u[indices]^2)) unorm2<-sum(u[indices[-1]]^2) uu<-u[j] u[j]<-if(uu<0)uu-unorm1 else -unorm2/(uu+unorm1) gamma<-0.5(unorm2 + u[j]^2) # multiply by householder matrix A[indices,j]<-0 A[j,j]<-unorm1 if(j==p)return(A) for(l in (j+1):p){ k<-sum(A[indices,l]u[indices])/gamma A[indices,l]<-A[indices,l] - ku[indices] } } A } ####################################################### # Givens function: calculates R of QR decomp of A givens<-function(A){ n<-dim(A)[1] p<-dim(A)[2] for(j in 1:(p-1)){ indices<-j:p for(i in (j+1):n){ sqr<-sqrt(A[j,j]^2+A[i,j]^2) cc<-A[j,j]/sqr ss<-A[i,j]/sqr temp<-ccA[j,indices] + ssA[i,indices] A[i,indices]<- -ssA[j,indices] + ccA[i,indices] A[j,indices]<-temp } } A }

?