tags: R
Categories: 遗传参数
···
param= function(){
GA=as.matrix(read.table("GA.csv",h=F,sep=","))
PE
PE=as.matrix(read.table("PE.csv",h=F,sep=","))
Prity3PE
Parity3PE =as.matrix(read.table("Parity3PE.csv",h=F,sep=","))
CP
CP=as.matrix(read.table("CP.csv",h=F,sep=","))
Residual
R=as.matrix(read.table("R.csv",h=F,sep=","))
Phenotypic Variance
P1 = as.matrix(GA+PE+Parity3PE+R)
Heritabilities
h2 = as.matrix((diag(GA)/diag(P1)))
PE ratio
r =as.matrix(diag(GA+PE+Parity3PE) / diag(P1))
Genetic_correlation GC
diagGC=diag(x = 1, nrow(GA), ncol(GA), names = TRUE)
diag(diagGC) <- sqrt(diag(GA))
GC=solve(diagGC) %% GA %% solve(t(diagGC))
PE_correlation PEC
diagPEC=diag(x = 1, nrow(PE), ncol(PE), names = TRUE)
diag(diagPEC) <- sqrt(diag(PE+Parity3PE))
PEC = solve(diagPEC)%% (PE+Parity3PE) %% solve(t(diagPEC))
Phenotype_correlation PC
diagPC=diag(x = 1, nrow(P1), ncol(P1), names = TRUE)
diag(diagPC) <- sqrt(diag(P1))
PC = solve(diagPC)%% P1 %% solve(t(diagPC))
return(list(h2,r,GC,PC))
}
···
param()