Sie sind auf Seite 1von 2

# INTERVALOS DE CONFIANZA Y PRUEBA T STUDENT DE UNA MUESTRAS: VAR.

CONTINUAS

# CREAR CARPETA EN EL NODO RAÍZ DEL DISCO C: Y COPIAR DATOS C:/RIntConf

getwd()
dir.create("c:/RIntConf")
setwd("c:/RIntConf")
getwd()

# CARGAR PAQUETES DE ACCESO A ARCHIVOS EXCEL Y LEER LOS DATOS

#Package: XLConnect
Install.packages(“XLConnect”)
library("XLConnect")
setwd("c:/RIntConf")
Libro = loadWorkbook("ufcDataSpecies.xls")

Hoja = readWorksheet(Libro, sheet = "Sheet1", header = TRUE)

View(Hoja)
Hoja <- edit(Hoja)

# CARGAR PAQUETES DE CALCULO DE INTERVALOS DE CONFIANZA 95% DISTRIB. T STUDENT

#Package:pastecs

install.packages("pastecs")
library(pastecs)
stat.desc(Hoja$Height)

#TEST DE HIPÓTESIS T STUDENT DEL PROMEDIO MUESTRAL VERSUS UN VALOR DE REFERENCIA

t.test(Hoja$Height,mu=243)

Student t Distribution

http://www.r-tutor.com/elementary-statistics/probability-distributions/student-t-distribution

Assume that a random variable Z has the standard normal distribution, and another random
variable V has the Chi-Squared distribution with m degrees of freedom. Assume further
that Zand V are independent, then the following quantity follows a Student t
distribution with mdegrees of freedom.

Here is a graph of the Student t distribution with 5 degrees of freedom.

Problem
Find the 2.5th and 97.5th percentiles of the Student t distribution with 5 degrees of freedom.
Solution
We apply the quantile function qt of the Student t distribution against the decimal values
0.025 and 0.975.
> qt(c(.025, .975), df=5) # 5 degrees of freedom
[1] -2.5706 2.5706

Answer
The 2.5th and 97.5th percentiles of the Student t distribution with 5 degrees of freedom are -
2.5706 and 2.5706 respectively.
Quick-r R T STUDENT
http://www.statmethods.net/stats/ttest.html

The t.test( ) function produces a variety of t-tests. Unlike most statistical packages, the default
assumes unequal variance and applies the Welsh df modification.

# one sample t-test

t.test(y,mu=3) # Ho: mu=3

# independent 2-group t-test

t.test(y~x) # where y is numeric and x is a binary factor

# independent 2-group t-test

t.test(y1,y2) # where y1 and y2 are numeric

# paired t-test

t.test(y1,y2,paired=TRUE) # where y1 & y2 are numeric

You can use the var.equal = TRUE option to specify equal variances and a pooled variance estimate.
You can use the alternative="less" or alternative="greater" option to specify a one tailed test.

Nonparametric and resampling alternatives to t-tests are available.


Use box plots or density plots to visualize group differences.

Das könnte Ihnen auch gefallen