[R] predicting without a model

Felipe Carrillo mazatlanmexico at yahoo.com
Tue May 11 21:46:36 CEST 2010


Exactly what I want, thanks a lot Ben.
 
Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish & Wildlife Service
California, USA



----- Original Message ----
> From: Ben Bolker <bolker at ufl.edu>
> To: r-help at stat.math.ethz.ch
> Sent: Tue, May 11, 2010 12:11:00 PM
> Subject: Re: [R] predicting without a model
> 
> Felipe Carrillo <mazatlanmexico <at> > href="http://yahoo.com">yahoo.com> writes:

## snip

  
> In the absence of any other information, I would say your
best bet would just 
> be to take the weekly average across the
previous years.  There are lots 
> of ways to do this (tapply,
aggregate, etc.), but cast() 
> works:

fallavg <- 
> cast(fallmelt,value="value",WEEK~.,fun.aggregate=mean,
      
>           na.rm=TRUE)
names(fallavg)[2] <- 
> "value"
fallavg$variable <- 
> "predicted"
ggplot(fallmelt,aes(WEEK,value/1000,linetype=variable,
  
>                   
> colour=variable,fill=variable)) +
  geom_line(size=1)+
  
> theme_bw() +
  scale_x_continuous(breaks=seq(1,52,3),
    
>                 
> labels=levels(fall$week)[seq(1,52,3)],) + 
  opts(title="Fall 
> Cumulative") +
  labs(y="Number of fish X 1,000",x="WEEK")+
  
> geom_line(data=fallavg,size=2)

______________________________________________
> ymailto="mailto:R-help at r-project.org" 
> href="mailto:R-help at r-project.org">R-help at r-project.org mailing list
> href="https://stat.ethz.ch/mailman/listinfo/r-help" target=_blank 
> >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.






More information about the R-help mailing list