Julien Wist / 2017 / Universidad del Valle
Andrés Bernal / 2017 / ???
An up-to-date version of this notebook can be found here: https://github.com/jwist/chemometrics/
In [1]:
options(repr.plot.width=4, repr.plot.height=4)
In [3]:
# we load a few packages
library(ggplot2)
library(corrplot)
library(reshape2)
library(caret)
library(MASS) # for LDA
library(klaR) # for pls
library(pls)
library(e1071)# for pls
library(pROC) # for pls
library(vegan)
require(scales)
require(gridExtra);
In [4]:
load(url('https://github.com/jwist/chemometrics/raw/master/datasets/Coffee-IR-binned.rda'))
In [5]:
load(url('https://github.com/jwist/chemometrics/raw/master/datasets/Coffee-IR-ppm-binned.rda'))
In [8]:
load(url('https://github.com/jwist/chemometrics/raw/master/datasets/Coffee-NIR-binned.rda'))
In [9]:
load(url('https://github.com/jwist/chemometrics/raw/master/datasets/CoffeeiIR.rda'))
In [10]:
ls()
- 'allIRs'
- 'irscale'
- 'nirdev2scale'
- 'ppm1'
In [26]:
names(allIRs)
- 'nmr'
- 'ir'
- 'nir'
- 'metadata'
In [27]:
dim(allIRs$nir)
- 85
- 900
In [33]:
options(repr.plot.width=8, repr.plot.height=3)
plot(nirdev2scale, allIRs$nir[1,], type='l', xlab='freq', ylab='relative intensity')
In [59]:
matplot(t(allIRs$nir), type='l')
In [34]:
dim(allIRs$ir)
- 85
- 1037
In [35]:
options(repr.plot.width=8, repr.plot.height=3)
plot(irscale, allIRs$ir[1,], type='l', xlab='freq', ylab='relative intensity')
In [58]:
matplot(t(allIRs$ir), type='l')
In [36]:
allIRs$metadata
ID dateReception name country department city species composition presentation beneficioType ⋯ fermentationType drying dryingTime certification certificationType color Temp.roasting X.Humidity.Sinar species1 groups
1 AC1160 Feb 2012 Rove100-14 India NA NA Robusta 100 tostado molido y verde molido unknown ⋯ NA NA NA NA NA NA NA NA -1 Robusta
4 AC1161 Feb 2012 Rove100-15 Indonesia NA NA Robusta 100 tostado molido y verde molido unknown ⋯ NA NA NA NA NA NA NA NA -1 Robusta
7 AC1162 Feb 2012 Rove100-16 Vietnam NA NA Robusta 100 tostado molido y verde molido unknown ⋯ NA NA NA NA NA NA NA NA -1 Robusta
10 AC1163 Feb 2012 Rove100-17 Vietnam NA NA Robusta 100 tostado molido y verde molido unknown ⋯ NA NA NA NA NA NA NA NA -1 Robusta
13 AC1164 Feb 2012 Rove100-18 Indonesia NA NA Robusta 100 tostado molido y verde molido unknown ⋯ NA NA NA NA NA NA NA NA -1 Robusta
16 AC1168 Mar 2012 TPAAH12002 Colombia Tolima Ibague 100% ARABICA COLOMBIA 0 tostado molido y verde molido h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
22 AC1170 Mar 2012 TCHAH12003 Colombia Tolima Ibague 100% ARABICA COLOMBIA 0 tostado molido y verde molido h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
25 AC1171 Mar 2012 TICOAH12008 Colombia Tolima Ibague 100% ARABICA COLOMBIA 0 tostado molido y verde molido h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
28 AC1198 290312 BRAAS12062 Brazil NA NA Arabica 0 verde molido y tostado molido fino s ⋯ NA NA NA NA NA NA NA NA 1 Brazil
37 AC1201 290312 HPAAH12051 Colombia Huila Palestina 100% ARABICA COLOMBIA 0 tostado molido y verde molido h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
40 AC1204 290312 BRAAS12063 Brazil NA NA Arabica 0 verde molido y tostado molido fino s ⋯ NA NA NA NA NA NA NA NA 1 Brazil
43 AC1205 290312 HSMAH12053 Colombia Huila Santa María 100% ARABICA COLOMBIA 0 tostado molido y verde molido h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
46 AC1206 290312 HPAAH12049 Colombia Huila Paicol 100% ARABICA COLOMBIA 0 tostado molido y verde molido h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
52 AC1208 290312 HCOAH12050 Colombia Huila Colombia 100% ARABICA COLOMBIA 0 tostado molido y verde molido h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
58 AC1212 290312 MSMAH12043 Colombia Magdalena Santa Marta 100% ARABICA COLOMBIA 0 verde molido h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
61 AC1213 290312 BRAAS12064 Brazil NA NA Arabica 0 verde molido y tostado molido fino s ⋯ NA NA NA NA NA NA NA NA 1 Brazil
64 AC1216 290312 HNAAH12057 Colombia Huila Nataga 100% ARABICA COLOMBIA 0 tostado molido y verde molido h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
67 AC1217 290312 HTEAH12048 Colombia Huila Tesalia 100% ARABICA COLOMBIA 0 tostado molido y verde molido h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
76 AC1234 Jun2012 TANRS11078 Tanzania NA NA Robusta 100 verde molido y tostado molido fino s ⋯ NA NA NA NA NA NA NA NA -1 Robusta
79 AC1241 Jun2012 NBUAH12031 Colombia Narino Buesaco 100% ARABICA COLOMBIA 0 verde molido y tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
85 AC1243 Jun2012 NTAAH12033 Colombia Narino Taminango 100% ARABICA COLOMBIA 0 verde molido y tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
88 AC1246 Jun2012 NTBAH12036 Colombia Narino Tablon 100% ARABICA COLOMBIA 0 verde molido y tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
91 AC1247 Jun2012 NROAH12037 Colombia Narino Rosario 100% ARABICA COLOMBIA 0 verde molido y tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
94 AC1248 Jun2012 NSJAH12038 Colombia Narino San Jose 100% ARABICA COLOMBIA 0 verde molido y tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
97 AC1250 Jun2012 VIERS11068 Vietnam NA NA Robusta 100 verde molido y tostado molido fino s ⋯ NA NA NA NA NA NA NA NA -1 Robusta
100 AC1251 Jun2012 CAMRS11069 Cameroon NA NA Robusta 100 verde molido y tostado molido fino s ⋯ NA NA NA NA NA NA NA NA -1 Robusta
103 AC1252 Jun2012 TOGRS11070 Togo NA NA Robusta 100 verde molido y tostado molido fino s ⋯ NA NA NA NA NA NA NA NA -1 Robusta
106 AC1256 Jun2012 INDRH11073 India NA NA Robusta 100 verde molido y tostado molido fino h ⋯ NA NA NA NA NA NA NA NA -1 Robusta
109 AC1258 Jun2012 UGARS11075 Uganda NA NA Robusta 100 verde molido y tostado molido fino s ⋯ NA NA NA NA NA NA NA NA -1 Robusta
112 AC1260 Jun2012 SUMRS11077 Indonesia Sumatra NA Robusta 100 verde molido y tostado molido fino s ⋯ NA NA NA NA NA NA NA NA -1 Robusta
⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋱ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮
201 AC1347 80812 GUAAH12165 Guatemala Maracaturra NA Arabica 0 verde molido y tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Others
204 AC1348 80812 GUAAH12166 Guatemala Hueltuetenango NA Arabica 0 verde molido y tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Others
207 AC1349 80812 GUAAH12167 Guatemala Atitlan NA Arabica 0 verde molido y tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Others
210 AC1353 80812 CTIAH12172 Colombia Cauca Timbio 100% ARABICA COLOMBIA 0 verde molido y tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
213 AC1354 80812 CPIAH12173 Colombia Cauca Piendamo 100% ARABICA COLOMBIA 0 verde molido y tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
216 AC1355 80812 CPIAH12174 Colombia Cauca Piendamo 100% ARABICA COLOMBIA 0 verde molido y tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
219 AC1356 80812 CPIAH12175 Colombia Cauca Piendamo 100% ARABICA COLOMBIA 0 verde molido y tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
222 AC1358 80812 CPIAH12177 Colombia Cauca Piendamo 100% ARABICA COLOMBIA 0 verde molido y tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
225 AC1375 180213 BRAA?12187 Brazil NA NA Arabica 0 tostado molido fino unknown ⋯ NA NA NA NA NA NA NA NA 1 Brazil
231 AC1377 180213 PERAH12189 Peru NA NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Peru
234 AC1379 180213 CRIAH12191 Costa Rica NA NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Others
240 AC1382 180213 GUAAH12194 Guatemala Hueltuetenango NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Others
243 AC1387 180213 PERAH12199 Peru NA NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Peru
246 AC1388 180213 PERAH12200 Peru NA NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Peru
249 AC1389 180213 VIERS12201 Vietnam NA NA Robusta 100 tostado molido fino s ⋯ NA NA NA NA NA NA NA NA -1 Robusta
252 AC1394 180213 GUALH12206 Guatemala NA NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Others
255 AC1395 180213 GUALH12207 Guatemala NA NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Others
261 AC1404 190313 GUAAH12213 Guatemala NA NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Others
264 AC1405 190313 GUAAH12214 Guatemala NA NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Others
267 AC1406 190313 BRAA?12215 Brazil NA NA Arabica 0 tostado molido fino unknown ⋯ NA NA NA NA NA NA NA NA 1 Brazil
270 AC1407 190313 PERAH12216 Peru NA NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Peru
273 AC1409 190313 CRIAH12218 Costa Rica NA NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Others
276 AC1412 190313 PERAH12221 Peru NA NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Peru
279 AC1413 190313 GUAAH12222 Guatemala NA NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Others
288 AC1421 90413 GUAAH12231 Guatemala NA NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Others
291 AC1424 90413 CRIAH12234 Costa Rica NA NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Others
297 AC1428 90413 PERAH13239 Peru NA NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Peru
303 AC1432 90413 GUAAH13236 Guatemala NA NA Arabica 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Others
306 AC1436 150413 CPOAH13245 Colombia Cauca Popayan 100% ARABICA COLOMBIA 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
309 AC1437 150413 CINAH13246 Colombia Cauca Inza 100% ARABICA COLOMBIA 0 tostado molido fino h ⋯ NA NA NA NA NA NA NA NA 1 Colombia
In [40]:
allIRs$metadata$species
- Robusta
- Robusta
- Robusta
- Robusta
- Robusta
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- Arabica
- 100% ARABICA COLOMBIA
- Arabica
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- Arabica
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- Robusta
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- Robusta
- Robusta
- Robusta
- Robusta
- Robusta
- Robusta
- Arabica
- Robusta
- Robusta
- Robusta
- Arabica
- Arabica
- Arabica
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- Arabica
- Arabica
- Arabica
- Arabica
- Robusta
- Robusta
- Arabica
- Arabica
- Robusta
- Arabica
- Arabica
- Arabica
- Arabica
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
- Arabica
- Arabica
- Arabica
- Arabica
- Arabica
- Arabica
- Robusta
- Arabica
- Arabica
- Arabica
- Arabica
- Arabica
- Arabica
- Arabica
- Arabica
- Arabica
- Arabica
- Arabica
- Arabica
- Arabica
- 100% ARABICA COLOMBIA
- 100% ARABICA COLOMBIA
In [43]:
duplicated(allIRs$metadata$ID)
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
- FALSE
save colors by groups
In [ ]:
levels(allIRs$metadata$species) <- c(1,2,3)
groupColors = factor(allIRs$metadata$species)
levels(allIRs$metadata$species) <- c("AC", "A", "R")
In [78]:
matplot(t(allIRs$ir), type='l', col=groupColors)
In [37]:
Deriv1 <- function(x,y)
{
y.prime <- diff(y) / diff(x)
x.prime <- x[-length(x)] + diff(x)/2
list(shift = x.prime,
intensity = y.prime)
}
In [38]:
#function for computation of second derivative
Deriv2 <- function(x,y)
{
h <- x[2] - x[1]
Range <- 2:(length(x)-1) # Drop first and last points
list(shift = x[Range],
intensity = (y[Range+1] - 2*y[Range] + y[Range-1]) / h^2)
}
In [39]:
plot.with.error.bars <- function(x, matrix, col = "black",
ylim = range(c(apply(matrix, 2, mean) - apply(matrix, 2, sd),
apply(matrix, 2, mean) + apply(matrix, 2, sd))), ...){
avg <- apply(matrix,2,mean)
sdev <- apply(matrix,2,sd)
plot(x, avg, col = col, ylim = ylim, ...)
arrows(x, avg - sdev, x, avg + sdev, length=0.05, angle=90, code=3, col = col)
}
In [114]:
osc.lims <- function(predictors, responses, nComp, accuracy = 1e-5, maxit = 100){
X<-as.matrix(predictors)
Y<-as.matrix(responses)
###Create output arrays
xscores <- c()
yscores <- c()
xweights <- c()
xloadings <- c()
yweights <- c()
B <- c()
coefficients <- array(0, c(dim(X)[2], dim(Y)[2], nComp));
###Variables for loop control
iterations <- c();
deltas <- c();
#if (dim(Y)[2] == 1){
# maxit <- 1;
#}
###loop on components (aka latent variables)
for (j in 1:nComp) {
u <- matrix(Y[,1],ncol=1) #/ sqrt(sum(Y * Y)); #initial guess for Y score #/ sqrt(sum(Y * Y)) is apparently not necessary, double check
delta = 1000000;
lastt = NULL;
iteration = 0;
while (delta > accuracy && iteration < maxit){
iteration = iteration + 1
t=prcomp(X,scale=FALSE,center=FALSE)$x
tnew = 1 - (Y%*%solve(t(Y)%*%(Y))%*%t(Y))%*%t
w = ginv(X) %*% tnew # / c(crossprod(u)); # X weight is X transposed projected on y score# denominator is unnecessary since we normalize next
t = (X %*% w) #/ c(crossprod(w));
p = t(t(t)%*%X) %*% (ginv(t%*%tnew))
if (!is.null(lastt)){
delta = sqrt(c(crossprod(t - lastt)));
}
lastt = t;
}
iterations = c(iterations, iteration);
deltas = c(deltas, delta);
##Save current component results
xweights = cbind(xweights, w);
xscores = cbind(xscores, t);
xloadings = cbind(xloadings, p);
#B = c(B,b);
#coefficients[,,j] = ginv(t(xloadings)) %*% (B * t(yweights));
##Deflate
E = X- t%*%t(p)
}
###return results
result <- list("xweights" = xweights,"xscores" = xscores,
"xloadings" = xloadings, "X"=E,"iterations" = iterations, "deltas" = deltas);
### results is of a class for multivariate regression models (testing)
class(result) = "model";
result;
}
In [115]:
osc <- osc.lims(as.matrix(allIRs$ir), as.matrix(as.numeric(allIRs$metadata$species)), nComp=2, accuracy = 1e-5, maxit = 100)
In [126]:
Y <- as.matrix(as.numeric(allIRs$metadata$species))
In [135]:
solve(t(Y)%*%(Y))
0.002898551
In [131]:
(Y%*%solve(t(Y)%*%(Y))%*%t(Y))
0.026086957 0.026086957 0.026086957 0.026086957 0.026086957 0.008695652 0.008695652 0.008695652 0.017391304 0.008695652 ⋯ 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.008695652 0.008695652
0.026086957 0.026086957 0.026086957 0.026086957 0.026086957 0.008695652 0.008695652 0.008695652 0.017391304 0.008695652 ⋯ 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.008695652 0.008695652
0.026086957 0.026086957 0.026086957 0.026086957 0.026086957 0.008695652 0.008695652 0.008695652 0.017391304 0.008695652 ⋯ 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.008695652 0.008695652
0.026086957 0.026086957 0.026086957 0.026086957 0.026086957 0.008695652 0.008695652 0.008695652 0.017391304 0.008695652 ⋯ 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.008695652 0.008695652
0.026086957 0.026086957 0.026086957 0.026086957 0.026086957 0.008695652 0.008695652 0.008695652 0.017391304 0.008695652 ⋯ 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.008695652 0.008695652
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.026086957 0.026086957 0.026086957 0.026086957 0.026086957 0.008695652 0.008695652 0.008695652 0.017391304 0.008695652 ⋯ 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.008695652 0.008695652
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.026086957 0.026086957 0.026086957 0.026086957 0.026086957 0.008695652 0.008695652 0.008695652 0.017391304 0.008695652 ⋯ 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.008695652 0.008695652
0.026086957 0.026086957 0.026086957 0.026086957 0.026086957 0.008695652 0.008695652 0.008695652 0.017391304 0.008695652 ⋯ 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.008695652 0.008695652
0.026086957 0.026086957 0.026086957 0.026086957 0.026086957 0.008695652 0.008695652 0.008695652 0.017391304 0.008695652 ⋯ 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.008695652 0.008695652
0.026086957 0.026086957 0.026086957 0.026086957 0.026086957 0.008695652 0.008695652 0.008695652 0.017391304 0.008695652 ⋯ 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.008695652 0.008695652
0.026086957 0.026086957 0.026086957 0.026086957 0.026086957 0.008695652 0.008695652 0.008695652 0.017391304 0.008695652 ⋯ 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.008695652 0.008695652
0.026086957 0.026086957 0.026086957 0.026086957 0.026086957 0.008695652 0.008695652 0.008695652 0.017391304 0.008695652 ⋯ 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.008695652 0.008695652
⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋱ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.026086957 0.026086957 0.026086957 0.026086957 0.026086957 0.008695652 0.008695652 0.008695652 0.017391304 0.008695652 ⋯ 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.008695652 0.008695652
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.017391304 0.017391304 0.017391304 0.017391304 0.017391304 0.005797101 0.005797101 0.005797101 0.011594203 0.005797101 ⋯ 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.011594203 0.005797101 0.005797101
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
0.008695652 0.008695652 0.008695652 0.008695652 0.008695652 0.002898551 0.002898551 0.002898551 0.005797101 0.002898551 ⋯ 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.005797101 0.002898551 0.002898551
In [ ]:
In [ ]:
In [116]:
summary(osc)
Length Class Mode
xweights 176290 -none- numeric
xscores 14450 -none- numeric
xloadings 176290 -none- numeric
X 88145 AsIs numeric
iterations 2 -none- numeric
deltas 14450 -none- numeric
In [117]:
dim(osc$xscores)
- 85
- 170
In [118]:
plot(osc$xscores[,1], osc$xscores[,2], col=groupColors)
In [119]:
dim(osc$xloadings)
- 1037
- 170
In [120]:
matplot(osc$xloadings, type='l', col=groupColors)
In [121]:
matplot(t(osc$X), type='l', col=groupColors)
In [77]:
- R
- R
- R
- R
- R
- AC
- AC
- AC
- A
- AC
- A
- AC
- AC
- AC
- AC
- A
- AC
- AC
- R
- AC
- AC
- AC
- AC
- AC
- R
- R
- R
- R
- R
- R
- A
- R
- R
- R
- A
- A
- A
- AC
- AC
- AC
- AC
- AC
- AC
- AC
- AC
- A
- A
- A
- A
- R
- R
- A
- A
- R
- A
- A
- A
- A
- AC
- AC
- AC
- AC
- AC
- A
- A
- A
- A
- A
- A
- R
- A
- A
- A
- A
- A
- A
- A
- A
- A
- A
- A
- A
- A
- AC
- AC
In [ ]:
In [ ]:
Content source: jwist/chemometrics
Similar notebooks: