search for: b2

Displaying 20 results from an estimated 1598 matches for "b2".

Did you mean: 2b
2009 Feb 13
2
extracting parts of words or extraxting letter to use in ifelse-func.
Hello I want to make some variables with the ifelse-function, but i don't know how to do it. I want to make these five variables; b2$PRRSvac <- ifelse(b2$status=='A' | b2$status=='Aa',1,0) b2$PRRSdk <- ifelse(b2$status=='B' | b2$status=='Bb',1,0) b2$sanVac <- ifelse(b2$status=='C' | b2$status=='sanAa',1,0) b2$sanDk <- ifelse(b2$status=='D' | b2$status=='...
2003 Nov 18
1
aov with Error and lme
...t;a2","a2","a2","a3","a3","a3","a3","a3","a3","a3","a3","a3","a3","a3","a3","a3","a3","a3") factB<-c("B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3","B1","B2","B3","B1...
2010 Aug 23
3
extracting p-values from Anova objects (from the car library)
...from an Anova object from the car library? I can't seem to locate the p-values using str(result) or str(summary(result)) in the example below > A <- factor( rep(1:2,each=3) ) > B <- factor( rep(1:3,times=2) ) > idata <- data.frame(A,B) > fit <- lm( cbind(a1_b1,a1_b2,a1_b3,a2_b1,a2_b2,a2_b3) ? sex, data=Data.wide) > result <- Anova(fit, type="III", test="Wilks", idata=idata, idesign=?A*B) Any help would be much appreciated! Many thanks, Johan
2013 Feb 23
1
how to calculate left kronecker product?
...to get the result I want. Or, alternatively how to transform the result of kronecker() to give my wanted. ---- test code --- A <- matrix(1:4, 2,2, dimnames=list(c("a1", "a2"), c("a1","a2"))) B <- diag(2) dimnames(B) <- list(c("b1", "b2"), c("b1","b2")) # standard, right kronecker product: each A[i,j] * B kronecker(A, B, make.dimnames=TRUE) # left kronecker product: A * each B[i,j] wanted <- rbind( cbind(A * B[1,1], A*B[1,2]), cbind(A * B[2,1], A*B[2,2])) rownames(wanted) <- colnames(wanted) <- p...
2008 Sep 27
0
compute posterior mean by numerical integration
...ke" <- function(t, omega, beta) { n <- length(t)-1 res <- n * log(omega) + n * log(beta) - beta * sum(cumsum(t[-length(t)])) - omega * (1-exp(-beta * cumsum(t)[n])) return(res) } ## log prior density "prior" <- function(omega, beta, o1, o2, b1, b2) { if(o1 && o2 && b1 && b2) res <- dgamma(omega, o1, o2, log=T) + dgamma(beta, b1, b2, log=T) else res <- 0 ## noninformative prior return(res) } ## log posterior density "logPost" <- function(t, omega, beta, o1, o2, b1, b2) { res &l...
2003 May 21
1
callNextMethod
Hi, I don't understand why this code doesn't work (f(b2)): ///////////////// setClass("B0", representation(b0 = "numeric")) setClass("B1", representation("B0", b1 = "character")) setClass("B2", representation("B1", b2 = "logical")) f <- function(x) class(x) setMethod(...
2009 Nov 29
3
Plotting observed vs. Predicted values, change of symbols
...red <- A1*exp(-a1*time)+A2*exp(-a2*time) (resp - pred) / sqrt(pred) } fit.wt.su <- nls( ~ wt.su(concsu, time,A1,a1,A2,a2), data=datasu, start=list(A1=500,a1=1,A2=100,a2=0.2), trace = TRUE) summary(fit.wt.su) # fit upright wt.up<- function(resp, time,B1,b1,B2,b2) { pred <- B1*exp(-b1*time)+B2*exp(-b2*time) (resp - pred) / sqrt(pred) } fit.wt.up <- nls( ~ wt.up(concup, time,B1,b1,B2,b2), data=dataup, start=list(B1=500,b1=1,B2=100,b2=0.1), trace = TRUE) summary(fit.wt.up) # Function that returns predicted value...
2006 Sep 30
1
Gradient problem in nlm
Hello everyone! I am having some trouble supplying the gradient function to nlm in R for windows version 2.2.1. What follows are the R-code I use: fredcs39<-function(a1,b1,b2,x){return(a1+exp(b1+b2*x))} loglikcs39<-function(theta,len){ value<-sum(mcs39[1:len]*fredcs39(theta[1],theta[2],theta[3],c(8:(7+len))) - pcs39[1:len] * log(fredcs39(theta[1],theta[2],theta[3],c(8:(7+len))))) a1<-theta[1]; b1<-theta[2]; b2<-theta[3] df.a1<-sum(-mcs39[1:len] + pcs39...
2009 Feb 19
2
Use of ifelse for indicating specific rownumber
Hello I have a dataset named "b2" with 1521 rows, in that dataset i have 64 rows containing specific information. the rownumbers with specific info are: + i [1] 22 53 104 127 151 196 235 238 249 250 263 335 344 353 362 370 389 422 458 459 473 492 502 530 561 624 647 651 666 671 [31] 715 78...
2012 May 13
2
Discrete choice model maximum likelihood estimation
...od functions, so I really doubt that they are true. Below I simplify the problem and provide the code I've written: # Probabilities for discrete choices for a=3, a=2 and a=1 respectively P3 <- function(b3,b,t) { P <- exp(b3+b*(t==1))/(1-exp(b3+b*(t==1))) return(P) } P2 <- function(b2,b,t) { P <- exp(b2+b*(t==1))/(1-exp(b2+b*(t==1))) return(P) } P1 <- function(b1,b,t) { P <- exp(b1+b*(t==1))/(1-exp(b1+b*(t==1))) return(P) } # Likelihood functions for discrete choices for a=3, a=2 and a=1 respectively L3 <- function(b1,b2,b3,b,t) { P11 <- P1(b1,b,t) P22 &lt...
2013 Nov 01
2
computation of hessian matrix
...a code to compute hessian matrix , which i need to generate 29 number of different matrices for example first element in x1 and x2 is use to generate let say matrix (M1) and second element in x1 and x2 give matrix (M2) upto  matrix (M29) corresponding to the total number of observations and b1 and b2 are constant.  can some one guide me or help to implement this please. I did not understand how to construct the loop which i think it should be about 3 dfferent loops example i = 1 to 29 number of matrices                 j1=1 t0 2 row of matirx                 j2= 1 to 2 ncol of matrix x1<-...
2009 Nov 29
1
Plotting observed vs. fitted values
...red <- A1*exp(-a1*time)+A2*exp(-a2*time) (resp - pred) / sqrt(pred) } fit.wt.su <- nls( ~ wt.su(concsu, time,A1,a1,A2,a2), data=datasu, start=list(A1=500,a1=1,A2=100,a2=0.2), trace = TRUE) summary(fit.wt.su) # fit upright wt.up<- function(resp, time,B1,b1,B2,b2) { pred <- B1*exp(-b1*time)+B2*exp(-b2*time) (resp - pred) / sqrt(pred) } fit.wt.up <- nls( ~ wt.up(concup, time,B1,b1,B2,b2), data=dataup, start=list(B1=500,b1=1,B2=100,b2=0.1), trace = TRUE) summary(fit.wt.up) # Function that returns predicted value...
2012 Sep 07
6
splitting character vectors into multiple vectors using strsplit
Hi folks, Suppose I create the character vector charvec by > charvec<-c("a1.b1","a2.b2") > charvec [1] "a1.b1" "a2.b2" and then I use strsplit on charvec as follows: > splitlist<-strsplit(charvec,split=".",fixed=TRUE) > splitlist [[1]] [1] "a1" "b1" [[2]] [1] "a2" "b2" I was wondering whether...
2003 Sep 09
1
charge a vector with variables and to use as variable in a checkbutton?
...==1) {b1<-tkcheckbutton (f,text="b1",variable="b1",relief="raised");tkpack(b1);print(tclvalue ("b1"))}else if (i==2) {b1<-tkcheckbutton (f,text="b1",variable="b1",relief="raised");tkpack(b1);print(tclvalue ("b1"));b2<-tkcheckbutton(f,text="b2",variable="b2",relief="raised");tkpack (b2);print(tclvalue("b2"))}else if (i==3) {b1<-tkcheckbutton (f,text="b1",variable="b1",relief="raised");tkpack(b1);print(tclvalue ("b1"));b2<-tk...
2007 Feb 25
1
Repeated measures logistic regression
...5 3 3 6 4 4 2 ... Secondly, each participant did a task which required a series of button-pushes. The response is binary. The factors CondA and CondB describe the structure of the stimulus: > experiment ID CondA CondB Response 1 1 a1 b1 1 2 1 a2 b2 0 3 1 a3 b1 0 4 1 a4 b2 0 5 1 a1 b1 1 6 1 a2 b2 0 7 1 a3 b1 0 8 1 a4 b2 0 9 2 a1 b1 1 10 2 a2 b2 0 11 2 a3 b1 0 12 2 a4 b2 0 13 2...
2009 Jan 07
0
fixed effect significance_NB mixed models_further pursuit
...calculate the Wald statistic. I understand there are problems inherent to each approach. Following the logic of D. Bates (R-sig-mixed models list serv: 13 Oct 08), I decided to pursue the LLRT approach. Still, I have several questions. If this is my model: m <- glmm.admb(fixed = y ~ b1 + b2 + I(b2^2) + b1:b2, random = ~ 1, group = ?subject?, family = ?nbinom?, data = dataset) and b1 = a categorical variable with 3 levels b2 = a continuous variable and I?ve set my contrasts as follows: options(contrasts =c("contr.treatment", "contr.poly")) dataset$b1 <- fac...
2009 Feb 13
0
Odp: Odp: extracting parts of words or extraxting letter to use in ifelse-func.
...10:38:31: > > > >> > >> Hello > >> > >> I want to make some variables with the ifelse-function, but i don't know > > how > >> to do it. > >> > >> I want to make these five variables; > >> > >> b2$PRRSvac <- ifelse(b2$status=='A' | b2$status=='Aa',1,0) > >> b2$PRRSdk <- ifelse(b2$status=='B' | b2$status=='Bb',1,0) > >> b2$sanVac <- ifelse(b2$status=='C' | b2$status=='sanAa',1,0) > >> b2$sanDk <- ifelse(...
2003 Feb 03
1
summary.table bug in parameter (and fix) (PR#2526)
...ent this in with an old version, but it's in latest version as well. The fix is simple. In the summary.table function, the parameter is calculated incorrectly for a test of independence among all cells when the table is more than 2-way table. Example: Consider X: > X a b c 1 A1 B2 C1 2 A3 BA3 C2 3 A2 B1 C4 4 A1 B2 C3 5 A3 BA3 C2 6 A1 BA3 C1 7 A2 BA3 C2 8 A1 BA3 C3 9 A1 B2 C1 10 A1 BA3 C2 11 A2 B1 C2 12 A1 B2 C3 13 A3 BA3 C4 14 A2 B1 C3 15 A2 B1 C2 16 A2 BA3 C4 17 A3 BA3 C3 18 A3 BA3 C4 19 A2 BA3 C4 20 A1 B2 C3 21 A1 BA3 C1 22 A2 B1 C2 23...
2011 Jan 27
1
Errors in Integrate
Hello, I have written the function I would like to integrate in two ways: denfxn <- function(yy,vv,a2,b2,mu2) { pp <- 1-pnorm(yy/sqrt(vv)) part1 <- pp^(a2-1) part2 <- (1-pp)^(b2-1) part3 <- dnorm(yy,mu2,sqrt(vv)) return(part1*part2*part3) } denfxnorg <- function(yy,vv,a2,b2,mu2) { pp <- 1-pnorm(yy/sqrt(vv)) pp <- if (pp < .001) .001 else if (pp &g...
2002 Jun 08
3
contour plot for non-linear models
...the labels, but it doesn't shows the contour lines. Could you help me resolving this problem? This is the code that appears in the book and I've been testing. > fm0 <- lm(Wt*Time ~ Viscosity + Time -1, data= stormer) > b0 <- coef(fm0); names(b0) <- c("b1", "b2") > storm.fm <- nls(Time ~ b1*Viscosity/(Wt-b2), data = stormer, start=b0, trace = T) > bc <- coef(storm.fm) > se <- sqrt(diag(vcov(storm.fm))) > dv <- deviance(storm.fm) > par(pty = "s") > b1 <- bc[1] + seq(-3*se[1], 3*se[1], length = 51) > b2 &...