0% found this document useful (0 votes)
16 views9 pages

RMPE Handout

The document provides a comprehensive overview of experimental designs and statistical methods using Octave/Matlab, covering key components such as hypothesis, independent and dependent variables, and control conditions. It also details various statistical techniques including descriptive statistics, t-tests, correlation, regression, and ANOVA, along with practical examples and code snippets for implementation. Additionally, it discusses concepts like signal detection theory and ROC curves to evaluate classifier performance.

Uploaded by

Sana Siddiq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views9 pages

RMPE Handout

The document provides a comprehensive overview of experimental designs and statistical methods using Octave/Matlab, covering key components such as hypothesis, independent and dependent variables, and control conditions. It also details various statistical techniques including descriptive statistics, t-tests, correlation, regression, and ANOVA, along with practical examples and code snippets for implementation. Additionally, it discusses concepts like signal detection theory and ROC curves to evaluate classifier performance.

Uploaded by

Sana Siddiq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Statistics with Octa-

ve/Matlab
RMPE Handouts
Rakesh Sengupta

Rakesh Sengupta, Center for Creative Cognition, SRU


[email protected]
Contenido
4 Experimental designs
1.1 Key Components of Experimental Design . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 Control Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Counterbalancing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 Randomization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 Threshold Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.6 ROC Curve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

7 Statistics and Inference


2.1 Descriptive Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Histogram and Density Plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Normality Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.4 T-Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.5 Correlation and Regression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.6 One-Way ANOVA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.7 Post-Hoc Test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

2
This page is intentionally left blank.
Experimental designs
1.1 Key Components of Experimental Design
Hypothesis: A clear, testable statement predicting the outcome of the experiment.
Independent Variable (IV): The variable that is manipulated by the experimenter.
Dependent Variable (DV): The variable that is measured and is expected to change due to
manipulations of the IV.
Control Variables: Variables that are kept constant to prevent them from influencing the
DV.
Experimental Group: The group exposed to the treatment or condition.
Control Group: The group not exposed to the treatment, serving as a baseline for comparison.

1.2 Control Conditions


Definition: Control conditions are used to isolate the effect of the independent variable by
providing a baseline to compare against the experimental condition.
Purpose: - Ensure that observed effects are due to the IV and not extraneous factors. - Increase
the internal validity of the experiment.
Example: In a study measuring the effect of a new drug on memory, the control group would
receive a placebo.

1.3 Counterbalancing
Definition: A method used to control for order effects in repeated measures designs by varying
the order of conditions for different participants.
Types: - Complete Counterbalancing: All possible orders of conditions are used. - Partial
Counterbalancing: A subset of all possible orders is used.
Example: If testing the effect of three different types of noise on reading comprehension,
counterbalance the order in which participants experience each type of noise.

1.4 Randomization
Definition: The process of randomly assigning participants to different conditions or groups
to ensure each participant has an equal chance of being assigned to any group.
Purpose: - Minimize bias. - Control for confounding variables. - Ensure groups are comparable
at the start of the experiment.
Example: Randomly assigning participants to either a treatment or control group in a clinical
trial.

4
Threshold Measurements • 5

1.5 Threshold Measurements


Definition: Methods used to determine the smallest detectable level of a stimulus.
Methods: - Method of Constant Stimuli: Presenting stimuli of varying intensities in ran-
dom order. - Method of Limits: Gradually increasing or decreasing the stimulus intensity
until it is detectable. - Method of Adjustment: Participants adjust the stimulus intensity to
the threshold level.
Example: Determining the minimum volume at which a tone can be heard.

6. Signal Detection Theory (SDT)


Definition: A framework for measuring the ability to differentiate between signal and noise.
Components: - Hit: Correctly identifying the presence of a signal. - Miss: Failing to identify
the presence of a signal. - False Alarm: Incorrectly identifying the presence of a signal when
there is none. - Correct Rejection: Correctly identifying the absence of a signal.
d’: A measure of sensitivity, representing the distance between the signal and noise distributions.

d ′ = Z(hit rate) − Z(false alarm rate)

1.6 ROC Curve


Definition: A graphical plot illustrating the performance of a binary classifier system as its
discrimination threshold is varied.
Axes: - X-axis: False Positive Rate (FPR) - Y-axis: True Positive Rate (TPR)
Purpose: - Visualize trade-offs between sensitivity and specificity. - Compare the performance
of different classifiers.
Example: Plotting the ROC curve to evaluate the accuracy of a medical diagnostic test.

Figura 1.1: Example of an ROC Curve


This page is intentionally left blank.
Statistics and Inference
2.1 Descriptive Statistics
Mean: The average value of a dataset.

xi
Mean =
n
Median: The middle value in a dataset when it is ordered.
Mode: The most frequently occurring value in a dataset.
Variance: A measure of how much values in a dataset differ from the mean.

(xi − Mean)2
Variance =
n−1
Standard Deviation: The square root of the variance, indicating how spread out the values
are. √
Standard Deviation = Variance

Listing 2.1: Descriptive Statistics


data = randn ( 1 0 0 , 1 ) ;
mean_value = mean( data ) ;
median_value = median ( data ) ;
mode_value = mode ( data ) ;
v a r i a n c e _ v a l u e = v a r ( data ) ;
std_dev_value = std ( data ) ;

2.2 Histogram and Density Plot


Histogram: A graphical representation of the distribution of a dataset using bars.
Density Plot: A smoothed version of the histogram that shows the probability density function
of the data.
Listing 2.2: Histogram and Density Plot
h i s t ( data ) ; % Histogram
[ f , x i ] = k s d e n s i t y ( data ) ; % D e n s i t y p l o t
plot ( x i , f ) ;

2.3 Normality Test


Shapiro-Wilk Test: A test to check if a dataset is normally distributed.
H0 : Data is normally distributed

7
8 • T-Test

H1 : Data is not normally distributed


p-value: If the p-value is less than a significance level (e.g., 0.05), reject H0 .
Listing 2.3: Normality Test
pkg load s t a t i s t i c s ; % Load t h e s t a t i s t i c s p a c k a g e
[ h , p_value ] = s w t e s t ( data ) ;

2.4 T-Test
One-Sample T-Test: Tests if the mean of a single sample is equal to a known value.

H0 : µ = µ0

Two-Sample T-Test: Tests if the means of two independent samples are equal.

H0 : µ1 = µ2

Listing 2.4: T-Test


d a t a 1 = randn ( 1 0 0 , 1 ) ;
d a t a 2 = randn ( 1 0 0 , 1 ) + 0 . 5 ;
[ h , p_value ] = t t e s t ( data1 , 0 ) ; % One−sample t − t e s t
[ h , p_value ] = t t e s t 2 ( data1 , da t a 2 ) ; % Two−sample t − t e s t

2.5 Correlation and Regression


Correlation Coefficient (r): Measures the strength and direction of a linear relationship
between two variables.
cov(x, y)
r=
σx σy
Linear Regression: Fits a line to the data that best predicts the dependent variable (y) from
the independent variable (x).
y = b0 + b1 x

Listing 2.5: Correlation and Regression


x = randn ( 1 0 0 , 1 ) ;
y = 2 ∗ x + randn ( 1 0 0 , 1 ) ;
correlation = corr (x , y ) ;
model = p o l y f i t ( x , y , 1 ) ;

2.6 One-Way ANOVA


One-Way ANOVA: Tests if there are any statistically significant differences between the
means of three or more independent groups.

H0 : µ1 = µ2 = µ3 = . . . = µk
Post-Hoc Test • 9

H1 : At least one group mean is different


F-Statistic: Ratio of between-group variance to within-group variance.
Listing 2.6: One-Way ANOVA
group1 = randn ( 3 0 , 1 ) ;
group2 = randn ( 3 0 , 1 ) + 1 ;
group3 = randn ( 3 0 , 1 ) + 2 ;
data = [ group1 ; group2 ; group3 ] ;
g r o u p s = [ ones ( 3 0 , 1 ) ; 2∗ ones ( 3 0 , 1 ) ; 3∗ ones ( 3 0 , 1 ) ] ;
[ p , t a b l e , s t a t s ] = anova1 ( data , g r o u p s ) ;

2.7 Post-Hoc Test


Tukey’s HSD (Honestly Significant Difference): Used after ANOVA to find which specific
groups’ means are different. - Comparison of all pairs: Controls for Type I error across
multiple comparisons.
Listing 2.7: Post-Hoc Test
[ c , m, h , nms ] = multcompare ( s t a t s ) ;

You might also like