Lecture 1 Flashcards

1
Q

What are descriptive statistics?

A

Summary statistics - sum up features of a data sample.

Descriptive statistics (PLURAL) is the process of analyzing those statistics.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is exploratory data analysis?

A

The critical process of performing investigations on data to:
discover patterns
spot anomalies
test hypothesis AND
check assumptions
with the help of summary statistics and graphical representations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Discrete VS Continuous Probability Distributions

A

DISCRETE: Data can only take on certain values, for example, integers.
CONTINUOUS: Data can take on any value within a specified range (which may be infinite).

For a discrete distribution, probabilities can be assigned to the values in the distribution - for example, the probability that a web page will have 12 clicks in an hour is 0.15.

In contrast, in a continuous distribution, the probability associated with any particular value is null. Therefore, continuous distributions are normally described in terms of probability density, which can be converted into the probability that a value will fall within a certain range.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Console window

A

Where you type R commands

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Source file

A

Instead of entering commands one at a time in the Console window, you can run a set of commands from a source file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

q()

A

To quit R

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

You can perform mathematical calculations in R.

A

Answers will appear in Console window.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Generating and Displaying an object

A

Generate: x=5
Display: x

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

ls()

A

To list objects available in the current R session
e.g.
x=5
x2=9
COMMAND: ls(pattern=”x”)
CONSOLE: “x” “x2”

NOTE: Pattern - Optional. Only names matching pattern are returned.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

exists(“name of object”)

A

Checks whether or not specified object exists. Returns TRUE or FALSE.
e.g.
COMMAND: exists(“x”)
CONSOLE: TRUE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

rm(“name of object”)

A

Removes previously defined object from the workspace
e.g.
rm(“x”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Workspace

A

Objects that you create during an R session are held in memory.

The collection of objects that you currently have is called the workspace. The workspace can be found in the Environment tab.

REMEMBER: The workspace is not saved unless you tell R to save it. This means that your objects are lost when you close R without saving the objects OR when R/your system crashes during a session.

When you close the R-GUI or the R console window, the system will ask you if you want to save the workspace image. If you select the ‘save the workspace image’ option, all the objects in your current R session will be saved in a file (.RData).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

getwd()

A

To find out what the current working directory is

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

save.image()

A

To save to the current working directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

save.image(“Working Directory”)

A

To save to a specific file/location

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

If you have saved a workspace image and you start R the next time…

A

It will restore the workspace. All previously saved objects will be available again.

17
Q

R gets confused if you use a path like: c:\mydocuments\myfile.txt
BECAUSE R sees \ as an escape character. Instead, use…

A

c:\my documents\myfile.txt
OR
c:/mydocuments/myfile.txt

18
Q

help(options)

A

To learn about available options.

19
Q

options(…)

A

Allow the user to set and examine a variety of global options which affect the way in which R computes and displays its results.
e.g.
options(digits=3)

20
Q

history()

A

Displays last 25 commands

21
Q

history(max.show=Inf)

A

Displays all previous commands.

22
Q

savehistory(file = “name of file”)

A

Saves command history.

Default is “.Rhistory”

23
Q

loadhistory(file = “name of file”)

A

Recalls command history.

Default is “.Rhistory”

24
Q

help.start()

A

General help.

25
Q

help(foo) OR ?foo

A

Help about function foo.

The name ‘foo’ is not a real name: it is a placeholder used to represent the name of any desired thing.

26
Q

apropos(“foo”)

A

Lists all functions containing string foo.

The apropos() function in R is used to return a vector with the names of objects matching or containing the input character partially.

27
Q

example(foo)

A

Shows an example of function foo.

28
Q

data()

A

To see available datasets. Depends on what packages you have loaded.

29
Q

help(datasetname)

A

Provides details on sample dataset.

30
Q

R package OR R library

A

The system allows you to write new functions and package those functions - an extension of the system.

When you download R, a number of packages (around 30) are downloaded as well.

To use a function in an R package, that package must be attached to the system.

When you start R, not all the downloaded packages are attached. Only seven packages are attached to the system by default.

You can use function search to see the list of packages that are currently attached to the system. This list is also called the search path. (COMMAND: search() OR searchpaths()). You can also use the Packages window.

In order to be able to use a package, make sure it is activated by clicking on the check box. This can be done with the command library(package name) as well.

If a package is not available in the list, click on “Install Package”, enter the name, and click on “Install”. You may use the code: install.packages(“package name”) as well.

31
Q

It is not recommended to do so but…

A

R allows the user to give an object a name that already exists. If you are not sure if a name already exists, enter the name in the console and see if R can find it. R will look for the object in all the libraries (packages) that are currently attached to the system. R will not warn you when you use an existing name.
e.g.
mean = 10
mean
The object mean already exists in the base package, but is now masked by your object mean. To get a list of all masked objects, use the function conflicts. (COMMAND: conflicts())

You can safely remove the object mean with the function rm() without risking deletion of the mean function.

32
Q

Condition for existence of inverse of a matrix

A

A matrix’s rank should be full for the existence of its inverse.

33
Q

Basic Calculations

A

+ Addition
- Subtraction
* Multiplication
/ Division
^ OR ** Exponent
x%%y Modulus (x mod y)
x%/%y Integer division