similar to: Combining 2 arrays into a third array via a function

Displaying 20 results from an estimated 300 matches similar to: "Combining 2 arrays into a third array via a function"

2009 Jan 10
2
Print specific matrix value???
Hello All, I'm trying to print specific row and column for Observed_Scores matrix, however, when I execute the command "Observed_Scores[1,1]", I get the message "Error in Observed_Scores[1, 1] : incorrect number of dimensions". Could you please help and let me know where is the mistake? Here is my program: library(ltm) library(psych) # Settting the working directory
2012 Dec 09
1
about loop, 10 times, 10 matrix
Dear all: I have simulated ability(500 examinees) and difficulty(40 items). as: N <- 500 theta <- rnorm( N ) I <- 40 b <- seq( -2 , 2 , len=I ) p1 <- plogis( outer( theta, b, "-" ) ) I want to simulate 10 responses matrix through this syntax: respR <- 1 * ( p1 > matrix( runif( N*I ) , nrow=N , ncol=I ) ) I tried this: n<-10 respR<-list() for(i in 1:n){
2009 Jan 28
1
stack data sets
Hi All, I'm generating 10 different data sets with 1 and 0 in a matrix form and writing the output in separate files. Now I need to stack all these data sets in one vector and I know that stack only operates on list or data frame however I got these data sets by converting list to a matrix so can't go backwards now. Is there a way i can still use Stack? Please see the program:
2008 Jul 26
4
parametric bootstrap
Hi I am trying to find a parametric bootstrap confidence interval and when I used the boot function I get zero bias and zero st.error? What could be my mistake? Thank you and take care. Laila [[alternative HTML version deleted]]
2023 Aug 20
2
Issues when trying to fit a nonlinear regression model
Dear Bert, Thank you so much for your kind and valuable feedback. I tried finding the starting values using the approach you mentioned, then did the following to fit the nonlinear regression model: nlregmod2 <- nls(y ~ theta1 - theta2*exp(-theta3*x), start = list(theta1 = 0.37, theta2 = exp(-1.8), theta3 =
2008 Jun 27
3
For loop
Hi, Could you please let me know to use a list in a for loop here geneset is a loop.I am trying to match the names of the list with 1st row of the output. result<- list() for(i in 1:length(output) { result[[i]] <- geneset(which(geneset %n% output[,1])) } Kindly help me out -- View this message in context: http://www.nabble.com/For-loop-tp18163665p18163665.html Sent from the R
2008 Nov 26
1
Finding Stopping time
Can any one help me to solve problem in my code? I am actually trying to find the stopping index N. So first I generate random numbers from normals. There is no problem in finding the first stopping index. Now I want to find the second stopping index using obeservation starting from the one after the first stopping index. E.g. If my first stopping index was 5. I want to set 6th observation from
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
Oh, sorry; I changed signs in the model, fitting theta0 + theta1*exp(theta2*x) So for theta0 - theta1*exp(-theta2*x) use theta1= -.exp(-1.8) and theta2 = +.055 as starting values. -- Bert On Sun, Aug 20, 2023 at 11:50?AM Paul Bernal <paulbernal07 at gmail.com> wrote: > Dear Bert, > > Thank you so much for your kind and valuable feedback. I tried finding the > starting
2023 Aug 20
3
Issues when trying to fit a nonlinear regression model
Dear friends, This is the dataset I am currently working with: >dput(mod14data2_random) structure(list(index = c(14L, 27L, 37L, 33L, 34L, 16L, 7L, 1L, 39L, 36L, 40L, 19L, 28L, 38L, 32L), y = c(0.44, 0.4, 0.4, 0.4, 0.4, 0.43, 0.46, 0.49, 0.41, 0.41, 0.38, 0.42, 0.41, 0.4, 0.4 ), x = c(16, 24, 32, 30, 30, 16, 12, 8, 36, 32, 36, 20, 26, 34, 28)), row.names = c(NA, -15L), class =
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
Dear Bert, Thank you for your extremely valuable feedback. Now, I just want to understand why the signs for those starting values, given the following: > #Fiting intermediate model to get starting values > intermediatemod <- lm(log(y - .37) ~ x, data=mod14data2_random) > summary(intermediatemod) Call: lm(formula = log(y - 0.37) ~ x, data = mod14data2_random) Residuals: Min
2009 Nov 02
1
need help in using Hessian matrix
Hi I need to find the Hessian matrix for a complicated function from a certain kind of data but i keep getting this error Error in f1 - f2 : non-numeric argument to binary operator the data is given by U<-runif(n) Us<-sort(U) tau1<- 2 F1tau<- pgamma((tau1/theta1),shape,1) N1<-sum(Us<F1tau) X1<- Us[1:N1]
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
Basic algebra and exponentials/logs. I leave those details to you or another HelpeR. -- Bert On Sun, Aug 20, 2023 at 12:17?PM Paul Bernal <paulbernal07 at gmail.com> wrote: > Dear Bert, > > Thank you for your extremely valuable feedback. Now, I just want to > understand why the signs for those starting values, given the following: > > #Fiting intermediate model to get
2004 May 15
2
questions about optim
Hi, I am trying to do parameter estimation with optim, but I can't get it to work quite right-- I have an equation X = Y where X is a gaussian, Y is a multinomial distribution, and I am trying to estimate the probabilities of Y( the mean and sd of X are known ), Theta1, Theta2, Theta3, and Theta4; I do not know how I can specify the constraint that Theta1 + Theta2 + Theta3 + Theta4 = 1 in
2008 Apr 22
4
how to convert non numeric data into numeric?
I am having the following error in my function function(theta,reqdIRR) { theta1<-theta[1] theta2<-theta[2] n<-length(reqdIRR) constant<- n*(theta1+theta2) sum1<-lapply(reqdIRR*exp(theta1),FUN = sum) sum2<-lapply(exp(theta2 - reqdIRR*exp(theta1)),FUN = sum) sum = sum1 + sum2 log.fcn = constant - as.numeric(sum) result = - log.fcn return(result) } *error :
2008 Jul 03
0
FW: For loop
HiI have a specific sample coming from a gamma(alpha,theta1) distribution and then divided into two parts first part follows a gamma(alpha,theta1) the second is gamma(alpha,theta2) then I would like to find the mle`s for theta1 and theta2 which I found. Now I would like to simulate those estimates 500 or 1000 times.I tried for loop but it did not work It wont do the loop the problem is that I need
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
I got starting values as follows: Noting that the minimum data value is .38, I fit the linear model log(y - .37) ~ x to get intercept = -1.8 and slope = -.055. So I used .37, exp(-1.8) and -.055 as the starting values for theta0, theta1, and theta2 in the nonlinear model. This converged without problems. Cheers, Bert On Sun, Aug 20, 2023 at 10:15?AM Paul Bernal <paulbernal07 at
2007 Sep 10
1
Generating Replicate Datasets (using loops or other means)
Hello All, I have searched many help forums, message boards, etc. and I just can't apply the comments to what I need my program to do. I am running R 2.5.1 on an XP system, and my desire is to produce replicate datasets for a simulation study I am running. Essentially, I have sets of parameters (a's, b's, and c's) that define a function which produces a decimal value. This
2008 Apr 22
2
optimization setup
Hi, here comes my problem, say I have the following functions (example case) #------------------------------------------------------------ function1 <- function (x, theta) {a <- theta[1] ( 1 - exp(-theta[2]) ) * theta[3] ) b <- x * theta[1] / theta[3]^2 return( list( a = a, b = b )) } #----------------------------------------------------------- function2<-function (x, theta) {P
2007 Jul 26
3
substituting dots in the names of the columns (sub, gsub, regexpr)
Dear R users, I have the following two problems, related to the function sub, grep, regexpr and similia. The header of the file(s) I have to import is like this. c("y (m)", "BD (g/cm3)", "PR (Mpa)", "Ks (m/s)", "SP g./g.", "P (m3/m3)", "theta1 (g/g)", "theta2 (g/g)", "AWC (g/g)") To get rid of spaces and
2007 Sep 12
1
enquiry
Dear R-help, I am trying to estimate a Cox model with nested effects basing on the minimization of the overall AIC; I have two frailties terms, both gamma distributed. There is a error message (theta2 argument misses) and I don?t understand why. I would like to know what I have wrong. Thank you very much for your time. fitM7 <- coxph(Surv(lifespan,censured) ~ south + frailty(id,