0

I have a data set like this:

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
  

the SAS code is

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;

what I tried was this

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

but I do get an error

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

i don't understand the 'family' column.

Onyambu
  • 67,392
  • 3
  • 24
  • 53
R.Merritt
  • 477
  • 5
  • 17
  • consider using `data = MDA_plot_controls, family = binomial` for example – Onyambu Dec 20 '20 at 07:11
  • What??? use , family = binomial in the R command ? I am trying to convert this to R? Im do not understand what you arre saying – R.Merritt Dec 21 '20 at 00:00
  • 1
    `glm(Value ~ factor(Row) + factor(Column),binomial(), MDA_plot_controls)` is what you are looking for – Onyambu Dec 21 '20 at 00:26
  • I don't know the sasLM package. What's wrong with good ole lm() – Russ Lenth Dec 21 '20 at 00:48
  • Aggh I am trying to recreate the functionality of SAS PROC GLM ...that is why I am trying sasLM – R.Merritt Dec 21 '20 at 02:12
  • glm(Value ~ factor(Row) + factor(Column),binomial(), MDA_plot_controls gives me an error Error in eval(family$initialize) : y values must be 0 <= y <= 1 – R.Merritt Dec 21 '20 at 02:24
  • BY Year Location Trait; in the SAS function seems to be missing – R.Merritt Dec 21 '20 at 04:58
  • In SAS, GLM refers to a general linear model. In R, glm refers to a *generalized* linear model, which is a whole different animal. Certainly, a `glm()` call with a binomial response is nothing at all like anything that PROC GLM does. The R function `lm()` is pretty much the equivalent of SAS PROC GLM. That is why I suggested it. – Russ Lenth Dec 23 '20 at 15:18
  • OK thanks Ross , I think the sasLM::GLM is supposed to mirror the SAS GLM but Like I said I cannot see where to replicate the lines mentioned. So I will give lm() a shot – R.Merritt Dec 23 '20 at 21:53
  • The error message refers to R's `glm` function which suggests otherwise. Look at what the documentation says and be careful with "generalized" vs. "general" – Russ Lenth Dec 25 '20 at 02:17
  • OK can I ask how I specify the GLM package in require(sasLM) – R.Merritt Dec 26 '20 at 01:49
  • https://cran.r-project.org/web/packages/sasLM/index.html – R.Merritt Dec 29 '20 at 02:56

0 Answers0