[R] predicting without a model

Felipe Carrillo mazatlanmexico at yahoo.com
Tue May 11 20:22:51 CEST 2010

I have 5 years of weekly passage data and want to predict fish passage
for the following year. I don't have a model to use to predict data for
the sixth year. Can I somehow still predict based on these five years?
I just want to see on the graph what the predicted year would look like
and how those new values are generated. Gracias 
 fall <- structure(list(week = c(48L, 49L, 50L, 51L, 52L, 1L, 2L, 3L, 
4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 
18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 
31L, 32L, 33L, 34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 
44L, 45L, 46L, 47L), BY2009 = c(133L, 3599L, 19293L, 1400757L, 
1594507L, 2052187L, 3376236L, 5778048L, 6163335L, 6399815L, 6818616L, 
6919183L, 7051636L, 7295812L, 7347721L, 7369703L, 7374776L, 7376542L, 
7382576L, 7736453L, 7989938L, 8107309L, 8218383L, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), BY2008 = c(1458L, 11406L, 
25164L, 98137L, 429803L, 689344L, 963184L, 1312894L, 2161068L, 
2401375L, 3006642L, 4307369L, 5614661L, 6630939L, 6776930L, 6859756L, 
6869892L, 6876532L, 6886570L, 7104424L, 7364601L, 7805950L, 7906434L, 
8005774L, 8158304L, 8243308L, 8310733L, 8401212L, 8474341L, 8600614L, 
8720752L, 8862874L, 8986228L, 9057916L, 9109962L, 9140033L, 9164944L, 
9179118L, 9187147L, 9196092L, 9197854L, 9197937L, 9198146L, 9198146L, 
9198560L, 9198644L, 9200826L, 9200876L, 9200876L, 9200876L, 9200876L, 
9200876L), BY2007 = c(1198L, 24218L, 66086L, 747653L, 994288L, 
1692360L, 2356022L, 2801027L, 3854652L, 5956156L, 6918275L, 7803125L, 
9352350L, 10068694L, 10149151L, 10186205L, 10208371L, 10217151L, 
10227754L, 10253107L, 10332407L, 10437833L, 10674552L, 10858356L, 
11066029L, 11297526L, 11620839L, 11863328L, 12039528L, 12163605L, 
12259731L, 12402784L, 12492540L, 12588194L, 12660129L, 12708489L, 
12733659L, 12741729L, 12747309L, 12751791L, 12756008L, 12756723L, 
12756887L, 12757170L, 12757259L, 12757335L, 12757335L, 12757376L, 
12757420L, 12757535L, 12757572L, 12757572L), BY2006 = c(638L, 
7256L, 168407L, 240003L, 1105744L, 1473358L, 1966370L, 2541123L, 
3053125L, 3530039L, 7014740L, 8992174L, 9521796L, 10799067L, 
10980023L, 11136954L, 11212576L, 11280414L, 11366813L, 11595285L, 
11978213L, 12505817L, 12901199L, 13244327L, 13451395L, 13757741L, 
14102109L, 14485419L, 14854943L, 15299435L, 15643435L, 15927148L, 
16145466L, 16467177L, 16532330L, 16576229L, 16599571L, 16610983L, 
16616614L, 16619056L, 16621892L, 16623003L, 16623835L, 16624108L, 
16624108L, 16624189L, 16624231L, 16624231L, 16624271L, 16624271L, 
16624271L, 16624271L), BY2005 = c(20312L, 67525L, 110417L, 1956158L, 
2725094L, 3397913L, 4070732L, 4684837L, 5790037L, 6964945L, 7766074L, 
8586577L, 9157692L, 9638537L, 10176641L, 10714745L, 11068492L, 
11455305L, 11951353L, 12447401L, 13089726L, 13432371L, 14250269L, 
14909179L, 15198104L, 15487029L, 15775954L, 16064879L, 16353804L, 
16545454L, 16624048L, 16710905L, 16791227L, 16866143L, 16908224L, 
16936545L, 16961204L, 16979235L, 16991347L, 16998116L, 17001562L, 
17003213L, 17004041L, 17004041L, 17004091L, 17004091L, 17004207L, 
17004207L, 17004207L, 17004207L, 17004254L, 17004254L)), .Names = c("week", 
"BY2009", "BY2008", "BY2007", "BY2006", "BY2005"), class = "data.frame", row.names = c(NA, 
fall$week <- ordered(spring$week,levels=c(48:52,1:47))
fall$WEEK <- 1:52
fallmelt <- melt(fall,id=c("week","WEEK"))
ggplot(fallmelt,aes(WEEK,value/1000,linetype=variable,colour=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") 
Felipe D. Carrillo
Supervisory Fishery Biologist
Department of the Interior
US Fish & Wildlife Service
California, USA


More information about the R-help mailing list