On 25/03/2015 12:30, Frederic Ntirenganya wrote:
Hi all,

I am doing analysis which involves fitting a line on trellis plot.

But the commands below (or at least the output from them) are not plotting commands.

 The
factor is month. As you know a year has 12 months and I expect to get
12 lines one for each month. I am getting the following results which
is different to my expectation. Am I have to do anything about the
data? Any suggestion is welcome. Thanks.


Call:
lm(formula = curr_data[[tmin_col]] ~ curr_data[[year_col]] -
     1 | curr_data[[month_col]])

It would be simpler to say
lm(tmin_col ~ year_col - 1 | month_col, data = curr_data)

What did you think this was going to do? Is there any mention in the help for lm that you can use the | here?

It would also be helpful to see the result of str(curr_data) as we do not know what year_col is and we need to be sure that month_col is indeed a factor.

I am sure calendar experts on this list are readying themselves to question your assertion that all calendars have twelve months but that is rather off-topic.


Residuals:
     Min      1Q  Median      3Q     Max
-5.0625 -0.7625  0.0375  0.9375  4.9375

Coefficients: (1 not defined because of singularities)
                                                        Estimate Std.
Error t value Pr(>|t|)
(Intercept)                                            15.56254
0.01079    1442   <2e-16 ***
curr_data[[year_col]]  | curr_data[[month_col]]TRUE       NA
NA      NA       NA
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.327 on 15115 degrees of freedom
   (72 observations deleted due to missingness)

Regards,

Frederic.


Frederic Ntirenganya
Maseno University,
African Maths Initiative,
Kenya.
Mobile:(+254)718492836
Email: fr...@aims.ac.za
https://sites.google.com/a/aims.ac.za/fredo/

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5751 / Virus Database: 4315/9378 - Release Date: 03/25/15


--
Michael
http://www.dewey.myzen.co.uk

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to