Solution
We have
Solution
When you do an integral in polar co-ordinates you have to:
replace each x in the integrand with
and each ywith
,
replace dxdy with
,
and find the set of
values which correspond to the set
of x,y values over which we are integrating. The Jacobian is the
absolute value of the determinant filled up with derivatives of (x,y)with respect to r and
.
This 2 by 2 matrix has determinant
r. The value of r, being a distance from the origin is in the
range 0 to
while the angle in the plane is measured over
any interval of length
such as
.
This makes
Solution
All you have to do is prove that
and
.
But
is clearly positive. Thus I>0 and since I2=J=1we have I=1.
Solution
We have
and
.
Solution
The definition of MVN is that X be of the form AZ+b and then
and
.
So
and
.
Solution
Let B be the matrix
Arithmetically we find
Solution
Solution
Check by multiplying that
Solutions
The conditions show that all the off-diagonal blocks are 0, remembering
that
(AB)T = BTAT. Thus
Solutions
Multiply out the partitioned matrix
to
get
Solution
Solution
In the solution set for assignment the first column of Xbis 1, the second is X1 and the other two columns are X2. Now just multiply things like X1T X2 to make sure you get 0.
Solution
I used the following SAS code to find the mean age and to compute the correlation between age and age cubed:
data product; infile "CH07PR33.DAT"; input product age; proc means ; proc glm; model age = age*age*age; run;Part of the output is
Variable N Mean Std Dev Minimum Maximum
--------------------------------------------------------------------
PRODUCT 18 104.2222222 5.4292839 93.0000000 112.0000000
AGE 18 40.0000000 13.2842233 20.0000000 60.0000000
--------------------------------------------------------------------
Dependent Variable: AGE
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 1 2799.13108 2799.13108 222.96 0.0001
Error 16 200.86892 12.55431
Corrected Total 17 3000.00000
R-Square C.V. Root MSE AGE Mean
0.933044 8.858015 3.54321 40.0000
T for H0: Pr > |T| Std Error of
Parameter Estimate Parameter=0 Estimate
INTERCEPT 24.61714029 18.56 0.0001 1.32618815
AGE*AGE*AGE 0.00018313 14.93 0.0001 0.00001226
Since
r2 = 0.933 and the slope is positive we find that the correlation between
age and age cubed is 0.966.
Having found the mean age I did the rest of the problem with:
data product; infile "CH07PR33.DAT"; input product age; agec = age-40; agec2 = agec*agec; agec3 = agec*agec*agec; proc print; proc glm; model product= agec agec2 agec3; output out=prodout r=resid p=fitted ; run; proc glm; model agec3 = agec; run; proc rank normal=vw data=prodout out=prodout2; var resid; ranks normscr; run; proc gplot data=prodout2; plot resid*agec; plot resid*fitted; plot resid*normscr; run;obtaining the (edited) output:
OBS PRODUCT AGE AGEC AGEC2 AGEC3
1 97 20 -20 400 -8000
2 93 20 -20 400 -8000
3 99 25 -15 225 -3375
4 105 25 -15 225 -3375
5 109 30 -10 100 -1000
6 106 30 -10 100 -1000
7 109 35 -5 25 -125
8 111 35 -5 25 -125
9 100 40 0 0 0
10 105 40 0 0 0
11 97 45 5 25 125
12 101 45 5 25 125
13 105 50 10 100 1000
14 103 50 10 100 1000
15 105 55 15 225 3375
16 109 55 15 225 3375
17 112 60 20 400 8000
18 110 60 20 400 8000
Dependent Variable: PRODUCT
Sum of Mean
Source DF Squares Square F Value Pr > F
Model 3 351.680014 117.226671 10.98 0.0006
Error 14 149.431097 10.673650
Corrected Total 17 501.111111
R-Square C.V. Root MSE PRODUCT Mean
0.701800 3.134701 3.26706 104.222
Source DF Type I SS Mean Square F Value Pr > F
AGEC 1 124.033333 124.033333 11.62 0.0042
AGEC2 1 2.955267 2.955267 0.28 0.6070
AGEC3 1 224.691414 224.691414 21.05 0.0004
Source DF Type III SS Mean Square F Value Pr > F
AGEC 1 92.201230 92.201230 8.64 0.0108
AGEC2 1 2.955267 2.955267 0.28 0.6070
AGEC3 1 224.691414 224.691414 21.05 0.0004
T for H0: Pr > |T| Std Error of
Parameter Estimate Parameter=0 Estimate
INTERCEPT 104.6839827 89.66 0.0001 1.16751237
AGEC -0.4591751 -2.94 0.0108 0.15623072
AGEC2 -0.0027706 -0.53 0.6070 0.00526534
AGEC3 0.0022458 4.59 0.0004 0.00048948
Dependent Variable: AGEC3
Sum of Mean
R-Square C.V. Root MSE AGEC3 Mean
0.854233 9999.99 1668.64 0
T for H0: Pr > |T| Std Error of
Parameter Estimate Parameter=0 Estimate
INTERCEPT 0.0000000 0.00 1.0000 393.3033181
AGEC 295.0000000 9.68 0.0001 30.4651440
We are now in a position to answer the individual questions.
| Model | ESS |
| cubic | 149.431097 |
| quadratic | 149.431097 + 224.691414 |
| =374.122511 | |
| linear | 374.122511 + 2.955267 |
The extra sum of squares due to quadratic and cubic terms is then
the sum of the last two lines in the Type I SS table which is
227.646681. There are two more parameters in the cubic
model than in the linear model so there are 2 degrees of freedom
for the extra SS. The F statistic is
#
# Read in the data into a matrix (technically
# a data frame)
#
data <- read.table("CH07PR33.DAT")
#
# Add a new column to the matrix which has the Ages minus
# the mean age
#
data <- cbind(data,data[,2]-mean(data[,2]))
#
# Give names to the variables in the data frame
#
names(data) <- c("Product","Age","AgeCen")
#
# Compute the mean age for later use
#
m <- mean(data$Age)
#
# make the variables in the data frame available for general
# use without having to say things like data$Age
# which names the Age component of the data frame called data
#
attach(data)
#
# Regress the variable Product on the first three
# powers of the centered Age. Keep the results of
# the regression in a variable called fit
#
fit <- lm( Product ~ AgeCen+AgeCen^2 + AgeCen^3,data=data)
#
# store the residuals in R
#
R <- resid(fit)
#
# store the fitted values in Fit
Fit <- predict(fit)
#
# Make a postscript plot in a file fit.ps. The horizontal=F
# causes the image to be in portrait orientation, that is,
# in the usual direction (not turned sideways) on a piece
# of paper.
#
postscript("fit.ps",horizontal=F)
#
# Plot Productivity versus Age.
#
plot(Age, Product,xlab="Age", ylab="Productivity",
main="Productivity versus Age")
#
# Add a plot of the fitted cubic
#
# First make a vector full of ages
#
xp <- seq(from=min(Age),to=max(Age),length=500)
#
# now compute the corresponding fitted values
# The regression coefficients are obtained using
# the function coef.
#
co <- coef(fit)
yp <- co[1] + co[2]*(xp-m)
+ co[3]*(xp-m)^2 + co[4]*(xp-m)^3
#
# Add a curve to the plot
#
lines(xp,yp)
#
# finish this plot
#
dev.off()
#
# Now plot residuals against Fitted value
#
postscript("r_v_fit.ps",horizontal=F)
plot(Fit,R,xlab="Fitted Value",
ylab="Residual",main="Residual versus Fitted Value")
dev.off()
#
# Now plot residuals against Age
#
postscript("r_v_age.ps",horizontal=F)
plot(Fit,R,xlab="Age",ylab="Residual",main="Residual versus Age")
dev.off()
#
# Make a QQ plot
#
postscript("qq.ps",horizontal=F)
qqnorm(R)
dev.off()