Hello,
Firstly let me explain that the nature of what I want to do is actually
beyond my statistical knowledge, having only taken a second year
university stats course last year. Therefore I may have missed the
statistical essence of what I want to do as well as my lack of ability
to do it in R.
  I am trying to fit some hospital admissions data to a series of
weather variables. Due to my lack of knowledge, I am making the crude
assumption that the admissions have normally distributed errors (I have
taken the square root to stabalise the variance and it looks ok on a QQ
plot). Having fitted a series of linear models, I seem to have highly
significant p-values with very low R^2 (although we would presumably
expect R^2 to be fairly low as I am dealing in health data). I think the
p-values are probably artificially low as I have two many degrees of
freedom (I have 1530 observations in my dataset). I am also severely
breaking the assumption that the observations are independent of each
other as clearly temperature on one day is highly correlated with the
temperature on previous days, etc. I would therefore like to look at a
weighted regression as I believe this will reduce the degrees of freedom
(is this correct), giving larger p-values (which is ok) and hopefully
larger R^2 values. I just want to look at a vector of constant weights. 
  Now, having not done the theory, I assume that I need one weight for
each observation? And also one weight for each variable? So is my
so-called "vector" of weights actually a matrix? Or have I got this
totally wrong? 
  And if so, how to include it in lm in R? Obviously using the weights
argument. 
So for example I did,
weights=rep(0.15,1530)
(that's ok isn't it)?
But when I ran lm with this argument and just one variable, the number
of degrees of freedom wasn't reduced (i.e. I still had 2 and 1528
degrees of freedom).
So basically what I am asking is, do I need a weight for each
observation, and a weight for each variable, forming a matrix of
weights? Or just a vector of a weight for every observation, or just a
vector of weights for every variable? 
Initially I have six variables that I am interested in, so perhaps
somebody could reply with an example, say the variables are x1-x6?   
Thanks very much in advance.

Robin Williams
Met Office summer intern - Health Forecasting
[EMAIL PROTECTED] 

 

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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