R-help to the compulsory assignment

 

 

# Below are given some R-hints that are useful when you do the compulsory assignment.

# It is also useful to look at the R-help to the various practical exercises given under

# "?velsene" at the course web-page.

 

 

# Read the data:

bears<-read.table("http://www.math.uio.no/avdc/kurs/STK4900/data/bears.dat", header=T)

 

 

# QUESTION a)

# See e.g. the R-help to Exercise 2 in BSS

 

 

# QUESTION b)

# See e.g. the R-help to Exercises 3.1, 3.2 and 3.3 in BSS

 

 

# QUESTION c)

# See e.g. the R-help to Exercise 5 in BSS

 

 

# QUESTION d)

# Here you are asked to consider the data without observation 52.

# You may get a new data set with this observation omitted by

bears.without52<-bears[-52, ]

 

# If you have attached the full dataset, you should detach it by the command "detach(bears)"

# before you attach "bears.without52". If both the data sets are attached at the same time,

# things may get mixed up.

 

 

# QUESTION e)

# Here you are asked to consider adult bears only. You may get a data set with only adult bears by

bears.adult<-bears[bears$AGE>12, ]

 

 

# QUESTION g)

# See e.g. the R-help to Exercise 12 in BSS