I'm not 100% sure that this is the correct forum for this question, but I will ask anyway in hopes that it is and someone may have some advice.

I'm trying to examine the relationship (using linear regression) of two variables, one of which is zero-inflated (predictor) and the other of which is zero-truncated (response). The main issue I am having is that I cannot seem to find what type of regression is appropriate to use for data like mine in which the predictor, not the response, variable is zero-inflated.

The predictor variable is zero-inflated because it is based on count data. The variable itself is the count of predators encountered (by each observed prey individual) multiplied by the biomass of each predator encountered. Many prey individuals did not encounter any predators during the observation period, so their predator value is zero. The response variable is the area over which each individual prey moved during the observation period. Since area cannot be zero, this variable is zero-truncated.

I know that Zero-inflated Poisson Regression (ZIPR) or Zero-inflated Negative Binomial Regression (ZINBR; depending on whether the data are overdispersed or not) are options when the response variable is zero-inflated. I am using R (2.10.1) for all analyses and have tried using the zeroinfl function on my data. It returns an error message saying that the minimum value for the response variable is not zero, so I am assuming that this means the function (and ZIPR/ZINBR in general) only apply when the *response* variable is zero-inflated. However, my question is a) whether or these models should apply when the predictor (independent) variable os zero-inflated and, if not, b) is there more a appropriate model(s) to use?

Thank you in advance for any advice you can offer.

Cheers,

Elizabeth]]>

I am currently learning how to use the kohonen package. As I used the som-tool box in matlab before, I am kind of used to see each module is presented in a shape of hexagone or rectangle. I wonder if I can change the circle shape in R to other shapes too, which will eliminate the blank gaps between each module.

Thanks in advance,

Michelle]]>

Error in cov.wt(z) : 'x' must contain finite values only

Would missing values be the problem here? I have a handful of missing values and am unsure of the best way to proceed. (I don't need any sort of imputation strategies -- deletion is fine but I haven't been able to figure out the syntax for that with this function.)

Thanks for any help you can offer.

Jamie]]>

For calculate correlation matrix view cov.wt.

But I don`t have any idea for others methods, like homals.

Thanks]]>

I'm having some trouble getting a loop to work and I believe it my problem is in how I am trying to extract the info from the table it is in.

Thanks a ton for any help!

here is the code I'm trying to get to work:

# RESULTS TABLE

(TblResults <- data.frame(Motivations=names(TblTable1), n=0, n1=0, n2=0, n3=0, n4=0, n5=0, Median=0, Q25=0, Q75=0, IQRng=0))

for (i in 1:nrow(TblResults)) {

#Calculate Median and IQR for each Motivation

TblResults$n

TblResults$n1

TblResults$n2

TblResults$n3

TblResults$n4

TblResults$n5

TblResults$Median

TblResults$Q25

TblResults$Q75

TblResults$IQRng

}

#Complete Results table

TblResults

The data is coming from a table I set up earlier with this code:

TblDB <- sqlQuery(ADF2_ASTOnline,"Select MotivPowder,MotivCrowds, MotivAdventure, MotivTerrain, MotivBored, MotivNotSupposed, MotivKicker, MotivExercise, MotivFriends, MotivNature, MotivImpress, MotivAbout, MotivLifeStyle, MotivDMSkill, MotivPictures, MotivIdentity from tbl_analysis;")

TblTable1 <- na.omit(TblDB)

Here is a header of the table to see what it looks like:

> head(TblTable1)

MotivPowder MotivCrowds MotivAdventure MotivTerrain MotivBored

1 5 5 4 4 2

2 5 2 4 5 2

3 5 5 4 3 3

4 5 5 3 2 1

5 5 5 5 3 3

6 5 4 3 3 1

MotivNotSupposed MotivKicker MotivExercise MotivFriends MotivNature

1 1 1 3 3 2

2 1 3 2 3 2

3 2 4 2 3 2

4 1 1 5 3 5

5 1 1 3 3 5

6 1 1 1 1 3

MotivImpress MotivAbout MotivLifeStyle MotivDMSkill MotivPictures

1 1 4 3 3 4

2 1 1 4 2 3

3 1 1 2 2 1

4 2 1 5 4 1

5 1 1 3 3 2

6 1 1 3 3 1

MotivIdentity

1 3

2 4

3 4

4 5

5 3

6 4

A simple example is shown below:

a is a [2x3x2] array.

> (a = array(c(1:12),c(2,3,2)))

, , 1

[,1] [,2] [,3]

[1,] 1 3 5

[2,] 2 4 6

, , 2

[,1] [,2] [,3]

[1,] 7 9 11

[2,] 8 10 12

I want to obtain a 3rd matrix that is the sum of the these two matrices.

> a[,,1]+a[,,2]

[,1] [,2] [,3]

[1,] 8 12 16

[2,] 10 14 18

This is easy by simple addition when there are only 2 matrices however I have 119 of these. I know it's possible to do this with a loop but I was wondering if there is another way of doing this without a loop.

Thanks,

Mine]]>