Lab 5: Friday, May 5, 2000

Back to Main G274 TA Page
 

Assignment 3 due in class on Tuesday, May 9.

Comments on Assignment 2
 It may help to print every question and then answer it so you don't miss any.
 I'm looking for complete answers to the homework questions and a demonstration that you've synthesized class and book material.
 
 Non-linear least squares:
  given starting values, nls proceeds via iteration to find parameter values that minimize the squared difference.
  The solution space has many possible local minima, so starting seeds are important.
  format: nls (

Understanding more complex Splus objects
 In the object-oriented framework, objects are not simply collections of data.
 They are particular instances (instantiations) of particular classes.
   Objects include information (which might consist of data typed to other classes)
 Operations defined upon classes.
 Example:
  > module(spatial)
  > class(bramble.spp)
 returns the class of bramble. It's spp - spatial point pattern. More generally it's a data frame.
  > help(spp) : will tell you more about spatial point pattern objects
 Consider the K-function object named k produced via:
  > k_Khat(bramble.spp)
 k belongs to a class (could also be in a super/sub class):  class(k)
 k consists of several "things":
  > names(k)
  > k
 and a variety of functions may be defined for it
  > bramble.spp
  > plot(bramble.spp)
 Side: what's the difference between
      > plot(bramble.spp)
  and > plot(bramble.spp$x, bramble.spp$y)

 You can define objects to be particular classes. Try this:
  > x_rnorm(50, 10, 3)    # creates 50 random x values
  > y_rnorm(50, 10, 4)    # creates 50 random y values
  > plot(x,y)  # Gee, it looks like a point pattern...
  > k2_Khat(x,y)  # did this work?
  try this instead:
  > k2_Khat(as.spp(as.data.frame(cbind(x,y))))

 
Working with Linear Models in SPlus
 A depressing dataset, and oh so aspatial! ovarian
 Plot futime against age: plot(ovarian$futime, ovarian$age)
 Perform some regressions:
 > ovlm_lm(futime ~ age, data=ovarian)
 > ovlm2_lm(futime ~ age + residual.dz + rx + ecog.ps, data=ovarian)
 lm objects are complex: > names(ovlm)
 Useful operations on lm objects include summary and print
 You can examine and work with parts of the "superobject":
  > plot(ovlm$resid)
  > abline (0,0)
  > qqnorm (ovlm$resid)

Using the interp function
 Use to generate surfaces from point data.
  > z_rnorm(50, 100, 20)
 
 

Back to Main G274 TA Page