Displaying 2 results from an estimated 2 matches for "predc".
Did you mean:
preds
2008 Jun 13
1
help with colsplit (reshape)
...I'm trying to figure out how to use the reshape package to reshape
data from a "wide" format to a "long" format. I have data like this
pid <- c(1:10)
predA <- c(-1,-2,-1,-2,-1,-2,-1,-2,-1,-2)
predB.1 <- c(0,0,0,1,1,0,0,0,1,1)
predB.2 <- c(2,2,3,3,3,2,2,3,3,3)
predC.1 <- c(10,10,10,10,10,11,11,11,11,11)
predC.2 <- c(12,12,13,13,13,12,12,13,13,13)
out.1 <- c(100:109)
out.2 <- c(200:209)
Data <- data.frame(pid, predA, predB.1, predB.2, predC.1, predC.2, out.
1, out.2)
and I want to make it look like this:
head(L.Data <- reshape(Data, varying...
2007 Jun 24
2
matlab/gauss code in R
...ePts, Observed = Obs, Individuals = colID)
>
> fmA <- lm(Observed ~ Time, mydata)
> fmB <- lm(Observed ~ poly(Time, 2), mydata)
> fmC <- lm(Observed ~ poly(Time, 2) * Individuals, mydata)
>
> mydata$PredA <- predict(fmA)
> mydata$PredB <- predict(fmB)
> mydata$PredC <- predict(fmC)
>
> xyplot(Observed + PredA + PredB + PredC ~ Time | Individuals,
> data = mydata,
> type = c("p", "l", "l", "l"),
> distribute.type = TRUE)
>
> -Deepayan
>
>
>
> --------------------------...