In this exercise you will:
You need to have installed R, RStudio, and the necessary packages for
the course, including the ELMER
package. See how to
get set up for this course
'data.frame': 21 obs. of 2 variables:
$ Flow : int 24 36 24 25 72 37 46 24 37 46 ...
$ Problems: int 0 0 0 0 0 0 0 0 0 0 ...
A straight line did not model the mean of the river problems in the example found in ELMER at all well. Try fitting: \[\begin{aligned} \mu_{Y} & = & \beta_0 + \beta_1\ln{x} \\ var(Y) & = &k \mu_Y\end{aligned}\] Compare the fit of this model with the earlier one.
Step 1: Fit the unweighted model ModelU
, and make a copy
called ModelW
.
Step 2: Start to collect the values of the parameters you want to
track, and set up the Results
matrix to collate them.
Step 3: Write out the working for the weighted model, and then wrap it in a loop to produce enough iterations. (10 should suffice).
You will need to:
update()
to incorporate the weights.Step 4: Print out the Results
to see that sufficient
iterations have ben completed to assure convergence.
Step 5: Graph your new model.
You should compare your work with the solutions for this workshop.