Dear Eric,
Many thanks for your reply.
Best Regards,
Ashim
On Wed, Nov 14, 2018 at 4:05 PM Eric Berger wrote:
> Hi Ashim,
> Per the help page for arima(), it fits an ARIMA model to the specified
> time series - but the caller has to specify the order - i.e. (p,d,q) - of
> the model.
> The defa
Another way:
> A <- matrix(1:9,3,3,
dimnames=list(Row=paste0("r",1:3),Col=paste0("c",1:3)))
> A
Col
Row c1 c2 c3
r1 1 4 7
r2 2 5 8
r3 3 6 9
> matrix( A[row(A)!=col(A)], nrow(A)-1, ncol(A), dimnames=list(NULL,
colnames(A)))
c1 c2 c3
[1,] 2 4 7
[2,] 3 6 8
Bill Dunlap
An even better solution because it has fewer steps.
A <- matrix(1:9, 3, 3)
A
B <- A[-1, ]
B[upper.tri(B, diag=FALSE)] <- A[upper.tri(A)]
B
> A <- matrix(1:9, 3, 3)
> A
[,1] [,2] [,3]
[1,]147
[2,]258
[3,]369
> B <- A[-1, ]
> B[upper.tri(B, diag=FALSE)] <- A
Steve's method is very slick.
I think this is a bit easier to understand.
A <- matrix(1:9, 3, 3)
A
B <- matrix(nrow=2, ncol=3)
B[lower.tri(B, diag=TRUE)] <- A[lower.tri(A)]
B[upper.tri(B, diag=FALSE)] <- A[upper.tri(A)]
B
> A <- matrix(1:9, 3, 3)
> A
[,1] [,2] [,3]
[1,]147
[2,]
On behalf of the American Statistical Association sections mentioned
below, I am forwarding the information that recently appeared on the
Statistical Computing Section web at
https://community.amstat.org/stat-computing/data-expo/data-expo-2019.
Old-timers will know that the ASA Data Challenge
Sarah's answer is probably the best approach, but to do it using very basic R
methods that predate the very good spatial support that R now has, I would
likely do this:
## Thanks, Jim Lemon, for this step:
df1 <- read.table(text=
"latitude longitude Precip
45.5 110.5 3.2
45
> With your code you just remove diagonal elements from your matrix.
Worse; it removed _all_ elements from the matrix that match _anything_ in the
diagonal!
Which, in that example, was everything ...
***
This email and any attach
i) Your code creates w2 but references w1 to create aa.
So you needed
aa <- matrix(rep(c(0.4, 0.1, 0.2), 3), 3,3)
for a working example.
ii) This
> matrix(as.numeric(aa)[!as.numeric(aa) %in% diag(aa)],2,3)
removes any value that is present in the diagonal of aa. Look up ?"%in%" to see
what that
hello
for examplei have this matrix
w2<-c(0.1,0.2,0.4,0.2,0.4,0.1)aa<-matrix(w1,nrow=3,ncol=3)aa
[,1] [,2] [,3]
[1,] 0.4 0.4 0.4
[2,] 0.1 0.1 0.1
[3,] 0.2 0.2 0.2
if i use this code
matrix(as.numeric(aa)[!as.numeric(aa) %in% diag(aa)],2,3)
i will obtaine this matrix[,1] [,2] [,3]
[
> On 13 Nov 2018, at 16:19 , Paul Johnson wrote:
>
> Long ago, when R's t.test had var.equal=TRUE by default, I wrote some
> class notes showing that the result was equivalent to a one predictor
> regression model. Because t.test does not default to var.equal=TRUE
> these days, I'm curious to
Hi
Your mail is mess due to HTML formating. Please use plain taxt mail.
You got an advice, did you try it?
With your code you just remove diagonal elements from your matrix. If this is
not your intention, you should specify more clearly what do you want to achieve
as the result.
Cheers
Petr
>
helloi didn't obtaine the matrix after extrat non diagonalmy
programx<-rnorm(6,0,1)
aa<-matrix(x,nrow=6,ncol=6)
matrix(as.numeric(aa)[!as.numeric(aa) %in% diag(aa)],5,6)
nrow=5ncol=6thank you
[[alternative HTML version deleted]]
__
R-help@r-p
# construct the dataframe
`TK-QUADRANT` <- c(9161,9162,9163,9164,10152,10154,10161,10163)
LAT <-
c(55.07496,55.07496,55.02495,55.02496,54.97496,54.92495,54.97496,54.92496)
LON <-
c(8.37477,8.458109,8.37477,8.45811,8.291435,8.291437,8.374774,8.374774)
df <- data.frame(`TK-QUADRANT`=`TK-QUADRANT`,L
When that arrived it was a complete mess since you posted in HTML which
scrambles your code and you sent code which had syntax errors. Please
try again by posting in plain text and cut and paste your code. It would
also help if you stated exactly what you expected your output to consist of.
Mi
Hi.
You did not specify what do you want to do with the result.
functions
upper.tri, lower.tri and diag can manipulate parts of matrices.
Cheers
Petr
> -Original Message-
> From: R-help On Behalf Of malika yassa via R-
> help
> Sent: Wednesday, November 14, 2018 12:20 PM
> To: R-help
helloplease i have this matrixx<-rnorm(6,0,1)
aa<-matrix(x,nrow=6,ncol=6)
i have to extrat non diagonal value, i use this code
matrix(as.numeric(aa)[!as.numeric(aa) %in% diag(aa)],5,6)
but i didn't get the resultthank you
[[alternative HTML version deleted]]
__
Hi Ashim,
Per the help page for arima(), it fits an ARIMA model to the specified time
series - but the caller has to specify the order - i.e. (p,d,q) - of the
model.
The default order is (0,0,0) (per the help page). Hence your two calls are
different. The first call is equivalent to order=c(0,0,0)
Dear Eric and William,
Why do the 1st and 2nd incantation of arima return sigma^2 as 5.233 vs
.?
The help for arima says ---> sigma2: the MLE of the innovations variance.
By that account the 1st result is incorrect. I am a little confused.
set.seed(123)
b <- arima.sim(list(order = c(1,0,0),
18 matches
Mail list logo