[No group meeting scheduled] -->

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

wilfried.grangeu-paris.fr

Latest Entries

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
```

Read More [...]

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')`

Read More [...]

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')
```

Read More [...]

ANOVAHypothesis Testing

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

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()
```

Read More [...]

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')`

Read More [...]

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')`

Read More [...]

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)
```

Read More [...]

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))
```

Read More [...]