#### Institut de Physique et Chimie des Matériaux de Strasbourg

[No group meeting scheduled] -->

A blog for physicists or biologists. Mainly for experimentalists interested in Statistics. R scripts detailed and explained.

CONTACT

wilfried.grangeu-paris.fr

TAGS

Latest Entries

# Statistical Power

Posted 2020-10-30 by Wilfried. Post 8 of 8.
PowerHypothesis Testing

What is Statiscal Power? Why should I mention it when comparing means of 2 samples?

We have previously performed some 2-sample t-tests. When the p-value was smaller than 0.05, we have concluded that the 2 samples originate from 2 populations with equal means. Obviously the probability to conclude that 2 samples (originating from populations with different means) have equal means depends on both the sample size and the actual difference in means. That is what we will investigate here.

Let us define some parameters:

delta<-0.5 # difference in means
sd<-1.5 # standard deviation in populations
mu1<-20 # mean of 1st population
mu2<-mu1+delta # mean of 2nd population
n<-40 # number (n) of elements in each sample


# t-tests and Confidence Intervals

Posted 2020-10-25 by Wilfried. Post 7 of 8.
CIHypothesis Testing

Calculating 0.84 confidence intervals and performing a two-sample t-test

As usual, we check for some packages.

if (!require(gridExtra)) install.packages('gridExtra')

# ANOVA (ANalysis Of VAriance) Part II

Posted 2020-10-20 by Wilfried. Post 6 of 8.
ANOVAHypothesis Testing

P i m p my ANOVA Graph. Display FDR values for multiple comparisons

As usual, we check for some packages

# Check for Packages
if (!require(ggsignif)) install.packages('ggsignif')

# ANOVA (ANalysis Of VAriance) Part I

Posted 2020-10-13 by Wilfried. Post 5 of 8.
ANOVAHypothesis Testing

A step by step guide to perform a single-factor ANOVA

Family-Wise Error Rate (FWER)

Let's first have a look at the code below:

n<-2:20
m<-factorial(n)/(factorial(n-2)*factorial(2))
p<- 1- (1-0.05)^m
plot(n,p, main='Probability to observe at least 1 false discovery', xlab='Number of samples')
grid()

# Non-Linear Fitting (lots of points)

Posted 2020-10-09 by Wilfried. Post 4 of 8.
FittingChi^2

Non-linear fitting with R (lots of points, with error bars). I also discuss how some parameters can give statistical information regarding the quality of the fit

For this example, I use ggplot2 and so you need to enter:

if (!require(ggplot2)) install.packages('ggplot2')

# Fitting multiple data at once

Posted 2020-10-08 by Wilfried. Post 3 of 8.
BeginnerFitting

Here, I demonstrate how to fit multiple data at once using an easy script

For this example, I use ggplot2 and so you need to enter:

if (!require(ggplot2)) install.packages('ggplot2')

# Non-Linear Fitting

Posted 2020-10-07 by Wilfried. Post 2 of 8.
FittingChi^2

Non-linear fitting with R (few points, with error bars). I also discuss how some parameters can give statistical information regarding the quality of the fit

As an example of non-linear fitting, I will perform a Michaelis Menten fit on some synthetic data. I am using 3 vectors, which represent the Substrate concentration (S), the rate of product formation (v) as well as the error on v (dv).

# data (use c to create a vector and combine elements of identical types)
v<-c(0.004507692,0.004192308,0.00355384,0.002576923,0.001661538,0.001064286)
S<-c(3.6000,1.8000,0.9000,0.4800,0.2250,0.1125)
dv<-c(0.00012, 0.00008,  0.00012, 0.00010, 0.00007, 0.00005)

# Simple Linear Regression

Posted 2020-10-06 by Wilfried. Post 1 of 8.
BeginnerFitting

How to make a very simple linear fit with R (few points, no error bars)

myX<-1:10
myY<-jitter(1:10)
adjust<-lm(myY ~ myX)  # Use adjust<-lm(myY ~ 0 + myX) to force the intercept at 0
plot(myX,myY,abline(adjust))