Skip to contents

Extract predictions of the genotypic value from an object of class fitMod.

Usage

getGenoPred(
  fitMod,
  timePoints = names(fitMod),
  predictChecks = FALSE,
  outFile = NULL
)

Arguments

fitMod

An object of class fitMod.

timePoints

A character or numeric vector indicating the time point(s) for which the predictions should be extracted. When using a character string to reference a time point, the value has to be an exact match to one of the existing time points. When using a number it will be matched by its number ("timeNumber") in the timePoints attribute of the TP object.

predictChecks

Should predictions of the check genotypes be included in the ouptut. If TRUE a list of two data.frames is returned from the function, one with the predictions for the regular genotypes and one with the predictions for the checks.

outFile

A character string indicating the .csv file to which the results should be written. If NULL no file is written.

Value

A list of two data.frames with predicted genotypic values per time point. genoPred with the predicted values for the genotypes and checkPred with the predicted values for the checks. If predictChecks = FALSE the latter will be NULL.

See also

Other functions for spatial modeling: fitModels(), getCorrected(), getEffDims(), getHerit(), getVar(), plot.fitMod(), summary.fitMod()

Examples

## Using the first example dataset (PhenovatorDat1).
# \donttest{
phenoTP <- createTimePoints(dat = PhenovatorDat1,
                            experimentName = "Phenovator",
                            genotype = "Genotype",
                            timePoint = "timepoints",
                            repId = "Replicate",
                            plotId = "pos",
                            rowNum = "y", colNum = "x",
                            addCheck = TRUE,
                            checkGenotypes = c("check1", "check2",
                                               "check3", "check4"))
#> Warning: The following plotIds have observations for less than 50% of the time points:
#> c24r41, c7r18, c7r49

## Fit a SpATS model on few time points.
modPhenoSp <- fitModels(TP = phenoTP,
                        trait = "EffpsII",
                        timePoints = c(1, 6, 20))
#> 2018-05-31 16:37:00
#> 2018-06-02 09:07:00
#> 2018-06-05 14:37:00

## Extract the genotypic predictions for one time point:
genoPredSp <- getGenoPred(modPhenoSp,
                          timePoints = 6)
head(genoPredSp)
#> $genoPred
#>     timeNumber           timePoint genotype predicted.values standard.errors
#> 1            6 2018-06-02 09:07:00     G001        0.6664379     0.007700058
#> 2            6 2018-06-02 09:07:00     G002        0.6649805     0.007700359
#> 3            6 2018-06-02 09:07:00     G003        0.6569831     0.007704902
#> 4            6 2018-06-02 09:07:00     G004        0.6122083     0.007729850
#> 5            6 2018-06-02 09:07:00     G005        0.6576721     0.007697154
#> 6            6 2018-06-02 09:07:00     G006        0.6442406     0.007711890
#> 7            6 2018-06-02 09:07:00     G007        0.6620636     0.007709637
#> 8            6 2018-06-02 09:07:00     G008        0.6592120     0.007709473
#> 9            6 2018-06-02 09:07:00     G009        0.6386014     0.007697191
#> 10           6 2018-06-02 09:07:00     G010        0.6516471     0.007705202
#> 11           6 2018-06-02 09:07:00     G011        0.6750342     0.007708246
#> 12           6 2018-06-02 09:07:00     G012        0.6498224     0.007707951
#> 13           6 2018-06-02 09:07:00     G013        0.6605911     0.007700541
#> 14           6 2018-06-02 09:07:00     G014        0.6554624     0.007703979
#> 15           6 2018-06-02 09:07:00     G015        0.6597110     0.007705703
#> 16           6 2018-06-02 09:07:00     G016        0.6567955     0.007703997
#> 17           6 2018-06-02 09:07:00     G017        0.6591929     0.007695574
#> 18           6 2018-06-02 09:07:00     G018        0.6762427     0.007702262
#> 19           6 2018-06-02 09:07:00     G019        0.6659143     0.007707118
#> 20           6 2018-06-02 09:07:00     G020        0.6645302     0.007709326
#> 21           6 2018-06-02 09:07:00     G021        0.6846686     0.007701105
#> 22           6 2018-06-02 09:07:00     G022        0.6509674     0.008658303
#> 23           6 2018-06-02 09:07:00     G023        0.6830110     0.007702653
#> 24           6 2018-06-02 09:07:00     G024        0.6600209     0.007699111
#> 25           6 2018-06-02 09:07:00     G025        0.6445336     0.007702148
#> 26           6 2018-06-02 09:07:00     G026        0.6768089     0.007709682
#> 27           6 2018-06-02 09:07:00     G027        0.6544579     0.007699560
#> 28           6 2018-06-02 09:07:00     G028        0.6445496     0.007705877
#> 29           6 2018-06-02 09:07:00     G029        0.6693540     0.007699365
#> 30           6 2018-06-02 09:07:00     G030        0.6630166     0.007697679
#> 31           6 2018-06-02 09:07:00     G031        0.6601530     0.007701743
#> 32           6 2018-06-02 09:07:00     G032        0.6633195     0.007727830
#> 33           6 2018-06-02 09:07:00     G033        0.6645295     0.007703311
#> 34           6 2018-06-02 09:07:00     G034        0.6708713     0.007731471
#> 35           6 2018-06-02 09:07:00     G035        0.6536753     0.007729132
#> 36           6 2018-06-02 09:07:00     G036        0.6802631     0.007704726
#> 37           6 2018-06-02 09:07:00     G037        0.6612019     0.007698814
#> 38           6 2018-06-02 09:07:00     G038        0.6602141     0.007700083
#> 39           6 2018-06-02 09:07:00     G039        0.6735273     0.007700494
#> 40           6 2018-06-02 09:07:00     G040        0.6530825     0.007694335
#> 41           6 2018-06-02 09:07:00     G041        0.6621874     0.007707950
#> 42           6 2018-06-02 09:07:00     G042        0.6722508     0.008124089
#> 43           6 2018-06-02 09:07:00     G043        0.6612456     0.007701214
#> 44           6 2018-06-02 09:07:00     G044        0.6609375     0.007703963
#> 45           6 2018-06-02 09:07:00     G045        0.6787019     0.007702768
#> 46           6 2018-06-02 09:07:00     G046        0.6677625     0.007704307
#> 47           6 2018-06-02 09:07:00     G047        0.6654780     0.007698372
#> 48           6 2018-06-02 09:07:00     G048        0.6549039     0.007704991
#> 49           6 2018-06-02 09:07:00     G049        0.6449453     0.007711530
#> 50           6 2018-06-02 09:07:00     G050        0.6663340     0.007705456
#> 51           6 2018-06-02 09:07:00     G051        0.6611572     0.007727261
#> 52           6 2018-06-02 09:07:00     G052        0.6550151     0.007706797
#> 53           6 2018-06-02 09:07:00     G053        0.6585780     0.007705182
#> 54           6 2018-06-02 09:07:00     G054        0.6680242     0.007751794
#> 55           6 2018-06-02 09:07:00     G055        0.6703971     0.007729620
#> 56           6 2018-06-02 09:07:00     G056        0.6118391     0.007701664
#> 57           6 2018-06-02 09:07:00     G057        0.6645530     0.007723636
#> 58           6 2018-06-02 09:07:00     G058        0.6595585     0.007700130
#> 59           6 2018-06-02 09:07:00     G059        0.6652163     0.007705836
#> 60           6 2018-06-02 09:07:00     G060        0.6667614     0.007753973
#> 61           6 2018-06-02 09:07:00     G061        0.6642653     0.007699283
#> 62           6 2018-06-02 09:07:00     G062        0.6645500     0.007706543
#> 63           6 2018-06-02 09:07:00     G063        0.6699651     0.008116854
#> 64           6 2018-06-02 09:07:00     G064        0.6619514     0.007703589
#> 65           6 2018-06-02 09:07:00     G065        0.6651044     0.007733521
#> 66           6 2018-06-02 09:07:00     G066        0.6724889     0.007699851
#> 67           6 2018-06-02 09:07:00     G067        0.6611455     0.007701246
#> 68           6 2018-06-02 09:07:00     G068        0.6507050     0.008127772
#> 69           6 2018-06-02 09:07:00     G069        0.6613007     0.007739806
#> 70           6 2018-06-02 09:07:00     G070        0.6574314     0.008616607
#> 71           6 2018-06-02 09:07:00     G071        0.6694904     0.007703818
#> 72           6 2018-06-02 09:07:00     G072        0.6690957     0.007698006
#> 73           6 2018-06-02 09:07:00     G073        0.6632111     0.007702209
#> 74           6 2018-06-02 09:07:00     G074        0.6481942     0.007707940
#> 75           6 2018-06-02 09:07:00     G075        0.6686951     0.007707523
#> 76           6 2018-06-02 09:07:00     G076        0.6711070     0.007701188
#> 77           6 2018-06-02 09:07:00     G077        0.6612662     0.007697369
#> 78           6 2018-06-02 09:07:00     G078        0.6532985     0.007723672
#> 79           6 2018-06-02 09:07:00     G079        0.6640932     0.007694946
#> 80           6 2018-06-02 09:07:00     G080        0.6702728     0.007726926
#> 81           6 2018-06-02 09:07:00     G081        0.6760972     0.007696653
#> 82           6 2018-06-02 09:07:00     G082        0.6710345     0.007730372
#> 83           6 2018-06-02 09:07:00     G083        0.6488169     0.007710044
#> 84           6 2018-06-02 09:07:00     G084        0.6713796     0.007725933
#> 85           6 2018-06-02 09:07:00     G085        0.6744627     0.007699481
#> 86           6 2018-06-02 09:07:00     G086        0.6757281     0.007731798
#> 87           6 2018-06-02 09:07:00     G087        0.6509790     0.007732842
#> 88           6 2018-06-02 09:07:00     G088        0.6576374     0.007699586
#> 89           6 2018-06-02 09:07:00     G089        0.6605186     0.007699723
#> 90           6 2018-06-02 09:07:00     G090        0.6553467     0.007699184
#> 91           6 2018-06-02 09:07:00     G091        0.6703697     0.007704221
#> 92           6 2018-06-02 09:07:00     G092        0.6539418     0.007700623
#> 93           6 2018-06-02 09:07:00     G093        0.6604147     0.007715465
#> 94           6 2018-06-02 09:07:00     G094        0.6592644     0.008120315
#> 95           6 2018-06-02 09:07:00     G095        0.6711211     0.007699168
#> 96           6 2018-06-02 09:07:00     G096        0.6567808     0.007754300
#> 97           6 2018-06-02 09:07:00     G097        0.6612442     0.008126946
#> 98           6 2018-06-02 09:07:00     G098        0.6550896     0.007707885
#> 99           6 2018-06-02 09:07:00     G099        0.6607817     0.008193340
#> 100          6 2018-06-02 09:07:00     G100        0.6770290     0.010959465
#> 101          6 2018-06-02 09:07:00     G101        0.6775766     0.007700139
#> 102          6 2018-06-02 09:07:00     G102        0.6706355     0.007703304
#> 103          6 2018-06-02 09:07:00     G103        0.6615825     0.007697344
#> 104          6 2018-06-02 09:07:00     G104        0.6687181     0.007705662
#> 105          6 2018-06-02 09:07:00     G105        0.6643059     0.007729564
#> 106          6 2018-06-02 09:07:00     G106        0.6601783     0.007704042
#> 107          6 2018-06-02 09:07:00     G107        0.6385798     0.007701669
#> 108          6 2018-06-02 09:07:00     G108        0.6645371     0.007753134
#> 109          6 2018-06-02 09:07:00     G109        0.6566105     0.007701133
#> 110          6 2018-06-02 09:07:00     G110        0.6747622     0.007701680
#> 111          6 2018-06-02 09:07:00     G111        0.6409722     0.007703590
#> 112          6 2018-06-02 09:07:00     G112        0.6695963     0.007699623
#> 113          6 2018-06-02 09:07:00     G113        0.6679433     0.007701223
#> 114          6 2018-06-02 09:07:00     G114        0.6707194     0.007702253
#> 115          6 2018-06-02 09:07:00     G115        0.6768654     0.007698791
#> 116          6 2018-06-02 09:07:00     G116        0.6605405     0.007699775
#> 117          6 2018-06-02 09:07:00     G117        0.6751478     0.007700256
#> 118          6 2018-06-02 09:07:00     G118        0.6622331     0.007699093
#> 119          6 2018-06-02 09:07:00     G119        0.6529363     0.007709090
#> 120          6 2018-06-02 09:07:00     G120        0.6599894     0.007702553
#> 121          6 2018-06-02 09:07:00     G121        0.6705033     0.007702127
#> 122          6 2018-06-02 09:07:00     G122        0.6682551     0.007706948
#> 123          6 2018-06-02 09:07:00     G123        0.6475131     0.007707386
#> 124          6 2018-06-02 09:07:00     G124        0.6411380     0.007699575
#> 125          6 2018-06-02 09:07:00     G125        0.6691985     0.007703873
#> 126          6 2018-06-02 09:07:00     G126        0.6667264     0.007704937
#> 127          6 2018-06-02 09:07:00     G127        0.6678950     0.007697067
#> 128          6 2018-06-02 09:07:00     G128        0.6548751     0.007700656
#> 129          6 2018-06-02 09:07:00     G129        0.6650380     0.007727470
#> 130          6 2018-06-02 09:07:00     G130        0.6624278     0.007709811
#> 131          6 2018-06-02 09:07:00     G131        0.6713800     0.007707018
#> 132          6 2018-06-02 09:07:00     G132        0.6530011     0.007698864
#> 133          6 2018-06-02 09:07:00     G133        0.6638719     0.007700631
#> 134          6 2018-06-02 09:07:00     G134        0.6688086     0.007699578
#> 135          6 2018-06-02 09:07:00     G135        0.6665965     0.008118718
#> 136          6 2018-06-02 09:07:00     G136        0.6612019     0.007726583
#> 137          6 2018-06-02 09:07:00     G137        0.6625749     0.007698220
#> 138          6 2018-06-02 09:07:00     G138        0.6612678     0.007700833
#> 139          6 2018-06-02 09:07:00     G139        0.6768107     0.007703699
#> 140          6 2018-06-02 09:07:00     G140        0.6662416     0.007696663
#> 141          6 2018-06-02 09:07:00     G141        0.6781536     0.007699923
#> 142          6 2018-06-02 09:07:00     G142        0.6586183     0.008619330
#> 143          6 2018-06-02 09:07:00     G143        0.6677179     0.007715456
#> 144          6 2018-06-02 09:07:00     G144        0.6655668     0.007697878
#> 145          6 2018-06-02 09:07:00     G145        0.6626089     0.007709919
#> 146          6 2018-06-02 09:07:00     G146        0.6630299     0.007705597
#> 147          6 2018-06-02 09:07:00     G147        0.6621096     0.007700863
#> 148          6 2018-06-02 09:07:00     G148        0.6637336     0.007711971
#> 149          6 2018-06-02 09:07:00     G149        0.6623033     0.007725988
#> 150          6 2018-06-02 09:07:00     G150        0.6611395     0.007701117
#> 151          6 2018-06-02 09:07:00     G151        0.6703583     0.008137396
#> 152          6 2018-06-02 09:07:00     G152        0.6602543     0.007701790
#> 153          6 2018-06-02 09:07:00     G153        0.6561635     0.007710115
#> 154          6 2018-06-02 09:07:00     G154        0.6629187     0.007702880
#> 155          6 2018-06-02 09:07:00     G155        0.6705896     0.007703185
#> 156          6 2018-06-02 09:07:00     G156        0.6844003     0.007705869
#> 157          6 2018-06-02 09:07:00     G157        0.6610507     0.007715084
#> 158          6 2018-06-02 09:07:00     G158        0.6683279     0.007729605
#> 159          6 2018-06-02 09:07:00     G159        0.6661457     0.007698585
#> 160          6 2018-06-02 09:07:00     G160        0.6728815     0.008151421
#> 161          6 2018-06-02 09:07:00     G161        0.6682824     0.007727406
#> 162          6 2018-06-02 09:07:00     G162        0.6661318     0.007702443
#> 163          6 2018-06-02 09:07:00     G163        0.6678264     0.007726285
#> 164          6 2018-06-02 09:07:00     G164        0.6735394     0.007702346
#> 165          6 2018-06-02 09:07:00     G165        0.6563783     0.007703739
#> 166          6 2018-06-02 09:07:00     G166        0.6707537     0.007701172
#> 167          6 2018-06-02 09:07:00     G167        0.6440117     0.007705528
#> 168          6 2018-06-02 09:07:00     G168        0.6529146     0.007734770
#> 169          6 2018-06-02 09:07:00     G169        0.6684723     0.007704579
#> 170          6 2018-06-02 09:07:00     G170        0.6651630     0.007712559
#> 171          6 2018-06-02 09:07:00     G171        0.6648108     0.007699813
#> 172          6 2018-06-02 09:07:00     G172        0.6599931     0.007707282
#> 173          6 2018-06-02 09:07:00     G173        0.6546251     0.007731448
#> 174          6 2018-06-02 09:07:00     G174        0.6774589     0.007706590
#> 175          6 2018-06-02 09:07:00     G175        0.6486491     0.007703446
#> 176          6 2018-06-02 09:07:00     G176        0.6592223     0.007698616
#> 177          6 2018-06-02 09:07:00     G177        0.6538269     0.007712652
#> 178          6 2018-06-02 09:07:00     G178        0.6531421     0.008119709
#> 179          6 2018-06-02 09:07:00     G179        0.6588950     0.007711187
#> 180          6 2018-06-02 09:07:00     G180        0.6670155     0.007704359
#> 181          6 2018-06-02 09:07:00     G181        0.6094924     0.008125642
#> 182          6 2018-06-02 09:07:00     G182        0.6753670     0.007701206
#> 183          6 2018-06-02 09:07:00     G183        0.6561471     0.007698872
#> 184          6 2018-06-02 09:07:00     G184        0.6638217     0.007699844
#> 185          6 2018-06-02 09:07:00     G185        0.6596904     0.007737100
#> 186          6 2018-06-02 09:07:00     G186        0.6537197     0.007729561
#> 187          6 2018-06-02 09:07:00     G187        0.6612610     0.008122376
#> 188          6 2018-06-02 09:07:00     G188        0.6583949     0.007698748
#> 189          6 2018-06-02 09:07:00     G189        0.6565257     0.007735060
#> 190          6 2018-06-02 09:07:00     G190        0.6707160     0.007737670
#> 191          6 2018-06-02 09:07:00     G191        0.6566763     0.007703687
#> 192          6 2018-06-02 09:07:00     G192        0.6732723     0.007707968
#> 193          6 2018-06-02 09:07:00   check1        0.6659502     0.004303533
#> 194          6 2018-06-02 09:07:00   check2        0.5895666     0.005915225
#> 195          6 2018-06-02 09:07:00   check3        0.6675627     0.005784187
#> 196          6 2018-06-02 09:07:00   check4        0.6745496     0.004242575
#> 
#> $checkPred
#> NULL
#> 
# }