100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada 4.2 TrustPilot
logo-home
Notas de lectura

Lecture/seminar/powerpoint notes statistics (LCX046B05)

Puntuación
3.0
(1)
Vendido
3
Páginas
20
Subido en
26-10-2021
Escrito en
2021/2022

An overview of theory of the course Statistics: a combination of notes from the lectures, seminars, practicum assignments, and the powerpoints. Furthermore it includes an overview of functions used in R, and formulas and abbreviations.

Mostrar más Leer menos
Institución
Grado










Ups! No podemos cargar tu documento ahora. Inténtalo de nuevo o contacta con soporte.

Escuela, estudio y materia

Institución
Estudio
Grado

Información del documento

Subido en
26 de octubre de 2021
Archivo actualizado en
3 de noviembre de 2021
Número de páginas
20
Escrito en
2021/2022
Tipo
Notas de lectura
Profesor(es)
Multiple professors
Contiene
Todas las clases

Temas

Vista previa del contenido

Introduction to R
Statistics is used to make sense of data: (I) descriptive statistics, summarizing the data, and (II)
inferential statistics, assessing relationships in data. For this, data needs to be variable.

R has some basic functionalities:
 calculator: addition (5 + 5), multiplication (5 * 3), or division (5/3)
 <- to store a value in a variable (= assignment operator).
- E.g. storing value 5+5 in variable a: a <- 5 + 5
 c() to create a vector.
 <- c() to store multiple values in a variable by using a vector.
- E.g. storing values 2, 4, 5 in variable b: b <- c(2, 4, 5)
 mean() to calculate the mean.
 help() or ?... to get information about a specific function.
 setwd() to set your working directory.
 getwd() to see where R stores the file.
 # to indicate that the code or the information stated behind it is an addition.
 read.csv(…, sep = “;”, dec = “.”) to import data (make sure you save your excel as a
csv document).
 load(“”) to load a dataset.
 ls() to list variables in your workspace.
 class() to give an overall structure.
 dim() to see number of rows and columns (1st number is rows – observations, 2nd number is
columns – variables).
 nrow() to see number of rows (= sample size).
 ncol() to see number of columns.
 object.size() to see how much space the dataset is occupying in memory.
 names() to return a character vector of column (i.e. variable) names.
 head() to preview top of the dataset.
 head(…, number) to get a certain number of first rows.
 tail() to preview end of the dataset.
 tail(…, number) to get a certain number of end rows.
 dat[x, y] to see parts of table: x indicating the selected rows, y the selected columns.
- E.g., dat[1, 5] to see values in first row, fifth column, or dat[c(1,2), c(1,2)] to
see values in rows 1 and 2, columns 1 and 2. Or trough using names: dat[c(1,2),
c(“participant”, “study”).
 summary() to see how each variable is distributed and how much of the dataset is missing.
 str() to see structure of the dataset.
 rowmeans() to get the mean of the rows.
 rowsum() to get the sum of the rows.
 round() to round the number.
 $ to select a single column from the dataset.
- E.g. head(dat$study, 30) to show the study of the first 30 participants.
 relevel() to rearrange values, which can be useful with one-sided tests.
 rbind(x, y) to combine two subsets.
 rm() to remove an object.
 is.na() to test for missing data.
 apply(x, 1, mean) to apply mean to every row.

In R, the codes work form the inside of the brackets: it first computes the function in the most inner
brackets, and then works to the outside.


1

, - E.g. round(mean(dat$english_grade)) to first compute the mean, and then
round this mean.

Data can be accessed by using conditional indexing which allows to select parts of the data on the
basis of
 one condition,
- E.g. dat[dat$gender == “M”, ] to select observations for man only.
 combined conditions (and: &, or: |), or
- E.g. dat[dat$gender == “M” & dat$study == “IS”, ] to select
observations for male participants with the study IS.
 inversed conditions (is not equal to: !=).
- E.g. dat[dat$gender != “M” | dat$english_grade > 7, ] to select
observations for only women (i.e. gender is not equal to men) or everybody with an
English grade above 7.
You can also add columns to the dataset (here: dat) with the help of the operator $.
- E.g. dat$diff <- dat$english_grade – dat$english_score to add the column
diff which states the difference between the English grade and score.
- E.g. dat$pass_fail <- “PASS” to add the column pass_fail which is pass for
everyone  dat[dat$english_grade < 5.5, ]$pass_fail <- “FAIL” selecting
that if the grade is lower than 5.5, it is fail.

R shows NA when a value is missing: add na.rm = TRUE to the function to ignore missing values.

R also had many options for basic visualization.
 barplot() to visualize frequencies of categorical variables. To do this, you first need to
create a frequency table through table(), and of this table you can create a barplot.
- E.g. 1. gender <- table(dat$gender)) 2. barplot(gender).
 plot().
 boxplot() to visualize frequencies of numerical variables.
 hist() to make a histogram, where the y-axis displays the absolute frequencies.
 qqnorm() and adding the qqline() to visualize the distribution and see if it is normally
distributed.
In addition, you can add various graphical parameters to customize your graphics.
 col = c() to give it a color.
 main = “” to give it a title.
 xlab = “” to name the x-axis.
 ylab = “” to name the y-axis.
 legend = c() to add a legend.
- E.g. barplot(gender, col = c(“pink”, “ligtblue”), main = “Distribution
gender”, xlab = “Gender”, ylab = “Frequency”, legend =
c(“Female”, “Male”))

A frequency table is made from one variable (one column): the upper row shows the values of the
variable, and the lower row shows the frequency. A cross-table is made from two variables.
- E.g. table(dat$gender, dat$study) showing the variables gender and study.

Refer to figures, graphs, or tables with a capital letter.
- E.g. Figure 1, Table 2.




2

, Descriptive statistics
Samples of a population are used, because some populations are too big to study completely. The
sample is best if it is randomly drawn from the population. Characteristics of the individuals that one
studies are the variables, which has values.
- E.g., the variable gender can have the values male, female.
Collected data is organized in a dataset at which the individuals are represented in rows, and the
variables (with their values) in columns.

There are two types of variables, each having corresponding measurement levels.
 Categorical data: unordered categories.
o Nominal measurement level: just categorization, no ordering.
o Ordinal measurement level: categories have order, but no known distances.
 Numerical data: ranked data.
o Interval measurement level: ordered categories with known distances.
o Ratio measurement level: ordered categories with known distances with a
meaningful 0.

In the table below, a few examples of measurement levels.

Variable: Values: Measurement level:

a. Amount of sports practice A lot, little, nothing Ordinal
b. Political party preference PvdA, CDA, VVD, other Nominal
c. Response time 0, 1, 2, 3, .... milliseconds Ratio
d. Attitude towards Europe positive, neutral, negative Ordinal
e. Age 1, 2, 3, ... 25 years Ratio
f. Age 0-10 years, 11-20 years, 21-30 Ordinal
years, ...
g. Year of birth 1920, 1921, 1922, ... Interval
h. Number of inhabitants per km2 0-100, 101-200, 201-300, ... Ordinal
i. Gender male, female, non-binary Nominal
j. Type of car truck, bus, passenger car Nominal
k. Political opinion left, centre, right Nominal




Categorical variables can be characterized and visualized by using the function
 table() to create a table showing the absolute frequencies,


3
$4.71
Accede al documento completo:

100% de satisfacción garantizada
Inmediatamente disponible después del pago
Tanto en línea como en PDF
No estas atado a nada

Reseñas de compradores verificados

Se muestran los comentarios
3 año hace

3.0

1 reseñas

5
0
4
0
3
1
2
0
1
0
Reseñas confiables sobre Stuvia

Todas las reseñas las realizan usuarios reales de Stuvia después de compras verificadas.

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
hLianne Rijksuniversiteit Groningen
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
251
Miembro desde
6 año
Número de seguidores
158
Documentos
25
Última venta
2 meses hace
Communication and Information documents by Lianne

Op mijn profiel vind je allerlei samenvattingen en aantekeningen die ik maak voor mijn studie Communication and Information Studies en die jou zeker zullen helpen bij het studeren! Deze studie volg ik aan de Rijksuniversiteit Groningen. Vakken gericht op o.a. communicatie, taalkunde en academische vaardigheden komen aan bod. De documenten zijn natuurlijk ook te gebruiken voor andere studies.

4.1

21 reseñas

5
9
4
7
3
4
2
0
1
1

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes