首页 > 解决方案 > 试图将 SAS GLM 翻译成 R sasLM::GLM

问题描述

我有一个这样的数据集:

X1 Record  Plot   Row Column    Cp   Csp Entry  Year Location Genotype Trait Value Whole_plot
 <dbl>  <dbl> <dbl> <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl> <chr>    <chr>    <chr> <dbl> <chr>     
 1  3256    717   566     6      7     0     2   717  2019 Preston  Novelty  STD       5 6 + 7     
 2  3263    716   567     6      7     0     1   716  2019 Preston  Flanders STD       4 6 + 7     
 3  3893    716   657     7      8     0     1   716  2019 Preston  Flanders STD       2 7 + 8     
 4  3900    717   658     7      8     0     2   717  2019 Preston  Novelty  STD       2 7 + 8     
 5  4698    716   772     9      3     0     1   716  2019 Preston  Flanders STD       3 9 + 3     
 6  4712    717   774     9      3     0     2   717  2019 Preston  Novelty  STD       3 9 + 3     
 7  3257    717   566     6      7     0     2   717  2019 Preston  Novelty  V1        5 6 + 7     
 8  3264    716   567     6      7     0     1   716  2019 Preston  Flanders V1        4 6 + 7     
 9  3894    716   657     7      8     0     1   716  2019 Preston  Flanders V1        3 7 + 8     
10  3901    717   658     7      8     0     2   717  2019 Preston  Novelty  V1        3 7 + 8
  

SAS代码是

PROC GLM DATA=MAD.MDA_plot_subplot_controls outstat=MAD.subplot_control_anova_stat;
    BY Year Location Trait;
    CLASS  Whole_plot Genotype;
    MODEL Value = Whole_plot Genotype/SS3;
    RANDOM Whole_plot; 
    LSMEANS Whole_plot;
RUN;
QUIT;

我试过的是这个

  require(sasLM)
  glm(Value ~ factor(Row) + factor(Column),MDA_plot_controls)

但我确实得到了一个错误

Error in glm(Value ~ factor(Row) + factor(Column), MDA_plot_controls) : 
  'family' not recognized
In addition: Warning message:
Unknown or uninitialised column: `family`.

我不明白“家庭”一栏。

标签: rsasglm

解决方案


推荐阅读