
The R Book
相逢一醉为前缘
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
回归的一般问题
The response variable(a) Continuous Normal regression, ANOVA or ANCOVA(b) Proportion Logistic regression(c) Count Log-linear models(d) Binary Binary logistic analysis(e) Time at death Survival analysi...翻译 2018-03-29 21:40:39 · 482 阅读 · 0 评论 -
25.3 Cluster analysis
kmd <- read.table("c:\\temp\\kmeansdata.txt",header=T)attach(kmd)names(kmd)par(mfrow=c(2,2))plot(x,y,pch=16)plot(x,y,col=group,pch=16)model <- kmeans(data.frame(x,y),6)plot(x,y,col=model[[1]])mo...翻译 2018-04-01 12:26:22 · 190 阅读 · 0 评论 -
6.1.1 Random points in a circle
There are three broad classes of spatial pattern on a continuum from complete regularity (evenly spaced hexagons where every individual is the same distance from its nearest neighbour) to complete agg...翻译 2018-04-01 20:37:30 · 457 阅读 · 0 评论 -
26.2 Nearest neighbours
set the problem of drawing lines to join the nearest neighbour pairs of any given set of points (x, y) that are mapped in two dimensions. There are three steps to the computing: compute the distance...翻译 2018-04-01 21:43:10 · 340 阅读 · 0 评论 -
Discriminant analysis
, you know the identity of each individual (unlike cluster analysis) and you want to know how theexplanatory variables contribute to the correct classification of individuals. The method works by unco...翻译 2018-04-01 15:34:49 · 414 阅读 · 0 评论 -
Survival Analysis
rnos <- runif(100)which(rnos<= 0.1)which(rnos<= 0.1)[1]death1 <- numeric(30)for (i in 1:30){rnos <- runif(100)death1[i] <- which(rnos<= 0.1)[1]}death11/mean(death1)death2 <- nu...翻译 2018-04-02 22:10:24 · 399 阅读 · 0 评论 -
11.4 Variance components analysis
For random effects we are often more interested in the question of how much of the variation in the responsevariable can be attributed to a given factor, than we are in estimating means or assessing t...翻译 2018-03-27 21:37:38 · 848 阅读 · 0 评论 -
12.3 ANCOVA with two factors and one continuous covariate
Gain <- read.table("c:\\temp\\Gain.txt",header=T)attach(Gain)names(Gain)m1 <- lm(Weight~Sex*Age*Genotype)summary(m1)m2 <- step(m1)summary(m2)newGenotype <- Genotypelevels(newGenotype)level...翻译 2018-03-28 08:29:51 · 219 阅读 · 0 评论 -
12.4 Contrasts and the parameters of ANCOVA models
Ancovacontrasts <- read.table("c:\\temp\\Ancovacontrasts.txt",header=T)attach(Ancovacontrasts)names(Ancovacontrasts)lm(weight[sex=="male"]~age[sex=="male"])lm(weight~age,subset=(sex=="female"))lm(w...翻译 2018-03-28 10:45:59 · 303 阅读 · 0 评论 -
12.5 Order matters in summary.aov
summary.aov(lm(weight~sex*age))summary.aov(lm(weight~age*sex))summary.aov(lm(Fruit~Grazing*Root))summary.aov(lm(Fruit~Root*Grazing))tapply(Root,Grazing, mean)summary(lm(Fruit~Root*Grazing))summary(lm(...翻译 2018-03-28 11:24:41 · 331 阅读 · 0 评论 -
8.4 Two samples
8.4.1 Comparing two variancesBefore we can carry out a test to compare two sample means (see below), we need to test whether the samplevariances are significantly different (see p. 356). The test coul...翻译 2018-03-27 23:23:58 · 243 阅读 · 0 评论 -
24.10 Time series models
Typically, we would use the partial autocorrelation plot (above) to determine the order. So, for the lynx data(p. 800) we would use order 2 or 4, depending on taste. Other things being equal, parsimon...翻译 2018-03-31 21:05:59 · 301 阅读 · 0 评论 -
24.7 Spectral analysis
numbers <- read.table("c:\\temp\\lynx.txt",header=T)attach(numbers)names(numbers)plot.ts(Lynx)The fundamental tool of spectral analysis is the periodogram. This is based on the squared correlationb...翻译 2018-03-31 20:21:51 · 313 阅读 · 0 评论 -
24.5 Decompositions and testing for trend
It is useful to be able to turn a time series into components. The function stl (with a lower-case letter L, notnumeral one) performs seasonal decomposition of a time series into seasonal, trend and i...翻译 2018-03-31 18:20:55 · 233 阅读 · 0 评论 -
10.8 Bootstrap with regression
An alternative to estimating confidence intervals on the regression parameters from the pooled error variancein the ANOVA table (p. 459) is to use bootstrapping. There are two ways of doing this: samp...翻译 2018-03-30 17:46:05 · 468 阅读 · 1 评论 -
10.9 Jackknife with regression
A second alternative to estimating confidence intervals on regression parameters is to jackknife the data.Each point in the data set is left out, one at a time, and the parameter of interest is re-est...翻译 2018-03-30 17:59:52 · 480 阅读 · 0 评论 -
10.11 Serial correlation in the residuals
The Durbin–Watson function is used for testing whether there is autocorrelation in the residuals froma linear model or a generalized linear model, and is implemented as part of the car package (seeFox...翻译 2018-03-30 18:04:05 · 337 阅读 · 0 评论 -
10.12 Piecewise regression
his kind of regression fits different functions over different ranges of the explanatory variable. For example,it might fit different linear regressions to the left- and right-hand halves of a scatter...翻译 2018-03-30 18:41:13 · 1345 阅读 · 0 评论 -
混合效应模型的假设与作用
It was Eisenhart (1947) who realized that there were actually two fundamentally different sorts of categoricalexplanatory variables: he called these fixed effects and random effects. It will take a go...翻译 2018-03-30 19:12:28 · 4120 阅读 · 0 评论 -
19.5 Hierarchical sampling and variance components analysis
Hierarchical data are often encountered in observational studies where information is collected at a range ofdifferent spatial scales. The principal aim is to discover the scale at which most of the v...翻译 2018-03-31 12:07:41 · 319 阅读 · 0 评论 -
Tree Models
install.packages("tree")library(tree)Pollute <- read.table("c:\\temp\\Pollute.txt",header=T)attach(Pollute)names(Pollute)model <- tree(Pollute)plot(model)text(model)The model is fitted using bin...翻译 2018-03-31 15:40:04 · 238 阅读 · 0 评论 -
23.6 Classification trees with categorical explanatory variables
epilobium <- read.table("c:\\temp\\epilobium.txt",header=T)attach(epilobium)epilobiummodel <- tree(species ~ .,epilobium,mindev=1e-6,minsize=2)plot(model)text(model,cex=0.7)taxonomy <- read.t...翻译 2018-03-31 15:54:44 · 222 阅读 · 0 评论 -
23.4 Tree models as regressions
car.test.frame <- read.table("c:\\temp\\car.test.frame.txt",header=T)attach(car.test.frame)names(car.test.frame)plot(Weight,Mileage,pch=21,col="brown",bg="green")a <- mean(Mileage[Weight<2567...翻译 2018-03-31 15:57:14 · 171 阅读 · 0 评论 -
Time Series Analysis
The three key concepts in time series analysis are trend, serial dependence, and stationarityblowfly <- read.table("c:\\temp\\blowfly.txt",header=T)attach(blowfly)names(blowfly)flies <- ts(flies...翻译 2018-03-31 17:18:40 · 798 阅读 · 0 评论 -
8.5 Tests on paired samples,8.6 The sign test
streams <- read.table("c:\\temp\\streams.txt",header=T)attach(streams)names(streams)t.test(down,up)t.test(down,up,paired=TRUE)difference <- up - downt.test(difference)8.6 The sign testbinom.test...翻译 2018-03-28 17:22:02 · 335 阅读 · 0 评论