UCLA Department of Statistics
Course 102A Introduction to Statistics with R Part I:
Jan de Leeuw
September 22, 2010
Jan de Leeuw 102A_1 UCLA Department of Statistics
Jan de Leeuw 102A_1 UCLA Department of Statistics

UCLA Department of Statistics
Course 102A Introduction to Computational Statistics with R Part II: The R Session
Jan de Leeuw
Jan de Leeuw 102A_2
October 4, 2010
UCLA Department of Statistics
Getting out and Getting Help
Out !
Two things are extremely imp

STAT 102A - HOMEWORK 1
JAN DE LEEUW
Suppose we have a vector of numbers x. (1) Give R code to compute the moments around zero of order one to four. (2) Give R code to compute the moments around the mean of order one to four. (3) Give R code to compute the

HOMEWORK 4: NEWTON ITERATIONS FOR THE SQUARE ROOT
JAN DE LEEUW
Newton iterations to nd the root of a real valued function f , i.e. a number x for which f ( x) = 0, are of the form x(k+1) = x(k) f ( x(k) ) . f ( x(k) )
Example. To nd the square root of a p

tapply cfw_base
R Documentation
Apply a Function Over a Ragged Array
Description
Apply a function to each cell of a ragged array, that is to each (non-empty) group of values given by a unique combination of the levels of certain factors.
Usage
tapply(X, I

outer cfw_base
R Documentation
Outer Product of Arrays
Description
The outer product of the arrays X and Y is the array A with dimension c(dim(X), dim(Y) where element A[c(arrayindex.x, arrayindex.y)] = FUN(X[arrayindex.x], Y[arrayindex.y], .).
Usage
oute

ifelse cfw_base
R Documentation
Conditional Element Selection
Description
ifelse returns a value with the same shape as test which is filled with elements selected from either yes or no depending on whether the element of test is TRUE or FALSE.
Usage
ifel

HOMEWORK III
JAN DE LEEUW
1. P ROBLEM Consider a table with n rows and m columns and an unequal number of observations in each cell. We can index the observations as xi jk with i = 1, , n and j = 1, , m and k = 1, ,
i j.
An example of such a table will lo

drop cfw_base
R Documentation
Drop Redundant Extent Information
Description
Delete the dimensions of an array which have only one level.
Usage
drop(x)
Arguments
x an array (including a matrix).
Value
If x is an object with a dim attribute (e.g., a matrix

data.frame cfw_base
R Documentation
Data Frames
Description
This function creates data frames, tightly coupled collections of variables which share many of the properties of matrices and of lists, used as the fundamental data structure by most of R's mode

cbind cfw_base
R Documentation
Combine R Objects by Rows or Columns
Description
Take a sequence of vector, matrix or data frames arguments and combine by columns or rows, respectively. These are generic functions with methods for other R classes.
Usage
cb

apply cfw_base
R Documentation
Apply Functions Over Array Margins
Description
Returns a vector or array or list of values obtained by applying a function to margins of an array or matrix.
Usage
apply(X, MARGIN, FUN, .)
Arguments
X an array, including a ma

HOMEWORK II
The exponent of a real number x can be dened by the power series
s 1 1 x exp(x) = 1 + x + x2 + x3 + = , 2 6 s=0 s!
or by the limit exp(x) = lim 1 +
n
x n
n
.
In the same way, the exponent of a square symmetric matrix X can be dened by the matr

PUBLISH OR PERISH
JAN DE LEEUW
Suppose A is an n m matrix with non-negative elements aij . Also suppose p and p are two vectors with n and m non-negative elements such that
n m
pi =
i=1 j =1
qj .
We now want to nd b with n elements and c with m elements s

ANOVA
Suppose X = cfw_xij is an n m matrix with numbers. In ANOVA we study the decomposition xij = + i + j + ij into a main eect, a row eect, a column eect, and an interaction. We identify the decomposition by requiring
n
i = 0,
i=1 m
j = 0,
j =1 n
ij =

Introduction Basic Matrix Operations Patterned Matrices Full Rank Decomposition and Matrix Rank QR Decomposition and Rank LDU D
UCLA Department of Statistics
Course 102A Introduction to Computational Statistics with R Part V: Matrices in R
Jan de Leeuw
Ja

Introduction Basic Matrix Operations Patterned Matrices Full Rank Decomposition and Matrix Rank QR Decomposition and Rank LDU Decomposition and Matrix Inverse Eigen or spectral decompositionBasic Matrix Operations Patterned Matrices Full Rank Decompositio

UCLA Department of Statistics
Course 102A Introduction to Computational Statistics with R Part IV: R I/O and Graphics
Jan de Leeuw
Jan de Leeuw 102A_4
October 12, 2010
UCLA Department of Statistics
Jan de Leeuw 102A_4 UCLA Department of Statistics

UCLA Department of Statistics
Course 102A Introduction to Computational Statistics with R Part IV: R I/O and Graphics
Jan de Leeuw
October 12, 2010
Jan de Leeuw 102A_4 UCLA Department of Statistics
Jan de Leeuw 102A_4 UCLA Department of Statistics

UCLA Department of Statistics
Course 102A Introduction to Computational Statistics with R Part III: R Objects
Jan de Leeuw
Jan de Leeuw 102A_1
October 12, 2010
UCLA Department of Statistics
Objects
What you create or load into R all becomes an R object. T

Objects
UCLA Department of Statistics
Course 102A Introduction to Computational Statistics with R Part III: R Objects
Jan de Leeuw
What you create or load into R all becomes an R object. There are R objects of many different types. All objects have a type

Getting out and Getting Help
UCLA Department of Statistics
Out !
Course 102A Introduction to Computational Statistics with R Part II: The R Session
Jan de Leeuw
Two things are extremely important for any software system. They are usually taken care of wit

Getting out and Getting Help
UCLA Department of Statistics
Out !
Course 102A Introduction to Computational Statistics with R Part II: The R Session
Jan de Leeuw
Two things are extremely important for any software system. They are usually taken care of wit

UCLA Department of Statistics
Course 102A Introduction to Computational Statistics with R Part I: Denition and Use of R
Jan de Leeuw
Jan de Leeuw 102A_1
September 27, 2010
UCLA Department of Statistics
This course will discuss programming in R, computatio

UCLA Department of Statistics
This course will discuss programming in R,
Course 102A Introduction to Computational Statistics with R Part I: Denition and Use of R
Jan de Leeuw
computational statistics in R. The general idea is to work through a number of

Masanao Yajima
Your
homework is on Moodle
http:/classes.stat.ucla.edu/
Submission
of your homework is also through Moodle Submission page will be open to submit a week from the due date and goes on until the midnight of the due date. There will be only

Masanao Yajima
This
is an upper level class. Which means when you go out of this class, you are supposed to know the material solid. This is also a statistical computing class, which means after you have completed this class you will be able to go out